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

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


Changes in directory llvm/lib/Target/Sparc:

SparcInternals.h updated: 1.85 -> 1.86

---
Log message:

Add prototypes to add passes to JIT compilation and code emission.
Also, added annotations to how instructions are modified (reg/imm operands).
Added prototype for adding register numbers to values pass for interfacing with
the target-independent register allocators in the JIT.


---
Diffs of the changes:

Index: llvm/lib/Target/Sparc/SparcInternals.h
diff -u llvm/lib/Target/Sparc/SparcInternals.h:1.85 llvm/lib/Target/Sparc/SparcInternals.h:1.86
--- llvm/lib/Target/Sparc/SparcInternals.h:1.85	Mon May 26 19:02:22 2003
+++ llvm/lib/Target/Sparc/SparcInternals.h	Tue May 27 17:01:10 2003
@@ -90,14 +90,14 @@
     bool ignore;
     if (this->maxImmedConstant(opCode, ignore) != 0) {
       // 1st store opcode
-      assert(! this->isStore((MachineOpCode) V9::STB - 1));
+      assert(! this->isStore((MachineOpCode) V9::STB - 1)); //r
       // last store opcode
-      assert(! this->isStore((MachineOpCode) V9::STXFSR + 1));
+      assert(! this->isStore((MachineOpCode) V9::STXFSR + 1)); //i
 
       if (opCode == V9::SETSW || opCode == V9::SETUW ||
           opCode == V9::SETX  || opCode == V9::SETHI)
         return 0;
-      if (opCode >= V9::STB && opCode <= V9::STXFSR)
+      if (opCode >= V9::STB && opCode <= V9::STXFSR) //r, i
         return 2;
       return 1;
     }
@@ -107,10 +107,10 @@
 
   /// createNOPinstr - returns the target's implementation of NOP, which is
   /// usually a pseudo-instruction, implemented by a degenerate version of
-  /// another instruction, e.g. X86: xchg ax, ax; SparcV9: sethi g0, 0
+  /// another instruction, e.g. X86: xchg ax, ax; SparcV9: sethi 0, g0
   ///
   MachineInstr* createNOPinstr() const {
-    return BuildMI(V9::SETHI, 2).addReg(SparcIntRegClass::g0).addZImm(0);
+    return BuildMI(V9::SETHI, 2).addZImm(0).addReg(SparcIntRegClass::g0);
   }
 
   /// isNOPinstr - not having a special NOP opcode, we need to know if a given
@@ -121,9 +121,9 @@
     // Make sure the instruction is EXACTLY `sethi g0, 0'
     if (MI.getOpcode() == V9::SETHI && MI.getNumOperands() == 2) {
       const MachineOperand &op0 = MI.getOperand(0), &op1 = MI.getOperand(1);
-      if (op0.isMachineRegister() &&
-          op0.getMachineRegNum() == SparcIntRegClass::g0 &&
-          op1.isImmediate() && op1.getImmedValue() == 0)
+      if (op0.isImmediate() && op0.getImmedValue() == 0 &&
+          op1.isMachineRegister() &&
+          op1.getMachineRegNum() == SparcIntRegClass::g0)
       {
         return true;
       }
@@ -688,6 +688,12 @@
   virtual bool IsUselessCopy    (const MachineInstr* MI) const;
 };
 
+/// createAddRegNumToValuesPass - this pass adds unsigned register numbers to
+/// instructions, since that's not done by the Sparc InstSelector, but that's
+/// how the target-independent register allocator in the JIT likes to see
+/// instructions. This pass enables the usage of the JIT register allocator(s).
+Pass *createAddRegNumToValuesPass();
+
 //---------------------------------------------------------------------------
 // class UltraSparcMachine 
 // 
@@ -716,6 +722,9 @@
   virtual const TargetOptInfo    &getOptInfo()   const { return optInfo; }
 
   virtual bool addPassesToEmitAssembly(PassManager &PM, std::ostream &Out);
+  virtual bool addPassesToJITCompile(PassManager &PM);
+  virtual bool addPassesToEmitMachineCode(PassManager &PM,
+                                          MachineCodeEmitter &MCE);
 
   // getPrologEpilogInsertionPass - Inserts prolog/epilog code.
   Pass* getPrologEpilogInsertionPass();





More information about the llvm-commits mailing list