ARM: Add a new RegImmOp base class.
authorGabe Black <gblack@eecs.umich.edu>
Wed, 2 Jun 2010 17:58:12 +0000 (12:58 -0500)
committerGabe Black <gblack@eecs.umich.edu>
Wed, 2 Jun 2010 17:58:12 +0000 (12:58 -0500)
src/arch/arm/insts/misc.cc
src/arch/arm/insts/misc.hh
src/arch/arm/isa/templates/misc.isa

index a5a4e3b3223a480fca3c6dc031701ef2acf0baad..0eae37de075d8ab4c1fb850e6e0a091b16f460ea 100644 (file)
@@ -152,6 +152,16 @@ ImmOp::generateDisassembly(Addr pc, const SymbolTable *symtab) const
     return ss.str();
 }
 
+std::string
+RegImmOp::generateDisassembly(Addr pc, const SymbolTable *symtab) const
+{
+    std::stringstream ss;
+    printMnemonic(ss);
+    printReg(ss, dest);
+    ccprintf(ss, ", #%d", imm);
+    return ss.str();
+}
+
 std::string
 RegRegOp::generateDisassembly(Addr pc, const SymbolTable *symtab) const
 {
index 53281400ed933f25d650221ae5e401d7ffdca8ac..6d78b311ac7bfea7df27a11c954413d41147f9f3 100644 (file)
@@ -107,6 +107,20 @@ class ImmOp : public PredOp
     std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const;
 };
 
+class RegImmOp : public PredOp
+{
+  protected:
+    IntRegIndex dest;
+    uint64_t imm;
+
+    RegImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
+             IntRegIndex _dest, uint64_t _imm) :
+        PredOp(mnem, _machInst, __opClass), dest(_dest), imm(_imm)
+    {}
+
+    std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const;
+};
+
 class RegRegOp : public PredOp
 {
   protected:
index 6f782ba5857ae40397870c3b654e3032821d8c33..87c6e430c227f7d72cd4594884d336590c66ea33 100644 (file)
@@ -118,6 +118,26 @@ def template ImmOpConstructor {{
     }
 }};
 
+def template RegImmOpDeclare {{
+class %(class_name)s : public %(base_class)s
+{
+  protected:
+    public:
+        // Constructor
+        %(class_name)s(ExtMachInst machInst, IntRegIndex _dest, uint64_t _imm);
+        %(BasicExecDeclare)s
+};
+}};
+
+def template RegImmOpConstructor {{
+    inline %(class_name)s::%(class_name)s(ExtMachInst machInst,
+            IntRegIndex _dest, uint64_t _imm)
+        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, _dest, _imm)
+    {
+        %(constructor)s;
+    }
+}};
+
 def template RegRegOpDeclare {{
 class %(class_name)s : public %(base_class)s
 {