aboutsummaryrefslogtreecommitdiff
path: root/backend/lib/CodeGen/MachineBasicBlock.cpp
diff options
context:
space:
mode:
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