llvm.org GIT mirror llvm / 43ed267
Fix some refactos for iostream changes (in -Asserts mode). - The world needs better C++ refactoring tools, can I get an Amen!? git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79843 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Dunbar 11 years ago
8 changed file(s) with 39 addition(s) and 37 deletion(s). Raw diff Collapse all Expand all
3131 // is specified. This should probably not be referenced directly, instead, use
3232 // the DEBUG macro below.
3333 //
34 #ifndef NDEBUG
3435 extern bool DebugFlag;
36 #endif
3537
3638 // isCurrentDebugType - Return true if the specified string is the debug type
3739 // specified on the command line, or if none was specified on the command line
304304 #ifndef NDEBUG
305305 ViewGraph(this, "mf" + getFunction()->getNameStr());
306306 #else
307 cerr << "SelectionDAG::viewGraph is only available in debug builds on "
308 << "systems with Graphviz or gv!\n";
307 errs() << "SelectionDAG::viewGraph is only available in debug builds on "
308 << "systems with Graphviz or gv!\n";
309309 #endif // NDEBUG
310310 }
311311
314314 #ifndef NDEBUG
315315 ViewGraph(this, "mf" + getFunction()->getNameStr(), true);
316316 #else
317 cerr << "SelectionDAG::viewGraph is only available in debug builds on "
318 << "systems with Graphviz or gv!\n";
317 errs() << "SelectionDAG::viewGraph is only available in debug builds on "
318 << "systems with Graphviz or gv!\n";
319319 #endif // NDEBUG
320320 }
321321
9292 ViewGraph(this, "dag." + MF.getFunction()->getNameStr(), false,
9393 "Scheduling-Units Graph for " + MF.getFunction()->getNameStr());
9494 #else
95 cerr << "ScheduleDAG::viewGraph is only available in debug builds on "
96 << "systems with Graphviz or gv!\n";
95 errs() << "ScheduleDAG::viewGraph is only available in debug builds on "
96 << "systems with Graphviz or gv!\n";
9797 #endif // NDEBUG
9898 }
140140 ViewGraph(this, "dag." + getMachineFunction().getFunction()->getNameStr(),
141141 false, Title);
142142 #else
143 cerr << "SelectionDAG::viewGraph is only available in debug builds on "
144 << "systems with Graphviz or gv!\n";
143 errs() << "SelectionDAG::viewGraph is only available in debug builds on "
144 << "systems with Graphviz or gv!\n";
145145 #endif // NDEBUG
146146 }
147147
157157 #ifndef NDEBUG
158158 NodeGraphAttrs.clear();
159159 #else
160 cerr << "SelectionDAG::clearGraphAttrs is only available in debug builds"
161 << " on systems with Graphviz or gv!\n";
160 errs() << "SelectionDAG::clearGraphAttrs is only available in debug builds"
161 << " on systems with Graphviz or gv!\n";
162162 #endif
163163 }
164164
169169 #ifndef NDEBUG
170170 NodeGraphAttrs[N] = Attrs;
171171 #else
172 cerr << "SelectionDAG::setGraphAttrs is only available in debug builds"
173 << " on systems with Graphviz or gv!\n";
172 errs() << "SelectionDAG::setGraphAttrs is only available in debug builds"
173 << " on systems with Graphviz or gv!\n";
174174 #endif
175175 }
176176
187187 else
188188 return "";
189189 #else
190 cerr << "SelectionDAG::getGraphAttrs is only available in debug builds"
191 << " on systems with Graphviz or gv!\n";
190 errs() << "SelectionDAG::getGraphAttrs is only available in debug builds"
191 << " on systems with Graphviz or gv!\n";
192192 return std::string("");
193193 #endif
194194 }
199199 #ifndef NDEBUG
200200 NodeGraphAttrs[N] = std::string("color=") + Color;
201201 #else
202 cerr << "SelectionDAG::setGraphColor is only available in debug builds"
203 << " on systems with Graphviz or gv!\n";
202 errs() << "SelectionDAG::setGraphColor is only available in debug builds"
203 << " on systems with Graphviz or gv!\n";
204204 #endif
205205 }
206206
231231 }
232232 }
233233 #else
234 cerr << "SelectionDAG::setSubgraphColor is only available in debug builds"
235 << " on systems with Graphviz or gv!\n";
234 errs() << "SelectionDAG::setSubgraphColor is only available in debug builds"
235 << " on systems with Graphviz or gv!\n";
236236 #endif
237237 return hit_limit;
238238 }
254254 }
255255
256256 #else
257 cerr << "SelectionDAG::setSubgraphColor is only available in debug builds"
258 << " on systems with Graphviz or gv!\n";
257 errs() << "SelectionDAG::setSubgraphColor is only available in debug builds"
258 << " on systems with Graphviz or gv!\n";
259259 #endif
260260 }
261261
2626 #include "llvm/Support/Debug.h"
2727 using namespace llvm;
2828
29 // All Debug.h functionality is a no-op in NDEBUG mode.
30 #ifndef NDEBUG
2931 bool llvm::DebugFlag; // DebugFlag - Exported boolean set by the -debug option
3032
31 #ifndef NDEBUG
3233 // -debug - Command line option to enable the DEBUG statements in the passes.
3334 // This flag may only be enabled in debug builds.
3435 static cl::opt
4748 DebugOnly("debug-only", cl::desc("Enable a specific type of debug output"),
4849 cl::Hidden, cl::value_desc("debug string"),
4950 cl::location(DebugOnlyOptLoc), cl::ValueRequired);
50 #endif
5151
5252 // isCurrentDebugType - Return true if the specified string is the debug type
5353 // specified on the command line, or if none was specified on the command line
5454 // with the -debug-only=X option.
5555 //
5656 bool llvm::isCurrentDebugType(const char *DebugType) {
57 #ifndef NDEBUG
5857 return CurrentDebugType.empty() || DebugType == CurrentDebugType;
58 }
5959 #else
60 return false;
60 // Avoid "has no symbols" warning.
61 int Debug_dummy = 0;
6162 #endif
62 }
129129
130130 // Codegen the basic block.
131131 DEBUG(errs() << "===== Instruction selection begins:\n");
132 Indent = 0;
132 DEBUG(Indent = 0);
133133 SelectRoot(*CurDAG);
134134 DEBUG(errs() << "===== Instruction selection ends:\n");
135135
144144 DEBUG(errs().indent(Indent) << "Selecting: ");
145145 DEBUG(Node->dump(CurDAG));
146146 DEBUG(errs() << "\n");
147 Indent += 2;
147 DEBUG(Indent += 2);
148148
149149 // If we have a custom node, we already have selected!
150150 if (Node->isMachineOpcode()) {
151151 DEBUG(errs().indent(Indent-2) << "== ";
152152 Node->dump(CurDAG);
153153 errs() << "\n");
154 Indent -= 2;
154 DEBUG(Indent -= 2);
155155 return NULL;
156156 }
157157
179179 else
180180 DEBUG(ResNode->dump(CurDAG));
181181 DEBUG(errs() << "\n");
182 Indent -= 2;
182 DEBUG(Indent -= 2);
183183
184184 return ResNode;
185185 }
111111 DEBUG(BB->dump());
112112 // Codegen the basic block.
113113 DEBUG(errs() << "===== Instruction selection begins:\n");
114 Indent = 0;
114 DEBUG(Indent = 0);
115115
116116 // Select target instructions for the DAG.
117117 SelectRoot(*CurDAG);
189189 DEBUG(errs().indent(Indent) << "Selecting: ";
190190 Node->dump(CurDAG);
191191 errs() << "\n");
192 Indent += 2;
192 DEBUG(Indent += 2);
193193
194194 // If we have a custom node, we already have selected!
195195 if (Node->isMachineOpcode()) {
196196 DEBUG(errs().indent(Indent-2) << "== ";
197197 Node->dump(CurDAG);
198198 errs() << "\n");
199 Indent -= 2;
199 DEBUG(Indent -= 2);
200200 return NULL;
201201 }
202202
366366 else
367367 DEBUG(ResNode->dump(CurDAG));
368368 DEBUG(errs() << "\n");
369 Indent -= 2;
369 DEBUG(Indent -= 2);
370370
371371 return ResNode;
372372 }
606606
607607 // Codegen the basic block.
608608 DEBUG(errs() << "===== Instruction selection begins:\n");
609 Indent = 0;
609 DEBUG(Indent = 0);
610610 SelectRoot(*CurDAG);
611611 DEBUG(errs() << "===== Instruction selection ends:\n");
612612
623623 DEBUG(errs().indent(Indent) << "Selecting: ";
624624 Node->dump(CurDAG);
625625 errs() << "\n");
626 Indent += 2;
626 DEBUG(Indent += 2);
627627
628628 // If we have a custom node, we already have selected!
629629 if (Node->isMachineOpcode()) {
630630 DEBUG(errs().indent(Indent-2) << "== ";
631631 Node->dump(CurDAG);
632632 errs() << "\n");
633 Indent -= 2;
633 DEBUG(Indent -= 2);
634634 return NULL; // Already selected.
635635 }
636636
821821 ResNode->dump(CurDAG);
822822 errs() << "\n";
823823 );
824 Indent -= 2;
824 DEBUG(Indent -= 2);
825825
826826 return ResNode;
827827 }