Support -print-machineinstrs
authorBrian Gaeke <gaeke@uiuc.edu>
Thu, 4 Mar 2004 19:22:16 +0000 (19:22 +0000)
committerBrian Gaeke <gaeke@uiuc.edu>
Thu, 4 Mar 2004 19:22:16 +0000 (19:22 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12124 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Sparc/SparcTargetMachine.cpp
lib/Target/SparcV8/SparcV8TargetMachine.cpp

index 581c535ccb244d35b84ab6ed9c7ff24b9dbe15a1..1b5b80abdbc9ece975f559c84ed251c9de328514 100644 (file)
@@ -42,19 +42,22 @@ bool SparcV8TargetMachine::addPassesToEmitAssembly(PassManager &PM,
                                               std::ostream &Out) {
   PM.add(createSparcV8SimpleInstructionSelector(*this));
 
-  // Print machine instructions as they are created.
-  PM.add(createMachineFunctionPrinterPass(&std::cerr));
+  // Print machine instructions as they were initially generated.
+  if (PrintMachineCode)
+    PM.add(createMachineFunctionPrinterPass(&std::cerr));
 
   PM.add(createRegisterAllocator());
   PM.add(createPrologEpilogCodeInserter());
-  // <insert assembly code output passes here>
 
-  // This is not a correct asm writer by any means, but at least we see what we
-  // are producing.
-  PM.add(createMachineFunctionPrinterPass(&Out));
+  // Print machine instructions after register allocation and prolog/epilog
+  // insertion.
+  if (PrintMachineCode)
+    PM.add(createMachineFunctionPrinterPass(&std::cerr));
 
+  // Output assembly language.
   PM.add(createSparcV8CodePrinterPass(Out, *this));
 
+  // Delete the MachineInstrs we generated, since they're no longer needed.
   PM.add(createMachineCodeDeleter());
   return false;
 }
index 581c535ccb244d35b84ab6ed9c7ff24b9dbe15a1..1b5b80abdbc9ece975f559c84ed251c9de328514 100644 (file)
@@ -42,19 +42,22 @@ bool SparcV8TargetMachine::addPassesToEmitAssembly(PassManager &PM,
                                               std::ostream &Out) {
   PM.add(createSparcV8SimpleInstructionSelector(*this));
 
-  // Print machine instructions as they are created.
-  PM.add(createMachineFunctionPrinterPass(&std::cerr));
+  // Print machine instructions as they were initially generated.
+  if (PrintMachineCode)
+    PM.add(createMachineFunctionPrinterPass(&std::cerr));
 
   PM.add(createRegisterAllocator());
   PM.add(createPrologEpilogCodeInserter());
-  // <insert assembly code output passes here>
 
-  // This is not a correct asm writer by any means, but at least we see what we
-  // are producing.
-  PM.add(createMachineFunctionPrinterPass(&Out));
+  // Print machine instructions after register allocation and prolog/epilog
+  // insertion.
+  if (PrintMachineCode)
+    PM.add(createMachineFunctionPrinterPass(&std::cerr));
 
+  // Output assembly language.
   PM.add(createSparcV8CodePrinterPass(Out, *this));
 
+  // Delete the MachineInstrs we generated, since they're no longer needed.
   PM.add(createMachineCodeDeleter());
   return false;
 }