Use isNull instead of getNode() to test for existence of a node, this is cheaper.
[oota-llvm.git] / lib / Target / X86 / X86TargetMachine.cpp
index 879ad5031176a2d1f39bbb64b37efb02bacea06b..83a390edaf8f137e40922189f628dcbcf639021e 100644 (file)
@@ -32,6 +32,9 @@ namespace {
   cl::opt<bool> NoSSAPeephole("disable-ssa-peephole", cl::init(true),
                         cl::desc("Disable the ssa-based peephole optimizer "
                                  "(defaults to disabled)"));
+  cl::opt<bool> DisableOutput("disable-x86-llc-output", cl::Hidden,
+                              cl::desc("Disable the X86 asm printer, for use "
+                                       "when profiling the code generator."));
 }
 
 // allocateX86TargetMachine - Allocate and return a subclass of TargetMachine
@@ -77,18 +80,18 @@ bool X86TargetMachine::addPassesToEmitAssembly(PassManager &PM,
 
   // Print the instruction selected machine code...
   if (PrintCode)
-    PM.add(createMachineFunctionPrinterPass());
+    PM.add(createMachineFunctionPrinterPass(&std::cerr));
 
   // Perform register allocation to convert to a concrete x86 representation
   PM.add(createRegisterAllocator());
 
   if (PrintCode)
-    PM.add(createMachineFunctionPrinterPass());
+    PM.add(createMachineFunctionPrinterPass(&std::cerr));
 
   PM.add(createX86FloatingPointStackifierPass());
 
   if (PrintCode)
-    PM.add(createMachineFunctionPrinterPass());
+    PM.add(createMachineFunctionPrinterPass(&std::cerr));
 
   // Insert prolog/epilog code.  Eliminate abstract frame index references...
   PM.add(createPrologEpilogCodeInserter());
@@ -98,7 +101,8 @@ bool X86TargetMachine::addPassesToEmitAssembly(PassManager &PM,
   if (PrintCode)  // Print the register-allocated code
     PM.add(createX86CodePrinterPass(std::cerr, *this));
 
-  PM.add(createX86CodePrinterPass(Out, *this));
+  if (!DisableOutput)
+    PM.add(createX86CodePrinterPass(Out, *this));
 
   // Delete machine code for this function
   PM.add(createMachineCodeDeleter());
@@ -134,18 +138,18 @@ void X86JITInfo::addPassesToJITCompile(FunctionPassManager &PM) {
 
   // Print the instruction selected machine code...
   if (PrintCode)
-    PM.add(createMachineFunctionPrinterPass());
+    PM.add(createMachineFunctionPrinterPass(&std::cerr));
 
   // Perform register allocation to convert to a concrete x86 representation
   PM.add(createRegisterAllocator());
 
   if (PrintCode)
-    PM.add(createMachineFunctionPrinterPass());
+    PM.add(createMachineFunctionPrinterPass(&std::cerr));
 
   PM.add(createX86FloatingPointStackifierPass());
 
   if (PrintCode)
-    PM.add(createMachineFunctionPrinterPass());
+    PM.add(createMachineFunctionPrinterPass(&std::cerr));
 
   // Insert prolog/epilog code.  Eliminate abstract frame index references...
   PM.add(createPrologEpilogCodeInserter());