aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/CodeGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-04-09 15:22:53 +0000
committerChris Lattner <sabre@nondot.org>2005-04-09 15:22:53 +0000
commitdde3a9abc3c44ccc9cbf0c713f735d23afbcf301 (patch)
treea1c0a99368d363e47ecb0114222da75aa2c95676 /include/llvm/CodeGen
parente00e5ded511162b2a74bc2092bf2ae1d61a047dd (diff)
downloadexternal_llvm-dde3a9abc3c44ccc9cbf0c713f735d23afbcf301.zip
external_llvm-dde3a9abc3c44ccc9cbf0c713f735d23afbcf301.tar.gz
external_llvm-dde3a9abc3c44ccc9cbf0c713f735d23afbcf301.tar.bz2
add routines to track the livein/out set for a function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21179 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r--include/llvm/CodeGen/MachineFunction.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/llvm/CodeGen/MachineFunction.h b/include/llvm/CodeGen/MachineFunction.h
index 34685dd..1121fd0 100644
--- a/include/llvm/CodeGen/MachineFunction.h
+++ b/include/llvm/CodeGen/MachineFunction.h
@@ -105,6 +105,11 @@ class MachineFunction : private Annotation {
/// for other target specific uses.
bool *UsedPhysRegs;
+ /// LiveIns/LiveOuts - Keep track of the physical registers that are
+ /// livein/liveout of the function. Live in values are typically arguments in
+ /// registers, live out values are typically return values in registers.
+ std::vector<unsigned> LiveIns, LiveOuts;
+
public:
MachineFunction(const Function *Fn, const TargetMachine &TM);
~MachineFunction();
@@ -167,6 +172,22 @@ public:
/// allocation to keep the PhysRegsUsed array up-to-date.
void changePhyRegUsed(unsigned Reg, bool State) { UsedPhysRegs[Reg] = State; }
+
+ // LiveIn/LiveOut management methods.
+
+ /// addLiveIn/Out - Add the specified register as a live in/out. Note that it
+ /// is an error to add the same register to the same set more than once.
+ void addLiveIn(unsigned Reg) { LiveIns.push_back(Reg); }
+ void addLiveOut(unsigned Reg) { LiveOuts.push_back(Reg); }
+
+ // Iteration support for live in/out sets. These sets are kept in sorted
+ // order by their register number.
+ typedef std::vector<unsigned>::const_iterator liveinout_iterator;
+ liveinout_iterator livein_begin() const { return LiveIns.begin(); }
+ liveinout_iterator livein_end() const { return LiveIns.end(); }
+ liveinout_iterator liveout_begin() const { return LiveOuts.begin(); }
+ liveinout_iterator liveout_end() const { return LiveOuts.end(); }
+
/// 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