aboutsummaryrefslogtreecommitdiff
path: root/backend/lib/CodeGen/MachineFunctionRecords.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backend/lib/CodeGen/MachineFunctionRecords.cpp')
-rw-r--r--backend/lib/CodeGen/MachineFunctionRecords.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/backend/lib/CodeGen/MachineFunctionRecords.cpp b/backend/lib/CodeGen/MachineFunctionRecords.cpp
index 9fda0d7..0a21581 100644
--- a/backend/lib/CodeGen/MachineFunctionRecords.cpp
+++ b/backend/lib/CodeGen/MachineFunctionRecords.cpp
@@ -80,6 +80,14 @@ verifyDebugValueSubstitution(const MachineDebugValueSubstitution &Substitution)
return {};
}
+[[nodiscard]] Expected<void> verifyEntryValue(const MachineEntryValueInfo &EntryValue) {
+ if (!EntryValue.Reg.isValid()) {
+ return makeUnexpected(ErrorCode::VerificationError,
+ "entry-value record requires a physical register");
+ }
+ return EntryValue.DebugInfo.verifyStructure();
+}
+
} // namespace
Expected<void>
@@ -143,6 +151,14 @@ MachineFunctionRecords::addDebugValueSubstitution(MachineDebugValueSubstitution
return {};
}
+Expected<void> MachineFunctionRecords::addEntryValue(MachineEntryValueInfo EntryValue) {
+ auto Verification = verifyEntryValue(EntryValue);
+ if (!Verification)
+ return std::unexpected(Verification.error());
+ EntryValues.push_back(std::move(EntryValue));
+ return {};
+}
+
Expected<void> MachineFunctionRecords::verify() const {
if (CalleeSavedRegisters) {
auto CalleeSavedVerification = verifyCalleeSavedRegisters(*CalleeSavedRegisters);
@@ -210,6 +226,12 @@ Expected<void> MachineFunctionRecords::verify() const {
}
CompletedDebugReferences.insert(Path.begin(), Path.end());
}
+
+ for (const MachineEntryValueInfo &EntryValue : EntryValues) {
+ auto EntryValueVerification = verifyEntryValue(EntryValue);
+ if (!EntryValueVerification)
+ return EntryValueVerification;
+ }
return {};
}
@@ -258,6 +280,11 @@ MachineFunctionRecords::clone(const MachineFunctionCloneContext &CloneContext) c
if (!AddResult)
return std::unexpected(AddResult.error());
}
+ for (const MachineEntryValueInfo &Source : EntryValues) {
+ auto AddResult = Result.addEntryValue(Source);
+ if (!AddResult)
+ return std::unexpected(AddResult.error());
+ }
return Result;
}