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 | 438c77ca1adf6ea29d25f5c53336dacff5ac5a21 (patch) | |
tree | 57bf2922a37cd74ee96e67eb31b9081ff3a7fe61 /llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp | |
parent | 2c4a838e241fa078b24811d81bfe87513d40d903 (diff) | |
download | bcm5719-llvm-438c77ca1adf6ea29d25f5c53336dacff5ac5a21.tar.gz bcm5719-llvm-438c77ca1adf6ea29d25f5c53336dacff5ac5a21.zip |
GlobalISel: perform multi-step legalization
llvm-svn: 279758
Diffstat (limited to 'llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp')
-rw-r--r-- | llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp b/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp index 2cb7e6696e5..50896abbb0e 100644 --- a/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp +++ b/llvm/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; } |