Make -print-machineinstrs even stronger. You get to see the final code after
authorBrian Gaeke <gaeke@uiuc.edu>
Mon, 14 Jun 2004 05:05:45 +0000 (05:05 +0000)
committerBrian Gaeke <gaeke@uiuc.edu>
Mon, 14 Jun 2004 05:05:45 +0000 (05:05 +0000)
peepholing, and make it work the same way in the JIT as in LLC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14170 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/SparcV9/SparcV9TargetMachine.cpp

index 4c92105bfe54fce52744c00e1819e924f6316036..d7d5ab7364c8e201b091afc152501eea5cfaa74f 100644 (file)
@@ -179,6 +179,9 @@ SparcV9TargetMachine::addPassesToEmitAssembly(PassManager &PM, std::ostream &Out
   if (!DisablePeephole)
     PM.add(createPeepholeOptsPass(*this));
 
+  if (PrintMachineCode)
+    PM.add(createMachineFunctionPrinterPass(&std::cerr, "Final code:\n"));
+
   if (EmitMappingInfo) {
     PM.add(createInternalGlobalMapperPass());
     PM.add(getMappingInfoAsmPrinterPass(Out));
@@ -234,6 +237,11 @@ void SparcV9JITInfo::addPassesToJITCompile(FunctionPassManager &PM) {
   //PM.add(createLICMPass());
   //PM.add(createGCSEPass());
 
+  // If the user's trying to read the generated code, they'll need to see the
+  // transformed input.
+  if (PrintMachineCode)
+    PM.add(new PrintFunctionPass());
+
   // Construct and initialize the MachineFunction object for this fn.
   PM.add(createMachineCodeConstructionPass(TM));
 
@@ -251,6 +259,9 @@ void SparcV9JITInfo::addPassesToJITCompile(FunctionPassManager &PM) {
 
   if (!DisablePeephole)
     PM.add(createPeepholeOptsPass(TM));
+
+  if (PrintMachineCode)
+    PM.add(createMachineFunctionPrinterPass(&std::cerr, "Final code:\n"));
 }
 
 /// allocateSparcV9TargetMachine - Allocate and return a subclass of TargetMachine