Blark! How in the world did this work without this?!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44874 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling 2007-12-11 19:40:06 +00:00
parent 28bd5f0e47
commit 12ebf14048

View File

@ -43,6 +43,8 @@ STATISTIC(NumHoisted, "Number of machine instructions hoisted out of loops");
namespace { namespace {
class VISIBILITY_HIDDEN MachineLICM : public MachineFunctionPass { class VISIBILITY_HIDDEN MachineLICM : public MachineFunctionPass {
MachineFunction *CurMF;// Current MachineFunction
// Various analyses that we use... // Various analyses that we use...
MachineLoopInfo *LI; // Current MachineLoopInfo MachineLoopInfo *LI; // Current MachineLoopInfo
MachineDominatorTree *DT; // Machine dominator tree for the current Loop MachineDominatorTree *DT; // Machine dominator tree for the current Loop
@ -91,7 +93,7 @@ namespace {
/// MapVirtualRegisterDefs - Create a map of which machine instruction /// MapVirtualRegisterDefs - Create a map of which machine instruction
/// defines a virtual register. /// defines a virtual register.
/// ///
void MapVirtualRegisterDefs(const MachineFunction &MF); void MapVirtualRegisterDefs();
/// IsInSubLoop - A little predicate that returns true if the specified /// IsInSubLoop - A little predicate that returns true if the specified
/// basic block is in a subloop of the current one, not the current one /// basic block is in a subloop of the current one, not the current one
@ -182,12 +184,15 @@ bool MachineLICM::runOnMachineFunction(MachineFunction &MF) {
if (!PerformLICM) return false; // For debugging. if (!PerformLICM) return false; // For debugging.
Changed = false; Changed = false;
TII = MF.getTarget().getInstrInfo(); CurMF = &MF;
TII = CurMF->getTarget().getInstrInfo();
// Get our Loop information... // Get our Loop information...
LI = &getAnalysis<MachineLoopInfo>(); LI = &getAnalysis<MachineLoopInfo>();
DT = &getAnalysis<MachineDominatorTree>(); DT = &getAnalysis<MachineDominatorTree>();
MapVirtualRegisterDefs();
for (MachineLoopInfo::iterator for (MachineLoopInfo::iterator
I = LI->begin(), E = LI->end(); I != E; ++I) { I = LI->begin(), E = LI->end(); I != E; ++I) {
MachineLoop *L = *I; MachineLoop *L = *I;
@ -205,9 +210,9 @@ bool MachineLICM::runOnMachineFunction(MachineFunction &MF) {
/// MapVirtualRegisterDefs - Create a map of which machine instruction defines a /// MapVirtualRegisterDefs - Create a map of which machine instruction defines a
/// virtual register. /// virtual register.
/// ///
void MachineLICM::MapVirtualRegisterDefs(const MachineFunction &MF) { void MachineLICM::MapVirtualRegisterDefs() {
for (MachineFunction::const_iterator for (MachineFunction::const_iterator
I = MF.begin(), E = MF.end(); I != E; ++I) { I = CurMF->begin(), E = CurMF->end(); I != E; ++I) {
const MachineBasicBlock &MBB = *I; const MachineBasicBlock &MBB = *I;
for (MachineBasicBlock::const_iterator for (MachineBasicBlock::const_iterator