Mercurial > hg > CbC > CbC_llvm
comparison lib/CodeGen/LivePhysRegs.cpp @ 134:3a76565eade5 LLVM5.0.1
update 5.0.1
author | mir3636 |
---|---|
date | Sat, 17 Feb 2018 09:57:20 +0900 |
parents | 803732b1fca8 |
children | c2174574ed3a |
comparison
equal
deleted
inserted
replaced
133:c60214abe0e8 | 134:3a76565eade5 |
---|---|
124 OS << " (empty)\n"; | 124 OS << " (empty)\n"; |
125 return; | 125 return; |
126 } | 126 } |
127 | 127 |
128 for (const_iterator I = begin(), E = end(); I != E; ++I) | 128 for (const_iterator I = begin(), E = end(); I != E; ++I) |
129 OS << " " << PrintReg(*I, TRI); | 129 OS << " " << printReg(*I, TRI); |
130 OS << "\n"; | 130 OS << "\n"; |
131 } | 131 } |
132 | 132 |
133 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) | 133 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) |
134 LLVM_DUMP_METHOD void LivePhysRegs::dump() const { | 134 LLVM_DUMP_METHOD void LivePhysRegs::dump() const { |
203 for (MCPhysReg R : Pristine) | 203 for (MCPhysReg R : Pristine) |
204 addReg(R); | 204 addReg(R); |
205 } | 205 } |
206 | 206 |
207 void LivePhysRegs::addLiveOutsNoPristines(const MachineBasicBlock &MBB) { | 207 void LivePhysRegs::addLiveOutsNoPristines(const MachineBasicBlock &MBB) { |
208 if (!MBB.succ_empty()) { | 208 // To get the live-outs we simply merge the live-ins of all successors. |
209 // To get the live-outs we simply merge the live-ins of all successors. | 209 for (const MachineBasicBlock *Succ : MBB.successors()) |
210 for (const MachineBasicBlock *Succ : MBB.successors()) | 210 addBlockLiveIns(*Succ); |
211 addBlockLiveIns(*Succ); | 211 if (MBB.isReturnBlock()) { |
212 } else if (MBB.isReturnBlock()) { | 212 // Return blocks are a special case because we currently don't mark up |
213 // For the return block: Add all callee saved registers that are saved and | 213 // return instructions completely: specifically, there is no explicit |
214 // restored (somewhere); This does not include callee saved registers that | 214 // use for callee-saved registers. So we add all callee saved registers |
215 // are unused and hence not saved and restored; they are called pristine. | 215 // that are saved and restored (somewhere). This does not include |
216 // callee saved registers that are unused and hence not saved and | |
217 // restored; they are called pristine. | |
218 // FIXME: PEI should add explicit markings to return instructions | |
219 // instead of implicitly handling them here. | |
216 const MachineFunction &MF = *MBB.getParent(); | 220 const MachineFunction &MF = *MBB.getParent(); |
217 const MachineFrameInfo &MFI = MF.getFrameInfo(); | 221 const MachineFrameInfo &MFI = MF.getFrameInfo(); |
218 if (MFI.isCalleeSavedInfoValid()) { | 222 if (MFI.isCalleeSavedInfoValid()) { |
219 for (const CalleeSavedInfo &Info : MFI.getCalleeSavedInfo()) | 223 for (const CalleeSavedInfo &Info : MFI.getCalleeSavedInfo()) |
220 if (Info.isRestored()) | 224 if (Info.isRestored()) |
223 } | 227 } |
224 } | 228 } |
225 | 229 |
226 void LivePhysRegs::addLiveOuts(const MachineBasicBlock &MBB) { | 230 void LivePhysRegs::addLiveOuts(const MachineBasicBlock &MBB) { |
227 const MachineFunction &MF = *MBB.getParent(); | 231 const MachineFunction &MF = *MBB.getParent(); |
228 if (!MBB.succ_empty()) { | 232 addPristines(MF); |
229 addPristines(MF); | 233 addLiveOutsNoPristines(MBB); |
230 addLiveOutsNoPristines(MBB); | |
231 } else if (MBB.isReturnBlock()) { | |
232 // For the return block: Add all callee saved registers. | |
233 const MachineFrameInfo &MFI = MF.getFrameInfo(); | |
234 if (MFI.isCalleeSavedInfoValid()) | |
235 addCalleeSavedRegs(*this, MF); | |
236 } | |
237 } | 234 } |
238 | 235 |
239 void LivePhysRegs::addLiveIns(const MachineBasicBlock &MBB) { | 236 void LivePhysRegs::addLiveIns(const MachineBasicBlock &MBB) { |
240 const MachineFunction &MF = *MBB.getParent(); | 237 const MachineFunction &MF = *MBB.getParent(); |
241 addPristines(MF); | 238 addPristines(MF); |