X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FCodeGen%2FRegAllocLocal.cpp;h=59831f0b707aef295b27960b9dfe9d3648fead81;hb=73b43b9b549a75fb0015c825df68abd95705a67c;hp=9e274543cf5cd7192e2d5c80af416fd0372814ac;hpb=97e3c01eb4ee6afff602ad11a2f2788ed7c83580;p=oota-llvm.git diff --git a/lib/CodeGen/RegAllocLocal.cpp b/lib/CodeGen/RegAllocLocal.cpp index 9e274543cf5..59831f0b707 100644 --- a/lib/CodeGen/RegAllocLocal.cpp +++ b/lib/CodeGen/RegAllocLocal.cpp @@ -31,17 +31,17 @@ #include "llvm/ADT/Statistic.h" #include "llvm/ADT/STLExtras.h" #include +#include using namespace llvm; STATISTIC(NumStores, "Number of stores added"); STATISTIC(NumLoads , "Number of loads added"); -namespace { - static RegisterRegAlloc - localRegAlloc("local", " local register allocator", - createLocalRegisterAllocator); - +static RegisterRegAlloc + localRegAlloc("local", " local register allocator", + createLocalRegisterAllocator); +namespace { class VISIBILITY_HIDDEN RALocal : public MachineFunctionPass { public: static char ID; @@ -306,8 +306,7 @@ void RALocal::spillVirtReg(MachineBasicBlock &MBB, // If the instruction reads the register that's spilled, (e.g. this can // happen if it is a move to a physical register), then the spill // instruction is not a kill. - bool isKill = !(I != MBB.end() && - I->findRegisterUseOperandIdx(PhysReg) != -1); + bool isKill = !(I != MBB.end() && I->readsRegister(PhysReg)); TII->storeRegToStackSlot(MBB, I, PhysReg, isKill, FrameIndex, RC); ++NumStores; // Update statistics } @@ -550,10 +549,10 @@ void RALocal::AllocateBasicBlock(MachineBasicBlock &MBB) { // If this is the first basic block in the machine function, add live-in // registers as active. - if (&MBB == &*MF->begin()) { - for (MachineRegisterInfo::livein_iterator I=MF->getRegInfo().livein_begin(), - E = MF->getRegInfo().livein_end(); I != E; ++I) { - unsigned Reg = I->first; + if (&MBB == &*MF->begin() || MBB.isLandingPad()) { + for (MachineBasicBlock::livein_iterator I = MBB.livein_begin(), + E = MBB.livein_end(); I != E; ++I) { + unsigned Reg = *I; MF->getRegInfo().setPhysRegUsed(Reg); PhysRegsUsed[Reg] = 0; // It is free and reserved now AddToPhysRegsUseOrder(Reg);