[llvm-commits] CVS: llvm/lib/Target/X86/X86TargetMachine.cpp

Brian Gaeke gaeke at niobe.cs.uiuc.edu
Wed Aug 13 13:17:07 PDT 2003


Changes in directory llvm/lib/Target/X86:

X86TargetMachine.cpp updated: 1.22 -> 1.23

---
Log message:

addPassesToJITCompile now takes a FunctionPassManager, to support
 function-at-a-time compilation and emission of code.
Separate addPassesToEmitAssembly from addPassesToJITCompile, because
 the latter requires you to use FunctionPasses, and the former might
 diverge anyway.


---
Diffs of the changes:

Index: llvm/lib/Target/X86/X86TargetMachine.cpp
diff -u llvm/lib/Target/X86/X86TargetMachine.cpp:1.22 llvm/lib/Target/X86/X86TargetMachine.cpp:1.23
--- llvm/lib/Target/X86/X86TargetMachine.cpp:1.22	Mon Aug 11 09:59:22 2003
+++ llvm/lib/Target/X86/X86TargetMachine.cpp	Wed Aug 13 13:15:52 2003
@@ -48,7 +48,44 @@
 // does to emit statically compiled machine code.
 bool X86TargetMachine::addPassesToEmitAssembly(PassManager &PM,
 					       std::ostream &Out) {
-  addPassesToJITCompile(PM);
+  // FIXME: Implement the switch instruction in the instruction selector!
+  PM.add(createLowerSwitchPass());
+
+  if (NoPatternISel)
+    PM.add(createX86SimpleInstructionSelector(*this));
+  else
+    PM.add(createX86PatternInstructionSelector(*this));
+
+  // TODO: optional optimizations go here
+
+  // FIXME: Add SSA based peephole optimizer here.
+
+  // Print the instruction selected machine code...
+  if (PrintCode)
+    PM.add(createMachineFunctionPrinterPass());
+
+  // Perform register allocation to convert to a concrete x86 representation
+  if (NoLocalRA)
+    PM.add(createSimpleRegisterAllocator());
+  else
+    PM.add(createLocalRegisterAllocator());
+
+  if (PrintCode)
+    PM.add(createMachineFunctionPrinterPass());
+
+  PM.add(createX86FloatingPointStackifierPass());
+
+  if (PrintCode)
+    PM.add(createMachineFunctionPrinterPass());
+
+  // Insert prolog/epilog code.  Eliminate abstract frame index references...
+  PM.add(createPrologEpilogCodeInserter());
+
+  PM.add(createX86PeepholeOptimizerPass());
+
+  if (PrintCode)  // Print the register-allocated code
+    PM.add(createX86CodePrinterPass(std::cerr, *this));
+
   PM.add(createX86CodePrinterPass(Out, *this));
   return false; // success!
 }
@@ -57,7 +94,7 @@
 /// implement a fast dynamic compiler for this target.  Return true if this is
 /// not supported for this target.
 ///
-bool X86TargetMachine::addPassesToJITCompile(PassManager &PM) {
+bool X86TargetMachine::addPassesToJITCompile(FunctionPassManager &PM) {
   // FIXME: Implement the switch instruction in the instruction selector!
   PM.add(createLowerSwitchPass());
 





More information about the llvm-commits mailing list