aboutsummaryrefslogtreecommitdiff
path: root/backend/lib/CodeGen/MachineBasicBlock.cpp
diff options
context:
space:
mode:
authorRichard-Qin-X <richard.qin.001@gmail.com>2026-08-14 04:33:41 +0800
committerRichard-Qin-X <richard.qin.001@gmail.com>2026-08-14 04:33:41 +0800
commit8be4d04455f70892a94d1e0798e266c948b4750a (patch)
tree6ef304317a6980ecfbe32868d64cd05f5e8af8bd /backend/lib/CodeGen/MachineBasicBlock.cpp
parentaa69e15c6909c3b162b15f5326f0a72ba9bb7163 (diff)
downloadrcc-project-8be4d04455f70892a94d1e0798e266c948b4750a.tar.gz
rcc-project-8be4d04455f70892a94d1e0798e266c948b4750a.tar.xz
[CodeGen] Match LLVM Legalizer ownership
Diffstat (limited to 'backend/lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r--backend/lib/CodeGen/MachineBasicBlock.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/backend/lib/CodeGen/MachineBasicBlock.cpp b/backend/lib/CodeGen/MachineBasicBlock.cpp
index a8d69f6..763a577 100644
--- a/backend/lib/CodeGen/MachineBasicBlock.cpp
+++ b/backend/lib/CodeGen/MachineBasicBlock.cpp
@@ -40,6 +40,8 @@ Expected<void> MachineBasicBlock::appendInstruction(MachineInstr &Instruction) {
else
FirstInstruction = &Instruction;
LastInstruction = &Instruction;
+ if (OwnerFunction->TheDelegate != nullptr)
+ OwnerFunction->TheDelegate->handleInsertion(Instruction);
return {};
}
@@ -65,6 +67,8 @@ Expected<void> MachineBasicBlock::insertInstructionBefore(MachineInstr &Position
else
FirstInstruction = &Instruction;
Position.PreviousInstruction = &Instruction;
+ if (OwnerFunction->TheDelegate != nullptr)
+ OwnerFunction->TheDelegate->handleInsertion(Instruction);
return {};
}
@@ -90,6 +94,8 @@ Expected<void> MachineBasicBlock::insertInstructionAfter(MachineInstr &Position,
else
LastInstruction = &Instruction;
Position.NextInstruction = &Instruction;
+ if (OwnerFunction->TheDelegate != nullptr)
+ OwnerFunction->TheDelegate->handleInsertion(Instruction);
return {};
}
@@ -98,6 +104,9 @@ Expected<void> MachineBasicBlock::removeInstruction(MachineInstr &Instruction) {
return makeUnexpected(ErrorCode::InvalidArgument, "instruction does not belong to this block");
}
+ if (OwnerFunction->TheDelegate != nullptr)
+ OwnerFunction->TheDelegate->handleRemoval(Instruction);
+
if (Instruction.PreviousInstruction != nullptr)
Instruction.PreviousInstruction->NextInstruction = Instruction.NextInstruction;
else