diff options
| author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2009-08-13 16:19:33 +0000 |
|---|---|---|
| committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2009-08-13 16:19:33 +0000 |
| commit | 3de4a60e1e6d53a7a9b2161bd87ae64a28fc1397 (patch) | |
| tree | 94c58130fe84a158271a5d3f2fd0c4d7e57f0a0f /llvm/lib/CodeGen/MachineFunction.cpp | |
| parent | 90e6b8b7089cb9e0a79e9667fc671080afad380f (diff) | |
| download | llvm-3de4a60e1e6d53a7a9b2161bd87ae64a28fc1397.zip llvm-3de4a60e1e6d53a7a9b2161bd87ae64a28fc1397.tar.gz llvm-3de4a60e1e6d53a7a9b2161bd87ae64a28fc1397.tar.bz2 | |
Add MachineFrameInfo::getPristineRegisters(MBB) method.
llvm-svn: 78911
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunction.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/MachineFunction.cpp | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp index ab037c2..3b854a5 100644 --- a/llvm/lib/CodeGen/MachineFunction.cpp +++ b/llvm/lib/CodeGen/MachineFunction.cpp @@ -380,6 +380,37 @@ int MachineFrameInfo::CreateFixedObject(uint64_t Size, int64_t SPOffset, } +BitVector +MachineFrameInfo::getPristineRegs(const MachineBasicBlock *MBB) const { + assert(MBB && "MBB must be valid"); + const MachineFunction *MF = MBB->getParent(); + assert(MF && "MBB must be part of a MachineFunction"); + const TargetMachine &TM = MF->getTarget(); + const TargetRegisterInfo *TRI = TM.getRegisterInfo(); + BitVector BV(TRI->getNumRegs()); + + // Before CSI is calculated, no registers are considered pristine. They can be + // freely used and PEI will make sure they are saved. + if (!isCalleeSavedInfoValid()) + return BV; + + for (const unsigned *CSR = TRI->getCalleeSavedRegs(MF); CSR && *CSR; ++CSR) + BV.set(*CSR); + + // The entry MBB always has all CSRs pristine. + if (MBB == &MF->front()) + return BV; + + // On other MBBs the saved CSRs are not pristine. + const std::vector<CalleeSavedInfo> &CSI = getCalleeSavedInfo(); + for (std::vector<CalleeSavedInfo>::const_iterator I = CSI.begin(), + E = CSI.end(); I != E; ++I) + BV.reset(I->getReg()); + + return BV; +} + + void MachineFrameInfo::print(const MachineFunction &MF, std::ostream &OS) const{ const TargetFrameInfo *FI = MF.getTarget().getFrameInfo(); int ValOffset = (FI ? FI->getOffsetOfLocalArea() : 0); @@ -420,7 +451,6 @@ void MachineFrameInfo::dump(const MachineFunction &MF) const { print(MF, *cerr.stream()); } - //===----------------------------------------------------------------------===// // MachineJumpTableInfo implementation //===----------------------------------------------------------------------===// |
