Cleaned up instruction class implementation
authorBenjamin Segovia <segovia.benjamin@gmail.com>
Wed, 1 Feb 2012 11:22:37 +0000 (11:22 +0000)
committerKeith Packard <keithp@keithp.com>
Fri, 10 Aug 2012 23:15:11 +0000 (16:15 -0700)
backend/src/ir/ir_instruction.hpp
backend/src/ir/ir_instruction.hxx

index 07df92e..3ad9058 100644 (file)
@@ -111,11 +111,60 @@ namespace gbe
     uint32 getDstType(void) const;
   };
 
-  /*! Store instruction */
+  /*! Store instruction. First source is the address. Next sources are the
+   *  values to store contiguously at the given address
+   */
   class StoreInstruction : public Instruction
   {
   public:
+    /*! Return the types of the values to store */
+    uint32 getValueType(void) const;
+    /*! Give the number of values the instruction is storing (srcNum-1) */
+    uint32 getValueNum(void) const;
+    /*! Address space that is manipulated here */
+    uint32 getAddressSpace(void) const;
+  };
+
+  /*! Load instruction. The source is simply the address where to get the data.
+   *  The multiple destinations are the contiguous values loaded at the given
+   *  address
+   */
+  class LoadInstruction : public Instruction
+  {
+  public:
+    /*! Type of the loaded values (ie type of all the destinations) */
+    uint32 getValueType(void) const;
+    /*! Number of values loaded (ie number of destinations) */
+    uint32 getValueNum(void) const;
+    /*! Address space that is manipulated here */
+    uint32 getAddressSpace(void) const;
+  };
 
+  /*! Load immediate instruction loads an typed immediate value into the given
+   * register. Since double and uint64 values will not fit into an instruction,
+   * the immediate themselves are stored in the function core. Contrary to
+   * regular load instructions, there is only one destination possible
+   */
+  class LoadImmInstruction : public Instruction
+  {
+    /*! The value as stored in the instruction */
+    union Value
+    {
+      int8 s8;
+      uint8 u8;
+      int16 i16;
+      uint16 u16;
+      int32 i32;
+      uint32 u32;
+      int64 i64;
+      uint64 u64;
+      float f32;
+      double f64;
+    };
+    /*! Return the value stored in the instruction */
+    Value getValue(void) const;
+    /*! Return the type of the stored value */
+    uint32 getType(void) const;
   };
 
 } /* namespace gbe */
index aa3bd9b..7707302 100644 (file)
@@ -21,7 +21,6 @@ DECL_INSN(TAN, UnaryInstruction)
 DECL_INSN(LOG, UnaryInstruction)
 DECL_INSN(SQR, UnaryInstruction)
 DECL_INSN(RSQ, UnaryInstruction)
-DECL_INSN(EXP2, UnaryInstruction)
 DECL_INSN(POW, BinaryInstruction)
 DECL_INSN(MUL, BinaryInstruction)
 DECL_INSN(ADD, BinaryInstruction)