diff options
author | Tim Northover <tnorthover@apple.com> | 2016-08-25 17:37:32 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2016-08-25 17:37:32 +0000 |
commit | 042ca5a33ab5acf8405024643a31cf006b5298b5 (patch) | |
tree | d306b730b015aec8f43473eb73d941394d4dc990 /lib/CodeGen/GlobalISel/MachineIRBuilder.cpp | |
parent | bbdb9c7d9b214b535b8c4ef9fe9a4ab1889a7652 (diff) | |
download | llvm-042ca5a33ab5acf8405024643a31cf006b5298b5.tar.gz |
GlobalISel: perform multi-step legalization
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279758 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/GlobalISel/MachineIRBuilder.cpp')
-rw-r--r-- | lib/CodeGen/GlobalISel/MachineIRBuilder.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp b/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp index 2cb7e6696e57..50896abbb0e9 100644 --- a/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp +++ b/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp @@ -26,6 +26,7 @@ void MachineIRBuilder::setMF(MachineFunction &MF) { this->TII = MF.getSubtarget().getInstrInfo(); this->DL = DebugLoc(); this->MI = nullptr; + this->InsertedInstr = nullptr; } void MachineIRBuilder::setMBB(MachineBasicBlock &MBB, bool Beginning) { @@ -53,6 +54,15 @@ MachineBasicBlock::iterator MachineIRBuilder::getInsertPt() { return Before ? getMBB().begin() : getMBB().end(); } +void MachineIRBuilder::recordInsertions( + std::function<void(MachineInstr *)> Inserted) { + InsertedInstr = Inserted; +} + +void MachineIRBuilder::stopRecordingInsertions() { + InsertedInstr = nullptr; +} + //------------------------------------------------------------------------------ // Build instruction variants. //------------------------------------------------------------------------------ @@ -69,6 +79,8 @@ MachineInstrBuilder MachineIRBuilder::buildInstr(unsigned Opcode, assert(!isPreISelGenericOpcode(Opcode) && "Generic instruction must have a type"); getMBB().insert(getInsertPt(), MIB); + if (InsertedInstr) + InsertedInstr(MIB); return MIB; } @@ -181,6 +193,8 @@ MachineInstrBuilder MachineIRBuilder::buildExtract(ArrayRef<LLT> ResTys, MIB.addImm(Idx); getMBB().insert(getInsertPt(), MIB); + if (InsertedInstr) + InsertedInstr(MIB); return MIB; } |