diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-10-28 20:34:50 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-10-28 20:34:50 +0000 |
commit | d68f458244b9d9a6644a9550dd5cee60331c9e7d (patch) | |
tree | be0b854b155d5095eeb52ab05922ec2a16742ad2 /lib/CodeGen | |
parent | 26b92be9222e267447efe943f12848775075e22f (diff) | |
download | external_llvm-d68f458244b9d9a6644a9550dd5cee60331c9e7d.zip external_llvm-d68f458244b9d9a6644a9550dd5cee60331c9e7d.tar.gz external_llvm-d68f458244b9d9a6644a9550dd5cee60331c9e7d.tar.bz2 |
Make MachineDominators available for SplitEditor. We are going to need it for
proper SSA updating.
This doesn't cause MachineDominators to be recomputed since we are already
requiring MachineLoopInfo which uses dominators as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117598 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/InlineSpiller.cpp | 9 | ||||
-rw-r--r-- | lib/CodeGen/RegAllocLinearScan.cpp | 2 | ||||
-rw-r--r-- | lib/CodeGen/SplitKit.cpp | 10 | ||||
-rw-r--r-- | lib/CodeGen/SplitKit.h | 8 |
4 files changed, 21 insertions, 8 deletions
diff --git a/lib/CodeGen/InlineSpiller.cpp b/lib/CodeGen/InlineSpiller.cpp index 73980f3..05aa388 100644 --- a/lib/CodeGen/InlineSpiller.cpp +++ b/lib/CodeGen/InlineSpiller.cpp @@ -19,6 +19,7 @@ #include "VirtRegMap.h" #include "llvm/CodeGen/LiveIntervalAnalysis.h" #include "llvm/CodeGen/LiveStackAnalysis.h" +#include "llvm/CodeGen/MachineDominators.h" #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineLoopInfo.h" @@ -40,6 +41,7 @@ class InlineSpiller : public Spiller { MachineFunction &mf_; LiveIntervals &lis_; LiveStacks &lss_; + MachineDominatorTree &mdt_; MachineLoopInfo &loops_; VirtRegMap &vrm_; MachineFrameInfo &mfi_; @@ -68,6 +70,7 @@ public: mf_(mf), lis_(pass.getAnalysis<LiveIntervals>()), lss_(pass.getAnalysis<LiveStacks>()), + mdt_(pass.getAnalysis<MachineDominatorTree>()), loops_(pass.getAnalysis<MachineLoopInfo>()), vrm_(vrm), mfi_(*mf.getFrameInfo()), @@ -112,7 +115,7 @@ bool InlineSpiller::split() { // Try splitting around loops. if (const MachineLoop *loop = splitAnalysis_.getBestSplitLoop()) { - SplitEditor(splitAnalysis_, lis_, vrm_, *edit_) + SplitEditor(splitAnalysis_, lis_, vrm_, mdt_, *edit_) .splitAroundLoop(loop); return true; } @@ -120,14 +123,14 @@ bool InlineSpiller::split() { // Try splitting into single block intervals. SplitAnalysis::BlockPtrSet blocks; if (splitAnalysis_.getMultiUseBlocks(blocks)) { - SplitEditor(splitAnalysis_, lis_, vrm_, *edit_) + SplitEditor(splitAnalysis_, lis_, vrm_, mdt_, *edit_) .splitSingleBlocks(blocks); return true; } // Try splitting inside a basic block. if (const MachineBasicBlock *MBB = splitAnalysis_.getBlockForInsideSplit()) { - SplitEditor(splitAnalysis_, lis_, vrm_, *edit_) + SplitEditor(splitAnalysis_, lis_, vrm_, mdt_, *edit_) .splitInsideBlock(MBB); return true; } diff --git a/lib/CodeGen/RegAllocLinearScan.cpp b/lib/CodeGen/RegAllocLinearScan.cpp index 18fd118..947a6c7 100644 --- a/lib/CodeGen/RegAllocLinearScan.cpp +++ b/lib/CodeGen/RegAllocLinearScan.cpp @@ -97,6 +97,7 @@ namespace { initializeCalculateSpillWeightsPass(*PassRegistry::getPassRegistry()); initializePreAllocSplittingPass(*PassRegistry::getPassRegistry()); initializeLiveStacksPass(*PassRegistry::getPassRegistry()); + initializeMachineDominatorTreePass(*PassRegistry::getPassRegistry()); initializeMachineLoopInfoPass(*PassRegistry::getPassRegistry()); initializeVirtRegMapPass(*PassRegistry::getPassRegistry()); initializeMachineDominatorTreePass(*PassRegistry::getPassRegistry()); @@ -208,6 +209,7 @@ namespace { AU.addPreserved<MachineLoopInfo>(); AU.addRequired<VirtRegMap>(); AU.addPreserved<VirtRegMap>(); + AU.addRequiredID(MachineDominatorsID); AU.addPreservedID(MachineDominatorsID); MachineFunctionPass::getAnalysisUsage(AU); } diff --git a/lib/CodeGen/SplitKit.cpp b/lib/CodeGen/SplitKit.cpp index a89a977..f81c479 100644 --- a/lib/CodeGen/SplitKit.cpp +++ b/lib/CodeGen/SplitKit.cpp @@ -18,6 +18,7 @@ #include "VirtRegMap.h" #include "llvm/CodeGen/CalcSpillWeights.h" #include "llvm/CodeGen/LiveIntervalAnalysis.h" +#include "llvm/CodeGen/MachineDominators.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineLoopInfo.h" #include "llvm/CodeGen/MachineRegisterInfo.h" @@ -603,14 +604,17 @@ VNInfo *LiveIntervalMap::defByCopyFrom(unsigned Reg, //===----------------------------------------------------------------------===// /// Create a new SplitEditor for editing the LiveInterval analyzed by SA. -SplitEditor::SplitEditor(SplitAnalysis &sa, LiveIntervals &lis, VirtRegMap &vrm, +SplitEditor::SplitEditor(SplitAnalysis &sa, + LiveIntervals &lis, + VirtRegMap &vrm, + MachineDominatorTree &mdt, LiveRangeEdit &edit) : sa_(sa), lis_(lis), vrm_(vrm), mri_(vrm.getMachineFunction().getRegInfo()), tii_(*vrm.getMachineFunction().getTarget().getInstrInfo()), edit_(edit), - dupli_(lis_, edit.getParent()), - openli_(lis_, edit.getParent()) + dupli_(lis_, mdt, edit.getParent()), + openli_(lis_, mdt, edit.getParent()) { } diff --git a/lib/CodeGen/SplitKit.h b/lib/CodeGen/SplitKit.h index 9c109dc..9ba7cbe 100644 --- a/lib/CodeGen/SplitKit.h +++ b/lib/CodeGen/SplitKit.h @@ -22,6 +22,7 @@ class LiveInterval; class LiveIntervals; class LiveRangeEdit; class MachineInstr; +class MachineDominatorTree; class MachineLoop; class MachineLoopInfo; class MachineRegisterInfo; @@ -154,6 +155,7 @@ public: /// Values in parentli_ may map to any number of openli_ values, including 0. class LiveIntervalMap { LiveIntervals &lis_; + MachineDominatorTree &mdt_; // The parent interval is never changed. const LiveInterval &parentli_; @@ -171,8 +173,9 @@ class LiveIntervalMap { public: LiveIntervalMap(LiveIntervals &lis, + MachineDominatorTree &mdt, const LiveInterval &parentli) - : lis_(lis), parentli_(parentli), li_(0) {} + : lis_(lis), mdt_(mdt), parentli_(parentli), li_(0) {} /// reset - clear all data structures and start a new live interval. void reset(LiveInterval *); @@ -285,7 +288,8 @@ class SplitEditor { public: /// Create a new SplitEditor for editing the LiveInterval analyzed by SA. /// Newly created intervals will be appended to newIntervals. - SplitEditor(SplitAnalysis &SA, LiveIntervals&, VirtRegMap&, LiveRangeEdit&); + SplitEditor(SplitAnalysis &SA, LiveIntervals&, VirtRegMap&, + MachineDominatorTree&, LiveRangeEdit&); /// getAnalysis - Get the corresponding analysis. SplitAnalysis &getAnalysis() { return sa_; } |