diff options
author | Dan Gohman <gohman@apple.com> | 2008-07-07 23:14:23 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-07-07 23:14:23 +0000 |
commit | 8e5f2c6f65841542e2a7092553fe42a00048e4c7 (patch) | |
tree | 24fe54b796f3f450ba6aff12b7357068ca66e341 /lib/Target/ARM/ARMConstantIslandPass.cpp | |
parent | 0e5f1306b059b62d7725f324e087efbc8e7a782d (diff) | |
download | external_llvm-8e5f2c6f65841542e2a7092553fe42a00048e4c7.zip external_llvm-8e5f2c6f65841542e2a7092553fe42a00048e4c7.tar.gz external_llvm-8e5f2c6f65841542e2a7092553fe42a00048e4c7.tar.bz2 |
Pool-allocation for MachineInstrs, MachineBasicBlocks, and
MachineMemOperands. The pools are owned by MachineFunctions.
This drastically reduces the number of calls to malloc/free made
during the "Emit" phase of scheduling, as well as later phases
in CodeGen. Combined with other changes, this speeds up the
"instruction selection" phase of CodeGen by 10% in some cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53212 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/ARMConstantIslandPass.cpp')
-rw-r--r-- | lib/Target/ARM/ARMConstantIslandPass.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/Target/ARM/ARMConstantIslandPass.cpp b/lib/Target/ARM/ARMConstantIslandPass.cpp index e7da3cf..f577de5 100644 --- a/lib/Target/ARM/ARMConstantIslandPass.cpp +++ b/lib/Target/ARM/ARMConstantIslandPass.cpp @@ -288,8 +288,8 @@ bool ARMConstantIslands::runOnMachineFunction(MachineFunction &Fn) { void ARMConstantIslands::DoInitialPlacement(MachineFunction &Fn, std::vector<MachineInstr*> &CPEMIs){ // Create the basic block to hold the CPE's. - MachineBasicBlock *BB = new MachineBasicBlock(); - Fn.getBasicBlockList().push_back(BB); + MachineBasicBlock *BB = Fn.CreateMachineBasicBlock(); + Fn.push_back(BB); // Add all of the constants from the constant pool to the end block, use an // identity mapping of CPI's to CPE's. @@ -558,11 +558,12 @@ void ARMConstantIslands::UpdateForInsertedWaterBlock(MachineBasicBlock *NewBB) { /// account for this change and returns the newly created block. MachineBasicBlock *ARMConstantIslands::SplitBlockBeforeInstr(MachineInstr *MI) { MachineBasicBlock *OrigBB = MI->getParent(); + MachineFunction &MF = *OrigBB->getParent(); // Create a new MBB for the code after the OrigBB. - MachineBasicBlock *NewBB = new MachineBasicBlock(OrigBB->getBasicBlock()); + MachineBasicBlock *NewBB = MF.CreateMachineBasicBlock(OrigBB->getBasicBlock()); MachineFunction::iterator MBBI = OrigBB; ++MBBI; - OrigBB->getParent()->getBasicBlockList().insert(MBBI, NewBB); + MF.insert(MBBI, NewBB); // Splice the instructions starting with MI over to NewBB. NewBB->splice(NewBB->end(), OrigBB, MI, OrigBB->end()); @@ -590,7 +591,7 @@ MachineBasicBlock *ARMConstantIslands::SplitBlockBeforeInstr(MachineInstr *MI) { // Update internal data structures to account for the newly inserted MBB. // This is almost the same as UpdateForInsertedWaterBlock, except that // the Water goes after OrigBB, not NewBB. - NewBB->getParent()->RenumberBlocks(NewBB); + MF.RenumberBlocks(NewBB); // Insert a size into BBSizes to align it properly with the (newly // renumbered) block numbers. @@ -1031,8 +1032,8 @@ bool ARMConstantIslands::HandleConstantPoolUser(MachineFunction &Fn, } // Okay, we know we can put an island before NewMBB now, do it! - MachineBasicBlock *NewIsland = new MachineBasicBlock(); - Fn.getBasicBlockList().insert(NewMBB, NewIsland); + MachineBasicBlock *NewIsland = Fn.CreateMachineBasicBlock(); + Fn.insert(NewMBB, NewIsland); // Update internal data structures to account for the newly inserted MBB. UpdateForInsertedWaterBlock(NewIsland); @@ -1201,7 +1202,7 @@ ARMConstantIslands::FixUpConditionalBr(MachineFunction &Fn, ImmBranch &Br) { NumCBrFixed++; if (BMI != MI) { - if (next(MachineBasicBlock::iterator(MI)) == MBB->back() && + if (next(MachineBasicBlock::iterator(MI)) == prior(MBB->end()) && BMI->getOpcode() == Br.UncondBr) { // Last MI in the BB is a unconditional branch. Can we simply invert the // condition and swap destinations: |