llvm.org GIT mirror llvm / 2d8e3d2
remove dead PrefixPrinter class. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79796 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 11 years ago
6 changed file(s) with 24 addition(s) and 115 deletion(s). Raw diff Collapse all Expand all
+0
-60
include/llvm/CodeGen/Dump.h less more
None //===- llvm/Support/Dump.h - Easy way to tailor dump output -----*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file provides the PrefixPrinter interface to pass to MachineFunction
10 // and MachineBasicBlock print methods to output additional information before
11 // blocks and instructions are printed.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_CODEGEN_DUMP_H
16 #define LLVM_CODEGEN_DUMP_H
17
18 #include
19
20 namespace llvm {
21
22 class MachineBasicBlock;
23 class MachineInstr;
24 class raw_ostream;
25
26 /// PrefixPrinter - Print some additional information before printing
27 /// basic blocks and instructions.
28 class PrefixPrinter {
29 public:
30 virtual ~PrefixPrinter();
31
32 /// operator() - Print a prefix before each MachineBasicBlock
33 virtual raw_ostream &operator()(raw_ostream &out,
34 const MachineBasicBlock &) const {
35 return out;
36 }
37
38 /// operator() - Print a prefix before each MachineInstr
39 virtual raw_ostream &operator()(raw_ostream &out,
40 const MachineInstr &) const {
41 return out;
42 }
43
44 /// operator() - Print a prefix before each MachineBasicBlock
45 virtual std::ostream &operator()(std::ostream &out,
46 const MachineBasicBlock &) const {
47 return out;
48 }
49
50 /// operator() - Print a prefix before each MachineInstr
51 virtual std::ostream &operator()(std::ostream &out,
52 const MachineInstr &) const {
53 return out;
54 }
55 };
56
57 } // End llvm namespace
58
59 #endif
1515
1616 #include "llvm/CodeGen/MachineInstr.h"
1717 #include "llvm/ADT/GraphTraits.h"
18 #include "llvm/CodeGen/Dump.h"
1918
2019 namespace llvm {
2120
310309
311310 // Debugging methods.
312311 void dump() const;
313 void print(std::ostream &OS,
314 const PrefixPrinter &prefix = PrefixPrinter()) const;
315 void print(std::ostream *OS,
316 const PrefixPrinter &prefix = PrefixPrinter()) const {
317 if (OS) print(*OS, prefix);
318 }
319 void print(raw_ostream &OS,
320 const PrefixPrinter &prefix = PrefixPrinter()) const;
321 void print(raw_ostream *OS,
322 const PrefixPrinter &prefix = PrefixPrinter()) const {
323 if (OS) print(*OS, prefix);
312 void print(std::ostream &OS) const;
313 void print(std::ostream *OS) const {
314 if (OS) print(*OS);
315 }
316 void print(raw_ostream &OS) const;
317 void print(raw_ostream *OS) const {
318 if (OS) print(*OS);
324319 }
325320
326321 /// getNumber - MachineBasicBlocks are uniquely numbered at the function
1717 #ifndef LLVM_CODEGEN_MACHINEFUNCTION_H
1818 #define LLVM_CODEGEN_MACHINEFUNCTION_H
1919
20 #include
20 #include "llvm/CodeGen/MachineBasicBlock.h"
2121 #include "llvm/ADT/ilist.h"
2222 #include "llvm/Support/DebugLoc.h"
23 #include "llvm/CodeGen/Dump.h"
24 #include "llvm/CodeGen/MachineBasicBlock.h"
2523 #include "llvm/Support/Allocator.h"
2624 #include "llvm/Support/Recycler.h"
25 #include
2726
2827 namespace llvm {
2928
207206 /// print - Print out the MachineFunction in a format suitable for debugging
208207 /// to the specified stream.
209208 ///
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);
209 void print(std::ostream &OS) const;
210 void print(std::ostream *OS) const {
211 if (OS) print(*OS);
215212 }
216213
217214 /// viewCFG - This function is meant for use from the debugger. You can just
+0
-18
lib/CodeGen/Dump.cpp less more
None //===- lib/Support/Dump.h - Virtual function homes --------------*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file provides the PrefixPrinter virtual function homes.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #include "llvm/CodeGen/Dump.h"
14
15 using namespace llvm;
16
17 PrefixPrinter::~PrefixPrinter() {}
172172 os << " %reg" << RegNo;
173173 }
174174
175 void MachineBasicBlock::print(std::ostream &OS,
176 const PrefixPrinter &prefix) const {
175 void MachineBasicBlock::print(std::ostream &OS) const {
177176 raw_os_ostream RawOS(OS);
178 print(RawOS, prefix);
179 }
180
181 void MachineBasicBlock::print(raw_ostream &OS,
182 const PrefixPrinter &prefix) const {
177 print(RawOS);
178 }
179
180 void MachineBasicBlock::print(raw_ostream &OS) const {
183181 const MachineFunction *MF = getParent();
184182 if (!MF) {
185183 OS << "Can't print out MachineBasicBlock because parent MachineFunction"
212210 }
213211
214212 for (const_iterator I = begin(); I != end(); ++I) {
215 prefix(OS, *I) << '\t';
213 OS << '\t';
216214 I->print(OS, &getParent()->getTarget());
217215 }
218216
219219 print(*cerr.stream());
220220 }
221221
222 void MachineFunction::print(std::ostream &OS,
223 const PrefixPrinter &prefix) const {
224 OS << "# Machine code for " << Fn->getNameStr () << "():\n";
222 void MachineFunction::print(std::ostream &OS) const {
223 OS << "# Machine code for " << Fn->getNameStr() << "():\n";
225224
226225 // Print Frame Information
227226 FrameInfo->print(*this, OS);
262261 OS << "\n";
263262 }
264263
265 for (const_iterator BB = begin(); BB != end(); ++BB) {
266 prefix(OS, *BB);
267 BB->print(OS, prefix);
268 }
269
270 OS << "\n# End machine code for " << Fn->getNameStr () << "().\n\n";
264 for (const_iterator BB = begin(), E = end(); BB != E; ++BB)
265 BB->print(OS);
266
267 OS << "\n# End machine code for " << Fn->getNameStr() << "().\n\n";
271268 }
272269
273270 namespace llvm {