[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineFunction.h
Chris Lattner
lattner at cs.uiuc.edu
Sat Apr 9 08:23:10 PDT 2005
Changes in directory llvm/include/llvm/CodeGen:
MachineFunction.h updated: 1.50 -> 1.51
---
Log message:
add routines to track the livein/out set for a function
---
Diffs of the changes: (+21 -0)
MachineFunction.h | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+)
Index: llvm/include/llvm/CodeGen/MachineFunction.h
diff -u llvm/include/llvm/CodeGen/MachineFunction.h:1.50 llvm/include/llvm/CodeGen/MachineFunction.h:1.51
--- llvm/include/llvm/CodeGen/MachineFunction.h:1.50 Thu Mar 17 12:23:22 2005
+++ llvm/include/llvm/CodeGen/MachineFunction.h Sat Apr 9 10:22:53 2005
@@ -105,6 +105,11 @@
/// 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 @@
/// 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
More information about the llvm-commits
mailing list