|
From: <sv...@va...> - 2012-09-13 19:33:33
|
florian 2012-09-13 20:33:24 +0100 (Thu, 13 Sep 2012)
New Revision: 2529
Log:
Tweak the IR injector so it can handle an immediate operand for
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.
Modified files:
trunk/priv/ir_inject.c
trunk/pub/libvex.h
Modified: trunk/priv/ir_inject.c (+10 -1)
===================================================================
--- trunk/priv/ir_inject.c 2012-09-13 16:58:01 +01:00 (rev 2528)
+++ trunk/priv/ir_inject.c 2012-09-13 20:33:24 +01:00 (rev 2529)
@@ -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 @@
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
Modified: trunk/pub/libvex.h (+1 -0)
===================================================================
--- trunk/pub/libvex.h 2012-09-13 16:58:01 +01:00 (rev 2528)
+++ trunk/pub/libvex.h 2012-09-13 20:33:24 +01:00 (rev 2529)
@@ -775,6 +775,7 @@
IRType t_opnd4; // type of 4th operand
UInt rounding_mode;
UInt num_operands; // excluding rounding mode, if any
+ Bool shift_amount_is_immediate;
}
IRICB;
|