aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-05-12 03:51:30 +0000
committerChris Lattner <sabre@nondot.org>2003-05-12 03:51:30 +0000
commit9c341366a7e644c9d8333ed84a90aa57516c7ace (patch)
tree3853edbaf594faad896f8c8154b6862f5ce53be1 /include
parentbbd5839a97cdd1b1f9fda52e9a807982cc1deac1 (diff)
downloadexternal_llvm-9c341366a7e644c9d8333ed84a90aa57516c7ace.zip
external_llvm-9c341366a7e644c9d8333ed84a90aa57516c7ace.tar.gz
external_llvm-9c341366a7e644c9d8333ed84a90aa57516c7ace.tar.bz2
Expand API for updating live var info.
Expose iterators, not const-iterators. Rename method that was VERY misleading git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6108 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/CodeGen/LiveVariables.h47
1 files changed, 39 insertions, 8 deletions
diff --git a/include/llvm/CodeGen/LiveVariables.h b/include/llvm/CodeGen/LiveVariables.h
index 1da673a..7b03c31 100644
--- a/include/llvm/CodeGen/LiveVariables.h
+++ b/include/llvm/CodeGen/LiveVariables.h
@@ -72,6 +72,7 @@ class LiveVariables : public MachineFunctionPass {
/// liveness for values that are not in this set.
///
std::vector<bool> AllocatablePhysicalRegisters;
+
private: // Intermediate data structures
/// BBMap - Maps LLVM basic blocks to their corresponding machine basic block.
@@ -89,32 +90,62 @@ public:
/// killed_iterator - Iterate over registers killed by a machine instruction
///
- typedef std::multimap<MachineInstr*,
- unsigned>::const_iterator killed_iterator;
+ typedef std::multimap<MachineInstr*, unsigned>::iterator killed_iterator;
/// killed_begin/end - Get access to the range of registers killed by a
/// machine instruction.
- killed_iterator killed_begin(MachineInstr *MI) const {
+ killed_iterator killed_begin(MachineInstr *MI) {
return RegistersKilled.lower_bound(MI);
}
- killed_iterator killed_end(MachineInstr *MI) const {
+ killed_iterator killed_end(MachineInstr *MI) {
return RegistersKilled.upper_bound(MI);
}
+ std::pair<killed_iterator, killed_iterator>
+ killed_range(MachineInstr *MI) {
+ return RegistersKilled.equal_range(MI);
+ }
- killed_iterator dead_begin(MachineInstr *MI) const {
+ killed_iterator dead_begin(MachineInstr *MI) {
return RegistersDead.lower_bound(MI);
}
- killed_iterator dead_end(MachineInstr *MI) const {
+ killed_iterator dead_end(MachineInstr *MI) {
return RegistersDead.upper_bound(MI);
}
+ std::pair<killed_iterator, killed_iterator>
+ dead_range(MachineInstr *MI) {
+ return RegistersDead.equal_range(MI);
+ }
- /// addVirtualRegisterKill - Add information about the fact that the specified
+ //===--------------------------------------------------------------------===//
+ // API to update live variable information
+
+ /// addVirtualRegisterKilled - Add information about the fact that the
+ /// specified register is killed after being used by the specified
+ /// instruction.
+ ///
+ void addVirtualRegisterKilled(unsigned IncomingReg, MachineInstr *MI) {
+ RegistersKilled.insert(std::make_pair(MI, IncomingReg));
+ }
+
+ /// removeVirtualRegistersKilled - Remove all of the specified killed
+ /// registers from the live variable information.
+ void removeVirtualRegistersKilled(killed_iterator B, killed_iterator E) {
+ RegistersKilled.erase(B, E);
+ }
+
+ /// addVirtualRegisterDead - Add information about the fact that the specified
/// register is dead after being used by the specified instruction.
///
- void addVirtualRegisterKill(unsigned IncomingReg, MachineInstr *MI) {
+ void addVirtualRegisterDead(unsigned IncomingReg, MachineInstr *MI) {
RegistersDead.insert(std::make_pair(MI, IncomingReg));
}
+ /// removeVirtualRegistersKilled - Remove all of the specified killed
+ /// registers from the live variable information.
+ void removeVirtualRegistersDead(killed_iterator B, killed_iterator E) {
+ RegistersDead.erase(B, E);
+ }
+
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
}