* Allow passing in an unsigned configuration to allocateSparcTargetMachine()
authorMisha Brukman <brukman+llvm@gmail.com>
Tue, 27 May 2003 22:24:48 +0000 (22:24 +0000)
committerMisha Brukman <brukman+llvm@gmail.com>
Tue, 27 May 2003 22:24:48 +0000 (22:24 +0000)
  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

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

lib/Target/SparcV9/SparcV9TargetMachine.cpp

index 74597155a20008de48017f4ea97912f9409059e0..1ca04a6abad897d915c8b3e9844314b4228b5304 100644 (file)
@@ -53,9 +53,9 @@ static cl::opt<bool> DisablePeephole("nopeephole",
 // 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 @@ bool UltraSparc::addPassesToEmitAssembly(PassManager &PM, std::ostream &Out)
 
   // 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));
 
@@ -194,3 +193,29 @@ bool UltraSparc::addPassesToEmitAssembly(PassManager &PM, std::ostream &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!
+}