llvm.org GIT mirror llvm / 4b93895
Add PrefixPrinter arguments to the dump routines for MachineFunction and MachineBasicBlock. We'll use these shortly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76603 91177308-0d34-0410-b5e6-96231b3b80d8 David Greene 11 years ago
4 changed file(s) with 23 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
1515
1616 #include "llvm/CodeGen/MachineInstr.h"
1717 #include "llvm/ADT/GraphTraits.h"
18 #include "llvm/Support/Dump.h"
1819
1920 namespace llvm {
2021
308309
309310 // Debugging methods.
310311 void dump() const;
311 void print(std::ostream &OS) const;
312 void print(std::ostream *OS) const { if (OS) print(*OS); }
312 void print(std::ostream &OS,
313 const PrefixPrinter &prefix = PrefixPrinter()) const;
314 void print(std::ostream *OS,
315 const PrefixPrinter &prefix = PrefixPrinter()) const {
316 if (OS) print(*OS, prefix);
317 }
313318
314319 /// getNumber - MachineBasicBlocks are uniquely numbered at the function
315320 /// level, unless they're not in a MachineFunction yet, in which case this
1919
2020 #include "llvm/ADT/ilist.h"
2121 #include "llvm/Support/DebugLoc.h"
22 #include "llvm/Support/Dump.h"
2223 #include "llvm/CodeGen/MachineBasicBlock.h"
2324 #include "llvm/Support/Annotation.h"
2425 #include "llvm/Support/Allocator.h"
206207 /// print - Print out the MachineFunction in a format suitable for debugging
207208 /// to the specified stream.
208209 ///
209 void print(std::ostream &OS) const;
210 void print(std::ostream *OS) const { if (OS) print(*OS); }
210 void print(std::ostream &OS,
211 const PrefixPrinter &prefix = PrefixPrinter()) const;
212 void print(std::ostream *OS,
213 const PrefixPrinter &prefix = PrefixPrinter()) const {
214 if (OS) print(*OS, prefix);
215 }
211216
212217 /// viewCFG - This function is meant for use from the debugger. You can just
213218 /// say 'call F->viewCFG()' and a ghostview window should pop up from the
147147 os << " %reg" << RegNo;
148148 }
149149
150 void MachineBasicBlock::print(std::ostream &OS) const {
150 void MachineBasicBlock::print(std::ostream &OS,
151 const PrefixPrinter &prefix) const {
151152 const MachineFunction *MF = getParent();
152153 if(!MF) {
153154 OS << "Can't print out MachineBasicBlock because parent MachineFunction"
180181 }
181182
182183 for (const_iterator I = begin(); I != end(); ++I) {
184 OS << prefix(*I);
183185 OS << "\t";
184186 I->print(OS, &getParent()->getTarget());
185187 }
251251 print(*cerr.stream());
252252 }
253253
254 void MachineFunction::print(std::ostream &OS) const {
254 void MachineFunction::print(std::ostream &OS,
255 const PrefixPrinter &prefix) const {
255256 OS << "# Machine code for " << Fn->getName () << "():\n";
256257
257258 // Print Frame Information
293294 OS << "\n";
294295 }
295296
296 for (const_iterator BB = begin(); BB != end(); ++BB)
297 BB->print(OS);
297 for (const_iterator BB = begin(); BB != end(); ++BB) {
298 OS << prefix(*BB);
299 BB->print(OS, prefix);
300 }
298301
299302 OS << "\n# End machine code for " << Fn->getName () << "().\n\n";
300303 }