aboutsummaryrefslogtreecommitdiff
path: root/backend/lib/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'backend/lib/CodeGen')
-rw-r--r--backend/lib/CodeGen/MachineCombiner.cpp4
-rw-r--r--backend/lib/CodeGen/MachineCompilationStatus.cpp4
-rw-r--r--backend/lib/CodeGen/MachineDCE.cpp10
3 files changed, 14 insertions, 4 deletions
diff --git a/backend/lib/CodeGen/MachineCombiner.cpp b/backend/lib/CodeGen/MachineCombiner.cpp
index 02ea5e3..513d282 100644
--- a/backend/lib/CodeGen/MachineCombiner.cpp
+++ b/backend/lib/CodeGen/MachineCombiner.cpp
@@ -103,7 +103,9 @@ namespace {
}
[[nodiscard]] bool hasProtectedAttachment(const MachineInstr &Instruction) noexcept {
- return Instruction.debugInstrNumber() != 0 || Instruction.preInstrSymbol().has_value() ||
+ return Instruction.flags().has(MachineInstrFlag::FrameSetup) ||
+ Instruction.flags().has(MachineInstrFlag::FrameDestroy) ||
+ Instruction.debugInstrNumber() != 0 || Instruction.preInstrSymbol().has_value() ||
Instruction.postInstrSymbol().has_value() || Instruction.heapAllocMarker().has_value() ||
Instruction.pcSections().has_value() || Instruction.mmra().has_value() ||
Instruction.cfiType().has_value() || Instruction.deactivationSymbol().has_value();
diff --git a/backend/lib/CodeGen/MachineCompilationStatus.cpp b/backend/lib/CodeGen/MachineCompilationStatus.cpp
index 93acf3a..3ebfa0f 100644
--- a/backend/lib/CodeGen/MachineCompilationStatus.cpp
+++ b/backend/lib/CodeGen/MachineCompilationStatus.cpp
@@ -51,6 +51,10 @@ isKnownDiagnosticSeverity(MachineCompilationDiagnosticSeverity Severity) noexcep
case ErrorCode::FinalEncodabilityFailed:
case ErrorCode::CFGOptimizationFailed:
case ErrorCode::AssemblyLoweringFailed:
+ case ErrorCode::InstructionEncodingFailed:
+ case ErrorCode::FixupApplicationFailed:
+ case ErrorCode::RelocationFailed:
+ case ErrorCode::ObjectWritingFailed:
case ErrorCode::IoError:
case ErrorCode::InternalError:
return true;
diff --git a/backend/lib/CodeGen/MachineDCE.cpp b/backend/lib/CodeGen/MachineDCE.cpp
index b413499..9ba9a1b 100644
--- a/backend/lib/CodeGen/MachineDCE.cpp
+++ b/backend/lib/CodeGen/MachineDCE.cpp
@@ -44,7 +44,9 @@ namespace {
}
[[nodiscard]] bool hasProtectedAttachment(const MachineInstr &Instruction) noexcept {
- return Instruction.debugInstrNumber() != 0 || Instruction.preInstrSymbol().has_value() ||
+ return Instruction.flags().has(MachineInstrFlag::FrameSetup) ||
+ Instruction.flags().has(MachineInstrFlag::FrameDestroy) ||
+ Instruction.debugInstrNumber() != 0 || Instruction.preInstrSymbol().has_value() ||
Instruction.postInstrSymbol().has_value() || Instruction.heapAllocMarker().has_value() ||
Instruction.pcSections().has_value() || Instruction.mmra().has_value() ||
Instruction.cfiType().has_value() || Instruction.deactivationSymbol().has_value();
@@ -156,8 +158,10 @@ Expected<MachinePassResult> MachineDCEPass::runImplementation(MachineFunction &F
Instruction = Next;
continue;
}
+ std::vector<Register> DefinitionList =
+ std::move(*Definitions).value_or(std::vector<Register>{});
- for (const Register Reg : **Definitions) {
+ for (const Register Reg : DefinitionList) {
auto Cleared = clearDebugUses(Registers, Reg);
if (!Cleared)
return std::unexpected(Cleared.error());
@@ -165,7 +169,7 @@ Expected<MachinePassResult> MachineDCEPass::runImplementation(MachineFunction &F
auto Removed = Block->removeInstruction(*Instruction);
if (!Removed)
return std::unexpected(Removed.error());
- for (const Register Reg : **Definitions) {
+ for (const Register Reg : DefinitionList) {
if (!Registers.useEmpty(Reg, true) || Registers.getUniqueVRegDef(Reg) != nullptr) {
return makeUnexpected(ErrorCode::InternalError,
"machine DCE left references to a removed definition");