]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Tweak the IR injector so it can handle an immediate operand for
authorFlorian Krohm <florian@eich-krohm.de>
Thu, 13 Sep 2012 19:33:24 +0000 (19:33 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Thu, 13 Sep 2012 19:33:24 +0000 (19:33 +0000)
shift operations. This is needed for Iop_ShlD64 and the like on
powerpc where the shift amount is an immediate field in the insn.
Part of fixing bugzilla #305948.

git-svn-id: svn://svn.valgrind.org/vex/trunk@2529

VEX/priv/ir_inject.c
VEX/pub/libvex.h

index 1914f4f0fc9a5c06a2c03ff51bcab10d0af69462..092c82ff87b886ffdbecd10bb0e6ecd43a50a5c7 100644 (file)
@@ -35,6 +35,7 @@
 #include "main_util.h"
 
 /* Convenience macros for readibility */
+#define mkU8(v)   IRExpr_Const(IRConst_U8(v))
 #define mkU32(v)  IRExpr_Const(IRConst_U32(v))
 #define mkU64(v)  IRExpr_Const(IRConst_U64(v))
 #define unop(kind, a)  IRExpr_Unop(kind, a)
@@ -208,7 +209,15 @@ vex_inject_ir(IRSB *irsb, IREndness endian)
 
    case 2:
       opnd1 = load(endian, iricb.t_opnd1, iricb.opnd1);
-      opnd2 = load(endian, iricb.t_opnd2, iricb.opnd2);
+
+      if (iricb.shift_amount_is_immediate) {
+         // This implies that the IROp is a shift op
+         vassert(iricb.t_opnd2 == Ity_I8);
+         opnd2 = mkU8(*((Char *)iricb.opnd2));
+      } else {
+         opnd2 = load(endian, iricb.t_opnd2, iricb.opnd2);
+      }
+
       if (rounding_mode)
          data = triop(iricb.op, rounding_mode, opnd1, opnd2);
       else
index 24a14b4c2bbf955cd6a91fb7313966d9d6dca997..3692770e29dc0fb5b06119ebd165d0622f5f6868 100644 (file)
@@ -775,6 +775,7 @@ typedef
       IRType t_opnd4;  // type of 4th operand
       UInt  rounding_mode;
       UInt  num_operands; // excluding rounding mode, if any
+      Bool  shift_amount_is_immediate;
    }
    IRICB;