[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineFunction.h
Chris Lattner
lattner at cs.uiuc.edu
Sun Jan 23 14:13:51 PST 2005
Changes in directory llvm/include/llvm/CodeGen:
MachineFunction.h updated: 1.45 -> 1.46
---
Log message:
Expose more information from register allocation to passes that run after
it.
---
Diffs of the changes: (+26 -0)
MachineFunction.h | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+)
Index: llvm/include/llvm/CodeGen/MachineFunction.h
diff -u llvm/include/llvm/CodeGen/MachineFunction.h:1.45 llvm/include/llvm/CodeGen/MachineFunction.h:1.46
--- llvm/include/llvm/CodeGen/MachineFunction.h:1.45 Wed Oct 27 11:14:51 2004
+++ llvm/include/llvm/CodeGen/MachineFunction.h Sun Jan 23 16:13:36 2005
@@ -97,6 +97,13 @@
// numbered and this vector keeps track of the mapping from ID's to MBB's.
std::vector<MachineBasicBlock*> MBBNumbering;
+ /// UsedPhysRegs - This is a new[]'d array of bools that is computed and set
+ /// by the register allocator, and must be kept up to date by passes that run
+ /// after register allocation (though most don't modify this). This is used
+ /// so that the code generator knows which callee save registers to save and
+ /// for other target specific uses.
+ bool *UsedPhysRegs;
+
public:
MachineFunction(const Function *Fn, const TargetMachine &TM);
~MachineFunction();
@@ -138,6 +145,25 @@
return static_cast<Ty*>(MFInfo);
}
+ /// setUsedPhysRegs - The register allocator should call this to initialized
+ /// the UsedPhysRegs set. This should be passed a new[]'d array with entries
+ /// for all of the physical registers that the target supports. Each array
+ /// entry should be set to true iff the physical register is used within the
+ /// function.
+ void setUsedPhysRegs(bool *UPR) { UsedPhysRegs = UPR; }
+
+ /// getUsedPhysregs - This returns the UsedPhysRegs array. This returns null
+ /// before register allocation.
+ const bool *getUsedPhysregs() { return UsedPhysRegs; }
+
+ /// isPhysRegUsed - Return true if the specified register is used in this
+ /// function. This only works after register allocation.
+ bool isPhysRegUsed(unsigned Reg) { return UsedPhysRegs[Reg]; }
+
+ /// changePhyRegUsed - This method allows code that runs after register
+ /// allocation to keep the PhysRegsUsed array up-to-date.
+ void changePhyRegUsed(unsigned Reg, bool State) { UsedPhysRegs[Reg] = State; }
+
/// getBlockNumbered - MachineBasicBlocks are automatically numbered when they
/// are inserted into the machine function. The block number for a machine
/// basic block can be found by using the MBB::getBlockNumber method, this
More information about the llvm-commits
mailing list