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

Misha Brukman brukman at cs.uiuc.edu
Tue May 27 17:25:01 PDT 2003


Changes in directory llvm/lib/Target/Sparc:

Sparc.cpp updated: 1.62 -> 1.63

---
Log message:

* Allow passing in an unsigned configuration to allocateSparcTargetMachine()
  a default value is set in the header file.
* Fixed some code layout to make it more consistent with the rest of codebase
* Added addPassesToJITCompile() with relevant passes


---
Diffs of the changes:

Index: llvm/lib/Target/Sparc/Sparc.cpp
diff -u llvm/lib/Target/Sparc/Sparc.cpp:1.62 llvm/lib/Target/Sparc/Sparc.cpp:1.63
--- llvm/lib/Target/Sparc/Sparc.cpp:1.62	Sat Apr 26 15:11:01 2003
+++ llvm/lib/Target/Sparc/Sparc.cpp	Tue May 27 17:24:48 2003
@@ -53,9 +53,9 @@
 // that implements the Sparc backend. (the llvm/CodeGen/Sparc.h interface)
 //----------------------------------------------------------------------------
 
-TargetMachine *allocateSparcTargetMachine() { return new UltraSparc(); }
-
-
+TargetMachine *allocateSparcTargetMachine(unsigned Configuration) {
+  return new UltraSparc();
+}
 
 //---------------------------------------------------------------------------
 // class UltraSparcFrameInfo 
@@ -155,13 +155,12 @@
 
   // Specialize LLVM code for this target machine and then
   // run basic dataflow optimizations on LLVM code.
-  if (!DisablePreSelect)
-    {
-      PM.add(createPreSelectionPass(*this));
-      PM.add(createReassociatePass());
-      PM.add(createLICMPass());
-      PM.add(createGCSEPass());
-    }
+  if (!DisablePreSelect) {
+    PM.add(createPreSelectionPass(*this));
+    PM.add(createReassociatePass());
+    PM.add(createLICMPass());
+    PM.add(createGCSEPass());
+  }
 
   PM.add(createInstructionSelectionPass(*this));
 
@@ -193,4 +192,30 @@
   PM.add(getEmitBytecodeToAsmPass(Out));
   PM.add(getFunctionInfo(Out)); 
   return false;
+}
+
+// addPassesToJITCompile - This method controls the JIT method of code
+// generation for the UltraSparc.
+//
+bool UltraSparc::addPassesToJITCompile(PassManager &PM) {
+  // FIXME: implement the switch instruction in the instruction selector.
+  PM.add(createLowerSwitchPass());
+
+  // Construct and initialize the MachineFunction object for this fn.
+  PM.add(createMachineCodeConstructionPass(*this));
+
+  //Insert empty stackslots in the stack frame of each function
+  //so %fp+offset-8 and %fp+offset-16 are empty slots now!
+  PM.add(createStackSlotsPass(*this));
+
+  PM.add(createInstructionSelectionPass(*this));
+
+  // new pass: convert Value* in MachineOperand to an unsigned register
+  // this brings it in line with what the X86 JIT's RegisterAllocator expects
+  //PM.add(createAddRegNumToValuesPass());
+
+  PM.add(getRegisterAllocator(*this));
+  PM.add(getPrologEpilogInsertionPass());
+
+  return false; // success!
 }





More information about the llvm-commits mailing list