diff options
| author | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-28 13:45:07 +0800 |
|---|---|---|
| committer | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-28 13:45:07 +0800 |
| commit | e72ad2cd524ff38f162a23d69da5f78494d337ae (patch) | |
| tree | 2e590806b0f610e4392f25f6e8cdff57d2f5a929 /backend/include/rcc/CodeGen | |
| parent | 3b14bd4d5324b5a280c1ee5567b5526b59e60c5b (diff) | |
| download | rcc-project-e72ad2cd524ff38f162a23d69da5f78494d337ae.tar.gz rcc-project-e72ad2cd524ff38f162a23d69da5f78494d337ae.tar.xz | |
[CodeGen] Centralize machine instruction erasure
Diffstat (limited to 'backend/include/rcc/CodeGen')
| -rw-r--r-- | backend/include/rcc/CodeGen/GlobalISel/LegalizationArtifactCombiner.h | 2 | ||||
| -rw-r--r-- | backend/include/rcc/CodeGen/MachineInstr.h | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/backend/include/rcc/CodeGen/GlobalISel/LegalizationArtifactCombiner.h b/backend/include/rcc/CodeGen/GlobalISel/LegalizationArtifactCombiner.h index c0c7be0..12225cf 100644 --- a/backend/include/rcc/CodeGen/GlobalISel/LegalizationArtifactCombiner.h +++ b/backend/include/rcc/CodeGen/GlobalISel/LegalizationArtifactCombiner.h @@ -351,7 +351,7 @@ private: for (MachineInstr *Dead : DeadInstructions) { if (Dead == nullptr || Dead->parent() == nullptr) continue; - auto Removed = Dead->parent()->removeInstruction(*Dead); + auto Removed = Dead->eraseFromParent(); if (!Removed) return std::unexpected(Removed.error()); } diff --git a/backend/include/rcc/CodeGen/MachineInstr.h b/backend/include/rcc/CodeGen/MachineInstr.h index 6de4a4e..441f80d 100644 --- a/backend/include/rcc/CodeGen/MachineInstr.h +++ b/backend/include/rcc/CodeGen/MachineInstr.h @@ -79,6 +79,8 @@ public: return ParentBlock != nullptr; } + [[nodiscard]] Expected<void> eraseFromParent(); + [[nodiscard]] bool isDebugInstr() const noexcept; [[nodiscard]] std::size_t operandCount() const noexcept { |
