MachineBasicBlock.cpp (198090) | MachineBasicBlock.cpp (198892) |
---|---|
1//===-- llvm/CodeGen/MachineBasicBlock.cpp ----------------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 6 unchanged lines hidden (view full) --- 15#include "llvm/BasicBlock.h" 16#include "llvm/CodeGen/MachineFunction.h" 17#include "llvm/Target/TargetRegisterInfo.h" 18#include "llvm/Target/TargetData.h" 19#include "llvm/Target/TargetInstrDesc.h" 20#include "llvm/Target/TargetMachine.h" 21#include "llvm/Support/LeakDetector.h" 22#include "llvm/Support/raw_ostream.h" | 1//===-- llvm/CodeGen/MachineBasicBlock.cpp ----------------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 6 unchanged lines hidden (view full) --- 15#include "llvm/BasicBlock.h" 16#include "llvm/CodeGen/MachineFunction.h" 17#include "llvm/Target/TargetRegisterInfo.h" 18#include "llvm/Target/TargetData.h" 19#include "llvm/Target/TargetInstrDesc.h" 20#include "llvm/Target/TargetMachine.h" 21#include "llvm/Support/LeakDetector.h" 22#include "llvm/Support/raw_ostream.h" |
23#include "llvm/Assembly/Writer.h" |
|
23#include <algorithm> 24using namespace llvm; 25 26MachineBasicBlock::MachineBasicBlock(MachineFunction &mf, const BasicBlock *bb) | 24#include <algorithm> 25using namespace llvm; 26 27MachineBasicBlock::MachineBasicBlock(MachineFunction &mf, const BasicBlock *bb) |
27 : BB(bb), Number(-1), xParent(&mf), Alignment(0), IsLandingPad(false) { | 28 : BB(bb), Number(-1), xParent(&mf), Alignment(0), IsLandingPad(false), 29 AddressTaken(false) { |
28 Insts.Parent = this; 29} 30 31MachineBasicBlock::~MachineBasicBlock() { 32 LeakDetector::removeGarbageObject(this); 33} 34 35raw_ostream &llvm::operator<<(raw_ostream &OS, const MachineBasicBlock &MBB) { --- 119 unchanged lines hidden (view full) --- 155} 156 157void MachineBasicBlock::dump() const { 158 print(errs()); 159} 160 161static inline void OutputReg(raw_ostream &os, unsigned RegNo, 162 const TargetRegisterInfo *TRI = 0) { | 30 Insts.Parent = this; 31} 32 33MachineBasicBlock::~MachineBasicBlock() { 34 LeakDetector::removeGarbageObject(this); 35} 36 37raw_ostream &llvm::operator<<(raw_ostream &OS, const MachineBasicBlock &MBB) { --- 119 unchanged lines hidden (view full) --- 157} 158 159void MachineBasicBlock::dump() const { 160 print(errs()); 161} 162 163static inline void OutputReg(raw_ostream &os, unsigned RegNo, 164 const TargetRegisterInfo *TRI = 0) { |
163 if (!RegNo || TargetRegisterInfo::isPhysicalRegister(RegNo)) { | 165 if (RegNo != 0 && TargetRegisterInfo::isPhysicalRegister(RegNo)) { |
164 if (TRI) 165 os << " %" << TRI->get(RegNo).Name; 166 else | 166 if (TRI) 167 os << " %" << TRI->get(RegNo).Name; 168 else |
167 os << " %mreg(" << RegNo << ")"; | 169 os << " %physreg" << RegNo; |
168 } else 169 os << " %reg" << RegNo; 170} 171 172void MachineBasicBlock::print(raw_ostream &OS) const { 173 const MachineFunction *MF = getParent(); 174 if (!MF) { 175 OS << "Can't print out MachineBasicBlock because parent MachineFunction" 176 << " is null\n"; 177 return; 178 } 179 | 170 } else 171 os << " %reg" << RegNo; 172} 173 174void MachineBasicBlock::print(raw_ostream &OS) const { 175 const MachineFunction *MF = getParent(); 176 if (!MF) { 177 OS << "Can't print out MachineBasicBlock because parent MachineFunction" 178 << " is null\n"; 179 return; 180 } 181 |
180 const BasicBlock *LBB = getBasicBlock(); | 182 if (Alignment) { OS << "Alignment " << Alignment << "\n"; } 183 184 OS << "BB#" << getNumber() << ": "; 185 186 const char *Comma = ""; 187 if (const BasicBlock *LBB = getBasicBlock()) { 188 OS << Comma << "derived from LLVM BB "; 189 WriteAsOperand(OS, LBB, /*PrintType=*/false); 190 Comma = ", "; 191 } 192 if (isLandingPad()) { OS << Comma << "EH LANDING PAD"; Comma = ", "; } 193 if (hasAddressTaken()) { OS << Comma << "ADDRESS TAKEN"; Comma = ", "; } |
181 OS << '\n'; | 194 OS << '\n'; |
182 if (LBB) OS << LBB->getName() << ": "; 183 OS << (const void*)this 184 << ", LLVM BB @" << (const void*) LBB << ", ID#" << getNumber(); 185 if (Alignment) OS << ", Alignment " << Alignment; 186 if (isLandingPad()) OS << ", EH LANDING PAD"; 187 OS << ":\n"; | |
188 189 const TargetRegisterInfo *TRI = MF->getTarget().getRegisterInfo(); 190 if (!livein_empty()) { | 195 196 const TargetRegisterInfo *TRI = MF->getTarget().getRegisterInfo(); 197 if (!livein_empty()) { |
191 OS << "Live Ins:"; | 198 OS << " Live Ins:"; |
192 for (const_livein_iterator I = livein_begin(),E = livein_end(); I != E; ++I) 193 OutputReg(OS, *I, TRI); 194 OS << '\n'; 195 } 196 // Print the preds of this block according to the CFG. 197 if (!pred_empty()) { 198 OS << " Predecessors according to CFG:"; 199 for (const_pred_iterator PI = pred_begin(), E = pred_end(); PI != E; ++PI) | 199 for (const_livein_iterator I = livein_begin(),E = livein_end(); I != E; ++I) 200 OutputReg(OS, *I, TRI); 201 OS << '\n'; 202 } 203 // Print the preds of this block according to the CFG. 204 if (!pred_empty()) { 205 OS << " Predecessors according to CFG:"; 206 for (const_pred_iterator PI = pred_begin(), E = pred_end(); PI != E; ++PI) |
200 OS << ' ' << *PI << " (#" << (*PI)->getNumber() << ')'; | 207 OS << " BB#" << (*PI)->getNumber(); |
201 OS << '\n'; 202 } 203 204 for (const_iterator I = begin(); I != end(); ++I) { 205 OS << '\t'; 206 I->print(OS, &getParent()->getTarget()); 207 } 208 209 // Print the successors of this block according to the CFG. 210 if (!succ_empty()) { 211 OS << " Successors according to CFG:"; 212 for (const_succ_iterator SI = succ_begin(), E = succ_end(); SI != E; ++SI) | 208 OS << '\n'; 209 } 210 211 for (const_iterator I = begin(); I != end(); ++I) { 212 OS << '\t'; 213 I->print(OS, &getParent()->getTarget()); 214 } 215 216 // Print the successors of this block according to the CFG. 217 if (!succ_empty()) { 218 OS << " Successors according to CFG:"; 219 for (const_succ_iterator SI = succ_begin(), E = succ_end(); SI != E; ++SI) |
213 OS << ' ' << *SI << " (#" << (*SI)->getNumber() << ')'; | 220 OS << " BB#" << (*SI)->getNumber(); |
214 OS << '\n'; 215 } 216} 217 218void MachineBasicBlock::removeLiveIn(unsigned Reg) { 219 livein_iterator I = std::find(livein_begin(), livein_end(), Reg); 220 assert(I != livein_end() && "Not a live in!"); 221 LiveIns.erase(I); --- 171 unchanged lines hidden --- | 221 OS << '\n'; 222 } 223} 224 225void MachineBasicBlock::removeLiveIn(unsigned Reg) { 226 livein_iterator I = std::find(livein_begin(), livein_end(), Reg); 227 assert(I != livein_end() && "Not a live in!"); 228 LiveIns.erase(I); --- 171 unchanged lines hidden --- |