aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/CodeGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-01-23 22:13:36 +0000
committerChris Lattner <sabre@nondot.org>2005-01-23 22:13:36 +0000
commitd6b210ca3808a0e0ab9e1e2aefb73d61462fff0a (patch)
tree7dec31b51f1c375143ea5bc8aa5e646373545cc7 /include/llvm/CodeGen
parent92b9fcea7b3180ed18f379212d14bd5cea7a1954 (diff)
downloadexternal_llvm-d6b210ca3808a0e0ab9e1e2aefb73d61462fff0a.zip
external_llvm-d6b210ca3808a0e0ab9e1e2aefb73d61462fff0a.tar.gz
external_llvm-d6b210ca3808a0e0ab9e1e2aefb73d61462fff0a.tar.bz2
Expose more information from register allocation to passes that run after
it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19788 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r--include/llvm/CodeGen/MachineFunction.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/llvm/CodeGen/MachineFunction.h b/include/llvm/CodeGen/MachineFunction.h
index e6d9eb1..94e9470 100644
--- a/include/llvm/CodeGen/MachineFunction.h
+++ b/include/llvm/CodeGen/MachineFunction.h
@@ -97,6 +97,13 @@ class MachineFunction : private Annotation {
// 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 @@ public:
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