Added class MachineOptInfo as interface to target-specific
authorVikram S. Adve <vadve@cs.uiuc.edu>
Fri, 20 Sep 2002 00:52:09 +0000 (00:52 +0000)
committerVikram S. Adve <vadve@cs.uiuc.edu>
Fri, 20 Sep 2002 00:52:09 +0000 (00:52 +0000)
routines supporting machine code optimization.
Also added method MachineInstrInfo::getNOPOpCode().

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

include/llvm/Target/MachineInstrInfo.h
include/llvm/Target/TargetInstrInfo.h
include/llvm/Target/TargetMachine.h
lib/Target/SparcV9/SparcV9Internals.h
lib/Target/SparcV9/SparcV9TargetMachine.cpp

index 24d13634531f3f6cb44976147f2bd0dff83cc594..f7780d0a6a9eca7d9394645873470d4f0c763dde 100644 (file)
@@ -191,7 +191,7 @@ public:
   bool isPseudoInstr(const MachineOpCode opCode) const {
     return getDescriptor(opCode).iclass & M_PSEUDO_FLAG;
   }
-  
+
   // Check if an instruction can be issued before its operands are ready,
   // or if a subsequent instruction that uses its result can be issued
   // before the results are ready.
@@ -265,7 +265,12 @@ public:
   //-------------------------------------------------------------------------
   // Code generation support for creating individual machine instructions
   //-------------------------------------------------------------------------
-  
+
+  // Get certain common op codes for the current target.  this and all the
+  // Create* methods below should be moved to a machine code generation class
+  // 
+  virtual MachineOpCode getNOPOpCode() const = 0;
+
   // Create an instruction sequence to put the constant `val' into
   // the virtual register `dest'.  `val' may be a Constant or a
   // GlobalValue, viz., the constant address of a global variable or function.
index 24d13634531f3f6cb44976147f2bd0dff83cc594..f7780d0a6a9eca7d9394645873470d4f0c763dde 100644 (file)
@@ -191,7 +191,7 @@ public:
   bool isPseudoInstr(const MachineOpCode opCode) const {
     return getDescriptor(opCode).iclass & M_PSEUDO_FLAG;
   }
-  
+
   // Check if an instruction can be issued before its operands are ready,
   // or if a subsequent instruction that uses its result can be issued
   // before the results are ready.
@@ -265,7 +265,12 @@ public:
   //-------------------------------------------------------------------------
   // Code generation support for creating individual machine instructions
   //-------------------------------------------------------------------------
-  
+
+  // Get certain common op codes for the current target.  this and all the
+  // Create* methods below should be moved to a machine code generation class
+  // 
+  virtual MachineOpCode getNOPOpCode() const = 0;
+
   // Create an instruction sequence to put the constant `val' into
   // the virtual register `dest'.  `val' may be a Constant or a
   // GlobalValue, viz., the constant address of a global variable or function.
index 1a2abff27a769cb7980799bbe3e5639013ed2ce5..13c7a0240b049f6199bb5351a99d7d266dddb295 100644 (file)
@@ -16,6 +16,7 @@ class MachineSchedInfo;
 class MachineRegInfo;
 class MachineFrameInfo;
 class MachineCacheInfo;
+class MachineOptInfo;
 class PassManager;
 class Pass;
 
@@ -56,13 +57,17 @@ public:
   // -- Instruction opcode and operand information
   // -- Pipelines and scheduling information
   // -- Register information
+  // -- Stack frame information
+  // -- Cache hierarchy information
+  // -- Machine-level optimization information (peephole only)
   // 
   virtual const MachineInstrInfo&       getInstrInfo() const = 0;
   virtual const MachineSchedInfo&       getSchedInfo() const = 0;
   virtual const MachineRegInfo&                getRegInfo()   const = 0;
   virtual const MachineFrameInfo&       getFrameInfo() const = 0;
   virtual const MachineCacheInfo&       getCacheInfo() const = 0;
-  
+  virtual const MachineOptInfo&         getOptInfo()   const = 0;
+
   // Data storage information
   // 
   virtual unsigned int findOptimalStorageSize  (const Type* ty) const;
index 4ff60644cd506be2baa6017638ec2f17dc48f2fe..01315baa19e2f203d8a5cadec53ccd76daaa4ee4 100644 (file)
@@ -13,6 +13,7 @@
 #include "llvm/Target/MachineFrameInfo.h"
 #include "llvm/Target/MachineCacheInfo.h"
 #include "llvm/Target/MachineRegInfo.h"
+#include "llvm/Target/MachineOptInfo.h"
 #include "llvm/Type.h"
 #include <sys/types.h>
 
@@ -125,7 +126,12 @@ struct UltraSparcInstrInfo : public MachineInstrInfo {
   //-------------------------------------------------------------------------
   // Code generation support for creating individual machine instructions
   //-------------------------------------------------------------------------
-  
+
+  // Get certain common op codes for the current target.  This and all the
+  // Create* methods below should be moved to a machine code generation class
+  // 
+  virtual MachineOpCode getNOPOpCode() const { return NOP; }
+
   // Create an instruction sequence to put the constant `val' into
   // the virtual register `dest'.  `val' may be a Constant or a
   // GlobalValue, viz., the constant address of a global variable or function.
@@ -690,6 +696,21 @@ public:
 };
 
 
+//---------------------------------------------------------------------------
+// class UltraSparcOptInfo 
+// 
+// Purpose:
+//   Interface to machine-level optimization routines for the UltraSPARC.
+//---------------------------------------------------------------------------
+
+class UltraSparcOptInfo: public MachineOptInfo {
+public:
+  UltraSparcOptInfo(const TargetMachine &T) : MachineOptInfo(T) {} 
+
+  virtual bool IsUselessCopy    (const MachineInstr* MI) const;
+};
+
+
 //---------------------------------------------------------------------------
 // class UltraSparcMachine 
 // 
@@ -707,14 +728,16 @@ private:
   UltraSparcRegInfo   regInfo;
   UltraSparcFrameInfo frameInfo;
   UltraSparcCacheInfo cacheInfo;
+  UltraSparcOptInfo   optInfo;
 public:
   UltraSparc();
-  
+
   virtual const MachineInstrInfo &getInstrInfo() const { return instrInfo; }
   virtual const MachineSchedInfo &getSchedInfo() const { return schedInfo; }
   virtual const MachineRegInfo   &getRegInfo()   const { return regInfo; }
   virtual const MachineFrameInfo &getFrameInfo() const { return frameInfo; }
   virtual const MachineCacheInfo &getCacheInfo() const { return cacheInfo; }
+  virtual const MachineOptInfo   &getOptInfo()   const { return optInfo; }
 
   // getPrologEpilogCodeInserter - Inserts prolog/epilog code.
   virtual Pass* getPrologEpilogInsertionPass();
index 98c013100855fe21b0de0187efb62e853594f8c7..28b9734361c159ab7aaefdc83c7390dfd4e9fe34 100644 (file)
@@ -108,7 +108,8 @@ UltraSparc::UltraSparc()
     schedInfo(*this),
     regInfo(*this),
     frameInfo(*this),
-    cacheInfo(*this)
+    cacheInfo(*this),
+    optInfo(*this)
 {
   optSizeForSubWordData = 4;
   minMemOpWordSize = 8;