forked from OSchip/llvm-project
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. llvm-svn: 117598
This commit is contained in:
parent
1005cf323d
commit
e172a8b794
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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_; }
|
||||
|
|
Loading…
Reference in New Issue