llvm.org GIT mirror llvm / 9c34136
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 Chris Lattner 17 years ago
1 changed file(s) with 39 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
7171 /// liveness for values that are not in this set.
7272 ///
7373 std::vector AllocatablePhysicalRegisters;
74
7475 private: // Intermediate data structures
7576
7677 /// BBMap - Maps LLVM basic blocks to their corresponding machine basic block.
8889
8990 /// killed_iterator - Iterate over registers killed by a machine instruction
9091 ///
91 typedef std::multimap
92 unsigned>::const_iterator killed_iterator;
92 typedef std::multimap::iterator killed_iterator;
9393
9494 /// killed_begin/end - Get access to the range of registers killed by a
9595 /// machine instruction.
96 killed_iterator killed_begin(MachineInstr *MI) const {
96 killed_iterator killed_begin(MachineInstr *MI) {
9797 return RegistersKilled.lower_bound(MI);
9898 }
99 killed_iterator killed_end(MachineInstr *MI) const {
99 killed_iterator killed_end(MachineInstr *MI) {
100100 return RegistersKilled.upper_bound(MI);
101101 }
102 std::pair
103 killed_range(MachineInstr *MI) {
104 return RegistersKilled.equal_range(MI);
105 }
102106
103 killed_iterator dead_begin(MachineInstr *MI) const {
107 killed_iterator dead_begin(MachineInstr *MI) {
104108 return RegistersDead.lower_bound(MI);
105109 }
106 killed_iterator dead_end(MachineInstr *MI) const {
110 killed_iterator dead_end(MachineInstr *MI) {
107111 return RegistersDead.upper_bound(MI);
108112 }
113 std::pair
114 dead_range(MachineInstr *MI) {
115 return RegistersDead.equal_range(MI);
116 }
109117
110 /// addVirtualRegisterKill - Add information about the fact that the specified
118 //===--------------------------------------------------------------------===//
119 // API to update live variable information
120
121 /// addVirtualRegisterKilled - Add information about the fact that the
122 /// specified register is killed after being used by the specified
123 /// instruction.
124 ///
125 void addVirtualRegisterKilled(unsigned IncomingReg, MachineInstr *MI) {
126 RegistersKilled.insert(std::make_pair(MI, IncomingReg));
127 }
128
129 /// removeVirtualRegistersKilled - Remove all of the specified killed
130 /// registers from the live variable information.
131 void removeVirtualRegistersKilled(killed_iterator B, killed_iterator E) {
132 RegistersKilled.erase(B, E);
133 }
134
135 /// addVirtualRegisterDead - Add information about the fact that the specified
111136 /// register is dead after being used by the specified instruction.
112137 ///
113 void addVirtualRegisterKill(unsigned IncomingReg, MachineInstr *MI) {
138 void addVirtualRegisterDead(unsigned IncomingReg, MachineInstr *MI) {
114139 RegistersDead.insert(std::make_pair(MI, IncomingReg));
140 }
141
142 /// removeVirtualRegistersKilled - Remove all of the specified killed
143 /// registers from the live variable information.
144 void removeVirtualRegistersDead(killed_iterator B, killed_iterator E) {
145 RegistersDead.erase(B, E);
115146 }
116147
117148 virtual void getAnalysisUsage(AnalysisUsage &AU) const {