mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-23 17:24:48 +00:00
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
This commit is contained in:
@ -19,6 +19,7 @@
|
|||||||
#include "VirtRegMap.h"
|
#include "VirtRegMap.h"
|
||||||
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
|
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
|
||||||
#include "llvm/CodeGen/LiveStackAnalysis.h"
|
#include "llvm/CodeGen/LiveStackAnalysis.h"
|
||||||
|
#include "llvm/CodeGen/MachineDominators.h"
|
||||||
#include "llvm/CodeGen/MachineFrameInfo.h"
|
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||||
#include "llvm/CodeGen/MachineFunction.h"
|
#include "llvm/CodeGen/MachineFunction.h"
|
||||||
#include "llvm/CodeGen/MachineLoopInfo.h"
|
#include "llvm/CodeGen/MachineLoopInfo.h"
|
||||||
@ -40,6 +41,7 @@ class InlineSpiller : public Spiller {
|
|||||||
MachineFunction &mf_;
|
MachineFunction &mf_;
|
||||||
LiveIntervals &lis_;
|
LiveIntervals &lis_;
|
||||||
LiveStacks &lss_;
|
LiveStacks &lss_;
|
||||||
|
MachineDominatorTree &mdt_;
|
||||||
MachineLoopInfo &loops_;
|
MachineLoopInfo &loops_;
|
||||||
VirtRegMap &vrm_;
|
VirtRegMap &vrm_;
|
||||||
MachineFrameInfo &mfi_;
|
MachineFrameInfo &mfi_;
|
||||||
@ -68,6 +70,7 @@ public:
|
|||||||
mf_(mf),
|
mf_(mf),
|
||||||
lis_(pass.getAnalysis<LiveIntervals>()),
|
lis_(pass.getAnalysis<LiveIntervals>()),
|
||||||
lss_(pass.getAnalysis<LiveStacks>()),
|
lss_(pass.getAnalysis<LiveStacks>()),
|
||||||
|
mdt_(pass.getAnalysis<MachineDominatorTree>()),
|
||||||
loops_(pass.getAnalysis<MachineLoopInfo>()),
|
loops_(pass.getAnalysis<MachineLoopInfo>()),
|
||||||
vrm_(vrm),
|
vrm_(vrm),
|
||||||
mfi_(*mf.getFrameInfo()),
|
mfi_(*mf.getFrameInfo()),
|
||||||
@ -112,7 +115,7 @@ bool InlineSpiller::split() {
|
|||||||
|
|
||||||
// Try splitting around loops.
|
// Try splitting around loops.
|
||||||
if (const MachineLoop *loop = splitAnalysis_.getBestSplitLoop()) {
|
if (const MachineLoop *loop = splitAnalysis_.getBestSplitLoop()) {
|
||||||
SplitEditor(splitAnalysis_, lis_, vrm_, *edit_)
|
SplitEditor(splitAnalysis_, lis_, vrm_, mdt_, *edit_)
|
||||||
.splitAroundLoop(loop);
|
.splitAroundLoop(loop);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -120,14 +123,14 @@ bool InlineSpiller::split() {
|
|||||||
// Try splitting into single block intervals.
|
// Try splitting into single block intervals.
|
||||||
SplitAnalysis::BlockPtrSet blocks;
|
SplitAnalysis::BlockPtrSet blocks;
|
||||||
if (splitAnalysis_.getMultiUseBlocks(blocks)) {
|
if (splitAnalysis_.getMultiUseBlocks(blocks)) {
|
||||||
SplitEditor(splitAnalysis_, lis_, vrm_, *edit_)
|
SplitEditor(splitAnalysis_, lis_, vrm_, mdt_, *edit_)
|
||||||
.splitSingleBlocks(blocks);
|
.splitSingleBlocks(blocks);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try splitting inside a basic block.
|
// Try splitting inside a basic block.
|
||||||
if (const MachineBasicBlock *MBB = splitAnalysis_.getBlockForInsideSplit()) {
|
if (const MachineBasicBlock *MBB = splitAnalysis_.getBlockForInsideSplit()) {
|
||||||
SplitEditor(splitAnalysis_, lis_, vrm_, *edit_)
|
SplitEditor(splitAnalysis_, lis_, vrm_, mdt_, *edit_)
|
||||||
.splitInsideBlock(MBB);
|
.splitInsideBlock(MBB);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -97,6 +97,7 @@ namespace {
|
|||||||
initializeCalculateSpillWeightsPass(*PassRegistry::getPassRegistry());
|
initializeCalculateSpillWeightsPass(*PassRegistry::getPassRegistry());
|
||||||
initializePreAllocSplittingPass(*PassRegistry::getPassRegistry());
|
initializePreAllocSplittingPass(*PassRegistry::getPassRegistry());
|
||||||
initializeLiveStacksPass(*PassRegistry::getPassRegistry());
|
initializeLiveStacksPass(*PassRegistry::getPassRegistry());
|
||||||
|
initializeMachineDominatorTreePass(*PassRegistry::getPassRegistry());
|
||||||
initializeMachineLoopInfoPass(*PassRegistry::getPassRegistry());
|
initializeMachineLoopInfoPass(*PassRegistry::getPassRegistry());
|
||||||
initializeVirtRegMapPass(*PassRegistry::getPassRegistry());
|
initializeVirtRegMapPass(*PassRegistry::getPassRegistry());
|
||||||
initializeMachineDominatorTreePass(*PassRegistry::getPassRegistry());
|
initializeMachineDominatorTreePass(*PassRegistry::getPassRegistry());
|
||||||
@ -208,6 +209,7 @@ namespace {
|
|||||||
AU.addPreserved<MachineLoopInfo>();
|
AU.addPreserved<MachineLoopInfo>();
|
||||||
AU.addRequired<VirtRegMap>();
|
AU.addRequired<VirtRegMap>();
|
||||||
AU.addPreserved<VirtRegMap>();
|
AU.addPreserved<VirtRegMap>();
|
||||||
|
AU.addRequiredID(MachineDominatorsID);
|
||||||
AU.addPreservedID(MachineDominatorsID);
|
AU.addPreservedID(MachineDominatorsID);
|
||||||
MachineFunctionPass::getAnalysisUsage(AU);
|
MachineFunctionPass::getAnalysisUsage(AU);
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "VirtRegMap.h"
|
#include "VirtRegMap.h"
|
||||||
#include "llvm/CodeGen/CalcSpillWeights.h"
|
#include "llvm/CodeGen/CalcSpillWeights.h"
|
||||||
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
|
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
|
||||||
|
#include "llvm/CodeGen/MachineDominators.h"
|
||||||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||||
#include "llvm/CodeGen/MachineLoopInfo.h"
|
#include "llvm/CodeGen/MachineLoopInfo.h"
|
||||||
#include "llvm/CodeGen/MachineRegisterInfo.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.
|
/// 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)
|
LiveRangeEdit &edit)
|
||||||
: sa_(sa), lis_(lis), vrm_(vrm),
|
: sa_(sa), lis_(lis), vrm_(vrm),
|
||||||
mri_(vrm.getMachineFunction().getRegInfo()),
|
mri_(vrm.getMachineFunction().getRegInfo()),
|
||||||
tii_(*vrm.getMachineFunction().getTarget().getInstrInfo()),
|
tii_(*vrm.getMachineFunction().getTarget().getInstrInfo()),
|
||||||
edit_(edit),
|
edit_(edit),
|
||||||
dupli_(lis_, edit.getParent()),
|
dupli_(lis_, mdt, edit.getParent()),
|
||||||
openli_(lis_, edit.getParent())
|
openli_(lis_, mdt, edit.getParent())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ class LiveInterval;
|
|||||||
class LiveIntervals;
|
class LiveIntervals;
|
||||||
class LiveRangeEdit;
|
class LiveRangeEdit;
|
||||||
class MachineInstr;
|
class MachineInstr;
|
||||||
|
class MachineDominatorTree;
|
||||||
class MachineLoop;
|
class MachineLoop;
|
||||||
class MachineLoopInfo;
|
class MachineLoopInfo;
|
||||||
class MachineRegisterInfo;
|
class MachineRegisterInfo;
|
||||||
@ -154,6 +155,7 @@ public:
|
|||||||
/// Values in parentli_ may map to any number of openli_ values, including 0.
|
/// Values in parentli_ may map to any number of openli_ values, including 0.
|
||||||
class LiveIntervalMap {
|
class LiveIntervalMap {
|
||||||
LiveIntervals &lis_;
|
LiveIntervals &lis_;
|
||||||
|
MachineDominatorTree &mdt_;
|
||||||
|
|
||||||
// The parent interval is never changed.
|
// The parent interval is never changed.
|
||||||
const LiveInterval &parentli_;
|
const LiveInterval &parentli_;
|
||||||
@ -171,8 +173,9 @@ class LiveIntervalMap {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
LiveIntervalMap(LiveIntervals &lis,
|
LiveIntervalMap(LiveIntervals &lis,
|
||||||
|
MachineDominatorTree &mdt,
|
||||||
const LiveInterval &parentli)
|
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.
|
/// reset - clear all data structures and start a new live interval.
|
||||||
void reset(LiveInterval *);
|
void reset(LiveInterval *);
|
||||||
@ -285,7 +288,8 @@ class SplitEditor {
|
|||||||
public:
|
public:
|
||||||
/// Create a new SplitEditor for editing the LiveInterval analyzed by SA.
|
/// Create a new SplitEditor for editing the LiveInterval analyzed by SA.
|
||||||
/// Newly created intervals will be appended to newIntervals.
|
/// 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.
|
/// getAnalysis - Get the corresponding analysis.
|
||||||
SplitAnalysis &getAnalysis() { return sa_; }
|
SplitAnalysis &getAnalysis() { return sa_; }
|
||||||
|
Reference in New Issue
Block a user