blob: 29f8b416f65e3ef8db6c74be2e58545db60c10ab [file] [log] [blame]
sewardjec6ad592004-06-20 12:26:53 +00001
2/*---------------------------------------------------------------*/
sewardj752f9062010-05-03 21:38:49 +00003/*--- begin ir_defs.c ---*/
sewardjec6ad592004-06-20 12:26:53 +00004/*---------------------------------------------------------------*/
5
sewardjf8ed9d82004-11-12 17:40:23 +00006/*
sewardj752f9062010-05-03 21:38:49 +00007 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
sewardjf8ed9d82004-11-12 17:40:23 +00009
sewardj25e54732012-08-05 15:36:51 +000010 Copyright (C) 2004-2012 OpenWorks LLP
sewardj752f9062010-05-03 21:38:49 +000011 info@open-works.net
sewardjf8ed9d82004-11-12 17:40:23 +000012
sewardj752f9062010-05-03 21:38:49 +000013 This program is free software; you can redistribute it and/or
14 modify it under the terms of the GNU General Public License as
15 published by the Free Software Foundation; either version 2 of the
16 License, or (at your option) any later version.
sewardjf8ed9d82004-11-12 17:40:23 +000017
sewardj752f9062010-05-03 21:38:49 +000018 This program is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
sewardj7bd6ffe2005-08-03 16:07:36 +000026 02110-1301, USA.
27
sewardj752f9062010-05-03 21:38:49 +000028 The GNU General Public License is contained in the file COPYING.
sewardjf8ed9d82004-11-12 17:40:23 +000029
30 Neither the names of the U.S. Department of Energy nor the
31 University of California nor the names of its contributors may be
32 used to endorse or promote products derived from this software
33 without prior written permission.
sewardjf8ed9d82004-11-12 17:40:23 +000034*/
35
sewardj887a11a2004-07-05 17:26:47 +000036#include "libvex_basictypes.h"
37#include "libvex_ir.h"
38#include "libvex.h"
sewardjec6ad592004-06-20 12:26:53 +000039
sewardjcef7d3e2009-07-02 12:21:59 +000040#include "main_util.h"
sewardjc0ee2ed2004-07-27 10:29:41 +000041
sewardjec6ad592004-06-20 12:26:53 +000042
43/*---------------------------------------------------------------*/
44/*--- Printing the IR ---*/
45/*---------------------------------------------------------------*/
46
sewardj35421a32004-07-05 13:12:34 +000047void ppIRType ( IRType ty )
sewardjec6ad592004-06-20 12:26:53 +000048{
sewardj3e838932005-01-07 12:09:15 +000049 switch (ty) {
50 case Ity_INVALID: vex_printf("Ity_INVALID"); break;
sewardj9b967672005-02-08 11:13:09 +000051 case Ity_I1: vex_printf( "I1"); break;
52 case Ity_I8: vex_printf( "I8"); break;
53 case Ity_I16: vex_printf( "I16"); break;
54 case Ity_I32: vex_printf( "I32"); break;
55 case Ity_I64: vex_printf( "I64"); break;
56 case Ity_I128: vex_printf( "I128"); break;
57 case Ity_F32: vex_printf( "F32"); break;
58 case Ity_F64: vex_printf( "F64"); break;
sewardj2019a972011-03-07 16:04:07 +000059 case Ity_F128: vex_printf( "F128"); break;
sewardjc6bbd472012-04-02 10:20:48 +000060 case Ity_D32: vex_printf( "D32"); break;
61 case Ity_D64: vex_printf( "D64"); break;
62 case Ity_D128: vex_printf( "D128"); break;
sewardjc4530ae2012-05-21 10:18:49 +000063 case Ity_V128: vex_printf( "V128"); break;
64 case Ity_V256: vex_printf( "V256"); break;
sewardj3e838932005-01-07 12:09:15 +000065 default: vex_printf("ty = 0x%x\n", (Int)ty);
66 vpanic("ppIRType");
67 }
sewardjec6ad592004-06-20 12:26:53 +000068}
69
sewardj35421a32004-07-05 13:12:34 +000070void ppIRConst ( IRConst* con )
sewardjec6ad592004-06-20 12:26:53 +000071{
sewardj2019a972011-03-07 16:04:07 +000072 union { ULong i64; Double f64; UInt i32; Float f32; } u;
sewardj63327402006-01-25 03:26:27 +000073 vassert(sizeof(ULong) == sizeof(Double));
sewardj2d3f77c2004-09-22 23:49:09 +000074 switch (con->tag) {
sewardjba999312004-11-15 15:21:17 +000075 case Ico_U1: vex_printf( "%d:I1", con->Ico.U1 ? 1 : 0); break;
sewardj2d3f77c2004-09-22 23:49:09 +000076 case Ico_U8: vex_printf( "0x%x:I8", (UInt)(con->Ico.U8)); break;
77 case Ico_U16: vex_printf( "0x%x:I16", (UInt)(con->Ico.U16)); break;
78 case Ico_U32: vex_printf( "0x%x:I32", (UInt)(con->Ico.U32)); break;
79 case Ico_U64: vex_printf( "0x%llx:I64", (ULong)(con->Ico.U64)); break;
sewardj2019a972011-03-07 16:04:07 +000080 case Ico_F32: u.f32 = con->Ico.F32;
81 vex_printf( "F32{0x%x}", u.i32);
82 break;
83 case Ico_F32i: vex_printf( "F32i{0x%x}", con->Ico.F32i); break;
sewardja162c2c2005-12-18 03:07:11 +000084 case Ico_F64: u.f64 = con->Ico.F64;
85 vex_printf( "F64{0x%llx}", u.i64);
sewardj695cff92004-10-13 14:50:14 +000086 break;
sewardj2d3f77c2004-09-22 23:49:09 +000087 case Ico_F64i: vex_printf( "F64i{0x%llx}", con->Ico.F64i); break;
sewardj1e6ad742004-12-02 16:16:11 +000088 case Ico_V128: vex_printf( "V128{0x%04x}", (UInt)(con->Ico.V128)); break;
sewardj37a505b2012-06-29 15:28:24 +000089 case Ico_V256: vex_printf( "V256{0x%08x}", con->Ico.V256); break;
sewardj2d3f77c2004-09-22 23:49:09 +000090 default: vpanic("ppIRConst");
91 }
92}
93
sewardj8ea867b2004-10-30 19:03:02 +000094void ppIRCallee ( IRCallee* ce )
95{
96 vex_printf("%s", ce->name);
sewardj77352542004-10-30 20:39:01 +000097 if (ce->regparms > 0)
sewardj43c56462004-11-06 12:17:57 +000098 vex_printf("[rp=%d]", ce->regparms);
99 if (ce->mcx_mask > 0)
100 vex_printf("[mcx=0x%x]", ce->mcx_mask);
sewardj8ea867b2004-10-30 19:03:02 +0000101 vex_printf("{%p}", (void*)ce->addr);
102}
103
sewardjdd40fdf2006-12-24 02:20:24 +0000104void ppIRRegArray ( IRRegArray* arr )
sewardj2d3f77c2004-09-22 23:49:09 +0000105{
sewardj0bfea7f2004-10-04 07:15:48 +0000106 vex_printf("(%d:%dx", arr->base, arr->nElems);
sewardj2d3f77c2004-09-22 23:49:09 +0000107 ppIRType(arr->elemTy);
sewardj0bfea7f2004-10-04 07:15:48 +0000108 vex_printf(")");
sewardje3d0d2e2004-06-27 10:42:44 +0000109}
110
sewardj35421a32004-07-05 13:12:34 +0000111void ppIRTemp ( IRTemp tmp )
sewardje3d0d2e2004-06-27 10:42:44 +0000112{
sewardj92d168d2004-11-15 14:22:12 +0000113 if (tmp == IRTemp_INVALID)
114 vex_printf("IRTemp_INVALID");
sewardjfbcaf332004-07-08 01:46:01 +0000115 else
sewardj41f43bc2004-07-08 14:23:22 +0000116 vex_printf( "t%d", (Int)tmp);
sewardje3d0d2e2004-06-27 10:42:44 +0000117}
118
sewardj35421a32004-07-05 13:12:34 +0000119void ppIROp ( IROp op )
sewardje3d0d2e2004-06-27 10:42:44 +0000120{
sewardjecbaee72008-11-01 23:54:45 +0000121 HChar* str = NULL;
sewardja98bf492005-02-07 01:39:17 +0000122 IROp base;
sewardj41f43bc2004-07-08 14:23:22 +0000123 switch (op) {
124 case Iop_Add8 ... Iop_Add64:
125 str = "Add"; base = Iop_Add8; break;
126 case Iop_Sub8 ... Iop_Sub64:
127 str = "Sub"; base = Iop_Sub8; break;
128 case Iop_Mul8 ... Iop_Mul64:
129 str = "Mul"; base = Iop_Mul8; break;
130 case Iop_Or8 ... Iop_Or64:
131 str = "Or"; base = Iop_Or8; break;
132 case Iop_And8 ... Iop_And64:
133 str = "And"; base = Iop_And8; break;
134 case Iop_Xor8 ... Iop_Xor64:
135 str = "Xor"; base = Iop_Xor8; break;
136 case Iop_Shl8 ... Iop_Shl64:
137 str = "Shl"; base = Iop_Shl8; break;
138 case Iop_Shr8 ... Iop_Shr64:
139 str = "Shr"; base = Iop_Shr8; break;
140 case Iop_Sar8 ... Iop_Sar64:
141 str = "Sar"; base = Iop_Sar8; break;
sewardje90ad6a2004-07-10 19:02:10 +0000142 case Iop_CmpEQ8 ... Iop_CmpEQ64:
143 str = "CmpEQ"; base = Iop_CmpEQ8; break;
144 case Iop_CmpNE8 ... Iop_CmpNE64:
145 str = "CmpNE"; base = Iop_CmpNE8; break;
sewardj1fb8c922009-07-12 12:56:53 +0000146 case Iop_CasCmpEQ8 ... Iop_CasCmpEQ64:
147 str = "CasCmpEQ"; base = Iop_CasCmpEQ8; break;
148 case Iop_CasCmpNE8 ... Iop_CasCmpNE64:
149 str = "CasCmpNE"; base = Iop_CasCmpNE8; break;
sewardj41f43bc2004-07-08 14:23:22 +0000150 case Iop_Not8 ... Iop_Not64:
151 str = "Not"; base = Iop_Not8; break;
152 /* other cases must explicitly "return;" */
sewardj9690d922004-07-14 01:39:17 +0000153 case Iop_8Uto16: vex_printf("8Uto16"); return;
154 case Iop_8Uto32: vex_printf("8Uto32"); return;
155 case Iop_16Uto32: vex_printf("16Uto32"); return;
156 case Iop_8Sto16: vex_printf("8Sto16"); return;
157 case Iop_8Sto32: vex_printf("8Sto32"); return;
158 case Iop_16Sto32: vex_printf("16Sto32"); return;
sewardjbb53f8c2004-08-14 11:50:01 +0000159 case Iop_32Sto64: vex_printf("32Sto64"); return;
sewardje5427e82004-09-11 19:43:51 +0000160 case Iop_32Uto64: vex_printf("32Uto64"); return;
sewardja2384712004-07-29 14:36:40 +0000161 case Iop_32to8: vex_printf("32to8"); return;
sewardj291a7e82005-04-27 11:42:44 +0000162 case Iop_16Uto64: vex_printf("16Uto64"); return;
163 case Iop_16Sto64: vex_printf("16Sto64"); return;
164 case Iop_8Uto64: vex_printf("8Uto64"); return;
165 case Iop_8Sto64: vex_printf("8Sto64"); return;
166 case Iop_64to16: vex_printf("64to16"); return;
167 case Iop_64to8: vex_printf("64to8"); return;
sewardj6e797c52004-10-13 15:20:17 +0000168
169 case Iop_Not1: vex_printf("Not1"); return;
sewardj9690d922004-07-14 01:39:17 +0000170 case Iop_32to1: vex_printf("32to1"); return;
sewardj291a7e82005-04-27 11:42:44 +0000171 case Iop_64to1: vex_printf("64to1"); return;
sewardj9690d922004-07-14 01:39:17 +0000172 case Iop_1Uto8: vex_printf("1Uto8"); return;
sewardj84ff0652004-08-23 16:16:08 +0000173 case Iop_1Uto32: vex_printf("1Uto32"); return;
sewardj291a7e82005-04-27 11:42:44 +0000174 case Iop_1Uto64: vex_printf("1Uto64"); return;
sewardjfd332772004-11-09 16:01:40 +0000175 case Iop_1Sto8: vex_printf("1Sto8"); return;
sewardj8eda6302004-11-05 01:55:46 +0000176 case Iop_1Sto16: vex_printf("1Sto16"); return;
sewardj415d9352004-11-04 15:20:15 +0000177 case Iop_1Sto32: vex_printf("1Sto32"); return;
sewardjb5874aa2004-11-04 16:57:50 +0000178 case Iop_1Sto64: vex_printf("1Sto64"); return;
sewardj9690d922004-07-14 01:39:17 +0000179
180 case Iop_MullS8: vex_printf("MullS8"); return;
181 case Iop_MullS16: vex_printf("MullS16"); return;
182 case Iop_MullS32: vex_printf("MullS32"); return;
sewardj9b967672005-02-08 11:13:09 +0000183 case Iop_MullS64: vex_printf("MullS64"); return;
sewardj9690d922004-07-14 01:39:17 +0000184 case Iop_MullU8: vex_printf("MullU8"); return;
185 case Iop_MullU16: vex_printf("MullU16"); return;
186 case Iop_MullU32: vex_printf("MullU32"); return;
sewardj9b967672005-02-08 11:13:09 +0000187 case Iop_MullU64: vex_printf("MullU64"); return;
sewardj9690d922004-07-14 01:39:17 +0000188
sewardjf53b7352005-04-06 20:01:56 +0000189 case Iop_Clz64: vex_printf("Clz64"); return;
sewardjce646f22004-08-31 23:55:54 +0000190 case Iop_Clz32: vex_printf("Clz32"); return;
sewardjf53b7352005-04-06 20:01:56 +0000191 case Iop_Ctz64: vex_printf("Ctz64"); return;
sewardjce646f22004-08-31 23:55:54 +0000192 case Iop_Ctz32: vex_printf("Ctz32"); return;
193
sewardj84ff0652004-08-23 16:16:08 +0000194 case Iop_CmpLT32S: vex_printf("CmpLT32S"); return;
195 case Iop_CmpLE32S: vex_printf("CmpLE32S"); return;
196 case Iop_CmpLT32U: vex_printf("CmpLT32U"); return;
197 case Iop_CmpLE32U: vex_printf("CmpLE32U"); return;
198
sewardj98540072005-04-26 01:52:01 +0000199 case Iop_CmpLT64S: vex_printf("CmpLT64S"); return;
200 case Iop_CmpLE64S: vex_printf("CmpLE64S"); return;
201 case Iop_CmpLT64U: vex_printf("CmpLT64U"); return;
202 case Iop_CmpLE64U: vex_printf("CmpLE64U"); return;
203
sewardj0033ddc2005-04-26 23:34:34 +0000204 case Iop_CmpNEZ8: vex_printf("CmpNEZ8"); return;
205 case Iop_CmpNEZ16: vex_printf("CmpNEZ16"); return;
206 case Iop_CmpNEZ32: vex_printf("CmpNEZ32"); return;
207 case Iop_CmpNEZ64: vex_printf("CmpNEZ64"); return;
208
sewardjeb17e492007-08-25 23:07:44 +0000209 case Iop_CmpwNEZ32: vex_printf("CmpwNEZ32"); return;
210 case Iop_CmpwNEZ64: vex_printf("CmpwNEZ64"); return;
211
212 case Iop_Left8: vex_printf("Left8"); return;
213 case Iop_Left16: vex_printf("Left16"); return;
214 case Iop_Left32: vex_printf("Left32"); return;
215 case Iop_Left64: vex_printf("Left64"); return;
sewardj478646f2008-05-01 20:13:04 +0000216 case Iop_Max32U: vex_printf("Max32U"); return;
sewardjeb17e492007-08-25 23:07:44 +0000217
sewardjb51f0f42005-07-18 11:38:02 +0000218 case Iop_CmpORD32U: vex_printf("CmpORD32U"); return;
219 case Iop_CmpORD32S: vex_printf("CmpORD32S"); return;
220
cerion2831b002005-11-30 19:55:22 +0000221 case Iop_CmpORD64U: vex_printf("CmpORD64U"); return;
222 case Iop_CmpORD64S: vex_printf("CmpORD64S"); return;
223
cerion5c8a0cb2005-02-03 13:59:46 +0000224 case Iop_DivU32: vex_printf("DivU32"); return;
225 case Iop_DivS32: vex_printf("DivS32"); return;
cerionf0de28c2005-12-13 20:21:11 +0000226 case Iop_DivU64: vex_printf("DivU64"); return;
227 case Iop_DivS64: vex_printf("DivS64"); return;
sewardje71e56a2011-09-05 12:11:06 +0000228 case Iop_DivU64E: vex_printf("DivU64E"); return;
sewardj4aa412a2011-07-24 14:13:21 +0000229 case Iop_DivS64E: vex_printf("DivS64E"); return;
230 case Iop_DivU32E: vex_printf("DivU32E"); return;
sewardje71e56a2011-09-05 12:11:06 +0000231 case Iop_DivS32E: vex_printf("DivS32E"); return;
cerion5c8a0cb2005-02-03 13:59:46 +0000232
sewardj9690d922004-07-14 01:39:17 +0000233 case Iop_DivModU64to32: vex_printf("DivModU64to32"); return;
234 case Iop_DivModS64to32: vex_printf("DivModS64to32"); return;
235
sewardj343b9d02005-01-31 18:08:45 +0000236 case Iop_DivModU128to64: vex_printf("DivModU128to64"); return;
237 case Iop_DivModS128to64: vex_printf("DivModS128to64"); return;
238
sewardj2019a972011-03-07 16:04:07 +0000239 case Iop_DivModS64to64: vex_printf("DivModS64to64"); return;
240
sewardjb81f8b32004-07-30 10:17:50 +0000241 case Iop_16HIto8: vex_printf("16HIto8"); return;
242 case Iop_16to8: vex_printf("16to8"); return;
243 case Iop_8HLto16: vex_printf("8HLto16"); return;
244
sewardj8c7f1ab2004-07-29 20:31:09 +0000245 case Iop_32HIto16: vex_printf("32HIto16"); return;
246 case Iop_32to16: vex_printf("32to16"); return;
247 case Iop_16HLto32: vex_printf("16HLto32"); return;
248
sewardj9690d922004-07-14 01:39:17 +0000249 case Iop_64HIto32: vex_printf("64HIto32"); return;
sewardj8c7f1ab2004-07-29 20:31:09 +0000250 case Iop_64to32: vex_printf("64to32"); return;
sewardj9690d922004-07-14 01:39:17 +0000251 case Iop_32HLto64: vex_printf("32HLto64"); return;
252
sewardj9b967672005-02-08 11:13:09 +0000253 case Iop_128HIto64: vex_printf("128HIto64"); return;
254 case Iop_128to64: vex_printf("128to64"); return;
255 case Iop_64HLto128: vex_printf("64HLto128"); return;
256
sewardj2019a972011-03-07 16:04:07 +0000257 case Iop_CmpF32: vex_printf("CmpF32"); return;
258 case Iop_F32toI16S: vex_printf("F32toI16S"); return;
259 case Iop_F32toI32S: vex_printf("F32toI32S"); return;
260 case Iop_F32toI64S: vex_printf("F32toI64S"); return;
261 case Iop_I16StoF32: vex_printf("I16StoF32"); return;
262 case Iop_I32StoF32: vex_printf("I32StoF32"); return;
263 case Iop_I64StoF32: vex_printf("I64StoF32"); return;
264
sewardjcfded9a2004-09-09 11:44:16 +0000265 case Iop_AddF64: vex_printf("AddF64"); return;
266 case Iop_SubF64: vex_printf("SubF64"); return;
267 case Iop_MulF64: vex_printf("MulF64"); return;
268 case Iop_DivF64: vex_printf("DivF64"); return;
sewardjb183b852006-02-03 16:08:03 +0000269 case Iop_AddF64r32: vex_printf("AddF64r32"); return;
270 case Iop_SubF64r32: vex_printf("SubF64r32"); return;
271 case Iop_MulF64r32: vex_printf("MulF64r32"); return;
272 case Iop_DivF64r32: vex_printf("DivF64r32"); return;
sewardj6c299f32009-12-31 18:00:12 +0000273 case Iop_AddF32: vex_printf("AddF32"); return;
274 case Iop_SubF32: vex_printf("SubF32"); return;
275 case Iop_MulF32: vex_printf("MulF32"); return;
276 case Iop_DivF32: vex_printf("DivF32"); return;
sewardj46de4072004-09-11 19:23:24 +0000277
sewardj2019a972011-03-07 16:04:07 +0000278 /* 128 bit floating point */
279 case Iop_AddF128: vex_printf("AddF128"); return;
280 case Iop_SubF128: vex_printf("SubF128"); return;
281 case Iop_MulF128: vex_printf("MulF128"); return;
282 case Iop_DivF128: vex_printf("DivF128"); return;
283 case Iop_AbsF128: vex_printf("AbsF128"); return;
284 case Iop_NegF128: vex_printf("NegF128"); return;
285 case Iop_SqrtF128: vex_printf("SqrtF128"); return;
286 case Iop_CmpF128: vex_printf("CmpF128"); return;
287
288 case Iop_F64HLtoF128: vex_printf("F64HLtoF128"); return;
289 case Iop_F128HItoF64: vex_printf("F128HItoF64"); return;
290 case Iop_F128LOtoF64: vex_printf("F128LOtoF64"); return;
291 case Iop_I32StoF128: vex_printf("I32StoF128"); return;
292 case Iop_I64StoF128: vex_printf("I64StoF128"); return;
293 case Iop_F128toI32S: vex_printf("F128toI32S"); return;
294 case Iop_F128toI64S: vex_printf("F128toI64S"); return;
295 case Iop_F32toF128: vex_printf("F32toF128"); return;
296 case Iop_F64toF128: vex_printf("F64toF128"); return;
297 case Iop_F128toF64: vex_printf("F128toF64"); return;
298 case Iop_F128toF32: vex_printf("F128toF32"); return;
299
300 /* s390 specific */
301 case Iop_MAddF32: vex_printf("s390_MAddF32"); return;
302 case Iop_MSubF32: vex_printf("s390_MSubF32"); return;
303
sewardj442d0be2004-10-15 22:57:13 +0000304 case Iop_ScaleF64: vex_printf("ScaleF64"); return;
305 case Iop_AtanF64: vex_printf("AtanF64"); return;
306 case Iop_Yl2xF64: vex_printf("Yl2xF64"); return;
307 case Iop_Yl2xp1F64: vex_printf("Yl2xp1F64"); return;
308 case Iop_PRemF64: vex_printf("PRemF64"); return;
309 case Iop_PRemC3210F64: vex_printf("PRemC3210F64"); return;
310 case Iop_PRem1F64: vex_printf("PRem1F64"); return;
311 case Iop_PRem1C3210F64: vex_printf("PRem1C3210F64"); return;
312 case Iop_NegF64: vex_printf("NegF64"); return;
sewardj6c299f32009-12-31 18:00:12 +0000313 case Iop_AbsF64: vex_printf("AbsF64"); return;
314 case Iop_NegF32: vex_printf("NegF32"); return;
315 case Iop_AbsF32: vex_printf("AbsF32"); return;
sewardj442d0be2004-10-15 22:57:13 +0000316 case Iop_SqrtF64: vex_printf("SqrtF64"); return;
sewardj6c299f32009-12-31 18:00:12 +0000317 case Iop_SqrtF32: vex_printf("SqrtF32"); return;
sewardjcfded9a2004-09-09 11:44:16 +0000318 case Iop_SinF64: vex_printf("SinF64"); return;
319 case Iop_CosF64: vex_printf("CosF64"); return;
sewardj99016a72004-10-15 22:09:17 +0000320 case Iop_TanF64: vex_printf("TanF64"); return;
sewardj06c32a02004-09-12 12:07:34 +0000321 case Iop_2xm1F64: vex_printf("2xm1F64"); return;
sewardjbdc7d212004-09-09 02:46:40 +0000322
sewardj40c80262006-02-08 19:30:46 +0000323 case Iop_MAddF64: vex_printf("MAddF64"); return;
324 case Iop_MSubF64: vex_printf("MSubF64"); return;
325 case Iop_MAddF64r32: vex_printf("MAddF64r32"); return;
326 case Iop_MSubF64r32: vex_printf("MSubF64r32"); return;
327
328 case Iop_Est5FRSqrt: vex_printf("Est5FRSqrt"); return;
sewardj0f1ef862008-08-08 08:37:06 +0000329 case Iop_RoundF64toF64_NEAREST: vex_printf("RoundF64toF64_NEAREST"); return;
330 case Iop_RoundF64toF64_NegINF: vex_printf("RoundF64toF64_NegINF"); return;
331 case Iop_RoundF64toF64_PosINF: vex_printf("RoundF64toF64_PosINF"); return;
332 case Iop_RoundF64toF64_ZERO: vex_printf("RoundF64toF64_ZERO"); return;
333
sewardjb183b852006-02-03 16:08:03 +0000334 case Iop_TruncF64asF32: vex_printf("TruncF64asF32"); return;
sewardja0e3d422007-08-28 06:06:57 +0000335 case Iop_CalcFPRF: vex_printf("CalcFPRF"); return;
sewardjbaf971a2006-01-27 15:09:35 +0000336
sewardj44ce46d2012-07-11 13:19:10 +0000337 case Iop_QAdd32S: vex_printf("QAdd32S"); return;
338 case Iop_QSub32S: vex_printf("QSub32S"); return;
sewardje2ea1762010-09-22 00:56:37 +0000339 case Iop_Add16x2: vex_printf("Add16x2"); return;
340 case Iop_Sub16x2: vex_printf("Sub16x2"); return;
341 case Iop_QAdd16Sx2: vex_printf("QAdd16Sx2"); return;
342 case Iop_QAdd16Ux2: vex_printf("QAdd16Ux2"); return;
343 case Iop_QSub16Sx2: vex_printf("QSub16Sx2"); return;
344 case Iop_QSub16Ux2: vex_printf("QSub16Ux2"); return;
345 case Iop_HAdd16Ux2: vex_printf("HAdd16Ux2"); return;
346 case Iop_HAdd16Sx2: vex_printf("HAdd16Sx2"); return;
347 case Iop_HSub16Ux2: vex_printf("HSub16Ux2"); return;
348 case Iop_HSub16Sx2: vex_printf("HSub16Sx2"); return;
349
350 case Iop_Add8x4: vex_printf("Add8x4"); return;
351 case Iop_Sub8x4: vex_printf("Sub8x4"); return;
352 case Iop_QAdd8Sx4: vex_printf("QAdd8Sx4"); return;
353 case Iop_QAdd8Ux4: vex_printf("QAdd8Ux4"); return;
354 case Iop_QSub8Sx4: vex_printf("QSub8Sx4"); return;
355 case Iop_QSub8Ux4: vex_printf("QSub8Ux4"); return;
356 case Iop_HAdd8Ux4: vex_printf("HAdd8Ux4"); return;
357 case Iop_HAdd8Sx4: vex_printf("HAdd8Sx4"); return;
358 case Iop_HSub8Ux4: vex_printf("HSub8Ux4"); return;
359 case Iop_HSub8Sx4: vex_printf("HSub8Sx4"); return;
sewardj310d6b22010-10-18 16:29:40 +0000360 case Iop_Sad8Ux4: vex_printf("Sad8Ux4"); return;
sewardje2ea1762010-09-22 00:56:37 +0000361
362 case Iop_CmpNEZ16x2: vex_printf("CmpNEZ16x2"); return;
363 case Iop_CmpNEZ8x4: vex_printf("CmpNEZ8x4"); return;
364
sewardj46de4072004-09-11 19:23:24 +0000365 case Iop_CmpF64: vex_printf("CmpF64"); return;
366
sewardj6c299f32009-12-31 18:00:12 +0000367 case Iop_F64toI16S: vex_printf("F64toI16S"); return;
368 case Iop_F64toI32S: vex_printf("F64toI32S"); return;
369 case Iop_F64toI64S: vex_printf("F64toI64S"); return;
sewardj4aa412a2011-07-24 14:13:21 +0000370 case Iop_F64toI64U: vex_printf("F64toI64U"); return;
sewardj3bca9062004-12-04 14:36:09 +0000371
sewardj6c299f32009-12-31 18:00:12 +0000372 case Iop_F64toI32U: vex_printf("F64toI32U"); return;
373
374 case Iop_I16StoF64: vex_printf("I16StoF64"); return;
375 case Iop_I32StoF64: vex_printf("I32StoF64"); return;
376 case Iop_I64StoF64: vex_printf("I64StoF64"); return;
sewardj66d5ef22011-04-15 11:55:00 +0000377 case Iop_I64UtoF64: vex_printf("I64UtoF64"); return;
378 case Iop_I64UtoF32: vex_printf("I64UtoF32"); return;
sewardj6c299f32009-12-31 18:00:12 +0000379
380 case Iop_I32UtoF64: vex_printf("I32UtoF64"); return;
sewardjcfded9a2004-09-09 11:44:16 +0000381
sewardj89cd0932004-09-08 18:23:25 +0000382 case Iop_F32toF64: vex_printf("F32toF64"); return;
383 case Iop_F64toF32: vex_printf("F64toF32"); return;
sewardjbb53f8c2004-08-14 11:50:01 +0000384
sewardjb183b852006-02-03 16:08:03 +0000385 case Iop_RoundF64toInt: vex_printf("RoundF64toInt"); return;
sewardjd15b5972010-06-27 09:06:34 +0000386 case Iop_RoundF32toInt: vex_printf("RoundF32toInt"); return;
sewardjb183b852006-02-03 16:08:03 +0000387 case Iop_RoundF64toF32: vex_printf("RoundF64toF32"); return;
sewardj3bca9062004-12-04 14:36:09 +0000388
sewardj17442fe2004-09-20 14:54:28 +0000389 case Iop_ReinterpF64asI64: vex_printf("ReinterpF64asI64"); return;
390 case Iop_ReinterpI64asF64: vex_printf("ReinterpI64asF64"); return;
sewardjfc1b5412007-01-09 15:20:07 +0000391 case Iop_ReinterpF32asI32: vex_printf("ReinterpF32asI32"); return;
sewardjfd226452004-12-07 19:02:18 +0000392 case Iop_ReinterpI32asF32: vex_printf("ReinterpI32asF32"); return;
sewardj17442fe2004-09-20 14:54:28 +0000393
sewardj228c7c82008-07-29 09:47:21 +0000394 case Iop_I32UtoFx4: vex_printf("I32UtoFx4"); return;
395 case Iop_I32StoFx4: vex_printf("I32StoFx4"); return;
cerionf294eb32005-11-16 17:21:10 +0000396
sewardj2fdd4162010-08-22 12:59:02 +0000397 case Iop_F32toF16x4: vex_printf("F32toF16x4"); return;
398 case Iop_F16toF32x4: vex_printf("F16toF32x4"); return;
399
400 case Iop_Rsqrte32Fx4: vex_printf("VRsqrte32Fx4"); return;
401 case Iop_Rsqrte32x4: vex_printf("VRsqrte32x4"); return;
402 case Iop_Rsqrte32Fx2: vex_printf("VRsqrte32Fx2"); return;
403 case Iop_Rsqrte32x2: vex_printf("VRsqrte32x2"); return;
404
sewardj228c7c82008-07-29 09:47:21 +0000405 case Iop_QFtoI32Ux4_RZ: vex_printf("QFtoI32Ux4_RZ"); return;
406 case Iop_QFtoI32Sx4_RZ: vex_printf("QFtoI32Sx4_RZ"); return;
cerionf294eb32005-11-16 17:21:10 +0000407
sewardj2fdd4162010-08-22 12:59:02 +0000408 case Iop_FtoI32Ux4_RZ: vex_printf("FtoI32Ux4_RZ"); return;
409 case Iop_FtoI32Sx4_RZ: vex_printf("FtoI32Sx4_RZ"); return;
410
411 case Iop_I32UtoFx2: vex_printf("I32UtoFx2"); return;
412 case Iop_I32StoFx2: vex_printf("I32StoFx2"); return;
413
414 case Iop_FtoI32Ux2_RZ: vex_printf("FtoI32Ux2_RZ"); return;
415 case Iop_FtoI32Sx2_RZ: vex_printf("FtoI32Sx2_RZ"); return;
416
sewardj228c7c82008-07-29 09:47:21 +0000417 case Iop_RoundF32x4_RM: vex_printf("RoundF32x4_RM"); return;
418 case Iop_RoundF32x4_RP: vex_printf("RoundF32x4_RP"); return;
419 case Iop_RoundF32x4_RN: vex_printf("RoundF32x4_RN"); return;
420 case Iop_RoundF32x4_RZ: vex_printf("RoundF32x4_RZ"); return;
cerionf294eb32005-11-16 17:21:10 +0000421
sewardj2fdd4162010-08-22 12:59:02 +0000422 case Iop_Abs8x8: vex_printf("Abs8x8"); return;
423 case Iop_Abs16x4: vex_printf("Abs16x4"); return;
424 case Iop_Abs32x2: vex_printf("Abs32x2"); return;
sewardj38a3f862005-01-13 15:06:51 +0000425 case Iop_Add8x8: vex_printf("Add8x8"); return;
426 case Iop_Add16x4: vex_printf("Add16x4"); return;
427 case Iop_Add32x2: vex_printf("Add32x2"); return;
428 case Iop_QAdd8Ux8: vex_printf("QAdd8Ux8"); return;
429 case Iop_QAdd16Ux4: vex_printf("QAdd16Ux4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000430 case Iop_QAdd32Ux2: vex_printf("QAdd32Ux2"); return;
431 case Iop_QAdd64Ux1: vex_printf("QAdd64Ux1"); return;
sewardj38a3f862005-01-13 15:06:51 +0000432 case Iop_QAdd8Sx8: vex_printf("QAdd8Sx8"); return;
433 case Iop_QAdd16Sx4: vex_printf("QAdd16Sx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000434 case Iop_QAdd32Sx2: vex_printf("QAdd32Sx2"); return;
435 case Iop_QAdd64Sx1: vex_printf("QAdd64Sx1"); return;
436 case Iop_PwAdd8x8: vex_printf("PwAdd8x8"); return;
437 case Iop_PwAdd16x4: vex_printf("PwAdd16x4"); return;
438 case Iop_PwAdd32x2: vex_printf("PwAdd32x2"); return;
439 case Iop_PwAdd32Fx2: vex_printf("PwAdd32Fx2"); return;
440 case Iop_PwAddL8Ux8: vex_printf("PwAddL8Ux8"); return;
441 case Iop_PwAddL16Ux4: vex_printf("PwAddL16Ux4"); return;
442 case Iop_PwAddL32Ux2: vex_printf("PwAddL32Ux2"); return;
443 case Iop_PwAddL8Sx8: vex_printf("PwAddL8Sx8"); return;
444 case Iop_PwAddL16Sx4: vex_printf("PwAddL16Sx4"); return;
445 case Iop_PwAddL32Sx2: vex_printf("PwAddL32Sx2"); return;
sewardj38a3f862005-01-13 15:06:51 +0000446 case Iop_Sub8x8: vex_printf("Sub8x8"); return;
447 case Iop_Sub16x4: vex_printf("Sub16x4"); return;
448 case Iop_Sub32x2: vex_printf("Sub32x2"); return;
449 case Iop_QSub8Ux8: vex_printf("QSub8Ux8"); return;
450 case Iop_QSub16Ux4: vex_printf("QSub16Ux4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000451 case Iop_QSub32Ux2: vex_printf("QSub32Ux2"); return;
452 case Iop_QSub64Ux1: vex_printf("QSub64Ux1"); return;
sewardj38a3f862005-01-13 15:06:51 +0000453 case Iop_QSub8Sx8: vex_printf("QSub8Sx8"); return;
454 case Iop_QSub16Sx4: vex_printf("QSub16Sx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000455 case Iop_QSub32Sx2: vex_printf("QSub32Sx2"); return;
456 case Iop_QSub64Sx1: vex_printf("QSub64Sx1"); return;
457 case Iop_Mul8x8: vex_printf("Mul8x8"); return;
sewardj38a3f862005-01-13 15:06:51 +0000458 case Iop_Mul16x4: vex_printf("Mul16x4"); return;
sewardjd166e282008-02-06 11:42:45 +0000459 case Iop_Mul32x2: vex_printf("Mul32x2"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000460 case Iop_Mul32Fx2: vex_printf("Mul32Fx2"); return;
461 case Iop_PolynomialMul8x8: vex_printf("PolynomialMul8x8"); return;
sewardj38a3f862005-01-13 15:06:51 +0000462 case Iop_MulHi16Ux4: vex_printf("MulHi16Ux4"); return;
463 case Iop_MulHi16Sx4: vex_printf("MulHi16Sx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000464 case Iop_QDMulHi16Sx4: vex_printf("QDMulHi16Sx4"); return;
465 case Iop_QDMulHi32Sx2: vex_printf("QDMulHi32Sx2"); return;
466 case Iop_QRDMulHi16Sx4: vex_printf("QRDMulHi16Sx4"); return;
467 case Iop_QRDMulHi32Sx2: vex_printf("QRDMulHi32Sx2"); return;
468 case Iop_QDMulLong16Sx4: vex_printf("QDMulLong16Sx4"); return;
469 case Iop_QDMulLong32Sx2: vex_printf("QDMulLong32Sx2"); return;
sewardj38a3f862005-01-13 15:06:51 +0000470 case Iop_Avg8Ux8: vex_printf("Avg8Ux8"); return;
471 case Iop_Avg16Ux4: vex_printf("Avg16Ux4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000472 case Iop_Max8Sx8: vex_printf("Max8Sx8"); return;
sewardj38a3f862005-01-13 15:06:51 +0000473 case Iop_Max16Sx4: vex_printf("Max16Sx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000474 case Iop_Max32Sx2: vex_printf("Max32Sx2"); return;
sewardj38a3f862005-01-13 15:06:51 +0000475 case Iop_Max8Ux8: vex_printf("Max8Ux8"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000476 case Iop_Max16Ux4: vex_printf("Max16Ux4"); return;
477 case Iop_Max32Ux2: vex_printf("Max32Ux2"); return;
478 case Iop_Min8Sx8: vex_printf("Min8Sx8"); return;
sewardj38a3f862005-01-13 15:06:51 +0000479 case Iop_Min16Sx4: vex_printf("Min16Sx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000480 case Iop_Min32Sx2: vex_printf("Min32Sx2"); return;
sewardj38a3f862005-01-13 15:06:51 +0000481 case Iop_Min8Ux8: vex_printf("Min8Ux8"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000482 case Iop_Min16Ux4: vex_printf("Min16Ux4"); return;
483 case Iop_Min32Ux2: vex_printf("Min32Ux2"); return;
484 case Iop_PwMax8Sx8: vex_printf("PwMax8Sx8"); return;
485 case Iop_PwMax16Sx4: vex_printf("PwMax16Sx4"); return;
486 case Iop_PwMax32Sx2: vex_printf("PwMax32Sx2"); return;
487 case Iop_PwMax8Ux8: vex_printf("PwMax8Ux8"); return;
488 case Iop_PwMax16Ux4: vex_printf("PwMax16Ux4"); return;
489 case Iop_PwMax32Ux2: vex_printf("PwMax32Ux2"); return;
490 case Iop_PwMin8Sx8: vex_printf("PwMin8Sx8"); return;
491 case Iop_PwMin16Sx4: vex_printf("PwMin16Sx4"); return;
492 case Iop_PwMin32Sx2: vex_printf("PwMin32Sx2"); return;
493 case Iop_PwMin8Ux8: vex_printf("PwMin8Ux8"); return;
494 case Iop_PwMin16Ux4: vex_printf("PwMin16Ux4"); return;
495 case Iop_PwMin32Ux2: vex_printf("PwMin32Ux2"); return;
sewardj38a3f862005-01-13 15:06:51 +0000496 case Iop_CmpEQ8x8: vex_printf("CmpEQ8x8"); return;
497 case Iop_CmpEQ16x4: vex_printf("CmpEQ16x4"); return;
498 case Iop_CmpEQ32x2: vex_printf("CmpEQ32x2"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000499 case Iop_CmpGT8Ux8: vex_printf("CmpGT8Ux8"); return;
500 case Iop_CmpGT16Ux4: vex_printf("CmpGT16Ux4"); return;
501 case Iop_CmpGT32Ux2: vex_printf("CmpGT32Ux2"); return;
sewardj38a3f862005-01-13 15:06:51 +0000502 case Iop_CmpGT8Sx8: vex_printf("CmpGT8Sx8"); return;
503 case Iop_CmpGT16Sx4: vex_printf("CmpGT16Sx4"); return;
504 case Iop_CmpGT32Sx2: vex_printf("CmpGT32Sx2"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000505 case Iop_Cnt8x8: vex_printf("Cnt8x8"); return;
506 case Iop_Clz8Sx8: vex_printf("Clz8Sx8"); return;
507 case Iop_Clz16Sx4: vex_printf("Clz16Sx4"); return;
508 case Iop_Clz32Sx2: vex_printf("Clz32Sx2"); return;
509 case Iop_Cls8Sx8: vex_printf("Cls8Sx8"); return;
510 case Iop_Cls16Sx4: vex_printf("Cls16Sx4"); return;
511 case Iop_Cls32Sx2: vex_printf("Cls32Sx2"); return;
sewardjd166e282008-02-06 11:42:45 +0000512 case Iop_ShlN8x8: vex_printf("ShlN8x8"); return;
sewardj38a3f862005-01-13 15:06:51 +0000513 case Iop_ShlN16x4: vex_printf("ShlN16x4"); return;
514 case Iop_ShlN32x2: vex_printf("ShlN32x2"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000515 case Iop_ShrN8x8: vex_printf("ShrN8x8"); return;
sewardj38a3f862005-01-13 15:06:51 +0000516 case Iop_ShrN16x4: vex_printf("ShrN16x4"); return;
517 case Iop_ShrN32x2: vex_printf("ShrN32x2"); return;
sewardjd71ba832006-12-27 01:15:29 +0000518 case Iop_SarN8x8: vex_printf("SarN8x8"); return;
sewardj38a3f862005-01-13 15:06:51 +0000519 case Iop_SarN16x4: vex_printf("SarN16x4"); return;
520 case Iop_SarN32x2: vex_printf("SarN32x2"); return;
sewardj5f438dd2011-06-16 11:36:23 +0000521 case Iop_QNarrowBin16Sto8Ux8: vex_printf("QNarrowBin16Sto8Ux8"); return;
522 case Iop_QNarrowBin16Sto8Sx8: vex_printf("QNarrowBin16Sto8Sx8"); return;
523 case Iop_QNarrowBin32Sto16Sx4: vex_printf("QNarrowBin32Sto16Sx4"); return;
sewardjad2c9ea2011-10-22 09:32:16 +0000524 case Iop_NarrowBin16to8x8: vex_printf("NarrowBin16to8x8"); return;
525 case Iop_NarrowBin32to16x4: vex_printf("NarrowBin32to16x4"); return;
sewardj38a3f862005-01-13 15:06:51 +0000526 case Iop_InterleaveHI8x8: vex_printf("InterleaveHI8x8"); return;
527 case Iop_InterleaveHI16x4: vex_printf("InterleaveHI16x4"); return;
528 case Iop_InterleaveHI32x2: vex_printf("InterleaveHI32x2"); return;
529 case Iop_InterleaveLO8x8: vex_printf("InterleaveLO8x8"); return;
530 case Iop_InterleaveLO16x4: vex_printf("InterleaveLO16x4"); return;
531 case Iop_InterleaveLO32x2: vex_printf("InterleaveLO32x2"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000532 case Iop_CatOddLanes8x8: vex_printf("CatOddLanes8x8"); return;
sewardjd166e282008-02-06 11:42:45 +0000533 case Iop_CatOddLanes16x4: vex_printf("CatOddLanes16x4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000534 case Iop_CatEvenLanes8x8: vex_printf("CatEvenLanes8x8"); return;
sewardjd166e282008-02-06 11:42:45 +0000535 case Iop_CatEvenLanes16x4: vex_printf("CatEvenLanes16x4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000536 case Iop_InterleaveOddLanes8x8: vex_printf("InterleaveOddLanes8x8"); return;
537 case Iop_InterleaveOddLanes16x4: vex_printf("InterleaveOddLanes16x4"); return;
538 case Iop_InterleaveEvenLanes8x8: vex_printf("InterleaveEvenLanes8x8"); return;
539 case Iop_InterleaveEvenLanes16x4: vex_printf("InterleaveEvenLanes16x4"); return;
540 case Iop_Shl8x8: vex_printf("Shl8x8"); return;
541 case Iop_Shl16x4: vex_printf("Shl16x4"); return;
542 case Iop_Shl32x2: vex_printf("Shl32x2"); return;
543 case Iop_Shr8x8: vex_printf("Shr8x8"); return;
544 case Iop_Shr16x4: vex_printf("Shr16x4"); return;
545 case Iop_Shr32x2: vex_printf("Shr32x2"); return;
546 case Iop_QShl8x8: vex_printf("QShl8x8"); return;
547 case Iop_QShl16x4: vex_printf("QShl16x4"); return;
548 case Iop_QShl32x2: vex_printf("QShl32x2"); return;
549 case Iop_QShl64x1: vex_printf("QShl64x1"); return;
550 case Iop_QSal8x8: vex_printf("QSal8x8"); return;
551 case Iop_QSal16x4: vex_printf("QSal16x4"); return;
552 case Iop_QSal32x2: vex_printf("QSal32x2"); return;
553 case Iop_QSal64x1: vex_printf("QSal64x1"); return;
554 case Iop_QShlN8x8: vex_printf("QShlN8x8"); return;
555 case Iop_QShlN16x4: vex_printf("QShlN16x4"); return;
556 case Iop_QShlN32x2: vex_printf("QShlN32x2"); return;
557 case Iop_QShlN64x1: vex_printf("QShlN64x1"); return;
558 case Iop_QShlN8Sx8: vex_printf("QShlN8Sx8"); return;
559 case Iop_QShlN16Sx4: vex_printf("QShlN16Sx4"); return;
560 case Iop_QShlN32Sx2: vex_printf("QShlN32Sx2"); return;
561 case Iop_QShlN64Sx1: vex_printf("QShlN64Sx1"); return;
562 case Iop_QSalN8x8: vex_printf("QSalN8x8"); return;
563 case Iop_QSalN16x4: vex_printf("QSalN16x4"); return;
564 case Iop_QSalN32x2: vex_printf("QSalN32x2"); return;
565 case Iop_QSalN64x1: vex_printf("QSalN64x1"); return;
566 case Iop_Sar8x8: vex_printf("Sar8x8"); return;
567 case Iop_Sar16x4: vex_printf("Sar16x4"); return;
568 case Iop_Sar32x2: vex_printf("Sar32x2"); return;
569 case Iop_Sal8x8: vex_printf("Sal8x8"); return;
570 case Iop_Sal16x4: vex_printf("Sal16x4"); return;
571 case Iop_Sal32x2: vex_printf("Sal32x2"); return;
572 case Iop_Sal64x1: vex_printf("Sal64x1"); return;
sewardj228c7c82008-07-29 09:47:21 +0000573 case Iop_Perm8x8: vex_printf("Perm8x8"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000574 case Iop_Reverse16_8x8: vex_printf("Reverse16_8x8"); return;
575 case Iop_Reverse32_8x8: vex_printf("Reverse32_8x8"); return;
576 case Iop_Reverse32_16x4: vex_printf("Reverse32_16x4"); return;
577 case Iop_Reverse64_8x8: vex_printf("Reverse64_8x8"); return;
578 case Iop_Reverse64_16x4: vex_printf("Reverse64_16x4"); return;
579 case Iop_Reverse64_32x2: vex_printf("Reverse64_32x2"); return;
580 case Iop_Abs32Fx2: vex_printf("Abs32Fx2"); return;
sewardj38a3f862005-01-13 15:06:51 +0000581
sewardj18069182005-01-13 19:16:04 +0000582 case Iop_CmpNEZ32x2: vex_printf("CmpNEZ32x2"); return;
583 case Iop_CmpNEZ16x4: vex_printf("CmpNEZ16x4"); return;
584 case Iop_CmpNEZ8x8: vex_printf("CmpNEZ8x8"); return;
585
sewardj1e6ad742004-12-02 16:16:11 +0000586 case Iop_Add32Fx4: vex_printf("Add32Fx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000587 case Iop_Add32Fx2: vex_printf("Add32Fx2"); return;
sewardj1e6ad742004-12-02 16:16:11 +0000588 case Iop_Add32F0x4: vex_printf("Add32F0x4"); return;
sewardj636ad762004-12-07 11:16:04 +0000589 case Iop_Add64Fx2: vex_printf("Add64Fx2"); return;
590 case Iop_Add64F0x2: vex_printf("Add64F0x2"); return;
sewardj1e6ad742004-12-02 16:16:11 +0000591
sewardj176a59c2004-12-03 20:08:31 +0000592 case Iop_Div32Fx4: vex_printf("Div32Fx4"); return;
593 case Iop_Div32F0x4: vex_printf("Div32F0x4"); return;
sewardj636ad762004-12-07 11:16:04 +0000594 case Iop_Div64Fx2: vex_printf("Div64Fx2"); return;
595 case Iop_Div64F0x2: vex_printf("Div64F0x2"); return;
sewardj176a59c2004-12-03 20:08:31 +0000596
sewardj8eb7ae82012-06-24 14:00:27 +0000597 case Iop_Max32Fx8: vex_printf("Max32Fx8"); return;
sewardj176a59c2004-12-03 20:08:31 +0000598 case Iop_Max32Fx4: vex_printf("Max32Fx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000599 case Iop_Max32Fx2: vex_printf("Max32Fx2"); return;
600 case Iop_PwMax32Fx4: vex_printf("PwMax32Fx4"); return;
601 case Iop_PwMax32Fx2: vex_printf("PwMax32Fx2"); return;
sewardj176a59c2004-12-03 20:08:31 +0000602 case Iop_Max32F0x4: vex_printf("Max32F0x4"); return;
sewardj8eb7ae82012-06-24 14:00:27 +0000603 case Iop_Max64Fx4: vex_printf("Max64Fx4"); return;
sewardj636ad762004-12-07 11:16:04 +0000604 case Iop_Max64Fx2: vex_printf("Max64Fx2"); return;
605 case Iop_Max64F0x2: vex_printf("Max64F0x2"); return;
sewardj176a59c2004-12-03 20:08:31 +0000606
sewardj8eb7ae82012-06-24 14:00:27 +0000607 case Iop_Min32Fx8: vex_printf("Min32Fx8"); return;
sewardj176a59c2004-12-03 20:08:31 +0000608 case Iop_Min32Fx4: vex_printf("Min32Fx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000609 case Iop_Min32Fx2: vex_printf("Min32Fx2"); return;
610 case Iop_PwMin32Fx4: vex_printf("PwMin32Fx4"); return;
611 case Iop_PwMin32Fx2: vex_printf("PwMin32Fx2"); return;
sewardj176a59c2004-12-03 20:08:31 +0000612 case Iop_Min32F0x4: vex_printf("Min32F0x4"); return;
sewardj8eb7ae82012-06-24 14:00:27 +0000613 case Iop_Min64Fx4: vex_printf("Min64Fx4"); return;
sewardj636ad762004-12-07 11:16:04 +0000614 case Iop_Min64Fx2: vex_printf("Min64Fx2"); return;
615 case Iop_Min64F0x2: vex_printf("Min64F0x2"); return;
sewardj176a59c2004-12-03 20:08:31 +0000616
sewardj9636b442004-12-04 01:38:37 +0000617 case Iop_Mul32Fx4: vex_printf("Mul32Fx4"); return;
618 case Iop_Mul32F0x4: vex_printf("Mul32F0x4"); return;
sewardj636ad762004-12-07 11:16:04 +0000619 case Iop_Mul64Fx2: vex_printf("Mul64Fx2"); return;
620 case Iop_Mul64F0x2: vex_printf("Mul64F0x2"); return;
sewardj9636b442004-12-04 01:38:37 +0000621
sewardj2fdd4162010-08-22 12:59:02 +0000622 case Iop_Recip32x2: vex_printf("Recip32x2"); return;
623 case Iop_Recip32Fx2: vex_printf("Recip32Fx2"); return;
sewardj0bd7ce62004-12-05 02:47:40 +0000624 case Iop_Recip32Fx4: vex_printf("Recip32Fx4"); return;
sewardj82096922012-06-24 14:57:59 +0000625 case Iop_Recip32Fx8: vex_printf("Recip32Fx8"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000626 case Iop_Recip32x4: vex_printf("Recip32x4"); return;
sewardj0bd7ce62004-12-05 02:47:40 +0000627 case Iop_Recip32F0x4: vex_printf("Recip32F0x4"); return;
sewardj636ad762004-12-07 11:16:04 +0000628 case Iop_Recip64Fx2: vex_printf("Recip64Fx2"); return;
629 case Iop_Recip64F0x2: vex_printf("Recip64F0x2"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000630 case Iop_Recps32Fx2: vex_printf("VRecps32Fx2"); return;
631 case Iop_Recps32Fx4: vex_printf("VRecps32Fx4"); return;
632 case Iop_Abs32Fx4: vex_printf("Abs32Fx4"); return;
633 case Iop_Rsqrts32Fx4: vex_printf("VRsqrts32Fx4"); return;
634 case Iop_Rsqrts32Fx2: vex_printf("VRsqrts32Fx2"); return;
sewardj0bd7ce62004-12-05 02:47:40 +0000635
sewardjc1e7dfc2004-12-05 19:29:45 +0000636 case Iop_RSqrt32Fx4: vex_printf("RSqrt32Fx4"); return;
637 case Iop_RSqrt32F0x4: vex_printf("RSqrt32F0x4"); return;
sewardj66becf32012-06-18 23:15:16 +0000638 case Iop_RSqrt32Fx8: vex_printf("RSqrt32Fx8"); return;
sewardj636ad762004-12-07 11:16:04 +0000639 case Iop_RSqrt64Fx2: vex_printf("RSqrt64Fx2"); return;
640 case Iop_RSqrt64F0x2: vex_printf("RSqrt64F0x2"); return;
sewardjc1e7dfc2004-12-05 19:29:45 +0000641
sewardj636ad762004-12-07 11:16:04 +0000642 case Iop_Sqrt32Fx4: vex_printf("Sqrt32Fx4"); return;
643 case Iop_Sqrt32F0x4: vex_printf("Sqrt32F0x4"); return;
644 case Iop_Sqrt64Fx2: vex_printf("Sqrt64Fx2"); return;
645 case Iop_Sqrt64F0x2: vex_printf("Sqrt64F0x2"); return;
sewardj66becf32012-06-18 23:15:16 +0000646 case Iop_Sqrt32Fx8: vex_printf("Sqrt32Fx8"); return;
647 case Iop_Sqrt64Fx4: vex_printf("Sqrt64Fx4"); return;
648
sewardjc1e7dfc2004-12-05 19:29:45 +0000649 case Iop_Sub32Fx4: vex_printf("Sub32Fx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000650 case Iop_Sub32Fx2: vex_printf("Sub32Fx2"); return;
sewardjc1e7dfc2004-12-05 19:29:45 +0000651 case Iop_Sub32F0x4: vex_printf("Sub32F0x4"); return;
sewardj636ad762004-12-07 11:16:04 +0000652 case Iop_Sub64Fx2: vex_printf("Sub64Fx2"); return;
653 case Iop_Sub64F0x2: vex_printf("Sub64F0x2"); return;
sewardjc1e7dfc2004-12-05 19:29:45 +0000654
sewardj1e6ad742004-12-02 16:16:11 +0000655 case Iop_CmpEQ32Fx4: vex_printf("CmpEQ32Fx4"); return;
656 case Iop_CmpLT32Fx4: vex_printf("CmpLT32Fx4"); return;
657 case Iop_CmpLE32Fx4: vex_printf("CmpLE32Fx4"); return;
cerion206c3642005-11-14 00:35:59 +0000658 case Iop_CmpGT32Fx4: vex_printf("CmpGT32Fx4"); return;
659 case Iop_CmpGE32Fx4: vex_printf("CmpGE32Fx4"); return;
sewardj1e6ad742004-12-02 16:16:11 +0000660 case Iop_CmpUN32Fx4: vex_printf("CmpUN32Fx4"); return;
sewardj636ad762004-12-07 11:16:04 +0000661 case Iop_CmpEQ64Fx2: vex_printf("CmpEQ64Fx2"); return;
662 case Iop_CmpLT64Fx2: vex_printf("CmpLT64Fx2"); return;
663 case Iop_CmpLE64Fx2: vex_printf("CmpLE64Fx2"); return;
664 case Iop_CmpUN64Fx2: vex_printf("CmpUN64Fx2"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000665 case Iop_CmpGT32Fx2: vex_printf("CmpGT32Fx2"); return;
666 case Iop_CmpEQ32Fx2: vex_printf("CmpEQ32Fx2"); return;
667 case Iop_CmpGE32Fx2: vex_printf("CmpGE32Fx2"); return;
sewardj1e6ad742004-12-02 16:16:11 +0000668
669 case Iop_CmpEQ32F0x4: vex_printf("CmpEQ32F0x4"); return;
670 case Iop_CmpLT32F0x4: vex_printf("CmpLT32F0x4"); return;
671 case Iop_CmpLE32F0x4: vex_printf("CmpLE32F0x4"); return;
672 case Iop_CmpUN32F0x4: vex_printf("CmpUN32F0x4"); return;
sewardj636ad762004-12-07 11:16:04 +0000673 case Iop_CmpEQ64F0x2: vex_printf("CmpEQ64F0x2"); return;
674 case Iop_CmpLT64F0x2: vex_printf("CmpLT64F0x2"); return;
675 case Iop_CmpLE64F0x2: vex_printf("CmpLE64F0x2"); return;
676 case Iop_CmpUN64F0x2: vex_printf("CmpUN64F0x2"); return;
sewardjc9a43662004-11-30 18:51:59 +0000677
sewardj2fdd4162010-08-22 12:59:02 +0000678 case Iop_Neg32Fx4: vex_printf("Neg32Fx4"); return;
679 case Iop_Neg32Fx2: vex_printf("Neg32Fx2"); return;
680
sewardjf0c1c582005-02-07 23:47:38 +0000681 case Iop_V128to64: vex_printf("V128to64"); return;
682 case Iop_V128HIto64: vex_printf("V128HIto64"); return;
683 case Iop_64HLtoV128: vex_printf("64HLtoV128"); return;
sewardja0037df2004-12-10 18:56:29 +0000684
sewardjf0c1c582005-02-07 23:47:38 +0000685 case Iop_64UtoV128: vex_printf("64UtoV128"); return;
686 case Iop_SetV128lo64: vex_printf("SetV128lo64"); return;
sewardjc9a43662004-11-30 18:51:59 +0000687
sewardjf0c1c582005-02-07 23:47:38 +0000688 case Iop_32UtoV128: vex_printf("32UtoV128"); return;
689 case Iop_V128to32: vex_printf("V128to32"); return;
690 case Iop_SetV128lo32: vex_printf("SetV128lo32"); return;
sewardj129b3d92004-12-05 15:42:05 +0000691
cerionf887b3e2005-09-13 16:34:28 +0000692 case Iop_Dup8x16: vex_printf("Dup8x16"); return;
693 case Iop_Dup16x8: vex_printf("Dup16x8"); return;
694 case Iop_Dup32x4: vex_printf("Dup32x4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000695 case Iop_Dup8x8: vex_printf("Dup8x8"); return;
696 case Iop_Dup16x4: vex_printf("Dup16x4"); return;
697 case Iop_Dup32x2: vex_printf("Dup32x2"); return;
cerionf887b3e2005-09-13 16:34:28 +0000698
sewardjf0c1c582005-02-07 23:47:38 +0000699 case Iop_NotV128: vex_printf("NotV128"); return;
700 case Iop_AndV128: vex_printf("AndV128"); return;
701 case Iop_OrV128: vex_printf("OrV128"); return;
702 case Iop_XorV128: vex_printf("XorV128"); return;
sewardj18069182005-01-13 19:16:04 +0000703
sewardj2e383862004-12-12 16:46:47 +0000704 case Iop_CmpNEZ8x16: vex_printf("CmpNEZ8x16"); return;
705 case Iop_CmpNEZ16x8: vex_printf("CmpNEZ16x8"); return;
sewardj70f676d2004-12-10 14:59:57 +0000706 case Iop_CmpNEZ32x4: vex_printf("CmpNEZ32x4"); return;
sewardj109ffdb2004-12-10 21:45:38 +0000707 case Iop_CmpNEZ64x2: vex_printf("CmpNEZ64x2"); return;
sewardj164f9272004-12-09 00:39:32 +0000708
sewardj2fdd4162010-08-22 12:59:02 +0000709 case Iop_Abs8x16: vex_printf("Abs8x16"); return;
710 case Iop_Abs16x8: vex_printf("Abs16x8"); return;
711 case Iop_Abs32x4: vex_printf("Abs32x4"); return;
712
sewardj164f9272004-12-09 00:39:32 +0000713 case Iop_Add8x16: vex_printf("Add8x16"); return;
714 case Iop_Add16x8: vex_printf("Add16x8"); return;
715 case Iop_Add32x4: vex_printf("Add32x4"); return;
716 case Iop_Add64x2: vex_printf("Add64x2"); return;
717 case Iop_QAdd8Ux16: vex_printf("QAdd8Ux16"); return;
718 case Iop_QAdd16Ux8: vex_printf("QAdd16Ux8"); return;
cerionf887b3e2005-09-13 16:34:28 +0000719 case Iop_QAdd32Ux4: vex_printf("QAdd32Ux4"); return;
sewardj164f9272004-12-09 00:39:32 +0000720 case Iop_QAdd8Sx16: vex_printf("QAdd8Sx16"); return;
721 case Iop_QAdd16Sx8: vex_printf("QAdd16Sx8"); return;
cerionf887b3e2005-09-13 16:34:28 +0000722 case Iop_QAdd32Sx4: vex_printf("QAdd32Sx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000723 case Iop_QAdd64Ux2: vex_printf("QAdd64Ux2"); return;
724 case Iop_QAdd64Sx2: vex_printf("QAdd64Sx2"); return;
725 case Iop_PwAdd8x16: vex_printf("PwAdd8x16"); return;
726 case Iop_PwAdd16x8: vex_printf("PwAdd16x8"); return;
727 case Iop_PwAdd32x4: vex_printf("PwAdd32x4"); return;
728 case Iop_PwAddL8Ux16: vex_printf("PwAddL8Ux16"); return;
729 case Iop_PwAddL16Ux8: vex_printf("PwAddL16Ux8"); return;
730 case Iop_PwAddL32Ux4: vex_printf("PwAddL32Ux4"); return;
731 case Iop_PwAddL8Sx16: vex_printf("PwAddL8Sx16"); return;
732 case Iop_PwAddL16Sx8: vex_printf("PwAddL16Sx8"); return;
733 case Iop_PwAddL32Sx4: vex_printf("PwAddL32Sx4"); return;
sewardj164f9272004-12-09 00:39:32 +0000734
735 case Iop_Sub8x16: vex_printf("Sub8x16"); return;
736 case Iop_Sub16x8: vex_printf("Sub16x8"); return;
737 case Iop_Sub32x4: vex_printf("Sub32x4"); return;
738 case Iop_Sub64x2: vex_printf("Sub64x2"); return;
739 case Iop_QSub8Ux16: vex_printf("QSub8Ux16"); return;
740 case Iop_QSub16Ux8: vex_printf("QSub16Ux8"); return;
cerionf887b3e2005-09-13 16:34:28 +0000741 case Iop_QSub32Ux4: vex_printf("QSub32Ux4"); return;
sewardj164f9272004-12-09 00:39:32 +0000742 case Iop_QSub8Sx16: vex_printf("QSub8Sx16"); return;
743 case Iop_QSub16Sx8: vex_printf("QSub16Sx8"); return;
cerionf887b3e2005-09-13 16:34:28 +0000744 case Iop_QSub32Sx4: vex_printf("QSub32Sx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000745 case Iop_QSub64Ux2: vex_printf("QSub64Ux2"); return;
746 case Iop_QSub64Sx2: vex_printf("QSub64Sx2"); return;
sewardj164f9272004-12-09 00:39:32 +0000747
sewardj2fdd4162010-08-22 12:59:02 +0000748 case Iop_Mul8x16: vex_printf("Mul8x16"); return;
sewardj164f9272004-12-09 00:39:32 +0000749 case Iop_Mul16x8: vex_printf("Mul16x8"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000750 case Iop_Mul32x4: vex_printf("Mul32x4"); return;
751 case Iop_Mull8Ux8: vex_printf("Mull8Ux8"); return;
752 case Iop_Mull8Sx8: vex_printf("Mull8Sx8"); return;
753 case Iop_Mull16Ux4: vex_printf("Mull16Ux4"); return;
754 case Iop_Mull16Sx4: vex_printf("Mull16Sx4"); return;
755 case Iop_Mull32Ux2: vex_printf("Mull32Ux2"); return;
756 case Iop_Mull32Sx2: vex_printf("Mull32Sx2"); return;
757 case Iop_PolynomialMul8x16: vex_printf("PolynomialMul8x16"); return;
758 case Iop_PolynomialMull8x8: vex_printf("PolynomialMull8x8"); return;
sewardj164f9272004-12-09 00:39:32 +0000759 case Iop_MulHi16Ux8: vex_printf("MulHi16Ux8"); return;
cerionf887b3e2005-09-13 16:34:28 +0000760 case Iop_MulHi32Ux4: vex_printf("MulHi32Ux4"); return;
sewardj164f9272004-12-09 00:39:32 +0000761 case Iop_MulHi16Sx8: vex_printf("MulHi16Sx8"); return;
cerionf887b3e2005-09-13 16:34:28 +0000762 case Iop_MulHi32Sx4: vex_printf("MulHi32Sx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000763 case Iop_QDMulHi16Sx8: vex_printf("QDMulHi16Sx8"); return;
764 case Iop_QDMulHi32Sx4: vex_printf("QDMulHi32Sx4"); return;
765 case Iop_QRDMulHi16Sx8: vex_printf("QRDMulHi16Sx8"); return;
766 case Iop_QRDMulHi32Sx4: vex_printf("QRDMulHi32Sx4"); return;
sewardj164f9272004-12-09 00:39:32 +0000767
cerion1ac656a2005-11-04 19:44:48 +0000768 case Iop_MullEven8Ux16: vex_printf("MullEven8Ux16"); return;
769 case Iop_MullEven16Ux8: vex_printf("MullEven16Ux8"); return;
770 case Iop_MullEven8Sx16: vex_printf("MullEven8Sx16"); return;
771 case Iop_MullEven16Sx8: vex_printf("MullEven16Sx8"); return;
772
sewardj164f9272004-12-09 00:39:32 +0000773 case Iop_Avg8Ux16: vex_printf("Avg8Ux16"); return;
774 case Iop_Avg16Ux8: vex_printf("Avg16Ux8"); return;
cerionf887b3e2005-09-13 16:34:28 +0000775 case Iop_Avg32Ux4: vex_printf("Avg32Ux4"); return;
776 case Iop_Avg8Sx16: vex_printf("Avg8Sx16"); return;
777 case Iop_Avg16Sx8: vex_printf("Avg16Sx8"); return;
778 case Iop_Avg32Sx4: vex_printf("Avg32Sx4"); return;
sewardj164f9272004-12-09 00:39:32 +0000779
cerionf887b3e2005-09-13 16:34:28 +0000780 case Iop_Max8Sx16: vex_printf("Max8Sx16"); return;
sewardj164f9272004-12-09 00:39:32 +0000781 case Iop_Max16Sx8: vex_printf("Max16Sx8"); return;
cerionf887b3e2005-09-13 16:34:28 +0000782 case Iop_Max32Sx4: vex_printf("Max32Sx4"); return;
sewardj164f9272004-12-09 00:39:32 +0000783 case Iop_Max8Ux16: vex_printf("Max8Ux16"); return;
cerionf887b3e2005-09-13 16:34:28 +0000784 case Iop_Max16Ux8: vex_printf("Max16Ux8"); return;
785 case Iop_Max32Ux4: vex_printf("Max32Ux4"); return;
786
787 case Iop_Min8Sx16: vex_printf("Min8Sx16"); return;
sewardj164f9272004-12-09 00:39:32 +0000788 case Iop_Min16Sx8: vex_printf("Min16Sx8"); return;
cerionf887b3e2005-09-13 16:34:28 +0000789 case Iop_Min32Sx4: vex_printf("Min32Sx4"); return;
sewardj164f9272004-12-09 00:39:32 +0000790 case Iop_Min8Ux16: vex_printf("Min8Ux16"); return;
cerionf887b3e2005-09-13 16:34:28 +0000791 case Iop_Min16Ux8: vex_printf("Min16Ux8"); return;
792 case Iop_Min32Ux4: vex_printf("Min32Ux4"); return;
sewardj164f9272004-12-09 00:39:32 +0000793
794 case Iop_CmpEQ8x16: vex_printf("CmpEQ8x16"); return;
795 case Iop_CmpEQ16x8: vex_printf("CmpEQ16x8"); return;
796 case Iop_CmpEQ32x4: vex_printf("CmpEQ32x4"); return;
sewardjd8815622011-10-19 15:24:01 +0000797 case Iop_CmpEQ64x2: vex_printf("CmpEQ64x2"); return;
sewardj164f9272004-12-09 00:39:32 +0000798 case Iop_CmpGT8Sx16: vex_printf("CmpGT8Sx16"); return;
799 case Iop_CmpGT16Sx8: vex_printf("CmpGT16Sx8"); return;
800 case Iop_CmpGT32Sx4: vex_printf("CmpGT32Sx4"); return;
sewardj69d98e32010-06-18 08:17:41 +0000801 case Iop_CmpGT64Sx2: vex_printf("CmpGT64Sx2"); return;
cerionf887b3e2005-09-13 16:34:28 +0000802 case Iop_CmpGT8Ux16: vex_printf("CmpGT8Ux16"); return;
803 case Iop_CmpGT16Ux8: vex_printf("CmpGT16Ux8"); return;
804 case Iop_CmpGT32Ux4: vex_printf("CmpGT32Ux4"); return;
805
sewardj2fdd4162010-08-22 12:59:02 +0000806 case Iop_Cnt8x16: vex_printf("Cnt8x16"); return;
807 case Iop_Clz8Sx16: vex_printf("Clz8Sx16"); return;
808 case Iop_Clz16Sx8: vex_printf("Clz16Sx8"); return;
809 case Iop_Clz32Sx4: vex_printf("Clz32Sx4"); return;
810 case Iop_Cls8Sx16: vex_printf("Cls8Sx16"); return;
811 case Iop_Cls16Sx8: vex_printf("Cls16Sx8"); return;
812 case Iop_Cls32Sx4: vex_printf("Cls32Sx4"); return;
813
cerionf887b3e2005-09-13 16:34:28 +0000814 case Iop_ShlV128: vex_printf("ShlV128"); return;
815 case Iop_ShrV128: vex_printf("ShrV128"); return;
sewardj164f9272004-12-09 00:39:32 +0000816
cerion2a4b8452005-09-15 16:28:36 +0000817 case Iop_ShlN8x16: vex_printf("ShlN8x16"); return;
sewardj164f9272004-12-09 00:39:32 +0000818 case Iop_ShlN16x8: vex_printf("ShlN16x8"); return;
819 case Iop_ShlN32x4: vex_printf("ShlN32x4"); return;
820 case Iop_ShlN64x2: vex_printf("ShlN64x2"); return;
cerion2a4b8452005-09-15 16:28:36 +0000821 case Iop_ShrN8x16: vex_printf("ShrN8x16"); return;
sewardj164f9272004-12-09 00:39:32 +0000822 case Iop_ShrN16x8: vex_printf("ShrN16x8"); return;
823 case Iop_ShrN32x4: vex_printf("ShrN32x4"); return;
824 case Iop_ShrN64x2: vex_printf("ShrN64x2"); return;
cerion2a4b8452005-09-15 16:28:36 +0000825 case Iop_SarN8x16: vex_printf("SarN8x16"); return;
sewardj164f9272004-12-09 00:39:32 +0000826 case Iop_SarN16x8: vex_printf("SarN16x8"); return;
827 case Iop_SarN32x4: vex_printf("SarN32x4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000828 case Iop_SarN64x2: vex_printf("SarN64x2"); return;
sewardj164f9272004-12-09 00:39:32 +0000829
cerionf887b3e2005-09-13 16:34:28 +0000830 case Iop_Shl8x16: vex_printf("Shl8x16"); return;
831 case Iop_Shl16x8: vex_printf("Shl16x8"); return;
832 case Iop_Shl32x4: vex_printf("Shl32x4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000833 case Iop_Shl64x2: vex_printf("Shl64x2"); return;
834 case Iop_QSal8x16: vex_printf("QSal8x16"); return;
835 case Iop_QSal16x8: vex_printf("QSal16x8"); return;
836 case Iop_QSal32x4: vex_printf("QSal32x4"); return;
837 case Iop_QSal64x2: vex_printf("QSal64x2"); return;
838 case Iop_QShl8x16: vex_printf("QShl8x16"); return;
839 case Iop_QShl16x8: vex_printf("QShl16x8"); return;
840 case Iop_QShl32x4: vex_printf("QShl32x4"); return;
841 case Iop_QShl64x2: vex_printf("QShl64x2"); return;
842 case Iop_QSalN8x16: vex_printf("QSalN8x16"); return;
843 case Iop_QSalN16x8: vex_printf("QSalN16x8"); return;
844 case Iop_QSalN32x4: vex_printf("QSalN32x4"); return;
845 case Iop_QSalN64x2: vex_printf("QSalN64x2"); return;
846 case Iop_QShlN8x16: vex_printf("QShlN8x16"); return;
847 case Iop_QShlN16x8: vex_printf("QShlN16x8"); return;
848 case Iop_QShlN32x4: vex_printf("QShlN32x4"); return;
849 case Iop_QShlN64x2: vex_printf("QShlN64x2"); return;
850 case Iop_QShlN8Sx16: vex_printf("QShlN8Sx16"); return;
851 case Iop_QShlN16Sx8: vex_printf("QShlN16Sx8"); return;
852 case Iop_QShlN32Sx4: vex_printf("QShlN32Sx4"); return;
853 case Iop_QShlN64Sx2: vex_printf("QShlN64Sx2"); return;
cerionf887b3e2005-09-13 16:34:28 +0000854 case Iop_Shr8x16: vex_printf("Shr8x16"); return;
855 case Iop_Shr16x8: vex_printf("Shr16x8"); return;
856 case Iop_Shr32x4: vex_printf("Shr32x4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000857 case Iop_Shr64x2: vex_printf("Shr64x2"); return;
cerionf887b3e2005-09-13 16:34:28 +0000858 case Iop_Sar8x16: vex_printf("Sar8x16"); return;
859 case Iop_Sar16x8: vex_printf("Sar16x8"); return;
860 case Iop_Sar32x4: vex_printf("Sar32x4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000861 case Iop_Sar64x2: vex_printf("Sar64x2"); return;
862 case Iop_Sal8x16: vex_printf("Sal8x16"); return;
863 case Iop_Sal16x8: vex_printf("Sal16x8"); return;
864 case Iop_Sal32x4: vex_printf("Sal32x4"); return;
865 case Iop_Sal64x2: vex_printf("Sal64x2"); return;
sewardj1bee5612005-11-10 18:10:58 +0000866 case Iop_Rol8x16: vex_printf("Rol8x16"); return;
867 case Iop_Rol16x8: vex_printf("Rol16x8"); return;
868 case Iop_Rol32x4: vex_printf("Rol32x4"); return;
cerionf887b3e2005-09-13 16:34:28 +0000869
sewardj5f438dd2011-06-16 11:36:23 +0000870 case Iop_NarrowBin16to8x16: vex_printf("NarrowBin16to8x16"); return;
871 case Iop_NarrowBin32to16x8: vex_printf("NarrowBin32to16x8"); return;
872 case Iop_QNarrowBin16Uto8Ux16: vex_printf("QNarrowBin16Uto8Ux16"); return;
873 case Iop_QNarrowBin32Sto16Ux8: vex_printf("QNarrowBin32Sto16Ux8"); return;
874 case Iop_QNarrowBin16Sto8Ux16: vex_printf("QNarrowBin16Sto8Ux16"); return;
875 case Iop_QNarrowBin32Uto16Ux8: vex_printf("QNarrowBin32Uto16Ux8"); return;
876 case Iop_QNarrowBin16Sto8Sx16: vex_printf("QNarrowBin16Sto8Sx16"); return;
877 case Iop_QNarrowBin32Sto16Sx8: vex_printf("QNarrowBin32Sto16Sx8"); return;
878 case Iop_NarrowUn16to8x8: vex_printf("NarrowUn16to8x8"); return;
879 case Iop_NarrowUn32to16x4: vex_printf("NarrowUn32to16x4"); return;
880 case Iop_NarrowUn64to32x2: vex_printf("NarrowUn64to32x2"); return;
881 case Iop_QNarrowUn16Uto8Ux8: vex_printf("QNarrowUn16Uto8Ux8"); return;
882 case Iop_QNarrowUn32Uto16Ux4: vex_printf("QNarrowUn32Uto16Ux4"); return;
883 case Iop_QNarrowUn64Uto32Ux2: vex_printf("QNarrowUn64Uto32Ux2"); return;
884 case Iop_QNarrowUn16Sto8Sx8: vex_printf("QNarrowUn16Sto8Sx8"); return;
885 case Iop_QNarrowUn32Sto16Sx4: vex_printf("QNarrowUn32Sto16Sx4"); return;
886 case Iop_QNarrowUn64Sto32Sx2: vex_printf("QNarrowUn64Sto32Sx2"); return;
887 case Iop_QNarrowUn16Sto8Ux8: vex_printf("QNarrowUn16Sto8Ux8"); return;
888 case Iop_QNarrowUn32Sto16Ux4: vex_printf("QNarrowUn32Sto16Ux4"); return;
889 case Iop_QNarrowUn64Sto32Ux2: vex_printf("QNarrowUn64Sto32Ux2"); return;
890 case Iop_Widen8Uto16x8: vex_printf("Widen8Uto16x8"); return;
891 case Iop_Widen16Uto32x4: vex_printf("Widen16Uto32x4"); return;
892 case Iop_Widen32Uto64x2: vex_printf("Widen32Uto64x2"); return;
893 case Iop_Widen8Sto16x8: vex_printf("Widen8Sto16x8"); return;
894 case Iop_Widen16Sto32x4: vex_printf("Widen16Sto32x4"); return;
895 case Iop_Widen32Sto64x2: vex_printf("Widen32Sto64x2"); return;
sewardj164f9272004-12-09 00:39:32 +0000896
897 case Iop_InterleaveHI8x16: vex_printf("InterleaveHI8x16"); return;
898 case Iop_InterleaveHI16x8: vex_printf("InterleaveHI16x8"); return;
899 case Iop_InterleaveHI32x4: vex_printf("InterleaveHI32x4"); return;
900 case Iop_InterleaveHI64x2: vex_printf("InterleaveHI64x2"); return;
901 case Iop_InterleaveLO8x16: vex_printf("InterleaveLO8x16"); return;
902 case Iop_InterleaveLO16x8: vex_printf("InterleaveLO16x8"); return;
903 case Iop_InterleaveLO32x4: vex_printf("InterleaveLO32x4"); return;
904 case Iop_InterleaveLO64x2: vex_printf("InterleaveLO64x2"); return;
905
sewardj2fdd4162010-08-22 12:59:02 +0000906 case Iop_CatOddLanes8x16: vex_printf("CatOddLanes8x16"); return;
907 case Iop_CatOddLanes16x8: vex_printf("CatOddLanes16x8"); return;
908 case Iop_CatOddLanes32x4: vex_printf("CatOddLanes32x4"); return;
909 case Iop_CatEvenLanes8x16: vex_printf("CatEvenLanes8x16"); return;
910 case Iop_CatEvenLanes16x8: vex_printf("CatEvenLanes16x8"); return;
911 case Iop_CatEvenLanes32x4: vex_printf("CatEvenLanes32x4"); return;
912
913 case Iop_InterleaveOddLanes8x16: vex_printf("InterleaveOddLanes8x16"); return;
914 case Iop_InterleaveOddLanes16x8: vex_printf("InterleaveOddLanes16x8"); return;
915 case Iop_InterleaveOddLanes32x4: vex_printf("InterleaveOddLanes32x4"); return;
916 case Iop_InterleaveEvenLanes8x16: vex_printf("InterleaveEvenLanes8x16"); return;
917 case Iop_InterleaveEvenLanes16x8: vex_printf("InterleaveEvenLanes16x8"); return;
918 case Iop_InterleaveEvenLanes32x4: vex_printf("InterleaveEvenLanes32x4"); return;
919
920 case Iop_GetElem8x16: vex_printf("GetElem8x16"); return;
921 case Iop_GetElem16x8: vex_printf("GetElem16x8"); return;
922 case Iop_GetElem32x4: vex_printf("GetElem32x4"); return;
923 case Iop_GetElem64x2: vex_printf("GetElem64x2"); return;
924
925 case Iop_GetElem8x8: vex_printf("GetElem8x8"); return;
926 case Iop_GetElem16x4: vex_printf("GetElem16x4"); return;
927 case Iop_GetElem32x2: vex_printf("GetElem32x2"); return;
928 case Iop_SetElem8x8: vex_printf("SetElem8x8"); return;
929 case Iop_SetElem16x4: vex_printf("SetElem16x4"); return;
930 case Iop_SetElem32x2: vex_printf("SetElem32x2"); return;
931
932 case Iop_Extract64: vex_printf("Extract64"); return;
933 case Iop_ExtractV128: vex_printf("ExtractV128"); return;
934
sewardjdc1f9132005-10-22 12:49:49 +0000935 case Iop_Perm8x16: vex_printf("Perm8x16"); return;
sewardjd8bca7e2012-06-20 11:46:19 +0000936 case Iop_Perm32x4: vex_printf("Perm32x4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000937 case Iop_Reverse16_8x16: vex_printf("Reverse16_8x16"); return;
938 case Iop_Reverse32_8x16: vex_printf("Reverse32_8x16"); return;
939 case Iop_Reverse32_16x8: vex_printf("Reverse32_16x8"); return;
940 case Iop_Reverse64_8x16: vex_printf("Reverse64_8x16"); return;
941 case Iop_Reverse64_16x8: vex_printf("Reverse64_16x8"); return;
942 case Iop_Reverse64_32x4: vex_printf("Reverse64_32x4"); return;
943
944 case Iop_F32ToFixed32Ux4_RZ: vex_printf("F32ToFixed32Ux4_RZ"); return;
945 case Iop_F32ToFixed32Sx4_RZ: vex_printf("F32ToFixed32Sx4_RZ"); return;
946 case Iop_Fixed32UToF32x4_RN: vex_printf("Fixed32UToF32x4_RN"); return;
947 case Iop_Fixed32SToF32x4_RN: vex_printf("Fixed32SToF32x4_RN"); return;
948 case Iop_F32ToFixed32Ux2_RZ: vex_printf("F32ToFixed32Ux2_RZ"); return;
949 case Iop_F32ToFixed32Sx2_RZ: vex_printf("F32ToFixed32Sx2_RZ"); return;
950 case Iop_Fixed32UToF32x2_RN: vex_printf("Fixed32UToF32x2_RN"); return;
951 case Iop_Fixed32SToF32x2_RN: vex_printf("Fixed32SToF32x2_RN"); return;
cerionf887b3e2005-09-13 16:34:28 +0000952
sewardj26217b02012-04-12 17:19:48 +0000953 case Iop_D32toD64: vex_printf("D32toD64"); return;
954 case Iop_D64toD32: vex_printf("D64toD32"); return;
sewardjc6bbd472012-04-02 10:20:48 +0000955 case Iop_AddD64: vex_printf("AddD64"); return;
956 case Iop_SubD64: vex_printf("SubD64"); return;
957 case Iop_MulD64: vex_printf("MulD64"); return;
958 case Iop_DivD64: vex_printf("DivD64"); return;
sewardj26217b02012-04-12 17:19:48 +0000959 case Iop_ShlD64: vex_printf("ShlD64"); return;
960 case Iop_ShrD64: vex_printf("ShrD64"); return;
961 case Iop_D64toI64S: vex_printf("D64toI64S"); return;
962 case Iop_I64StoD64: vex_printf("I64StoD64"); return;
963 case Iop_I64StoD128: vex_printf("I64StoD128"); return;
964 case Iop_D64toD128: vex_printf("D64toD128"); return;
965 case Iop_D128toD64: vex_printf("D128toD64"); return;
966 case Iop_D128toI64S: vex_printf("D128toI64S"); return;
sewardjc6bbd472012-04-02 10:20:48 +0000967 case Iop_AddD128: vex_printf("AddD128"); return;
968 case Iop_SubD128: vex_printf("SubD128"); return;
969 case Iop_MulD128: vex_printf("MulD128"); return;
970 case Iop_DivD128: vex_printf("DivD128"); return;
sewardj26217b02012-04-12 17:19:48 +0000971 case Iop_ShlD128: vex_printf("ShlD128"); return;
972 case Iop_ShrD128: vex_printf("ShrD128"); return;
sewardjcdc376d2012-04-23 11:21:12 +0000973 case Iop_RoundD64toInt: vex_printf("Iop_RoundD64toInt"); return;
974 case Iop_RoundD128toInt: vex_printf("Iop_RoundD128toInt"); return;
975 case Iop_QuantizeD64: vex_printf("Iop_QuantizeD64"); return;
976 case Iop_QuantizeD128: vex_printf("Iop_QuantizeD128"); return;
977 case Iop_ExtractExpD64: vex_printf("Iop_ExtractExpD64"); return;
978 case Iop_ExtractExpD128: vex_printf("Iop_ExtractExpD128"); return;
979 case Iop_InsertExpD64: vex_printf("Iop_InsertExpD64"); return;
980 case Iop_InsertExpD128: vex_printf("Iop_InsertExpD128"); return;
981 case Iop_CmpD64: vex_printf("CmpD64"); return;
982 case Iop_CmpD128: vex_printf("CmpD128"); return;
sewardjc6bbd472012-04-02 10:20:48 +0000983 case Iop_D64HLtoD128: vex_printf("D64HLtoD128"); return;
984 case Iop_D128HItoD64: vex_printf("D128HItoD64"); return;
985 case Iop_D128LOtoD64: vex_printf("D128LOtoD64"); return;
sewardjcdc376d2012-04-23 11:21:12 +0000986 case Iop_SignificanceRoundD64: vex_printf("Iop_SignificanceRoundD64");
987 return;
988 case Iop_SignificanceRoundD128: vex_printf("Iop_SignificanceRoundD128");
989 return;
990 case Iop_ReinterpI64asD64: vex_printf("ReinterpI64asD64"); return;
sewardj5eff1c52012-04-29 20:19:17 +0000991 case Iop_ReinterpD64asI64: vex_printf("ReinterpD64asI64"); return;
sewardjc4530ae2012-05-21 10:18:49 +0000992 case Iop_V256to64_0: vex_printf("V256to64_0"); return;
993 case Iop_V256to64_1: vex_printf("V256to64_1"); return;
994 case Iop_V256to64_2: vex_printf("V256to64_2"); return;
995 case Iop_V256to64_3: vex_printf("V256to64_3"); return;
996 case Iop_64x4toV256: vex_printf("64x4toV256"); return;
sewardj4b1cc832012-06-13 11:10:20 +0000997 case Iop_V256toV128_0: vex_printf("V256toV128_0"); return;
998 case Iop_V256toV128_1: vex_printf("V256toV128_1"); return;
999 case Iop_V128HLtoV256: vex_printf("V128HLtoV256"); return;
sewardj56c30312012-06-12 08:45:39 +00001000 case Iop_DPBtoBCD: vex_printf("DPBtoBCD"); return;
1001 case Iop_BCDtoDPB: vex_printf("BCDtoDPB"); return;
1002 case Iop_Add64Fx4: vex_printf("Add64Fx4"); return;
1003 case Iop_Sub64Fx4: vex_printf("Sub64Fx4"); return;
1004 case Iop_Mul64Fx4: vex_printf("Mul64Fx4"); return;
1005 case Iop_Div64Fx4: vex_printf("Div64Fx4"); return;
1006 case Iop_Add32Fx8: vex_printf("Add32Fx8"); return;
1007 case Iop_Sub32Fx8: vex_printf("Sub32Fx8"); return;
1008 case Iop_Mul32Fx8: vex_printf("Mul32Fx8"); return;
1009 case Iop_Div32Fx8: vex_printf("Div32Fx8"); return;
sewardj4b1cc832012-06-13 11:10:20 +00001010 case Iop_AndV256: vex_printf("AndV256"); return;
sewardj2a2bda92012-06-14 23:32:02 +00001011 case Iop_OrV256: vex_printf("OrV256"); return;
sewardj4b1cc832012-06-13 11:10:20 +00001012 case Iop_XorV256: vex_printf("XorV256"); return;
sewardj2a2bda92012-06-14 23:32:02 +00001013 case Iop_NotV256: vex_printf("NotV256"); return;
sewardj23db8a02012-06-25 07:46:18 +00001014 case Iop_CmpNEZ64x4: vex_printf("CmpNEZ64x4"); return;
1015 case Iop_CmpNEZ32x8: vex_printf("CmpNEZ32x8"); return;
sewardjc9a43662004-11-30 18:51:59 +00001016 default: vpanic("ppIROp(1)");
sewardj41f43bc2004-07-08 14:23:22 +00001017 }
sewardj1fb8c922009-07-12 12:56:53 +00001018
1019 vassert(str);
sewardj41f43bc2004-07-08 14:23:22 +00001020 switch (op - base) {
sewardjecbaee72008-11-01 23:54:45 +00001021 case 0: vex_printf("%s",str); vex_printf("8"); break;
1022 case 1: vex_printf("%s",str); vex_printf("16"); break;
1023 case 2: vex_printf("%s",str); vex_printf("32"); break;
1024 case 3: vex_printf("%s",str); vex_printf("64"); break;
sewardj41f43bc2004-07-08 14:23:22 +00001025 default: vpanic("ppIROp(2)");
1026 }
sewardje3d0d2e2004-06-27 10:42:44 +00001027}
1028
sewardj35421a32004-07-05 13:12:34 +00001029void ppIRExpr ( IRExpr* e )
sewardje3d0d2e2004-06-27 10:42:44 +00001030{
sewardje87b4842004-07-10 12:23:30 +00001031 Int i;
sewardje3d0d2e2004-06-27 10:42:44 +00001032 switch (e->tag) {
sewardj443cd9d2004-07-18 23:06:45 +00001033 case Iex_Binder:
1034 vex_printf("BIND-%d", e->Iex.Binder.binder);
1035 break;
sewardje3d0d2e2004-06-27 10:42:44 +00001036 case Iex_Get:
sewardjc9a43662004-11-30 18:51:59 +00001037 vex_printf( "GET:" );
sewardjfbcaf332004-07-08 01:46:01 +00001038 ppIRType(e->Iex.Get.ty);
sewardjc9a43662004-11-30 18:51:59 +00001039 vex_printf("(%d)", e->Iex.Get.offset);
sewardjec6ad592004-06-20 12:26:53 +00001040 break;
sewardjbb53f8c2004-08-14 11:50:01 +00001041 case Iex_GetI:
sewardj2d3f77c2004-09-22 23:49:09 +00001042 vex_printf( "GETI" );
sewardjdd40fdf2006-12-24 02:20:24 +00001043 ppIRRegArray(e->Iex.GetI.descr);
sewardj2d3f77c2004-09-22 23:49:09 +00001044 vex_printf("[");
sewardjeeac8412004-11-02 00:26:55 +00001045 ppIRExpr(e->Iex.GetI.ix);
sewardj2d3f77c2004-09-22 23:49:09 +00001046 vex_printf(",%d]", e->Iex.GetI.bias);
sewardjbb53f8c2004-08-14 11:50:01 +00001047 break;
sewardjdd40fdf2006-12-24 02:20:24 +00001048 case Iex_RdTmp:
1049 ppIRTemp(e->Iex.RdTmp.tmp);
sewardjec6ad592004-06-20 12:26:53 +00001050 break;
florian96d7cc32012-06-01 20:41:24 +00001051 case Iex_Qop: {
1052 IRQop *qop = e->Iex.Qop.details;
1053 ppIROp(qop->op);
sewardj40c80262006-02-08 19:30:46 +00001054 vex_printf( "(" );
florian96d7cc32012-06-01 20:41:24 +00001055 ppIRExpr(qop->arg1);
sewardj40c80262006-02-08 19:30:46 +00001056 vex_printf( "," );
florian96d7cc32012-06-01 20:41:24 +00001057 ppIRExpr(qop->arg2);
sewardj40c80262006-02-08 19:30:46 +00001058 vex_printf( "," );
florian96d7cc32012-06-01 20:41:24 +00001059 ppIRExpr(qop->arg3);
sewardj40c80262006-02-08 19:30:46 +00001060 vex_printf( "," );
florian96d7cc32012-06-01 20:41:24 +00001061 ppIRExpr(qop->arg4);
sewardj40c80262006-02-08 19:30:46 +00001062 vex_printf( ")" );
1063 break;
florian96d7cc32012-06-01 20:41:24 +00001064 }
florian420bfa92012-06-02 20:29:22 +00001065 case Iex_Triop: {
1066 IRTriop *triop = e->Iex.Triop.details;
1067 ppIROp(triop->op);
sewardjb183b852006-02-03 16:08:03 +00001068 vex_printf( "(" );
florian420bfa92012-06-02 20:29:22 +00001069 ppIRExpr(triop->arg1);
sewardjb183b852006-02-03 16:08:03 +00001070 vex_printf( "," );
florian420bfa92012-06-02 20:29:22 +00001071 ppIRExpr(triop->arg2);
sewardjb183b852006-02-03 16:08:03 +00001072 vex_printf( "," );
florian420bfa92012-06-02 20:29:22 +00001073 ppIRExpr(triop->arg3);
sewardjb183b852006-02-03 16:08:03 +00001074 vex_printf( ")" );
1075 break;
florian420bfa92012-06-02 20:29:22 +00001076 }
sewardje3d0d2e2004-06-27 10:42:44 +00001077 case Iex_Binop:
sewardj35421a32004-07-05 13:12:34 +00001078 ppIROp(e->Iex.Binop.op);
1079 vex_printf( "(" );
1080 ppIRExpr(e->Iex.Binop.arg1);
1081 vex_printf( "," );
1082 ppIRExpr(e->Iex.Binop.arg2);
1083 vex_printf( ")" );
sewardjec6ad592004-06-20 12:26:53 +00001084 break;
sewardje3d0d2e2004-06-27 10:42:44 +00001085 case Iex_Unop:
sewardj35421a32004-07-05 13:12:34 +00001086 ppIROp(e->Iex.Unop.op);
1087 vex_printf( "(" );
1088 ppIRExpr(e->Iex.Unop.arg);
1089 vex_printf( ")" );
sewardjec6ad592004-06-20 12:26:53 +00001090 break;
sewardjaf1ceca2005-06-30 23:31:27 +00001091 case Iex_Load:
sewardje768e922009-11-26 17:17:37 +00001092 vex_printf( "LD%s:", e->Iex.Load.end==Iend_LE ? "le" : "be" );
sewardjaf1ceca2005-06-30 23:31:27 +00001093 ppIRType(e->Iex.Load.ty);
sewardje05c42c2004-07-08 20:25:10 +00001094 vex_printf( "(" );
sewardjaf1ceca2005-06-30 23:31:27 +00001095 ppIRExpr(e->Iex.Load.addr);
sewardj35421a32004-07-05 13:12:34 +00001096 vex_printf( ")" );
sewardjec6ad592004-06-20 12:26:53 +00001097 break;
sewardje3d0d2e2004-06-27 10:42:44 +00001098 case Iex_Const:
sewardj35421a32004-07-05 13:12:34 +00001099 ppIRConst(e->Iex.Const.con);
sewardjec6ad592004-06-20 12:26:53 +00001100 break;
sewardje87b4842004-07-10 12:23:30 +00001101 case Iex_CCall:
sewardj8ea867b2004-10-30 19:03:02 +00001102 ppIRCallee(e->Iex.CCall.cee);
1103 vex_printf("(");
sewardje87b4842004-07-10 12:23:30 +00001104 for (i = 0; e->Iex.CCall.args[i] != NULL; i++) {
1105 ppIRExpr(e->Iex.CCall.args[i]);
1106 if (e->Iex.CCall.args[i+1] != NULL)
1107 vex_printf(",");
1108 }
1109 vex_printf("):");
1110 ppIRType(e->Iex.CCall.retty);
1111 break;
sewardj4042c7e2004-07-18 01:28:30 +00001112 case Iex_Mux0X:
1113 vex_printf("Mux0X(");
1114 ppIRExpr(e->Iex.Mux0X.cond);
sewardjeeb9ef82004-07-15 12:39:03 +00001115 vex_printf(",");
sewardj4042c7e2004-07-18 01:28:30 +00001116 ppIRExpr(e->Iex.Mux0X.expr0);
sewardjeeb9ef82004-07-15 12:39:03 +00001117 vex_printf(",");
sewardj4042c7e2004-07-18 01:28:30 +00001118 ppIRExpr(e->Iex.Mux0X.exprX);
sewardjeeb9ef82004-07-15 12:39:03 +00001119 vex_printf(")");
1120 break;
sewardjec6ad592004-06-20 12:26:53 +00001121 default:
sewardj909c06d2005-02-19 22:47:41 +00001122 vpanic("ppIRExpr");
sewardjec6ad592004-06-20 12:26:53 +00001123 }
1124}
1125
sewardj17442fe2004-09-20 14:54:28 +00001126void ppIREffect ( IREffect fx )
1127{
1128 switch (fx) {
1129 case Ifx_None: vex_printf("noFX"); return;
1130 case Ifx_Read: vex_printf("RdFX"); return;
1131 case Ifx_Write: vex_printf("WrFX"); return;
1132 case Ifx_Modify: vex_printf("MoFX"); return;
1133 default: vpanic("ppIREffect");
1134 }
1135}
1136
1137void ppIRDirty ( IRDirty* d )
1138{
1139 Int i;
sewardj92d168d2004-11-15 14:22:12 +00001140 if (d->tmp != IRTemp_INVALID) {
sewardj4b861de2004-11-03 15:24:42 +00001141 ppIRTemp(d->tmp);
1142 vex_printf(" = ");
1143 }
sewardjb8385d82004-11-02 01:34:15 +00001144 vex_printf("DIRTY ");
1145 ppIRExpr(d->guard);
sewardjc5fc7aa2004-10-27 23:00:55 +00001146 if (d->needsBBP)
1147 vex_printf(" NeedsBBP");
sewardj17442fe2004-09-20 14:54:28 +00001148 if (d->mFx != Ifx_None) {
sewardj49651f42004-10-28 22:11:04 +00001149 vex_printf(" ");
sewardj17442fe2004-09-20 14:54:28 +00001150 ppIREffect(d->mFx);
1151 vex_printf("-mem(");
1152 ppIRExpr(d->mAddr);
sewardj49651f42004-10-28 22:11:04 +00001153 vex_printf(",%d)", d->mSize);
sewardj17442fe2004-09-20 14:54:28 +00001154 }
1155 for (i = 0; i < d->nFxState; i++) {
sewardj49651f42004-10-28 22:11:04 +00001156 vex_printf(" ");
sewardj17442fe2004-09-20 14:54:28 +00001157 ppIREffect(d->fxState[i].fx);
sewardjc9069f22012-06-01 16:09:50 +00001158 vex_printf("-gst(%u,%u", (UInt)d->fxState[i].offset,
1159 (UInt)d->fxState[i].size);
1160 if (d->fxState[i].nRepeats > 0) {
1161 vex_printf(",reps%u,step%u", (UInt)d->fxState[i].nRepeats,
1162 (UInt)d->fxState[i].repeatLen);
1163 }
1164 vex_printf(")");
sewardj17442fe2004-09-20 14:54:28 +00001165 }
sewardjc5fc7aa2004-10-27 23:00:55 +00001166 vex_printf(" ::: ");
sewardj8ea867b2004-10-30 19:03:02 +00001167 ppIRCallee(d->cee);
1168 vex_printf("(");
sewardj17442fe2004-09-20 14:54:28 +00001169 for (i = 0; d->args[i] != NULL; i++) {
1170 ppIRExpr(d->args[i]);
1171 if (d->args[i+1] != NULL) {
1172 vex_printf(",");
1173 }
1174 }
1175 vex_printf(")");
1176}
1177
sewardje9d8a262009-07-01 08:06:34 +00001178void ppIRCAS ( IRCAS* cas )
1179{
1180 /* Print even structurally invalid constructions, as an aid to
1181 debugging. */
1182 if (cas->oldHi != IRTemp_INVALID) {
1183 ppIRTemp(cas->oldHi);
1184 vex_printf(",");
1185 }
1186 ppIRTemp(cas->oldLo);
1187 vex_printf(" = CAS%s(", cas->end==Iend_LE ? "le" : "be" );
1188 ppIRExpr(cas->addr);
1189 vex_printf("::");
1190 if (cas->expdHi) {
1191 ppIRExpr(cas->expdHi);
1192 vex_printf(",");
1193 }
1194 ppIRExpr(cas->expdLo);
1195 vex_printf("->");
1196 if (cas->dataHi) {
1197 ppIRExpr(cas->dataHi);
1198 vex_printf(",");
1199 }
1200 ppIRExpr(cas->dataLo);
1201 vex_printf(")");
1202}
1203
floriand6f38b32012-05-31 15:46:18 +00001204void ppIRPutI ( IRPutI* puti )
1205{
1206 vex_printf( "PUTI" );
1207 ppIRRegArray(puti->descr);
1208 vex_printf("[");
1209 ppIRExpr(puti->ix);
1210 vex_printf(",%d] = ", puti->bias);
1211 ppIRExpr(puti->data);
1212}
1213
sewardj893aada2004-11-29 19:57:54 +00001214void ppIRJumpKind ( IRJumpKind kind )
1215{
1216 switch (kind) {
sewardj4fa325a2005-11-03 13:27:24 +00001217 case Ijk_Boring: vex_printf("Boring"); break;
1218 case Ijk_Call: vex_printf("Call"); break;
1219 case Ijk_Ret: vex_printf("Return"); break;
1220 case Ijk_ClientReq: vex_printf("ClientReq"); break;
1221 case Ijk_Yield: vex_printf("Yield"); break;
1222 case Ijk_EmWarn: vex_printf("EmWarn"); break;
sewardj9dd9cf12006-01-20 14:13:55 +00001223 case Ijk_EmFail: vex_printf("EmFail"); break;
sewardj4fa325a2005-11-03 13:27:24 +00001224 case Ijk_NoDecode: vex_printf("NoDecode"); break;
1225 case Ijk_MapFail: vex_printf("MapFail"); break;
1226 case Ijk_TInval: vex_printf("Invalidate"); break;
sewardjce02aa72006-01-12 12:27:58 +00001227 case Ijk_NoRedir: vex_printf("NoRedir"); break;
sewardj0f500042007-08-29 09:09:17 +00001228 case Ijk_SigTRAP: vex_printf("SigTRAP"); break;
1229 case Ijk_SigSEGV: vex_printf("SigSEGV"); break;
sewardje9d8a262009-07-01 08:06:34 +00001230 case Ijk_SigBUS: vex_printf("SigBUS"); break;
sewardj4fa325a2005-11-03 13:27:24 +00001231 case Ijk_Sys_syscall: vex_printf("Sys_syscall"); break;
1232 case Ijk_Sys_int32: vex_printf("Sys_int32"); break;
1233 case Ijk_Sys_int128: vex_printf("Sys_int128"); break;
sewardjd660d412008-12-03 21:29:59 +00001234 case Ijk_Sys_int129: vex_printf("Sys_int129"); break;
1235 case Ijk_Sys_int130: vex_printf("Sys_int130"); break;
sewardj4fa325a2005-11-03 13:27:24 +00001236 case Ijk_Sys_sysenter: vex_printf("Sys_sysenter"); break;
1237 default: vpanic("ppIRJumpKind");
sewardj893aada2004-11-29 19:57:54 +00001238 }
1239}
1240
sewardjc4356f02007-11-09 21:15:04 +00001241void ppIRMBusEvent ( IRMBusEvent event )
1242{
1243 switch (event) {
sewardj6d615ba2011-09-26 16:19:43 +00001244 case Imbe_Fence:
1245 vex_printf("Fence"); break;
1246 case Imbe_CancelReservation:
1247 vex_printf("CancelReservation"); break;
1248 default:
1249 vpanic("ppIRMBusEvent");
sewardjc4356f02007-11-09 21:15:04 +00001250 }
1251}
1252
sewardj35421a32004-07-05 13:12:34 +00001253void ppIRStmt ( IRStmt* s )
sewardjec6ad592004-06-20 12:26:53 +00001254{
sewardjd2445f62005-03-21 00:15:53 +00001255 if (!s) {
1256 vex_printf("!!! IRStmt* which is NULL !!!");
1257 return;
1258 }
sewardj17442fe2004-09-20 14:54:28 +00001259 switch (s->tag) {
sewardjd2445f62005-03-21 00:15:53 +00001260 case Ist_NoOp:
1261 vex_printf("IR-NoOp");
1262 break;
sewardjf1689312005-03-16 18:19:10 +00001263 case Ist_IMark:
sewardj2f10aa62011-05-27 13:20:56 +00001264 vex_printf( "------ IMark(0x%llx, %d, %u) ------",
1265 s->Ist.IMark.addr, s->Ist.IMark.len,
1266 (UInt)s->Ist.IMark.delta);
sewardjf1689312005-03-16 18:19:10 +00001267 break;
sewardj5a9ffab2005-05-12 17:55:01 +00001268 case Ist_AbiHint:
1269 vex_printf("====== AbiHint(");
1270 ppIRExpr(s->Ist.AbiHint.base);
sewardj478646f2008-05-01 20:13:04 +00001271 vex_printf(", %d, ", s->Ist.AbiHint.len);
1272 ppIRExpr(s->Ist.AbiHint.nia);
1273 vex_printf(") ======");
sewardj5a9ffab2005-05-12 17:55:01 +00001274 break;
sewardj17442fe2004-09-20 14:54:28 +00001275 case Ist_Put:
1276 vex_printf( "PUT(%d) = ", s->Ist.Put.offset);
sewardj6d076362004-09-23 11:06:17 +00001277 ppIRExpr(s->Ist.Put.data);
sewardj17442fe2004-09-20 14:54:28 +00001278 break;
1279 case Ist_PutI:
floriand6f38b32012-05-31 15:46:18 +00001280 ppIRPutI(s->Ist.PutI.details);
sewardj17442fe2004-09-20 14:54:28 +00001281 break;
sewardjdd40fdf2006-12-24 02:20:24 +00001282 case Ist_WrTmp:
1283 ppIRTemp(s->Ist.WrTmp.tmp);
sewardj17442fe2004-09-20 14:54:28 +00001284 vex_printf( " = " );
sewardjdd40fdf2006-12-24 02:20:24 +00001285 ppIRExpr(s->Ist.WrTmp.data);
sewardj17442fe2004-09-20 14:54:28 +00001286 break;
sewardjaf1ceca2005-06-30 23:31:27 +00001287 case Ist_Store:
1288 vex_printf( "ST%s(", s->Ist.Store.end==Iend_LE ? "le" : "be" );
1289 ppIRExpr(s->Ist.Store.addr);
sewardj17442fe2004-09-20 14:54:28 +00001290 vex_printf( ") = ");
sewardjaf1ceca2005-06-30 23:31:27 +00001291 ppIRExpr(s->Ist.Store.data);
sewardje9d8a262009-07-01 08:06:34 +00001292 break;
1293 case Ist_CAS:
1294 ppIRCAS(s->Ist.CAS.details);
sewardj17442fe2004-09-20 14:54:28 +00001295 break;
sewardje768e922009-11-26 17:17:37 +00001296 case Ist_LLSC:
1297 if (s->Ist.LLSC.storedata == NULL) {
1298 ppIRTemp(s->Ist.LLSC.result);
1299 vex_printf(" = LD%s-Linked(",
1300 s->Ist.LLSC.end==Iend_LE ? "le" : "be");
1301 ppIRExpr(s->Ist.LLSC.addr);
1302 vex_printf(")");
1303 } else {
1304 ppIRTemp(s->Ist.LLSC.result);
1305 vex_printf(" = ( ST%s-Cond(",
1306 s->Ist.LLSC.end==Iend_LE ? "le" : "be");
1307 ppIRExpr(s->Ist.LLSC.addr);
1308 vex_printf(") = ");
1309 ppIRExpr(s->Ist.LLSC.storedata);
1310 vex_printf(" )");
1311 }
1312 break;
sewardj17442fe2004-09-20 14:54:28 +00001313 case Ist_Dirty:
1314 ppIRDirty(s->Ist.Dirty.details);
1315 break;
sewardjc4356f02007-11-09 21:15:04 +00001316 case Ist_MBE:
1317 vex_printf("IR-");
1318 ppIRMBusEvent(s->Ist.MBE.event);
sewardj3e838932005-01-07 12:09:15 +00001319 break;
sewardj17442fe2004-09-20 14:54:28 +00001320 case Ist_Exit:
1321 vex_printf( "if (" );
sewardj0276d4b2004-11-15 15:30:21 +00001322 ppIRExpr(s->Ist.Exit.guard);
sewardjc6f970f2012-04-02 21:54:49 +00001323 vex_printf( ") { PUT(%d) = ", s->Ist.Exit.offsIP);
sewardj17442fe2004-09-20 14:54:28 +00001324 ppIRConst(s->Ist.Exit.dst);
sewardjc6f970f2012-04-02 21:54:49 +00001325 vex_printf("; exit-");
1326 ppIRJumpKind(s->Ist.Exit.jk);
1327 vex_printf(" } ");
sewardj17442fe2004-09-20 14:54:28 +00001328 break;
1329 default:
1330 vpanic("ppIRStmt");
1331 }
sewardjec6ad592004-06-20 12:26:53 +00001332}
1333
sewardj35421a32004-07-05 13:12:34 +00001334void ppIRTypeEnv ( IRTypeEnv* env ) {
sewardjc97096c2004-06-30 09:28:04 +00001335 UInt i;
sewardje539a402004-07-14 18:24:17 +00001336 for (i = 0; i < env->types_used; i++) {
sewardjc97096c2004-06-30 09:28:04 +00001337 if (i % 8 == 0)
sewardj35421a32004-07-05 13:12:34 +00001338 vex_printf( " ");
sewardje539a402004-07-14 18:24:17 +00001339 ppIRTemp(i);
sewardj35421a32004-07-05 13:12:34 +00001340 vex_printf( ":");
sewardje539a402004-07-14 18:24:17 +00001341 ppIRType(env->types[i]);
sewardjc97096c2004-06-30 09:28:04 +00001342 if (i % 8 == 7)
sewardj35421a32004-07-05 13:12:34 +00001343 vex_printf( "\n");
sewardjc97096c2004-06-30 09:28:04 +00001344 else
sewardj35421a32004-07-05 13:12:34 +00001345 vex_printf( " ");
sewardjc97096c2004-06-30 09:28:04 +00001346 }
sewardje539a402004-07-14 18:24:17 +00001347 if (env->types_used > 0 && env->types_used % 8 != 7)
sewardj35421a32004-07-05 13:12:34 +00001348 vex_printf( "\n");
sewardjc97096c2004-06-30 09:28:04 +00001349}
1350
sewardjdd40fdf2006-12-24 02:20:24 +00001351void ppIRSB ( IRSB* bb )
sewardjec6ad592004-06-20 12:26:53 +00001352{
sewardjd7cb8532004-08-17 23:59:23 +00001353 Int i;
sewardjdd40fdf2006-12-24 02:20:24 +00001354 vex_printf("IRSB {\n");
sewardj35421a32004-07-05 13:12:34 +00001355 ppIRTypeEnv(bb->tyenv);
sewardj35439212004-07-14 22:36:10 +00001356 vex_printf("\n");
sewardjd7cb8532004-08-17 23:59:23 +00001357 for (i = 0; i < bb->stmts_used; i++) {
sewardjd2445f62005-03-21 00:15:53 +00001358 vex_printf( " ");
1359 ppIRStmt(bb->stmts[i]);
sewardj35421a32004-07-05 13:12:34 +00001360 vex_printf( "\n");
sewardjec6ad592004-06-20 12:26:53 +00001361 }
sewardjc6f970f2012-04-02 21:54:49 +00001362 vex_printf( " PUT(%d) = ", bb->offsIP );
sewardje539a402004-07-14 18:24:17 +00001363 ppIRExpr( bb->next );
sewardjc6f970f2012-04-02 21:54:49 +00001364 vex_printf( "; exit-");
1365 ppIRJumpKind(bb->jumpkind);
sewardj35439212004-07-14 22:36:10 +00001366 vex_printf( "\n}\n");
sewardjec6ad592004-06-20 12:26:53 +00001367}
1368
1369
1370/*---------------------------------------------------------------*/
1371/*--- Constructors ---*/
1372/*---------------------------------------------------------------*/
1373
sewardjc97096c2004-06-30 09:28:04 +00001374
1375/* Constructors -- IRConst */
1376
sewardjba999312004-11-15 15:21:17 +00001377IRConst* IRConst_U1 ( Bool bit )
sewardjb8e75862004-08-19 17:58:45 +00001378{
1379 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
sewardjba999312004-11-15 15:21:17 +00001380 c->tag = Ico_U1;
1381 c->Ico.U1 = bit;
sewardj4b861de2004-11-03 15:24:42 +00001382 /* call me paranoid; I don't care :-) */
1383 vassert(bit == False || bit == True);
sewardjb8e75862004-08-19 17:58:45 +00001384 return c;
1385}
sewardjc97096c2004-06-30 09:28:04 +00001386IRConst* IRConst_U8 ( UChar u8 )
1387{
sewardj35421a32004-07-05 13:12:34 +00001388 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
sewardjc97096c2004-06-30 09:28:04 +00001389 c->tag = Ico_U8;
1390 c->Ico.U8 = u8;
1391 return c;
1392}
1393IRConst* IRConst_U16 ( UShort u16 )
1394{
sewardj35421a32004-07-05 13:12:34 +00001395 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
sewardjc97096c2004-06-30 09:28:04 +00001396 c->tag = Ico_U16;
1397 c->Ico.U16 = u16;
1398 return c;
1399}
1400IRConst* IRConst_U32 ( UInt u32 )
1401{
sewardj35421a32004-07-05 13:12:34 +00001402 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
sewardjc97096c2004-06-30 09:28:04 +00001403 c->tag = Ico_U32;
1404 c->Ico.U32 = u32;
1405 return c;
1406}
1407IRConst* IRConst_U64 ( ULong u64 )
1408{
sewardj35421a32004-07-05 13:12:34 +00001409 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
sewardjc97096c2004-06-30 09:28:04 +00001410 c->tag = Ico_U64;
1411 c->Ico.U64 = u64;
1412 return c;
1413}
sewardj2019a972011-03-07 16:04:07 +00001414IRConst* IRConst_F32 ( Float f32 )
1415{
1416 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
1417 c->tag = Ico_F32;
1418 c->Ico.F32 = f32;
1419 return c;
1420}
1421IRConst* IRConst_F32i ( UInt f32i )
1422{
1423 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
1424 c->tag = Ico_F32i;
1425 c->Ico.F32i = f32i;
1426 return c;
1427}
sewardja58ea662004-08-15 03:12:41 +00001428IRConst* IRConst_F64 ( Double f64 )
1429{
1430 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
1431 c->tag = Ico_F64;
1432 c->Ico.F64 = f64;
1433 return c;
1434}
sewardj17442fe2004-09-20 14:54:28 +00001435IRConst* IRConst_F64i ( ULong f64i )
sewardj207557a2004-08-27 12:00:18 +00001436{
sewardj17442fe2004-09-20 14:54:28 +00001437 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
1438 c->tag = Ico_F64i;
1439 c->Ico.F64i = f64i;
sewardj207557a2004-08-27 12:00:18 +00001440 return c;
1441}
sewardj1e6ad742004-12-02 16:16:11 +00001442IRConst* IRConst_V128 ( UShort con )
1443{
1444 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
1445 c->tag = Ico_V128;
1446 c->Ico.V128 = con;
1447 return c;
1448}
sewardj37a505b2012-06-29 15:28:24 +00001449IRConst* IRConst_V256 ( UInt con )
1450{
1451 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
1452 c->tag = Ico_V256;
1453 c->Ico.V256 = con;
1454 return c;
1455}
sewardjc97096c2004-06-30 09:28:04 +00001456
sewardj8ea867b2004-10-30 19:03:02 +00001457/* Constructors -- IRCallee */
1458
sewardj2d49b432005-02-01 00:37:06 +00001459IRCallee* mkIRCallee ( Int regparms, HChar* name, void* addr )
sewardj8ea867b2004-10-30 19:03:02 +00001460{
1461 IRCallee* ce = LibVEX_Alloc(sizeof(IRCallee));
sewardj77352542004-10-30 20:39:01 +00001462 ce->regparms = regparms;
1463 ce->name = name;
1464 ce->addr = addr;
sewardj43c56462004-11-06 12:17:57 +00001465 ce->mcx_mask = 0;
sewardj77352542004-10-30 20:39:01 +00001466 vassert(regparms >= 0 && regparms <= 3);
sewardj8ea867b2004-10-30 19:03:02 +00001467 vassert(name != NULL);
1468 vassert(addr != 0);
1469 return ce;
1470}
1471
1472
sewardjdd40fdf2006-12-24 02:20:24 +00001473/* Constructors -- IRRegArray */
sewardje3d0d2e2004-06-27 10:42:44 +00001474
sewardjdd40fdf2006-12-24 02:20:24 +00001475IRRegArray* mkIRRegArray ( Int base, IRType elemTy, Int nElems )
sewardj2d3f77c2004-09-22 23:49:09 +00001476{
sewardjdd40fdf2006-12-24 02:20:24 +00001477 IRRegArray* arr = LibVEX_Alloc(sizeof(IRRegArray));
1478 arr->base = base;
1479 arr->elemTy = elemTy;
1480 arr->nElems = nElems;
sewardj2d3f77c2004-09-22 23:49:09 +00001481 vassert(!(arr->base < 0 || arr->base > 10000 /* somewhat arbitrary */));
sewardjba999312004-11-15 15:21:17 +00001482 vassert(!(arr->elemTy == Ity_I1));
sewardj2d3f77c2004-09-22 23:49:09 +00001483 vassert(!(arr->nElems <= 0 || arr->nElems > 500 /* somewhat arbitrary */));
1484 return arr;
1485}
1486
1487
1488/* Constructors -- IRExpr */
1489
sewardj443cd9d2004-07-18 23:06:45 +00001490IRExpr* IRExpr_Binder ( Int binder ) {
1491 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
1492 e->tag = Iex_Binder;
1493 e->Iex.Binder.binder = binder;
1494 return e;
1495}
sewardjfbcaf332004-07-08 01:46:01 +00001496IRExpr* IRExpr_Get ( Int off, IRType ty ) {
sewardj35421a32004-07-05 13:12:34 +00001497 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
sewardje3d0d2e2004-06-27 10:42:44 +00001498 e->tag = Iex_Get;
1499 e->Iex.Get.offset = off;
sewardjfbcaf332004-07-08 01:46:01 +00001500 e->Iex.Get.ty = ty;
sewardje3d0d2e2004-06-27 10:42:44 +00001501 return e;
1502}
sewardjdd40fdf2006-12-24 02:20:24 +00001503IRExpr* IRExpr_GetI ( IRRegArray* descr, IRExpr* ix, Int bias ) {
sewardj2d3f77c2004-09-22 23:49:09 +00001504 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
1505 e->tag = Iex_GetI;
1506 e->Iex.GetI.descr = descr;
sewardjeeac8412004-11-02 00:26:55 +00001507 e->Iex.GetI.ix = ix;
sewardj2d3f77c2004-09-22 23:49:09 +00001508 e->Iex.GetI.bias = bias;
sewardjd1725d12004-08-12 20:46:53 +00001509 return e;
1510}
sewardjdd40fdf2006-12-24 02:20:24 +00001511IRExpr* IRExpr_RdTmp ( IRTemp tmp ) {
1512 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
1513 e->tag = Iex_RdTmp;
1514 e->Iex.RdTmp.tmp = tmp;
sewardje3d0d2e2004-06-27 10:42:44 +00001515 return e;
1516}
sewardj40c80262006-02-08 19:30:46 +00001517IRExpr* IRExpr_Qop ( IROp op, IRExpr* arg1, IRExpr* arg2,
1518 IRExpr* arg3, IRExpr* arg4 ) {
1519 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
florian96d7cc32012-06-01 20:41:24 +00001520 IRQop* qop = LibVEX_Alloc(sizeof(IRQop));
1521 qop->op = op;
1522 qop->arg1 = arg1;
1523 qop->arg2 = arg2;
1524 qop->arg3 = arg3;
1525 qop->arg4 = arg4;
sewardj40c80262006-02-08 19:30:46 +00001526 e->tag = Iex_Qop;
florian96d7cc32012-06-01 20:41:24 +00001527 e->Iex.Qop.details = qop;
sewardj40c80262006-02-08 19:30:46 +00001528 return e;
1529}
sewardjb183b852006-02-03 16:08:03 +00001530IRExpr* IRExpr_Triop ( IROp op, IRExpr* arg1,
1531 IRExpr* arg2, IRExpr* arg3 ) {
florian420bfa92012-06-02 20:29:22 +00001532 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
1533 IRTriop* triop = LibVEX_Alloc(sizeof(IRTriop));
1534 triop->op = op;
1535 triop->arg1 = arg1;
1536 triop->arg2 = arg2;
1537 triop->arg3 = arg3;
sewardjb183b852006-02-03 16:08:03 +00001538 e->tag = Iex_Triop;
florian420bfa92012-06-02 20:29:22 +00001539 e->Iex.Triop.details = triop;
sewardjb183b852006-02-03 16:08:03 +00001540 return e;
1541}
sewardjc97096c2004-06-30 09:28:04 +00001542IRExpr* IRExpr_Binop ( IROp op, IRExpr* arg1, IRExpr* arg2 ) {
sewardj35421a32004-07-05 13:12:34 +00001543 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
sewardje3d0d2e2004-06-27 10:42:44 +00001544 e->tag = Iex_Binop;
1545 e->Iex.Binop.op = op;
1546 e->Iex.Binop.arg1 = arg1;
1547 e->Iex.Binop.arg2 = arg2;
1548 return e;
1549}
sewardjc97096c2004-06-30 09:28:04 +00001550IRExpr* IRExpr_Unop ( IROp op, IRExpr* arg ) {
sewardj35421a32004-07-05 13:12:34 +00001551 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
sewardje3d0d2e2004-06-27 10:42:44 +00001552 e->tag = Iex_Unop;
1553 e->Iex.Unop.op = op;
1554 e->Iex.Unop.arg = arg;
1555 return e;
1556}
sewardje768e922009-11-26 17:17:37 +00001557IRExpr* IRExpr_Load ( IREndness end, IRType ty, IRExpr* addr ) {
sewardj35421a32004-07-05 13:12:34 +00001558 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
sewardjaf1ceca2005-06-30 23:31:27 +00001559 e->tag = Iex_Load;
1560 e->Iex.Load.end = end;
1561 e->Iex.Load.ty = ty;
1562 e->Iex.Load.addr = addr;
1563 vassert(end == Iend_LE || end == Iend_BE);
sewardje3d0d2e2004-06-27 10:42:44 +00001564 return e;
1565}
sewardjc97096c2004-06-30 09:28:04 +00001566IRExpr* IRExpr_Const ( IRConst* con ) {
sewardj35421a32004-07-05 13:12:34 +00001567 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
sewardje3d0d2e2004-06-27 10:42:44 +00001568 e->tag = Iex_Const;
1569 e->Iex.Const.con = con;
1570 return e;
sewardjec6ad592004-06-20 12:26:53 +00001571}
sewardj8ea867b2004-10-30 19:03:02 +00001572IRExpr* IRExpr_CCall ( IRCallee* cee, IRType retty, IRExpr** args ) {
sewardje87b4842004-07-10 12:23:30 +00001573 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
1574 e->tag = Iex_CCall;
sewardj8ea867b2004-10-30 19:03:02 +00001575 e->Iex.CCall.cee = cee;
sewardje87b4842004-07-10 12:23:30 +00001576 e->Iex.CCall.retty = retty;
1577 e->Iex.CCall.args = args;
1578 return e;
1579}
sewardj4042c7e2004-07-18 01:28:30 +00001580IRExpr* IRExpr_Mux0X ( IRExpr* cond, IRExpr* expr0, IRExpr* exprX ) {
sewardjeeb9ef82004-07-15 12:39:03 +00001581 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
sewardj4042c7e2004-07-18 01:28:30 +00001582 e->tag = Iex_Mux0X;
1583 e->Iex.Mux0X.cond = cond;
1584 e->Iex.Mux0X.expr0 = expr0;
1585 e->Iex.Mux0X.exprX = exprX;
sewardjeeb9ef82004-07-15 12:39:03 +00001586 return e;
1587}
sewardjec6ad592004-06-20 12:26:53 +00001588
sewardjec6ad592004-06-20 12:26:53 +00001589
sewardjc5fc7aa2004-10-27 23:00:55 +00001590/* Constructors for NULL-terminated IRExpr expression vectors,
1591 suitable for use as arg lists in clean/dirty helper calls. */
1592
1593IRExpr** mkIRExprVec_0 ( void ) {
1594 IRExpr** vec = LibVEX_Alloc(1 * sizeof(IRExpr*));
1595 vec[0] = NULL;
1596 return vec;
1597}
1598IRExpr** mkIRExprVec_1 ( IRExpr* arg1 ) {
1599 IRExpr** vec = LibVEX_Alloc(2 * sizeof(IRExpr*));
1600 vec[0] = arg1;
1601 vec[1] = NULL;
1602 return vec;
1603}
1604IRExpr** mkIRExprVec_2 ( IRExpr* arg1, IRExpr* arg2 ) {
1605 IRExpr** vec = LibVEX_Alloc(3 * sizeof(IRExpr*));
1606 vec[0] = arg1;
1607 vec[1] = arg2;
1608 vec[2] = NULL;
1609 return vec;
1610}
sewardjf9655262004-10-31 20:02:16 +00001611IRExpr** mkIRExprVec_3 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3 ) {
1612 IRExpr** vec = LibVEX_Alloc(4 * sizeof(IRExpr*));
1613 vec[0] = arg1;
1614 vec[1] = arg2;
1615 vec[2] = arg3;
1616 vec[3] = NULL;
1617 return vec;
1618}
sewardj78ec32b2007-01-08 05:09:55 +00001619IRExpr** mkIRExprVec_4 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3,
1620 IRExpr* arg4 ) {
sewardjf9655262004-10-31 20:02:16 +00001621 IRExpr** vec = LibVEX_Alloc(5 * sizeof(IRExpr*));
1622 vec[0] = arg1;
1623 vec[1] = arg2;
1624 vec[2] = arg3;
1625 vec[3] = arg4;
1626 vec[4] = NULL;
1627 return vec;
1628}
sewardj78ec32b2007-01-08 05:09:55 +00001629IRExpr** mkIRExprVec_5 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3,
1630 IRExpr* arg4, IRExpr* arg5 ) {
sewardjf32c67d2004-11-08 13:10:44 +00001631 IRExpr** vec = LibVEX_Alloc(6 * sizeof(IRExpr*));
1632 vec[0] = arg1;
1633 vec[1] = arg2;
1634 vec[2] = arg3;
1635 vec[3] = arg4;
1636 vec[4] = arg5;
1637 vec[5] = NULL;
1638 return vec;
1639}
sewardj78ec32b2007-01-08 05:09:55 +00001640IRExpr** mkIRExprVec_6 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3,
1641 IRExpr* arg4, IRExpr* arg5, IRExpr* arg6 ) {
1642 IRExpr** vec = LibVEX_Alloc(7 * sizeof(IRExpr*));
1643 vec[0] = arg1;
1644 vec[1] = arg2;
1645 vec[2] = arg3;
1646 vec[3] = arg4;
1647 vec[4] = arg5;
1648 vec[5] = arg6;
1649 vec[6] = NULL;
1650 return vec;
1651}
1652IRExpr** mkIRExprVec_7 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3,
1653 IRExpr* arg4, IRExpr* arg5, IRExpr* arg6,
1654 IRExpr* arg7 ) {
1655 IRExpr** vec = LibVEX_Alloc(8 * sizeof(IRExpr*));
1656 vec[0] = arg1;
1657 vec[1] = arg2;
1658 vec[2] = arg3;
1659 vec[3] = arg4;
1660 vec[4] = arg5;
1661 vec[5] = arg6;
1662 vec[6] = arg7;
1663 vec[7] = NULL;
1664 return vec;
1665}
sewardj2fdd4162010-08-22 12:59:02 +00001666IRExpr** mkIRExprVec_8 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3,
1667 IRExpr* arg4, IRExpr* arg5, IRExpr* arg6,
1668 IRExpr* arg7, IRExpr* arg8 ) {
1669 IRExpr** vec = LibVEX_Alloc(9 * sizeof(IRExpr*));
1670 vec[0] = arg1;
1671 vec[1] = arg2;
1672 vec[2] = arg3;
1673 vec[3] = arg4;
1674 vec[4] = arg5;
1675 vec[5] = arg6;
1676 vec[6] = arg7;
1677 vec[7] = arg8;
1678 vec[8] = NULL;
1679 return vec;
1680}
sewardjc5fc7aa2004-10-27 23:00:55 +00001681
1682
sewardj17442fe2004-09-20 14:54:28 +00001683/* Constructors -- IRDirty */
1684
sewardjc5fc7aa2004-10-27 23:00:55 +00001685IRDirty* emptyIRDirty ( void ) {
sewardj17442fe2004-09-20 14:54:28 +00001686 IRDirty* d = LibVEX_Alloc(sizeof(IRDirty));
sewardj8ea867b2004-10-30 19:03:02 +00001687 d->cee = NULL;
sewardjb8385d82004-11-02 01:34:15 +00001688 d->guard = NULL;
sewardj17442fe2004-09-20 14:54:28 +00001689 d->args = NULL;
sewardj92d168d2004-11-15 14:22:12 +00001690 d->tmp = IRTemp_INVALID;
sewardj17442fe2004-09-20 14:54:28 +00001691 d->mFx = Ifx_None;
1692 d->mAddr = NULL;
1693 d->mSize = 0;
sewardjc5fc7aa2004-10-27 23:00:55 +00001694 d->needsBBP = False;
sewardj17442fe2004-09-20 14:54:28 +00001695 d->nFxState = 0;
1696 return d;
1697}
1698
1699
sewardje9d8a262009-07-01 08:06:34 +00001700/* Constructors -- IRCAS */
1701
1702IRCAS* mkIRCAS ( IRTemp oldHi, IRTemp oldLo,
1703 IREndness end, IRExpr* addr,
1704 IRExpr* expdHi, IRExpr* expdLo,
1705 IRExpr* dataHi, IRExpr* dataLo ) {
1706 IRCAS* cas = LibVEX_Alloc(sizeof(IRCAS));
1707 cas->oldHi = oldHi;
1708 cas->oldLo = oldLo;
1709 cas->end = end;
1710 cas->addr = addr;
1711 cas->expdHi = expdHi;
1712 cas->expdLo = expdLo;
1713 cas->dataHi = dataHi;
1714 cas->dataLo = dataLo;
1715 return cas;
1716}
1717
1718
floriand6f38b32012-05-31 15:46:18 +00001719/* Constructors -- IRPutI */
1720
1721IRPutI* mkIRPutI ( IRRegArray* descr, IRExpr* ix,
1722 Int bias, IRExpr* data )
1723{
1724 IRPutI* puti = LibVEX_Alloc(sizeof(IRPutI));
1725 puti->descr = descr;
1726 puti->ix = ix;
1727 puti->bias = bias;
1728 puti->data = data;
1729 return puti;
1730}
1731
1732
sewardjec6ad592004-06-20 12:26:53 +00001733/* Constructors -- IRStmt */
sewardje3d0d2e2004-06-27 10:42:44 +00001734
sewardjd2445f62005-03-21 00:15:53 +00001735IRStmt* IRStmt_NoOp ( void )
1736{
1737 /* Just use a single static closure. */
1738 static IRStmt static_closure;
1739 static_closure.tag = Ist_NoOp;
1740 return &static_closure;
1741}
sewardj2f10aa62011-05-27 13:20:56 +00001742IRStmt* IRStmt_IMark ( Addr64 addr, Int len, UChar delta ) {
1743 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
1744 s->tag = Ist_IMark;
1745 s->Ist.IMark.addr = addr;
1746 s->Ist.IMark.len = len;
1747 s->Ist.IMark.delta = delta;
sewardjf1689312005-03-16 18:19:10 +00001748 return s;
1749}
sewardj478646f2008-05-01 20:13:04 +00001750IRStmt* IRStmt_AbiHint ( IRExpr* base, Int len, IRExpr* nia ) {
sewardj5a9ffab2005-05-12 17:55:01 +00001751 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
1752 s->tag = Ist_AbiHint;
1753 s->Ist.AbiHint.base = base;
1754 s->Ist.AbiHint.len = len;
sewardj478646f2008-05-01 20:13:04 +00001755 s->Ist.AbiHint.nia = nia;
sewardj5a9ffab2005-05-12 17:55:01 +00001756 return s;
1757}
sewardj6d076362004-09-23 11:06:17 +00001758IRStmt* IRStmt_Put ( Int off, IRExpr* data ) {
sewardj35421a32004-07-05 13:12:34 +00001759 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
sewardje3d0d2e2004-06-27 10:42:44 +00001760 s->tag = Ist_Put;
1761 s->Ist.Put.offset = off;
sewardj6d076362004-09-23 11:06:17 +00001762 s->Ist.Put.data = data;
sewardje3d0d2e2004-06-27 10:42:44 +00001763 return s;
sewardjec6ad592004-06-20 12:26:53 +00001764}
floriand6f38b32012-05-31 15:46:18 +00001765IRStmt* IRStmt_PutI ( IRPutI* details ) {
1766 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
1767 s->tag = Ist_PutI;
1768 s->Ist.PutI.details = details;
sewardjd1725d12004-08-12 20:46:53 +00001769 return s;
1770}
sewardjdd40fdf2006-12-24 02:20:24 +00001771IRStmt* IRStmt_WrTmp ( IRTemp tmp, IRExpr* data ) {
1772 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
1773 s->tag = Ist_WrTmp;
1774 s->Ist.WrTmp.tmp = tmp;
1775 s->Ist.WrTmp.data = data;
sewardje3d0d2e2004-06-27 10:42:44 +00001776 return s;
sewardjec6ad592004-06-20 12:26:53 +00001777}
sewardje768e922009-11-26 17:17:37 +00001778IRStmt* IRStmt_Store ( IREndness end, IRExpr* addr, IRExpr* data ) {
1779 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
1780 s->tag = Ist_Store;
1781 s->Ist.Store.end = end;
1782 s->Ist.Store.addr = addr;
1783 s->Ist.Store.data = data;
sewardjaf1ceca2005-06-30 23:31:27 +00001784 vassert(end == Iend_LE || end == Iend_BE);
sewardje3d0d2e2004-06-27 10:42:44 +00001785 return s;
sewardjec6ad592004-06-20 12:26:53 +00001786}
sewardje9d8a262009-07-01 08:06:34 +00001787IRStmt* IRStmt_CAS ( IRCAS* cas ) {
1788 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
1789 s->tag = Ist_CAS;
1790 s->Ist.CAS.details = cas;
1791 return s;
1792}
sewardje768e922009-11-26 17:17:37 +00001793IRStmt* IRStmt_LLSC ( IREndness end,
1794 IRTemp result, IRExpr* addr, IRExpr* storedata ) {
1795 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
1796 s->tag = Ist_LLSC;
1797 s->Ist.LLSC.end = end;
1798 s->Ist.LLSC.result = result;
1799 s->Ist.LLSC.addr = addr;
1800 s->Ist.LLSC.storedata = storedata;
1801 return s;
1802}
sewardj17442fe2004-09-20 14:54:28 +00001803IRStmt* IRStmt_Dirty ( IRDirty* d )
1804{
1805 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
1806 s->tag = Ist_Dirty;
1807 s->Ist.Dirty.details = d;
1808 return s;
1809}
sewardjc4356f02007-11-09 21:15:04 +00001810IRStmt* IRStmt_MBE ( IRMBusEvent event )
sewardj3e838932005-01-07 12:09:15 +00001811{
sewardjc4356f02007-11-09 21:15:04 +00001812 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
1813 s->tag = Ist_MBE;
1814 s->Ist.MBE.event = event;
1815 return s;
sewardj3e838932005-01-07 12:09:15 +00001816}
sewardjc6f970f2012-04-02 21:54:49 +00001817IRStmt* IRStmt_Exit ( IRExpr* guard, IRJumpKind jk, IRConst* dst,
1818 Int offsIP ) {
1819 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
1820 s->tag = Ist_Exit;
1821 s->Ist.Exit.guard = guard;
1822 s->Ist.Exit.jk = jk;
1823 s->Ist.Exit.dst = dst;
1824 s->Ist.Exit.offsIP = offsIP;
sewardj64e1d652004-07-12 14:00:46 +00001825 return s;
1826}
sewardje3d0d2e2004-06-27 10:42:44 +00001827
sewardj695cff92004-10-13 14:50:14 +00001828
1829/* Constructors -- IRTypeEnv */
1830
1831IRTypeEnv* emptyIRTypeEnv ( void )
1832{
1833 IRTypeEnv* env = LibVEX_Alloc(sizeof(IRTypeEnv));
1834 env->types = LibVEX_Alloc(8 * sizeof(IRType));
1835 env->types_size = 8;
1836 env->types_used = 0;
1837 return env;
1838}
1839
1840
sewardjdd40fdf2006-12-24 02:20:24 +00001841/* Constructors -- IRSB */
sewardje3d0d2e2004-06-27 10:42:44 +00001842
sewardjdd40fdf2006-12-24 02:20:24 +00001843IRSB* emptyIRSB ( void )
sewardjd7cb8532004-08-17 23:59:23 +00001844{
sewardjdd40fdf2006-12-24 02:20:24 +00001845 IRSB* bb = LibVEX_Alloc(sizeof(IRSB));
sewardjd7cb8532004-08-17 23:59:23 +00001846 bb->tyenv = emptyIRTypeEnv();
1847 bb->stmts_used = 0;
1848 bb->stmts_size = 8;
1849 bb->stmts = LibVEX_Alloc(bb->stmts_size * sizeof(IRStmt*));
1850 bb->next = NULL;
1851 bb->jumpkind = Ijk_Boring;
sewardjc6f970f2012-04-02 21:54:49 +00001852 bb->offsIP = 0;
sewardje3d0d2e2004-06-27 10:42:44 +00001853 return bb;
sewardjec6ad592004-06-20 12:26:53 +00001854}
1855
sewardj695cff92004-10-13 14:50:14 +00001856
1857/*---------------------------------------------------------------*/
1858/*--- (Deep) copy constructors. These make complete copies ---*/
1859/*--- the original, which can be modified without affecting ---*/
1860/*--- the original. ---*/
1861/*---------------------------------------------------------------*/
1862
1863/* Copying IR Expr vectors (for call args). */
1864
1865/* Shallow copy of an IRExpr vector */
1866
sewardjdd40fdf2006-12-24 02:20:24 +00001867IRExpr** shallowCopyIRExprVec ( IRExpr** vec )
sewardjd7cb8532004-08-17 23:59:23 +00001868{
sewardj695cff92004-10-13 14:50:14 +00001869 Int i;
1870 IRExpr** newvec;
1871 for (i = 0; vec[i]; i++)
1872 ;
1873 newvec = LibVEX_Alloc((i+1)*sizeof(IRExpr*));
1874 for (i = 0; vec[i]; i++)
1875 newvec[i] = vec[i];
1876 newvec[i] = NULL;
1877 return newvec;
1878}
1879
1880/* Deep copy of an IRExpr vector */
1881
sewardjdd40fdf2006-12-24 02:20:24 +00001882IRExpr** deepCopyIRExprVec ( IRExpr** vec )
sewardj695cff92004-10-13 14:50:14 +00001883{
1884 Int i;
sewardjdd40fdf2006-12-24 02:20:24 +00001885 IRExpr** newvec = shallowCopyIRExprVec( vec );
sewardj695cff92004-10-13 14:50:14 +00001886 for (i = 0; newvec[i]; i++)
sewardjdd40fdf2006-12-24 02:20:24 +00001887 newvec[i] = deepCopyIRExpr(newvec[i]);
sewardj695cff92004-10-13 14:50:14 +00001888 return newvec;
1889}
1890
1891/* Deep copy constructors for all heap-allocated IR types follow. */
1892
sewardjdd40fdf2006-12-24 02:20:24 +00001893IRConst* deepCopyIRConst ( IRConst* c )
sewardj695cff92004-10-13 14:50:14 +00001894{
1895 switch (c->tag) {
sewardjba999312004-11-15 15:21:17 +00001896 case Ico_U1: return IRConst_U1(c->Ico.U1);
sewardj695cff92004-10-13 14:50:14 +00001897 case Ico_U8: return IRConst_U8(c->Ico.U8);
1898 case Ico_U16: return IRConst_U16(c->Ico.U16);
1899 case Ico_U32: return IRConst_U32(c->Ico.U32);
1900 case Ico_U64: return IRConst_U64(c->Ico.U64);
sewardj2019a972011-03-07 16:04:07 +00001901 case Ico_F32: return IRConst_F32(c->Ico.F32);
1902 case Ico_F32i: return IRConst_F32i(c->Ico.F32i);
sewardj695cff92004-10-13 14:50:14 +00001903 case Ico_F64: return IRConst_F64(c->Ico.F64);
1904 case Ico_F64i: return IRConst_F64i(c->Ico.F64i);
sewardj1e6ad742004-12-02 16:16:11 +00001905 case Ico_V128: return IRConst_V128(c->Ico.V128);
sewardjdd40fdf2006-12-24 02:20:24 +00001906 default: vpanic("deepCopyIRConst");
sewardjd7cb8532004-08-17 23:59:23 +00001907 }
sewardj695cff92004-10-13 14:50:14 +00001908}
1909
sewardjdd40fdf2006-12-24 02:20:24 +00001910IRCallee* deepCopyIRCallee ( IRCallee* ce )
sewardj8ea867b2004-10-30 19:03:02 +00001911{
sewardj43c56462004-11-06 12:17:57 +00001912 IRCallee* ce2 = mkIRCallee(ce->regparms, ce->name, ce->addr);
1913 ce2->mcx_mask = ce->mcx_mask;
1914 return ce2;
sewardj8ea867b2004-10-30 19:03:02 +00001915}
1916
sewardjdd40fdf2006-12-24 02:20:24 +00001917IRRegArray* deepCopyIRRegArray ( IRRegArray* d )
sewardj695cff92004-10-13 14:50:14 +00001918{
sewardjdd40fdf2006-12-24 02:20:24 +00001919 return mkIRRegArray(d->base, d->elemTy, d->nElems);
sewardj695cff92004-10-13 14:50:14 +00001920}
1921
sewardjdd40fdf2006-12-24 02:20:24 +00001922IRExpr* deepCopyIRExpr ( IRExpr* e )
sewardj695cff92004-10-13 14:50:14 +00001923{
1924 switch (e->tag) {
1925 case Iex_Get:
1926 return IRExpr_Get(e->Iex.Get.offset, e->Iex.Get.ty);
1927 case Iex_GetI:
sewardjdd40fdf2006-12-24 02:20:24 +00001928 return IRExpr_GetI(deepCopyIRRegArray(e->Iex.GetI.descr),
1929 deepCopyIRExpr(e->Iex.GetI.ix),
sewardj695cff92004-10-13 14:50:14 +00001930 e->Iex.GetI.bias);
sewardjdd40fdf2006-12-24 02:20:24 +00001931 case Iex_RdTmp:
1932 return IRExpr_RdTmp(e->Iex.RdTmp.tmp);
florian96d7cc32012-06-01 20:41:24 +00001933 case Iex_Qop: {
1934 IRQop* qop = e->Iex.Qop.details;
1935
1936 return IRExpr_Qop(qop->op,
1937 deepCopyIRExpr(qop->arg1),
1938 deepCopyIRExpr(qop->arg2),
1939 deepCopyIRExpr(qop->arg3),
1940 deepCopyIRExpr(qop->arg4));
1941 }
florian420bfa92012-06-02 20:29:22 +00001942 case Iex_Triop: {
1943 IRTriop *triop = e->Iex.Triop.details;
1944
1945 return IRExpr_Triop(triop->op,
1946 deepCopyIRExpr(triop->arg1),
1947 deepCopyIRExpr(triop->arg2),
1948 deepCopyIRExpr(triop->arg3));
1949 }
sewardj695cff92004-10-13 14:50:14 +00001950 case Iex_Binop:
1951 return IRExpr_Binop(e->Iex.Binop.op,
sewardjdd40fdf2006-12-24 02:20:24 +00001952 deepCopyIRExpr(e->Iex.Binop.arg1),
1953 deepCopyIRExpr(e->Iex.Binop.arg2));
sewardj695cff92004-10-13 14:50:14 +00001954 case Iex_Unop:
1955 return IRExpr_Unop(e->Iex.Unop.op,
sewardjdd40fdf2006-12-24 02:20:24 +00001956 deepCopyIRExpr(e->Iex.Unop.arg));
sewardjaf1ceca2005-06-30 23:31:27 +00001957 case Iex_Load:
sewardje768e922009-11-26 17:17:37 +00001958 return IRExpr_Load(e->Iex.Load.end,
sewardjaf1ceca2005-06-30 23:31:27 +00001959 e->Iex.Load.ty,
sewardjdd40fdf2006-12-24 02:20:24 +00001960 deepCopyIRExpr(e->Iex.Load.addr));
sewardj695cff92004-10-13 14:50:14 +00001961 case Iex_Const:
sewardjdd40fdf2006-12-24 02:20:24 +00001962 return IRExpr_Const(deepCopyIRConst(e->Iex.Const.con));
sewardj695cff92004-10-13 14:50:14 +00001963 case Iex_CCall:
sewardjdd40fdf2006-12-24 02:20:24 +00001964 return IRExpr_CCall(deepCopyIRCallee(e->Iex.CCall.cee),
sewardj695cff92004-10-13 14:50:14 +00001965 e->Iex.CCall.retty,
sewardjdd40fdf2006-12-24 02:20:24 +00001966 deepCopyIRExprVec(e->Iex.CCall.args));
sewardj695cff92004-10-13 14:50:14 +00001967
1968 case Iex_Mux0X:
sewardjdd40fdf2006-12-24 02:20:24 +00001969 return IRExpr_Mux0X(deepCopyIRExpr(e->Iex.Mux0X.cond),
1970 deepCopyIRExpr(e->Iex.Mux0X.expr0),
1971 deepCopyIRExpr(e->Iex.Mux0X.exprX));
sewardj695cff92004-10-13 14:50:14 +00001972 default:
sewardjdd40fdf2006-12-24 02:20:24 +00001973 vpanic("deepCopyIRExpr");
sewardj695cff92004-10-13 14:50:14 +00001974 }
1975}
1976
sewardjdd40fdf2006-12-24 02:20:24 +00001977IRDirty* deepCopyIRDirty ( IRDirty* d )
sewardj695cff92004-10-13 14:50:14 +00001978{
1979 Int i;
1980 IRDirty* d2 = emptyIRDirty();
sewardjdd40fdf2006-12-24 02:20:24 +00001981 d2->cee = deepCopyIRCallee(d->cee);
1982 d2->guard = deepCopyIRExpr(d->guard);
1983 d2->args = deepCopyIRExprVec(d->args);
sewardj695cff92004-10-13 14:50:14 +00001984 d2->tmp = d->tmp;
1985 d2->mFx = d->mFx;
sewardjdd40fdf2006-12-24 02:20:24 +00001986 d2->mAddr = d->mAddr==NULL ? NULL : deepCopyIRExpr(d->mAddr);
sewardj695cff92004-10-13 14:50:14 +00001987 d2->mSize = d->mSize;
sewardjc5fc7aa2004-10-27 23:00:55 +00001988 d2->needsBBP = d->needsBBP;
sewardj695cff92004-10-13 14:50:14 +00001989 d2->nFxState = d->nFxState;
1990 for (i = 0; i < d2->nFxState; i++)
1991 d2->fxState[i] = d->fxState[i];
1992 return d2;
1993}
1994
sewardje9d8a262009-07-01 08:06:34 +00001995IRCAS* deepCopyIRCAS ( IRCAS* cas )
1996{
1997 return mkIRCAS( cas->oldHi, cas->oldLo, cas->end,
1998 deepCopyIRExpr(cas->addr),
sewardj05a2c382009-07-17 16:34:30 +00001999 cas->expdHi==NULL ? NULL : deepCopyIRExpr(cas->expdHi),
sewardje9d8a262009-07-01 08:06:34 +00002000 deepCopyIRExpr(cas->expdLo),
sewardj05a2c382009-07-17 16:34:30 +00002001 cas->dataHi==NULL ? NULL : deepCopyIRExpr(cas->dataHi),
sewardje9d8a262009-07-01 08:06:34 +00002002 deepCopyIRExpr(cas->dataLo) );
2003}
2004
floriand6f38b32012-05-31 15:46:18 +00002005IRPutI* deepCopyIRPutI ( IRPutI * puti )
2006{
2007 return mkIRPutI( deepCopyIRRegArray(puti->descr),
2008 deepCopyIRExpr(puti->ix),
2009 puti->bias,
2010 deepCopyIRExpr(puti->data));
2011}
2012
sewardjdd40fdf2006-12-24 02:20:24 +00002013IRStmt* deepCopyIRStmt ( IRStmt* s )
sewardj695cff92004-10-13 14:50:14 +00002014{
2015 switch (s->tag) {
sewardjd2445f62005-03-21 00:15:53 +00002016 case Ist_NoOp:
2017 return IRStmt_NoOp();
sewardj5a9ffab2005-05-12 17:55:01 +00002018 case Ist_AbiHint:
sewardjdd40fdf2006-12-24 02:20:24 +00002019 return IRStmt_AbiHint(deepCopyIRExpr(s->Ist.AbiHint.base),
sewardj478646f2008-05-01 20:13:04 +00002020 s->Ist.AbiHint.len,
2021 deepCopyIRExpr(s->Ist.AbiHint.nia));
sewardjf1689312005-03-16 18:19:10 +00002022 case Ist_IMark:
sewardj2f10aa62011-05-27 13:20:56 +00002023 return IRStmt_IMark(s->Ist.IMark.addr,
2024 s->Ist.IMark.len,
2025 s->Ist.IMark.delta);
sewardj695cff92004-10-13 14:50:14 +00002026 case Ist_Put:
2027 return IRStmt_Put(s->Ist.Put.offset,
sewardjdd40fdf2006-12-24 02:20:24 +00002028 deepCopyIRExpr(s->Ist.Put.data));
sewardj695cff92004-10-13 14:50:14 +00002029 case Ist_PutI:
floriand6f38b32012-05-31 15:46:18 +00002030 return IRStmt_PutI(deepCopyIRPutI(s->Ist.PutI.details));
sewardjdd40fdf2006-12-24 02:20:24 +00002031 case Ist_WrTmp:
2032 return IRStmt_WrTmp(s->Ist.WrTmp.tmp,
2033 deepCopyIRExpr(s->Ist.WrTmp.data));
sewardjaf1ceca2005-06-30 23:31:27 +00002034 case Ist_Store:
2035 return IRStmt_Store(s->Ist.Store.end,
sewardjdd40fdf2006-12-24 02:20:24 +00002036 deepCopyIRExpr(s->Ist.Store.addr),
2037 deepCopyIRExpr(s->Ist.Store.data));
sewardje9d8a262009-07-01 08:06:34 +00002038 case Ist_CAS:
2039 return IRStmt_CAS(deepCopyIRCAS(s->Ist.CAS.details));
sewardje768e922009-11-26 17:17:37 +00002040 case Ist_LLSC:
2041 return IRStmt_LLSC(s->Ist.LLSC.end,
2042 s->Ist.LLSC.result,
2043 deepCopyIRExpr(s->Ist.LLSC.addr),
2044 s->Ist.LLSC.storedata
2045 ? deepCopyIRExpr(s->Ist.LLSC.storedata)
2046 : NULL);
sewardj695cff92004-10-13 14:50:14 +00002047 case Ist_Dirty:
sewardjdd40fdf2006-12-24 02:20:24 +00002048 return IRStmt_Dirty(deepCopyIRDirty(s->Ist.Dirty.details));
sewardjc4356f02007-11-09 21:15:04 +00002049 case Ist_MBE:
2050 return IRStmt_MBE(s->Ist.MBE.event);
sewardj695cff92004-10-13 14:50:14 +00002051 case Ist_Exit:
sewardjdd40fdf2006-12-24 02:20:24 +00002052 return IRStmt_Exit(deepCopyIRExpr(s->Ist.Exit.guard),
sewardj893aada2004-11-29 19:57:54 +00002053 s->Ist.Exit.jk,
sewardjc6f970f2012-04-02 21:54:49 +00002054 deepCopyIRConst(s->Ist.Exit.dst),
2055 s->Ist.Exit.offsIP);
sewardj695cff92004-10-13 14:50:14 +00002056 default:
sewardjdd40fdf2006-12-24 02:20:24 +00002057 vpanic("deepCopyIRStmt");
sewardj695cff92004-10-13 14:50:14 +00002058 }
2059}
2060
sewardjdd40fdf2006-12-24 02:20:24 +00002061IRTypeEnv* deepCopyIRTypeEnv ( IRTypeEnv* src )
sewardj695cff92004-10-13 14:50:14 +00002062{
2063 Int i;
2064 IRTypeEnv* dst = LibVEX_Alloc(sizeof(IRTypeEnv));
2065 dst->types_size = src->types_size;
2066 dst->types_used = src->types_used;
2067 dst->types = LibVEX_Alloc(dst->types_size * sizeof(IRType));
2068 for (i = 0; i < src->types_used; i++)
2069 dst->types[i] = src->types[i];
2070 return dst;
2071}
2072
sewardjdd40fdf2006-12-24 02:20:24 +00002073IRSB* deepCopyIRSB ( IRSB* bb )
sewardj695cff92004-10-13 14:50:14 +00002074{
2075 Int i;
2076 IRStmt** sts2;
sewardjdd40fdf2006-12-24 02:20:24 +00002077 IRSB* bb2 = deepCopyIRSBExceptStmts(bb);
sewardj695cff92004-10-13 14:50:14 +00002078 bb2->stmts_used = bb2->stmts_size = bb->stmts_used;
2079 sts2 = LibVEX_Alloc(bb2->stmts_used * sizeof(IRStmt*));
2080 for (i = 0; i < bb2->stmts_used; i++)
sewardjdd40fdf2006-12-24 02:20:24 +00002081 sts2[i] = deepCopyIRStmt(bb->stmts[i]);
sewardjc6f970f2012-04-02 21:54:49 +00002082 bb2->stmts = sts2;
sewardj6f2f2832006-11-24 23:32:55 +00002083 return bb2;
2084}
2085
sewardjdd40fdf2006-12-24 02:20:24 +00002086IRSB* deepCopyIRSBExceptStmts ( IRSB* bb )
sewardj6f2f2832006-11-24 23:32:55 +00002087{
sewardjdd40fdf2006-12-24 02:20:24 +00002088 IRSB* bb2 = emptyIRSB();
2089 bb2->tyenv = deepCopyIRTypeEnv(bb->tyenv);
2090 bb2->next = deepCopyIRExpr(bb->next);
sewardj695cff92004-10-13 14:50:14 +00002091 bb2->jumpkind = bb->jumpkind;
sewardjc6f970f2012-04-02 21:54:49 +00002092 bb2->offsIP = bb->offsIP;
sewardj695cff92004-10-13 14:50:14 +00002093 return bb2;
sewardjd7cb8532004-08-17 23:59:23 +00002094}
2095
sewardjec6ad592004-06-20 12:26:53 +00002096
sewardjc97096c2004-06-30 09:28:04 +00002097/*---------------------------------------------------------------*/
sewardj6efd4a12004-07-15 03:54:23 +00002098/*--- Primop types ---*/
2099/*---------------------------------------------------------------*/
2100
2101static
sewardjb183b852006-02-03 16:08:03 +00002102void typeOfPrimop ( IROp op,
2103 /*OUTs*/
2104 IRType* t_dst,
sewardj40c80262006-02-08 19:30:46 +00002105 IRType* t_arg1, IRType* t_arg2,
2106 IRType* t_arg3, IRType* t_arg4 )
sewardj6efd4a12004-07-15 03:54:23 +00002107{
sewardjb183b852006-02-03 16:08:03 +00002108# define UNARY(_ta1,_td) \
sewardj6efd4a12004-07-15 03:54:23 +00002109 *t_dst = (_td); *t_arg1 = (_ta1); break
sewardjb183b852006-02-03 16:08:03 +00002110# define BINARY(_ta1,_ta2,_td) \
sewardj6efd4a12004-07-15 03:54:23 +00002111 *t_dst = (_td); *t_arg1 = (_ta1); *t_arg2 = (_ta2); break
sewardjb183b852006-02-03 16:08:03 +00002112# define TERNARY(_ta1,_ta2,_ta3,_td) \
2113 *t_dst = (_td); *t_arg1 = (_ta1); \
2114 *t_arg2 = (_ta2); *t_arg3 = (_ta3); break
sewardj40c80262006-02-08 19:30:46 +00002115# define QUATERNARY(_ta1,_ta2,_ta3,_ta4,_td) \
2116 *t_dst = (_td); *t_arg1 = (_ta1); \
2117 *t_arg2 = (_ta2); *t_arg3 = (_ta3); \
2118 *t_arg4 = (_ta4); break
sewardjb183b852006-02-03 16:08:03 +00002119# define COMPARISON(_ta) \
sewardjba999312004-11-15 15:21:17 +00002120 *t_dst = Ity_I1; *t_arg1 = *t_arg2 = (_ta); break;
sewardjb183b852006-02-03 16:08:03 +00002121# define UNARY_COMPARISON(_ta) \
sewardj0033ddc2005-04-26 23:34:34 +00002122 *t_dst = Ity_I1; *t_arg1 = (_ta); break;
sewardj6efd4a12004-07-15 03:54:23 +00002123
sewardjb183b852006-02-03 16:08:03 +00002124 /* Rounding mode values are always Ity_I32, encoded as per
2125 IRRoundingMode */
2126 const IRType ity_RMode = Ity_I32;
2127
sewardj6efd4a12004-07-15 03:54:23 +00002128 *t_dst = Ity_INVALID;
2129 *t_arg1 = Ity_INVALID;
2130 *t_arg2 = Ity_INVALID;
sewardjb183b852006-02-03 16:08:03 +00002131 *t_arg3 = Ity_INVALID;
sewardj40c80262006-02-08 19:30:46 +00002132 *t_arg4 = Ity_INVALID;
sewardj6efd4a12004-07-15 03:54:23 +00002133 switch (op) {
sewardj17442fe2004-09-20 14:54:28 +00002134 case Iop_Add8: case Iop_Sub8: case Iop_Mul8:
2135 case Iop_Or8: case Iop_And8: case Iop_Xor8:
sewardjb183b852006-02-03 16:08:03 +00002136 BINARY(Ity_I8,Ity_I8, Ity_I8);
sewardj6efd4a12004-07-15 03:54:23 +00002137
sewardj17442fe2004-09-20 14:54:28 +00002138 case Iop_Add16: case Iop_Sub16: case Iop_Mul16:
2139 case Iop_Or16: case Iop_And16: case Iop_Xor16:
sewardjb183b852006-02-03 16:08:03 +00002140 BINARY(Ity_I16,Ity_I16, Ity_I16);
sewardj6efd4a12004-07-15 03:54:23 +00002141
sewardjb51f0f42005-07-18 11:38:02 +00002142 case Iop_CmpORD32U:
2143 case Iop_CmpORD32S:
sewardj17442fe2004-09-20 14:54:28 +00002144 case Iop_Add32: case Iop_Sub32: case Iop_Mul32:
2145 case Iop_Or32: case Iop_And32: case Iop_Xor32:
sewardj478646f2008-05-01 20:13:04 +00002146 case Iop_Max32U:
sewardj44ce46d2012-07-11 13:19:10 +00002147 case Iop_QAdd32S: case Iop_QSub32S:
sewardje2ea1762010-09-22 00:56:37 +00002148 case Iop_Add16x2: case Iop_Sub16x2:
2149 case Iop_QAdd16Sx2: case Iop_QAdd16Ux2:
2150 case Iop_QSub16Sx2: case Iop_QSub16Ux2:
2151 case Iop_HAdd16Ux2: case Iop_HAdd16Sx2:
2152 case Iop_HSub16Ux2: case Iop_HSub16Sx2:
2153 case Iop_Add8x4: case Iop_Sub8x4:
2154 case Iop_QAdd8Sx4: case Iop_QAdd8Ux4:
2155 case Iop_QSub8Sx4: case Iop_QSub8Ux4:
2156 case Iop_HAdd8Ux4: case Iop_HAdd8Sx4:
2157 case Iop_HSub8Ux4: case Iop_HSub8Sx4:
sewardj310d6b22010-10-18 16:29:40 +00002158 case Iop_Sad8Ux4:
sewardjb183b852006-02-03 16:08:03 +00002159 BINARY(Ity_I32,Ity_I32, Ity_I32);
sewardj6efd4a12004-07-15 03:54:23 +00002160
sewardj17442fe2004-09-20 14:54:28 +00002161 case Iop_Add64: case Iop_Sub64: case Iop_Mul64:
2162 case Iop_Or64: case Iop_And64: case Iop_Xor64:
cerion2831b002005-11-30 19:55:22 +00002163 case Iop_CmpORD64U:
2164 case Iop_CmpORD64S:
sewardj38a3f862005-01-13 15:06:51 +00002165 case Iop_Avg8Ux8: case Iop_Avg16Ux4:
2166 case Iop_Add8x8: case Iop_Add16x4: case Iop_Add32x2:
sewardj2fdd4162010-08-22 12:59:02 +00002167 case Iop_Add32Fx2: case Iop_Sub32Fx2:
sewardj38a3f862005-01-13 15:06:51 +00002168 case Iop_CmpEQ8x8: case Iop_CmpEQ16x4: case Iop_CmpEQ32x2:
2169 case Iop_CmpGT8Sx8: case Iop_CmpGT16Sx4: case Iop_CmpGT32Sx2:
sewardj2fdd4162010-08-22 12:59:02 +00002170 case Iop_CmpGT8Ux8: case Iop_CmpGT16Ux4: case Iop_CmpGT32Ux2:
2171 case Iop_CmpGT32Fx2: case Iop_CmpEQ32Fx2: case Iop_CmpGE32Fx2:
sewardj38a3f862005-01-13 15:06:51 +00002172 case Iop_InterleaveHI8x8: case Iop_InterleaveLO8x8:
2173 case Iop_InterleaveHI16x4: case Iop_InterleaveLO16x4:
2174 case Iop_InterleaveHI32x2: case Iop_InterleaveLO32x2:
sewardj2fdd4162010-08-22 12:59:02 +00002175 case Iop_CatOddLanes8x8: case Iop_CatEvenLanes8x8:
sewardjd166e282008-02-06 11:42:45 +00002176 case Iop_CatOddLanes16x4: case Iop_CatEvenLanes16x4:
sewardj2fdd4162010-08-22 12:59:02 +00002177 case Iop_InterleaveOddLanes8x8: case Iop_InterleaveEvenLanes8x8:
2178 case Iop_InterleaveOddLanes16x4: case Iop_InterleaveEvenLanes16x4:
sewardjd166e282008-02-06 11:42:45 +00002179 case Iop_Perm8x8:
sewardj2fdd4162010-08-22 12:59:02 +00002180 case Iop_Max8Ux8: case Iop_Max16Ux4: case Iop_Max32Ux2:
2181 case Iop_Max8Sx8: case Iop_Max16Sx4: case Iop_Max32Sx2:
2182 case Iop_Max32Fx2: case Iop_Min32Fx2:
2183 case Iop_PwMax32Fx2: case Iop_PwMin32Fx2:
2184 case Iop_Min8Ux8: case Iop_Min16Ux4: case Iop_Min32Ux2:
2185 case Iop_Min8Sx8: case Iop_Min16Sx4: case Iop_Min32Sx2:
2186 case Iop_PwMax8Ux8: case Iop_PwMax16Ux4: case Iop_PwMax32Ux2:
2187 case Iop_PwMax8Sx8: case Iop_PwMax16Sx4: case Iop_PwMax32Sx2:
2188 case Iop_PwMin8Ux8: case Iop_PwMin16Ux4: case Iop_PwMin32Ux2:
2189 case Iop_PwMin8Sx8: case Iop_PwMin16Sx4: case Iop_PwMin32Sx2:
2190 case Iop_Mul8x8: case Iop_Mul16x4: case Iop_Mul32x2:
2191 case Iop_Mul32Fx2:
2192 case Iop_PolynomialMul8x8:
sewardjd166e282008-02-06 11:42:45 +00002193 case Iop_MulHi16Sx4: case Iop_MulHi16Ux4:
sewardj2fdd4162010-08-22 12:59:02 +00002194 case Iop_QDMulHi16Sx4: case Iop_QDMulHi32Sx2:
2195 case Iop_QRDMulHi16Sx4: case Iop_QRDMulHi32Sx2:
sewardj38a3f862005-01-13 15:06:51 +00002196 case Iop_QAdd8Sx8: case Iop_QAdd16Sx4:
sewardj2fdd4162010-08-22 12:59:02 +00002197 case Iop_QAdd32Sx2: case Iop_QAdd64Sx1:
sewardj38a3f862005-01-13 15:06:51 +00002198 case Iop_QAdd8Ux8: case Iop_QAdd16Ux4:
sewardj2fdd4162010-08-22 12:59:02 +00002199 case Iop_QAdd32Ux2: case Iop_QAdd64Ux1:
2200 case Iop_PwAdd8x8: case Iop_PwAdd16x4: case Iop_PwAdd32x2:
2201 case Iop_PwAdd32Fx2:
sewardj5f438dd2011-06-16 11:36:23 +00002202 case Iop_QNarrowBin32Sto16Sx4:
2203 case Iop_QNarrowBin16Sto8Sx8: case Iop_QNarrowBin16Sto8Ux8:
sewardjad2c9ea2011-10-22 09:32:16 +00002204 case Iop_NarrowBin16to8x8: case Iop_NarrowBin32to16x4:
sewardj38a3f862005-01-13 15:06:51 +00002205 case Iop_Sub8x8: case Iop_Sub16x4: case Iop_Sub32x2:
2206 case Iop_QSub8Sx8: case Iop_QSub16Sx4:
sewardj2fdd4162010-08-22 12:59:02 +00002207 case Iop_QSub32Sx2: case Iop_QSub64Sx1:
sewardj38a3f862005-01-13 15:06:51 +00002208 case Iop_QSub8Ux8: case Iop_QSub16Ux4:
sewardj2fdd4162010-08-22 12:59:02 +00002209 case Iop_QSub32Ux2: case Iop_QSub64Ux1:
2210 case Iop_Shl8x8: case Iop_Shl16x4: case Iop_Shl32x2:
2211 case Iop_Shr8x8: case Iop_Shr16x4: case Iop_Shr32x2:
2212 case Iop_Sar8x8: case Iop_Sar16x4: case Iop_Sar32x2:
2213 case Iop_Sal8x8: case Iop_Sal16x4: case Iop_Sal32x2: case Iop_Sal64x1:
2214 case Iop_QShl8x8: case Iop_QShl16x4: case Iop_QShl32x2: case Iop_QShl64x1:
2215 case Iop_QSal8x8: case Iop_QSal16x4: case Iop_QSal32x2: case Iop_QSal64x1:
2216 case Iop_Recps32Fx2:
2217 case Iop_Rsqrts32Fx2:
sewardjb183b852006-02-03 16:08:03 +00002218 BINARY(Ity_I64,Ity_I64, Ity_I64);
sewardj38a3f862005-01-13 15:06:51 +00002219
sewardjd166e282008-02-06 11:42:45 +00002220 case Iop_ShlN32x2: case Iop_ShlN16x4: case Iop_ShlN8x8:
sewardj2fdd4162010-08-22 12:59:02 +00002221 case Iop_ShrN32x2: case Iop_ShrN16x4: case Iop_ShrN8x8:
sewardjd71ba832006-12-27 01:15:29 +00002222 case Iop_SarN32x2: case Iop_SarN16x4: case Iop_SarN8x8:
sewardj2fdd4162010-08-22 12:59:02 +00002223 case Iop_QShlN8x8: case Iop_QShlN16x4:
2224 case Iop_QShlN32x2: case Iop_QShlN64x1:
2225 case Iop_QShlN8Sx8: case Iop_QShlN16Sx4:
2226 case Iop_QShlN32Sx2: case Iop_QShlN64Sx1:
2227 case Iop_QSalN8x8: case Iop_QSalN16x4:
2228 case Iop_QSalN32x2: case Iop_QSalN64x1:
sewardjb183b852006-02-03 16:08:03 +00002229 BINARY(Ity_I64,Ity_I8, Ity_I64);
sewardj6efd4a12004-07-15 03:54:23 +00002230
2231 case Iop_Shl8: case Iop_Shr8: case Iop_Sar8:
sewardjb183b852006-02-03 16:08:03 +00002232 BINARY(Ity_I8,Ity_I8, Ity_I8);
sewardj6efd4a12004-07-15 03:54:23 +00002233 case Iop_Shl16: case Iop_Shr16: case Iop_Sar16:
sewardjb183b852006-02-03 16:08:03 +00002234 BINARY(Ity_I16,Ity_I8, Ity_I16);
sewardj6efd4a12004-07-15 03:54:23 +00002235 case Iop_Shl32: case Iop_Shr32: case Iop_Sar32:
sewardjb183b852006-02-03 16:08:03 +00002236 BINARY(Ity_I32,Ity_I8, Ity_I32);
sewardj6efd4a12004-07-15 03:54:23 +00002237 case Iop_Shl64: case Iop_Shr64: case Iop_Sar64:
sewardjb183b852006-02-03 16:08:03 +00002238 BINARY(Ity_I64,Ity_I8, Ity_I64);
sewardj6efd4a12004-07-15 03:54:23 +00002239
sewardjeb17e492007-08-25 23:07:44 +00002240 case Iop_Not8:
sewardjb183b852006-02-03 16:08:03 +00002241 UNARY(Ity_I8, Ity_I8);
sewardjeb17e492007-08-25 23:07:44 +00002242 case Iop_Not16:
sewardjb183b852006-02-03 16:08:03 +00002243 UNARY(Ity_I16, Ity_I16);
sewardjeb17e492007-08-25 23:07:44 +00002244 case Iop_Not32:
sewardje2ea1762010-09-22 00:56:37 +00002245 case Iop_CmpNEZ16x2: case Iop_CmpNEZ8x4:
sewardjb183b852006-02-03 16:08:03 +00002246 UNARY(Ity_I32, Ity_I32);
sewardj18069182005-01-13 19:16:04 +00002247
sewardj0033ddc2005-04-26 23:34:34 +00002248 case Iop_Not64:
sewardj18069182005-01-13 19:16:04 +00002249 case Iop_CmpNEZ32x2: case Iop_CmpNEZ16x4: case Iop_CmpNEZ8x8:
sewardj2fdd4162010-08-22 12:59:02 +00002250 case Iop_Cnt8x8:
2251 case Iop_Clz8Sx8: case Iop_Clz16Sx4: case Iop_Clz32Sx2:
2252 case Iop_Cls8Sx8: case Iop_Cls16Sx4: case Iop_Cls32Sx2:
2253 case Iop_PwAddL8Ux8: case Iop_PwAddL16Ux4: case Iop_PwAddL32Ux2:
2254 case Iop_PwAddL8Sx8: case Iop_PwAddL16Sx4: case Iop_PwAddL32Sx2:
2255 case Iop_Reverse64_8x8: case Iop_Reverse64_16x4: case Iop_Reverse64_32x2:
2256 case Iop_Reverse32_8x8: case Iop_Reverse32_16x4:
2257 case Iop_Reverse16_8x8:
2258 case Iop_FtoI32Sx2_RZ: case Iop_FtoI32Ux2_RZ:
2259 case Iop_I32StoFx2: case Iop_I32UtoFx2:
2260 case Iop_Recip32x2: case Iop_Recip32Fx2:
2261 case Iop_Abs32Fx2:
2262 case Iop_Rsqrte32Fx2:
2263 case Iop_Rsqrte32x2:
2264 case Iop_Neg32Fx2:
2265 case Iop_Abs8x8: case Iop_Abs16x4: case Iop_Abs32x2:
sewardjb183b852006-02-03 16:08:03 +00002266 UNARY(Ity_I64, Ity_I64);
sewardj6efd4a12004-07-15 03:54:23 +00002267
2268 case Iop_CmpEQ8: case Iop_CmpNE8:
sewardj1fb8c922009-07-12 12:56:53 +00002269 case Iop_CasCmpEQ8: case Iop_CasCmpNE8:
sewardj6efd4a12004-07-15 03:54:23 +00002270 COMPARISON(Ity_I8);
2271 case Iop_CmpEQ16: case Iop_CmpNE16:
sewardj1fb8c922009-07-12 12:56:53 +00002272 case Iop_CasCmpEQ16: case Iop_CasCmpNE16:
sewardj6efd4a12004-07-15 03:54:23 +00002273 COMPARISON(Ity_I16);
2274 case Iop_CmpEQ32: case Iop_CmpNE32:
sewardj1fb8c922009-07-12 12:56:53 +00002275 case Iop_CasCmpEQ32: case Iop_CasCmpNE32:
sewardj17442fe2004-09-20 14:54:28 +00002276 case Iop_CmpLT32S: case Iop_CmpLE32S:
2277 case Iop_CmpLT32U: case Iop_CmpLE32U:
sewardj6efd4a12004-07-15 03:54:23 +00002278 COMPARISON(Ity_I32);
2279 case Iop_CmpEQ64: case Iop_CmpNE64:
sewardj1fb8c922009-07-12 12:56:53 +00002280 case Iop_CasCmpEQ64: case Iop_CasCmpNE64:
sewardj98540072005-04-26 01:52:01 +00002281 case Iop_CmpLT64S: case Iop_CmpLE64S:
2282 case Iop_CmpLT64U: case Iop_CmpLE64U:
sewardj6efd4a12004-07-15 03:54:23 +00002283 COMPARISON(Ity_I64);
2284
sewardj0033ddc2005-04-26 23:34:34 +00002285 case Iop_CmpNEZ8: UNARY_COMPARISON(Ity_I8);
2286 case Iop_CmpNEZ16: UNARY_COMPARISON(Ity_I16);
2287 case Iop_CmpNEZ32: UNARY_COMPARISON(Ity_I32);
2288 case Iop_CmpNEZ64: UNARY_COMPARISON(Ity_I64);
2289
sewardjeb17e492007-08-25 23:07:44 +00002290 case Iop_Left8: UNARY(Ity_I8, Ity_I8);
2291 case Iop_Left16: UNARY(Ity_I16,Ity_I16);
2292 case Iop_CmpwNEZ32: case Iop_Left32: UNARY(Ity_I32,Ity_I32);
2293 case Iop_CmpwNEZ64: case Iop_Left64: UNARY(Ity_I64,Ity_I64);
2294
sewardjb81f8b32004-07-30 10:17:50 +00002295 case Iop_MullU8: case Iop_MullS8:
sewardjb183b852006-02-03 16:08:03 +00002296 BINARY(Ity_I8,Ity_I8, Ity_I16);
sewardjb81f8b32004-07-30 10:17:50 +00002297 case Iop_MullU16: case Iop_MullS16:
sewardjb183b852006-02-03 16:08:03 +00002298 BINARY(Ity_I16,Ity_I16, Ity_I32);
sewardj6d2638e2004-07-15 09:38:27 +00002299 case Iop_MullU32: case Iop_MullS32:
sewardjb183b852006-02-03 16:08:03 +00002300 BINARY(Ity_I32,Ity_I32, Ity_I64);
sewardj9b967672005-02-08 11:13:09 +00002301 case Iop_MullU64: case Iop_MullS64:
sewardjb183b852006-02-03 16:08:03 +00002302 BINARY(Ity_I64,Ity_I64, Ity_I128);
sewardj6d2638e2004-07-15 09:38:27 +00002303
sewardj17442fe2004-09-20 14:54:28 +00002304 case Iop_Clz32: case Iop_Ctz32:
sewardjb183b852006-02-03 16:08:03 +00002305 UNARY(Ity_I32, Ity_I32);
sewardjce646f22004-08-31 23:55:54 +00002306
sewardjf53b7352005-04-06 20:01:56 +00002307 case Iop_Clz64: case Iop_Ctz64:
sewardjb183b852006-02-03 16:08:03 +00002308 UNARY(Ity_I64, Ity_I64);
sewardjf53b7352005-04-06 20:01:56 +00002309
sewardje71e56a2011-09-05 12:11:06 +00002310 case Iop_DivU32: case Iop_DivS32: case Iop_DivU32E: case Iop_DivS32E:
sewardjb183b852006-02-03 16:08:03 +00002311 BINARY(Ity_I32,Ity_I32, Ity_I32);
cerion5c8a0cb2005-02-03 13:59:46 +00002312
sewardje71e56a2011-09-05 12:11:06 +00002313 case Iop_DivU64: case Iop_DivS64: case Iop_DivS64E: case Iop_DivU64E:
sewardjb183b852006-02-03 16:08:03 +00002314 BINARY(Ity_I64,Ity_I64, Ity_I64);
cerionf0de28c2005-12-13 20:21:11 +00002315
sewardj17442fe2004-09-20 14:54:28 +00002316 case Iop_DivModU64to32: case Iop_DivModS64to32:
sewardjb183b852006-02-03 16:08:03 +00002317 BINARY(Ity_I64,Ity_I32, Ity_I64);
sewardj6d2638e2004-07-15 09:38:27 +00002318
sewardj343b9d02005-01-31 18:08:45 +00002319 case Iop_DivModU128to64: case Iop_DivModS128to64:
sewardjb183b852006-02-03 16:08:03 +00002320 BINARY(Ity_I128,Ity_I64, Ity_I128);
sewardj343b9d02005-01-31 18:08:45 +00002321
sewardj2019a972011-03-07 16:04:07 +00002322 case Iop_DivModS64to64:
2323 BINARY(Ity_I64,Ity_I64, Ity_I128);
2324
sewardjb81f8b32004-07-30 10:17:50 +00002325 case Iop_16HIto8: case Iop_16to8:
sewardjb183b852006-02-03 16:08:03 +00002326 UNARY(Ity_I16, Ity_I8);
sewardjb81f8b32004-07-30 10:17:50 +00002327 case Iop_8HLto16:
sewardjb183b852006-02-03 16:08:03 +00002328 BINARY(Ity_I8,Ity_I8, Ity_I16);
sewardjb81f8b32004-07-30 10:17:50 +00002329
sewardj8c7f1ab2004-07-29 20:31:09 +00002330 case Iop_32HIto16: case Iop_32to16:
sewardjb183b852006-02-03 16:08:03 +00002331 UNARY(Ity_I32, Ity_I16);
sewardj8c7f1ab2004-07-29 20:31:09 +00002332 case Iop_16HLto32:
sewardjb183b852006-02-03 16:08:03 +00002333 BINARY(Ity_I16,Ity_I16, Ity_I32);
sewardj8c7f1ab2004-07-29 20:31:09 +00002334
2335 case Iop_64HIto32: case Iop_64to32:
sewardjb183b852006-02-03 16:08:03 +00002336 UNARY(Ity_I64, Ity_I32);
sewardj6d2638e2004-07-15 09:38:27 +00002337 case Iop_32HLto64:
sewardjb183b852006-02-03 16:08:03 +00002338 BINARY(Ity_I32,Ity_I32, Ity_I64);
sewardj6d2638e2004-07-15 09:38:27 +00002339
sewardj9b967672005-02-08 11:13:09 +00002340 case Iop_128HIto64: case Iop_128to64:
sewardjb183b852006-02-03 16:08:03 +00002341 UNARY(Ity_I128, Ity_I64);
sewardj9b967672005-02-08 11:13:09 +00002342 case Iop_64HLto128:
sewardjb183b852006-02-03 16:08:03 +00002343 BINARY(Ity_I64,Ity_I64, Ity_I128);
sewardj9b967672005-02-08 11:13:09 +00002344
sewardjb183b852006-02-03 16:08:03 +00002345 case Iop_Not1: UNARY(Ity_I1, Ity_I1);
2346 case Iop_1Uto8: UNARY(Ity_I1, Ity_I8);
2347 case Iop_1Sto8: UNARY(Ity_I1, Ity_I8);
2348 case Iop_1Sto16: UNARY(Ity_I1, Ity_I16);
2349 case Iop_1Uto32: case Iop_1Sto32: UNARY(Ity_I1, Ity_I32);
2350 case Iop_1Sto64: case Iop_1Uto64: UNARY(Ity_I1, Ity_I64);
2351 case Iop_32to1: UNARY(Ity_I32, Ity_I1);
2352 case Iop_64to1: UNARY(Ity_I64, Ity_I1);
sewardj47341042004-09-19 11:55:46 +00002353
sewardj17442fe2004-09-20 14:54:28 +00002354 case Iop_8Uto32: case Iop_8Sto32:
sewardjb183b852006-02-03 16:08:03 +00002355 UNARY(Ity_I8, Ity_I32);
sewardj47341042004-09-19 11:55:46 +00002356
sewardj17442fe2004-09-20 14:54:28 +00002357 case Iop_8Uto16: case Iop_8Sto16:
sewardjb183b852006-02-03 16:08:03 +00002358 UNARY(Ity_I8, Ity_I16);
sewardj47341042004-09-19 11:55:46 +00002359
sewardj17442fe2004-09-20 14:54:28 +00002360 case Iop_16Uto32: case Iop_16Sto32:
sewardjb183b852006-02-03 16:08:03 +00002361 UNARY(Ity_I16, Ity_I32);
sewardj6d2638e2004-07-15 09:38:27 +00002362
sewardj17442fe2004-09-20 14:54:28 +00002363 case Iop_32Sto64: case Iop_32Uto64:
sewardjb183b852006-02-03 16:08:03 +00002364 UNARY(Ity_I32, Ity_I64);
sewardj17442fe2004-09-20 14:54:28 +00002365
sewardj291a7e82005-04-27 11:42:44 +00002366 case Iop_8Uto64: case Iop_8Sto64:
sewardjb183b852006-02-03 16:08:03 +00002367 UNARY(Ity_I8, Ity_I64);
sewardj291a7e82005-04-27 11:42:44 +00002368
2369 case Iop_16Uto64: case Iop_16Sto64:
sewardj291a7e82005-04-27 11:42:44 +00002370 UNARY(Ity_I16, Ity_I64);
sewardjb183b852006-02-03 16:08:03 +00002371 case Iop_64to16:
2372 UNARY(Ity_I64, Ity_I16);
sewardj291a7e82005-04-27 11:42:44 +00002373
sewardjb183b852006-02-03 16:08:03 +00002374 case Iop_32to8: UNARY(Ity_I32, Ity_I8);
2375 case Iop_64to8: UNARY(Ity_I64, Ity_I8);
sewardj17442fe2004-09-20 14:54:28 +00002376
sewardjb183b852006-02-03 16:08:03 +00002377 case Iop_AddF64: case Iop_SubF64:
2378 case Iop_MulF64: case Iop_DivF64:
2379 case Iop_AddF64r32: case Iop_SubF64r32:
2380 case Iop_MulF64r32: case Iop_DivF64r32:
2381 TERNARY(ity_RMode,Ity_F64,Ity_F64, Ity_F64);
2382
sewardj6c299f32009-12-31 18:00:12 +00002383 case Iop_AddF32: case Iop_SubF32:
2384 case Iop_MulF32: case Iop_DivF32:
2385 TERNARY(ity_RMode,Ity_F32,Ity_F32, Ity_F32);
2386
sewardjb183b852006-02-03 16:08:03 +00002387 case Iop_NegF64: case Iop_AbsF64:
2388 UNARY(Ity_F64, Ity_F64);
2389
sewardj6c299f32009-12-31 18:00:12 +00002390 case Iop_NegF32: case Iop_AbsF32:
2391 UNARY(Ity_F32, Ity_F32);
2392
sewardjb183b852006-02-03 16:08:03 +00002393 case Iop_SqrtF64:
2394 case Iop_SqrtF64r32:
2395 BINARY(ity_RMode,Ity_F64, Ity_F64);
2396
sewardj6c299f32009-12-31 18:00:12 +00002397 case Iop_SqrtF32:
sewardjd15b5972010-06-27 09:06:34 +00002398 case Iop_RoundF32toInt:
sewardj6c299f32009-12-31 18:00:12 +00002399 BINARY(ity_RMode,Ity_F32, Ity_F32);
2400
sewardj2019a972011-03-07 16:04:07 +00002401 case Iop_CmpF32:
2402 BINARY(Ity_F32,Ity_F32, Ity_I32);
2403
sewardjbdc7d212004-09-09 02:46:40 +00002404 case Iop_CmpF64:
sewardjb183b852006-02-03 16:08:03 +00002405 BINARY(Ity_F64,Ity_F64, Ity_I32);
sewardj8f3debf2004-09-08 23:42:23 +00002406
sewardj2019a972011-03-07 16:04:07 +00002407 case Iop_CmpF128:
2408 BINARY(Ity_F128,Ity_F128, Ity_I32);
2409
sewardj6c299f32009-12-31 18:00:12 +00002410 case Iop_F64toI16S: BINARY(ity_RMode,Ity_F64, Ity_I16);
2411 case Iop_F64toI32S: BINARY(ity_RMode,Ity_F64, Ity_I32);
sewardj4aa412a2011-07-24 14:13:21 +00002412 case Iop_F64toI64S: case Iop_F64toI64U:
2413 BINARY(ity_RMode,Ity_F64, Ity_I64);
sewardj8f3debf2004-09-08 23:42:23 +00002414
sewardj6c299f32009-12-31 18:00:12 +00002415 case Iop_F64toI32U: BINARY(ity_RMode,Ity_F64, Ity_I32);
2416
2417 case Iop_I16StoF64: UNARY(Ity_I16, Ity_F64);
2418 case Iop_I32StoF64: UNARY(Ity_I32, Ity_F64);
2419 case Iop_I64StoF64: BINARY(ity_RMode,Ity_I64, Ity_F64);
sewardj66d5ef22011-04-15 11:55:00 +00002420 case Iop_I64UtoF64: BINARY(ity_RMode,Ity_I64, Ity_F64);
sewardj95d6f3a2011-04-27 10:07:42 +00002421 case Iop_I64UtoF32: BINARY(ity_RMode,Ity_I64, Ity_F32);
sewardj6c299f32009-12-31 18:00:12 +00002422
2423 case Iop_I32UtoF64: UNARY(Ity_I32, Ity_F64);
sewardj3bca9062004-12-04 14:36:09 +00002424
sewardj2019a972011-03-07 16:04:07 +00002425 case Iop_F32toI16S: BINARY(ity_RMode,Ity_F32, Ity_I16);
2426 case Iop_F32toI32S: BINARY(ity_RMode,Ity_F32, Ity_I32);
2427 case Iop_F32toI64S: BINARY(ity_RMode,Ity_F32, Ity_I64);
2428
2429 case Iop_I16StoF32: UNARY(Ity_I16, Ity_F32);
2430 case Iop_I32StoF32: BINARY(ity_RMode,Ity_I32, Ity_F32);
2431 case Iop_I64StoF32: BINARY(ity_RMode,Ity_I64, Ity_F32);
2432
sewardjb183b852006-02-03 16:08:03 +00002433 case Iop_F32toF64: UNARY(Ity_F32, Ity_F64);
2434 case Iop_F64toF32: BINARY(ity_RMode,Ity_F64, Ity_F32);
sewardj4cb918d2004-12-03 19:43:31 +00002435
sewardjb183b852006-02-03 16:08:03 +00002436 case Iop_ReinterpI64asF64: UNARY(Ity_I64, Ity_F64);
2437 case Iop_ReinterpF64asI64: UNARY(Ity_F64, Ity_I64);
2438 case Iop_ReinterpI32asF32: UNARY(Ity_I32, Ity_F32);
sewardjfc1b5412007-01-09 15:20:07 +00002439 case Iop_ReinterpF32asI32: UNARY(Ity_F32, Ity_I32);
sewardj8f3debf2004-09-08 23:42:23 +00002440
sewardjb183b852006-02-03 16:08:03 +00002441 case Iop_AtanF64: case Iop_Yl2xF64: case Iop_Yl2xp1F64:
2442 case Iop_ScaleF64: case Iop_PRemF64: case Iop_PRem1F64:
2443 TERNARY(ity_RMode,Ity_F64,Ity_F64, Ity_F64);
2444
2445 case Iop_PRemC3210F64: case Iop_PRem1C3210F64:
2446 TERNARY(ity_RMode,Ity_F64,Ity_F64, Ity_I32);
2447
2448 case Iop_SinF64: case Iop_CosF64: case Iop_TanF64:
2449 case Iop_2xm1F64:
2450 case Iop_RoundF64toInt: BINARY(ity_RMode,Ity_F64, Ity_F64);
2451
sewardj40c80262006-02-08 19:30:46 +00002452 case Iop_MAddF64: case Iop_MSubF64:
2453 case Iop_MAddF64r32: case Iop_MSubF64r32:
2454 QUATERNARY(ity_RMode,Ity_F64,Ity_F64,Ity_F64, Ity_F64);
2455
sewardjb183b852006-02-03 16:08:03 +00002456 case Iop_Est5FRSqrt:
sewardj0f1ef862008-08-08 08:37:06 +00002457 case Iop_RoundF64toF64_NEAREST: case Iop_RoundF64toF64_NegINF:
2458 case Iop_RoundF64toF64_PosINF: case Iop_RoundF64toF64_ZERO:
sewardjb183b852006-02-03 16:08:03 +00002459 UNARY(Ity_F64, Ity_F64);
2460 case Iop_RoundF64toF32:
2461 BINARY(ity_RMode,Ity_F64, Ity_F64);
2462 case Iop_CalcFPRF:
2463 UNARY(Ity_F64, Ity_I32);
2464 case Iop_TruncF64asF32:
2465 UNARY(Ity_F64, Ity_F32);
sewardjbb53f8c2004-08-14 11:50:01 +00002466
cerionf294eb32005-11-16 17:21:10 +00002467 case Iop_I32UtoFx4:
2468 case Iop_I32StoFx4:
2469 case Iop_QFtoI32Ux4_RZ:
2470 case Iop_QFtoI32Sx4_RZ:
sewardj2fdd4162010-08-22 12:59:02 +00002471 case Iop_FtoI32Ux4_RZ:
2472 case Iop_FtoI32Sx4_RZ:
cerionf294eb32005-11-16 17:21:10 +00002473 case Iop_RoundF32x4_RM:
2474 case Iop_RoundF32x4_RP:
2475 case Iop_RoundF32x4_RN:
2476 case Iop_RoundF32x4_RZ:
sewardj2fdd4162010-08-22 12:59:02 +00002477 case Iop_Abs32Fx4:
2478 case Iop_Rsqrte32Fx4:
2479 case Iop_Rsqrte32x4:
cerionf294eb32005-11-16 17:21:10 +00002480 UNARY(Ity_V128, Ity_V128);
2481
sewardj5f438dd2011-06-16 11:36:23 +00002482 case Iop_64HLtoV128:
2483 BINARY(Ity_I64,Ity_I64, Ity_V128);
2484
sewardj2fdd4162010-08-22 12:59:02 +00002485 case Iop_V128to64: case Iop_V128HIto64:
sewardj5f438dd2011-06-16 11:36:23 +00002486 case Iop_NarrowUn16to8x8:
2487 case Iop_NarrowUn32to16x4:
2488 case Iop_NarrowUn64to32x2:
2489 case Iop_QNarrowUn16Uto8Ux8:
2490 case Iop_QNarrowUn32Uto16Ux4:
2491 case Iop_QNarrowUn64Uto32Ux2:
2492 case Iop_QNarrowUn16Sto8Sx8:
2493 case Iop_QNarrowUn32Sto16Sx4:
2494 case Iop_QNarrowUn64Sto32Sx2:
2495 case Iop_QNarrowUn16Sto8Ux8:
2496 case Iop_QNarrowUn32Sto16Ux4:
2497 case Iop_QNarrowUn64Sto32Ux2:
sewardj2fdd4162010-08-22 12:59:02 +00002498 case Iop_F32toF16x4:
sewardjb183b852006-02-03 16:08:03 +00002499 UNARY(Ity_V128, Ity_I64);
sewardjc9a43662004-11-30 18:51:59 +00002500
sewardj5f438dd2011-06-16 11:36:23 +00002501 case Iop_Widen8Uto16x8:
2502 case Iop_Widen16Uto32x4:
2503 case Iop_Widen32Uto64x2:
2504 case Iop_Widen8Sto16x8:
2505 case Iop_Widen16Sto32x4:
2506 case Iop_Widen32Sto64x2:
sewardj2fdd4162010-08-22 12:59:02 +00002507 case Iop_F16toF32x4:
2508 UNARY(Ity_I64, Ity_V128);
2509
sewardjb183b852006-02-03 16:08:03 +00002510 case Iop_V128to32: UNARY(Ity_V128, Ity_I32);
2511 case Iop_32UtoV128: UNARY(Ity_I32, Ity_V128);
2512 case Iop_64UtoV128: UNARY(Ity_I64, Ity_V128);
2513 case Iop_SetV128lo32: BINARY(Ity_V128,Ity_I32, Ity_V128);
2514 case Iop_SetV128lo64: BINARY(Ity_V128,Ity_I64, Ity_V128);
sewardj129b3d92004-12-05 15:42:05 +00002515
sewardjb183b852006-02-03 16:08:03 +00002516 case Iop_Dup8x16: UNARY(Ity_I8, Ity_V128);
2517 case Iop_Dup16x8: UNARY(Ity_I16, Ity_V128);
2518 case Iop_Dup32x4: UNARY(Ity_I32, Ity_V128);
sewardj2fdd4162010-08-22 12:59:02 +00002519 case Iop_Dup8x8: UNARY(Ity_I8, Ity_I64);
2520 case Iop_Dup16x4: UNARY(Ity_I16, Ity_I64);
2521 case Iop_Dup32x2: UNARY(Ity_I32, Ity_I64);
cerionf887b3e2005-09-13 16:34:28 +00002522
sewardj1e6ad742004-12-02 16:16:11 +00002523 case Iop_CmpEQ32Fx4: case Iop_CmpLT32Fx4:
sewardj636ad762004-12-07 11:16:04 +00002524 case Iop_CmpEQ64Fx2: case Iop_CmpLT64Fx2:
sewardj1e6ad742004-12-02 16:16:11 +00002525 case Iop_CmpLE32Fx4: case Iop_CmpUN32Fx4:
sewardj636ad762004-12-07 11:16:04 +00002526 case Iop_CmpLE64Fx2: case Iop_CmpUN64Fx2:
cerion206c3642005-11-14 00:35:59 +00002527 case Iop_CmpGT32Fx4: case Iop_CmpGE32Fx4:
sewardj1e6ad742004-12-02 16:16:11 +00002528 case Iop_CmpEQ32F0x4: case Iop_CmpLT32F0x4:
sewardj636ad762004-12-07 11:16:04 +00002529 case Iop_CmpEQ64F0x2: case Iop_CmpLT64F0x2:
sewardj1e6ad742004-12-02 16:16:11 +00002530 case Iop_CmpLE32F0x4: case Iop_CmpUN32F0x4:
sewardj636ad762004-12-07 11:16:04 +00002531 case Iop_CmpLE64F0x2: case Iop_CmpUN64F0x2:
sewardj1e6ad742004-12-02 16:16:11 +00002532 case Iop_Add32Fx4: case Iop_Add32F0x4:
sewardj636ad762004-12-07 11:16:04 +00002533 case Iop_Add64Fx2: case Iop_Add64F0x2:
sewardj176a59c2004-12-03 20:08:31 +00002534 case Iop_Div32Fx4: case Iop_Div32F0x4:
sewardj636ad762004-12-07 11:16:04 +00002535 case Iop_Div64Fx2: case Iop_Div64F0x2:
sewardj176a59c2004-12-03 20:08:31 +00002536 case Iop_Max32Fx4: case Iop_Max32F0x4:
sewardj2fdd4162010-08-22 12:59:02 +00002537 case Iop_PwMax32Fx4: case Iop_PwMin32Fx4:
sewardj636ad762004-12-07 11:16:04 +00002538 case Iop_Max64Fx2: case Iop_Max64F0x2:
sewardj176a59c2004-12-03 20:08:31 +00002539 case Iop_Min32Fx4: case Iop_Min32F0x4:
sewardj636ad762004-12-07 11:16:04 +00002540 case Iop_Min64Fx2: case Iop_Min64F0x2:
sewardj9636b442004-12-04 01:38:37 +00002541 case Iop_Mul32Fx4: case Iop_Mul32F0x4:
sewardj636ad762004-12-07 11:16:04 +00002542 case Iop_Mul64Fx2: case Iop_Mul64F0x2:
sewardjc1e7dfc2004-12-05 19:29:45 +00002543 case Iop_Sub32Fx4: case Iop_Sub32F0x4:
sewardj636ad762004-12-07 11:16:04 +00002544 case Iop_Sub64Fx2: case Iop_Sub64F0x2:
sewardjf0c1c582005-02-07 23:47:38 +00002545 case Iop_AndV128: case Iop_OrV128: case Iop_XorV128:
sewardj164f9272004-12-09 00:39:32 +00002546 case Iop_Add8x16: case Iop_Add16x8:
2547 case Iop_Add32x4: case Iop_Add64x2:
sewardj2fdd4162010-08-22 12:59:02 +00002548 case Iop_QAdd8Ux16: case Iop_QAdd16Ux8:
2549 case Iop_QAdd32Ux4: //case Iop_QAdd64Ux2:
2550 case Iop_QAdd8Sx16: case Iop_QAdd16Sx8:
2551 case Iop_QAdd32Sx4: case Iop_QAdd64Sx2:
2552 case Iop_PwAdd8x16: case Iop_PwAdd16x8: case Iop_PwAdd32x4:
sewardj164f9272004-12-09 00:39:32 +00002553 case Iop_Sub8x16: case Iop_Sub16x8:
2554 case Iop_Sub32x4: case Iop_Sub64x2:
sewardj2fdd4162010-08-22 12:59:02 +00002555 case Iop_QSub8Ux16: case Iop_QSub16Ux8:
2556 case Iop_QSub32Ux4: //case Iop_QSub64Ux2:
2557 case Iop_QSub8Sx16: case Iop_QSub16Sx8:
2558 case Iop_QSub32Sx4: case Iop_QSub64Sx2:
2559 case Iop_Mul8x16: case Iop_Mul16x8: case Iop_Mul32x4:
2560 case Iop_PolynomialMul8x16:
cerionf887b3e2005-09-13 16:34:28 +00002561 case Iop_MulHi16Ux8: case Iop_MulHi32Ux4:
2562 case Iop_MulHi16Sx8: case Iop_MulHi32Sx4:
sewardj2fdd4162010-08-22 12:59:02 +00002563 case Iop_QDMulHi16Sx8: case Iop_QDMulHi32Sx4:
2564 case Iop_QRDMulHi16Sx8: case Iop_QRDMulHi32Sx4:
cerion1ac656a2005-11-04 19:44:48 +00002565 case Iop_MullEven8Ux16: case Iop_MullEven16Ux8:
2566 case Iop_MullEven8Sx16: case Iop_MullEven16Sx8:
cerionf887b3e2005-09-13 16:34:28 +00002567 case Iop_Avg8Ux16: case Iop_Avg16Ux8: case Iop_Avg32Ux4:
2568 case Iop_Avg8Sx16: case Iop_Avg16Sx8: case Iop_Avg32Sx4:
2569 case Iop_Max8Sx16: case Iop_Max16Sx8: case Iop_Max32Sx4:
2570 case Iop_Max8Ux16: case Iop_Max16Ux8: case Iop_Max32Ux4:
2571 case Iop_Min8Sx16: case Iop_Min16Sx8: case Iop_Min32Sx4:
2572 case Iop_Min8Ux16: case Iop_Min16Ux8: case Iop_Min32Ux4:
sewardj164f9272004-12-09 00:39:32 +00002573 case Iop_CmpEQ8x16: case Iop_CmpEQ16x8: case Iop_CmpEQ32x4:
sewardjd8815622011-10-19 15:24:01 +00002574 case Iop_CmpEQ64x2:
sewardj164f9272004-12-09 00:39:32 +00002575 case Iop_CmpGT8Sx16: case Iop_CmpGT16Sx8: case Iop_CmpGT32Sx4:
sewardj69d98e32010-06-18 08:17:41 +00002576 case Iop_CmpGT64Sx2:
cerionf887b3e2005-09-13 16:34:28 +00002577 case Iop_CmpGT8Ux16: case Iop_CmpGT16Ux8: case Iop_CmpGT32Ux4:
sewardj2fdd4162010-08-22 12:59:02 +00002578 case Iop_Shl8x16: case Iop_Shl16x8: case Iop_Shl32x4: case Iop_Shl64x2:
sewardj5f438dd2011-06-16 11:36:23 +00002579 case Iop_QShl8x16: case Iop_QShl16x8:
2580 case Iop_QShl32x4: case Iop_QShl64x2:
2581 case Iop_QSal8x16: case Iop_QSal16x8:
2582 case Iop_QSal32x4: case Iop_QSal64x2:
sewardj2fdd4162010-08-22 12:59:02 +00002583 case Iop_Shr8x16: case Iop_Shr16x8: case Iop_Shr32x4: case Iop_Shr64x2:
2584 case Iop_Sar8x16: case Iop_Sar16x8: case Iop_Sar32x4: case Iop_Sar64x2:
2585 case Iop_Sal8x16: case Iop_Sal16x8: case Iop_Sal32x4: case Iop_Sal64x2:
sewardj1bee5612005-11-10 18:10:58 +00002586 case Iop_Rol8x16: case Iop_Rol16x8: case Iop_Rol32x4:
sewardj5f438dd2011-06-16 11:36:23 +00002587 case Iop_QNarrowBin16Sto8Ux16: case Iop_QNarrowBin32Sto16Ux8:
2588 case Iop_QNarrowBin16Sto8Sx16: case Iop_QNarrowBin32Sto16Sx8:
2589 case Iop_QNarrowBin16Uto8Ux16: case Iop_QNarrowBin32Uto16Ux8:
2590 case Iop_NarrowBin16to8x16: case Iop_NarrowBin32to16x8:
sewardj164f9272004-12-09 00:39:32 +00002591 case Iop_InterleaveHI8x16: case Iop_InterleaveHI16x8:
2592 case Iop_InterleaveHI32x4: case Iop_InterleaveHI64x2:
sewardj2fdd4162010-08-22 12:59:02 +00002593 case Iop_InterleaveLO8x16: case Iop_InterleaveLO16x8:
sewardj164f9272004-12-09 00:39:32 +00002594 case Iop_InterleaveLO32x4: case Iop_InterleaveLO64x2:
sewardj2fdd4162010-08-22 12:59:02 +00002595 case Iop_CatOddLanes8x16: case Iop_CatEvenLanes8x16:
2596 case Iop_CatOddLanes16x8: case Iop_CatEvenLanes16x8:
2597 case Iop_CatOddLanes32x4: case Iop_CatEvenLanes32x4:
2598 case Iop_InterleaveOddLanes8x16: case Iop_InterleaveEvenLanes8x16:
2599 case Iop_InterleaveOddLanes16x8: case Iop_InterleaveEvenLanes16x8:
2600 case Iop_InterleaveOddLanes32x4: case Iop_InterleaveEvenLanes32x4:
sewardjd8bca7e2012-06-20 11:46:19 +00002601 case Iop_Perm8x16: case Iop_Perm32x4:
sewardj2fdd4162010-08-22 12:59:02 +00002602 case Iop_Recps32Fx4:
2603 case Iop_Rsqrts32Fx4:
sewardjb183b852006-02-03 16:08:03 +00002604 BINARY(Ity_V128,Ity_V128, Ity_V128);
sewardjc9a43662004-11-30 18:51:59 +00002605
sewardj2fdd4162010-08-22 12:59:02 +00002606 case Iop_PolynomialMull8x8:
2607 case Iop_Mull8Ux8: case Iop_Mull8Sx8:
2608 case Iop_Mull16Ux4: case Iop_Mull16Sx4:
2609 case Iop_Mull32Ux2: case Iop_Mull32Sx2:
2610 BINARY(Ity_I64, Ity_I64, Ity_V128);
2611
sewardjf0c1c582005-02-07 23:47:38 +00002612 case Iop_NotV128:
sewardj0bd7ce62004-12-05 02:47:40 +00002613 case Iop_Recip32Fx4: case Iop_Recip32F0x4:
sewardj2fdd4162010-08-22 12:59:02 +00002614 case Iop_Recip32x4:
sewardj636ad762004-12-07 11:16:04 +00002615 case Iop_Recip64Fx2: case Iop_Recip64F0x2:
sewardjc1e7dfc2004-12-05 19:29:45 +00002616 case Iop_RSqrt32Fx4: case Iop_RSqrt32F0x4:
sewardj636ad762004-12-07 11:16:04 +00002617 case Iop_RSqrt64Fx2: case Iop_RSqrt64F0x2:
sewardjc1e7dfc2004-12-05 19:29:45 +00002618 case Iop_Sqrt32Fx4: case Iop_Sqrt32F0x4:
sewardj636ad762004-12-07 11:16:04 +00002619 case Iop_Sqrt64Fx2: case Iop_Sqrt64F0x2:
sewardj2e383862004-12-12 16:46:47 +00002620 case Iop_CmpNEZ8x16: case Iop_CmpNEZ16x8:
sewardj109ffdb2004-12-10 21:45:38 +00002621 case Iop_CmpNEZ32x4: case Iop_CmpNEZ64x2:
sewardj2fdd4162010-08-22 12:59:02 +00002622 case Iop_Cnt8x16:
2623 case Iop_Clz8Sx16: case Iop_Clz16Sx8: case Iop_Clz32Sx4:
2624 case Iop_Cls8Sx16: case Iop_Cls16Sx8: case Iop_Cls32Sx4:
2625 case Iop_PwAddL8Ux16: case Iop_PwAddL16Ux8: case Iop_PwAddL32Ux4:
2626 case Iop_PwAddL8Sx16: case Iop_PwAddL16Sx8: case Iop_PwAddL32Sx4:
2627 case Iop_Reverse64_8x16: case Iop_Reverse64_16x8: case Iop_Reverse64_32x4:
2628 case Iop_Reverse32_8x16: case Iop_Reverse32_16x8:
2629 case Iop_Reverse16_8x16:
2630 case Iop_Neg32Fx4:
2631 case Iop_Abs8x16: case Iop_Abs16x8: case Iop_Abs32x4:
sewardj0bd7ce62004-12-05 02:47:40 +00002632 UNARY(Ity_V128, Ity_V128);
2633
cerionf887b3e2005-09-13 16:34:28 +00002634 case Iop_ShlV128: case Iop_ShrV128:
sewardjb183b852006-02-03 16:08:03 +00002635 case Iop_ShlN8x16: case Iop_ShlN16x8:
2636 case Iop_ShlN32x4: case Iop_ShlN64x2:
2637 case Iop_ShrN8x16: case Iop_ShrN16x8:
2638 case Iop_ShrN32x4: case Iop_ShrN64x2:
sewardj2fdd4162010-08-22 12:59:02 +00002639 case Iop_SarN8x16: case Iop_SarN16x8:
2640 case Iop_SarN32x4: case Iop_SarN64x2:
2641 case Iop_QShlN8x16: case Iop_QShlN16x8:
2642 case Iop_QShlN32x4: case Iop_QShlN64x2:
2643 case Iop_QShlN8Sx16: case Iop_QShlN16Sx8:
2644 case Iop_QShlN32Sx4: case Iop_QShlN64Sx2:
2645 case Iop_QSalN8x16: case Iop_QSalN16x8:
2646 case Iop_QSalN32x4: case Iop_QSalN64x2:
sewardjb183b852006-02-03 16:08:03 +00002647 BINARY(Ity_V128,Ity_I8, Ity_V128);
sewardj164f9272004-12-09 00:39:32 +00002648
sewardj2fdd4162010-08-22 12:59:02 +00002649 case Iop_F32ToFixed32Ux4_RZ:
2650 case Iop_F32ToFixed32Sx4_RZ:
2651 case Iop_Fixed32UToF32x4_RN:
2652 case Iop_Fixed32SToF32x4_RN:
2653 BINARY(Ity_V128, Ity_I8, Ity_V128);
2654
2655 case Iop_F32ToFixed32Ux2_RZ:
2656 case Iop_F32ToFixed32Sx2_RZ:
2657 case Iop_Fixed32UToF32x2_RN:
2658 case Iop_Fixed32SToF32x2_RN:
2659 BINARY(Ity_I64, Ity_I8, Ity_I64);
2660
2661 case Iop_GetElem8x16:
2662 BINARY(Ity_V128, Ity_I8, Ity_I8);
2663 case Iop_GetElem16x8:
2664 BINARY(Ity_V128, Ity_I8, Ity_I16);
2665 case Iop_GetElem32x4:
2666 BINARY(Ity_V128, Ity_I8, Ity_I32);
2667 case Iop_GetElem64x2:
2668 BINARY(Ity_V128, Ity_I8, Ity_I64);
2669 case Iop_GetElem8x8:
2670 BINARY(Ity_I64, Ity_I8, Ity_I8);
2671 case Iop_GetElem16x4:
2672 BINARY(Ity_I64, Ity_I8, Ity_I16);
2673 case Iop_GetElem32x2:
2674 BINARY(Ity_I64, Ity_I8, Ity_I32);
2675 case Iop_SetElem8x8:
2676 TERNARY(Ity_I64, Ity_I8, Ity_I8, Ity_I64);
2677 case Iop_SetElem16x4:
2678 TERNARY(Ity_I64, Ity_I8, Ity_I16, Ity_I64);
2679 case Iop_SetElem32x2:
2680 TERNARY(Ity_I64, Ity_I8, Ity_I32, Ity_I64);
2681
2682 case Iop_Extract64:
2683 TERNARY(Ity_I64, Ity_I64, Ity_I8, Ity_I64);
2684 case Iop_ExtractV128:
2685 TERNARY(Ity_V128, Ity_V128, Ity_I8, Ity_V128);
2686
2687 case Iop_QDMulLong16Sx4: case Iop_QDMulLong32Sx2:
2688 BINARY(Ity_I64, Ity_I64, Ity_V128);
2689
sewardj2019a972011-03-07 16:04:07 +00002690 /* s390 specific */
2691 case Iop_MAddF32:
2692 case Iop_MSubF32:
2693 QUATERNARY(ity_RMode,Ity_F32,Ity_F32,Ity_F32, Ity_F32);
2694
2695 case Iop_F64HLtoF128:
2696 BINARY(Ity_F64,Ity_F64, Ity_F128);
2697
2698 case Iop_F128HItoF64:
2699 case Iop_F128LOtoF64:
2700 UNARY(Ity_F128, Ity_F64);
2701
2702 case Iop_AddF128:
2703 case Iop_SubF128:
2704 case Iop_MulF128:
2705 case Iop_DivF128:
2706 TERNARY(ity_RMode,Ity_F128,Ity_F128, Ity_F128);
2707
2708 case Iop_NegF128:
2709 case Iop_AbsF128:
2710 UNARY(Ity_F128, Ity_F128);
2711
2712 case Iop_SqrtF128:
2713 BINARY(ity_RMode,Ity_F128, Ity_F128);
2714
2715 case Iop_I32StoF128: UNARY(Ity_I32, Ity_F128);
2716 case Iop_I64StoF128: UNARY(Ity_I64, Ity_F128);
2717
2718 case Iop_F128toI32S: BINARY(ity_RMode,Ity_F128, Ity_I32);
2719 case Iop_F128toI64S: BINARY(ity_RMode,Ity_F128, Ity_I64);
2720
2721 case Iop_F32toF128: UNARY(Ity_F32, Ity_F128);
2722 case Iop_F64toF128: UNARY(Ity_F64, Ity_F128);
2723
2724 case Iop_F128toF32: BINARY(ity_RMode,Ity_F128, Ity_F32);
2725 case Iop_F128toF64: BINARY(ity_RMode,Ity_F128, Ity_F64);
2726
sewardj26217b02012-04-12 17:19:48 +00002727 case Iop_D32toD64:
sewardjcdc376d2012-04-23 11:21:12 +00002728 case Iop_ExtractExpD64:
sewardj26217b02012-04-12 17:19:48 +00002729 UNARY(Ity_D64, Ity_D64);
2730
sewardjcdc376d2012-04-23 11:21:12 +00002731 case Iop_InsertExpD64:
2732 BINARY(Ity_D64,Ity_D64, Ity_D64);
2733
2734 case Iop_ExtractExpD128:
2735 UNARY(Ity_D128, Ity_D64);
2736
2737 case Iop_InsertExpD128:
2738 BINARY(Ity_D64,Ity_D128, Ity_D128);
2739
sewardj26217b02012-04-12 17:19:48 +00002740 case Iop_D64toD128:
2741 UNARY(Ity_D64, Ity_D128);
2742
sewardj5eff1c52012-04-29 20:19:17 +00002743 case Iop_ReinterpD64asI64:
2744 UNARY(Ity_D64, Ity_I64);
2745
sewardjcdc376d2012-04-23 11:21:12 +00002746 case Iop_ReinterpI64asD64:
2747 UNARY(Ity_I64, Ity_D64);
2748
2749 case Iop_RoundD64toInt:
2750 BINARY(ity_RMode,Ity_D64, Ity_D64);
2751
2752 case Iop_RoundD128toInt:
2753 BINARY(ity_RMode,Ity_D128, Ity_D128);
2754
sewardj26217b02012-04-12 17:19:48 +00002755 case Iop_I64StoD128: /* I64 bit pattern stored in Float register */
2756 UNARY(Ity_D64, Ity_D128);
2757
sewardj4c96e612012-06-02 23:47:02 +00002758 case Iop_DPBtoBCD:
2759 case Iop_BCDtoDPB:
2760 UNARY(Ity_I64, Ity_I64);
2761
sewardjc6bbd472012-04-02 10:20:48 +00002762 case Iop_D128HItoD64:
2763 case Iop_D128LOtoD64:
2764 UNARY(Ity_D128, Ity_D64);
2765
sewardj26217b02012-04-12 17:19:48 +00002766 case Iop_D128toI64S:
2767 BINARY(ity_RMode, Ity_D128, Ity_D64);
2768
sewardjc6bbd472012-04-02 10:20:48 +00002769 case Iop_D64HLtoD128:
sewardj26217b02012-04-12 17:19:48 +00002770 BINARY(Ity_D64, Ity_D64, Ity_D128);
2771
2772 case Iop_ShlD64:
2773 case Iop_ShrD64:
2774 BINARY(Ity_D64, Ity_I8, Ity_D64 );
2775
2776 case Iop_D64toD32:
2777 case Iop_D64toI64S:
2778 BINARY(ity_RMode, Ity_D64, Ity_D64);
2779
2780 case Iop_I64StoD64: /* I64 bit pattern stored in Float register */
2781 BINARY(ity_RMode, Ity_D64, Ity_D64);
2782
sewardjcdc376d2012-04-23 11:21:12 +00002783 case Iop_CmpD64:
2784 BINARY(Ity_D64,Ity_D64, Ity_I32);
2785
2786 case Iop_CmpD128:
2787 BINARY(Ity_D128,Ity_D128, Ity_I32);
2788
2789 case Iop_QuantizeD64:
2790 case Iop_SignificanceRoundD64:
2791 TERNARY(ity_RMode,Ity_D64,Ity_D64, Ity_D64);
2792
2793 case Iop_QuantizeD128:
2794 case Iop_SignificanceRoundD128:
2795 TERNARY(ity_RMode,Ity_D128,Ity_D128, Ity_D128);
2796
sewardj26217b02012-04-12 17:19:48 +00002797 case Iop_ShlD128:
2798 case Iop_ShrD128:
2799 BINARY(Ity_D128, Ity_I8, Ity_D128 );
sewardjc6bbd472012-04-02 10:20:48 +00002800
2801 case Iop_AddD64:
2802 case Iop_SubD64:
2803 case Iop_MulD64:
2804 case Iop_DivD64:
2805 TERNARY( ity_RMode, Ity_D64, Ity_D64, Ity_D64 );
2806
sewardj26217b02012-04-12 17:19:48 +00002807 case Iop_D128toD64:
2808 BINARY( ity_RMode, Ity_D128, Ity_D64 );
2809
sewardjc6bbd472012-04-02 10:20:48 +00002810 case Iop_AddD128:
2811 case Iop_SubD128:
2812 case Iop_MulD128:
2813 case Iop_DivD128:
2814 TERNARY(ity_RMode,Ity_D128,Ity_D128, Ity_D128);
2815
sewardjc4530ae2012-05-21 10:18:49 +00002816 case Iop_V256to64_0: case Iop_V256to64_1:
2817 case Iop_V256to64_2: case Iop_V256to64_3:
2818 UNARY(Ity_V256, Ity_I64);
2819
2820 case Iop_64x4toV256:
2821 QUATERNARY(Ity_I64, Ity_I64, Ity_I64, Ity_I64, Ity_V256);
2822
sewardj2a2bda92012-06-14 23:32:02 +00002823 case Iop_Add64Fx4: case Iop_Sub64Fx4:
2824 case Iop_Mul64Fx4: case Iop_Div64Fx4:
2825 case Iop_Add32Fx8: case Iop_Sub32Fx8:
2826 case Iop_Mul32Fx8: case Iop_Div32Fx8:
2827 case Iop_AndV256: case Iop_OrV256:
sewardj4b1cc832012-06-13 11:10:20 +00002828 case Iop_XorV256:
sewardj8eb7ae82012-06-24 14:00:27 +00002829 case Iop_Max32Fx8: case Iop_Min32Fx8:
2830 case Iop_Max64Fx4: case Iop_Min64Fx4:
sewardj56c30312012-06-12 08:45:39 +00002831 BINARY(Ity_V256,Ity_V256, Ity_V256);
2832
sewardj4b1cc832012-06-13 11:10:20 +00002833 case Iop_V256toV128_1: case Iop_V256toV128_0:
2834 UNARY(Ity_V256, Ity_V128);
2835
2836 case Iop_V128HLtoV256:
2837 BINARY(Ity_V128,Ity_V128, Ity_V256);
2838
sewardj2a2bda92012-06-14 23:32:02 +00002839 case Iop_NotV256:
sewardj66becf32012-06-18 23:15:16 +00002840 case Iop_RSqrt32Fx8:
2841 case Iop_Sqrt32Fx8:
2842 case Iop_Sqrt64Fx4:
sewardj82096922012-06-24 14:57:59 +00002843 case Iop_Recip32Fx8:
sewardj23db8a02012-06-25 07:46:18 +00002844 case Iop_CmpNEZ64x4: case Iop_CmpNEZ32x8:
sewardj2a2bda92012-06-14 23:32:02 +00002845 UNARY(Ity_V256, Ity_V256);
2846
sewardj6efd4a12004-07-15 03:54:23 +00002847 default:
2848 ppIROp(op);
2849 vpanic("typeOfPrimop");
2850 }
2851# undef UNARY
2852# undef BINARY
sewardjb183b852006-02-03 16:08:03 +00002853# undef TERNARY
sewardj6efd4a12004-07-15 03:54:23 +00002854# undef COMPARISON
sewardj0033ddc2005-04-26 23:34:34 +00002855# undef UNARY_COMPARISON
sewardj6efd4a12004-07-15 03:54:23 +00002856}
2857
2858
2859/*---------------------------------------------------------------*/
sewardj695cff92004-10-13 14:50:14 +00002860/*--- Helper functions for the IR -- IR Basic Blocks ---*/
sewardjc97096c2004-06-30 09:28:04 +00002861/*---------------------------------------------------------------*/
2862
sewardjdd40fdf2006-12-24 02:20:24 +00002863void addStmtToIRSB ( IRSB* bb, IRStmt* st )
sewardjd7cb8532004-08-17 23:59:23 +00002864{
2865 Int i;
sewardj695cff92004-10-13 14:50:14 +00002866 if (bb->stmts_used == bb->stmts_size) {
2867 IRStmt** stmts2 = LibVEX_Alloc(2 * bb->stmts_size * sizeof(IRStmt*));
2868 for (i = 0; i < bb->stmts_size; i++)
2869 stmts2[i] = bb->stmts[i];
2870 bb->stmts = stmts2;
2871 bb->stmts_size *= 2;
2872 }
2873 vassert(bb->stmts_used < bb->stmts_size);
2874 bb->stmts[bb->stmts_used] = st;
2875 bb->stmts_used++;
sewardjd7cb8532004-08-17 23:59:23 +00002876}
2877
sewardj695cff92004-10-13 14:50:14 +00002878
2879/*---------------------------------------------------------------*/
2880/*--- Helper functions for the IR -- IR Type Environments ---*/
2881/*---------------------------------------------------------------*/
2882
sewardjd7cb8532004-08-17 23:59:23 +00002883/* Allocate a new IRTemp, given its type. */
sewardje3d0d2e2004-06-27 10:42:44 +00002884
sewardje539a402004-07-14 18:24:17 +00002885IRTemp newIRTemp ( IRTypeEnv* env, IRType ty )
sewardjc97096c2004-06-30 09:28:04 +00002886{
sewardj35421a32004-07-05 13:12:34 +00002887 vassert(env);
sewardje539a402004-07-14 18:24:17 +00002888 vassert(env->types_used >= 0);
2889 vassert(env->types_size >= 0);
2890 vassert(env->types_used <= env->types_size);
2891 if (env->types_used < env->types_size) {
2892 env->types[env->types_used] = ty;
2893 return env->types_used++;
sewardjc97096c2004-06-30 09:28:04 +00002894 } else {
2895 Int i;
sewardje539a402004-07-14 18:24:17 +00002896 Int new_size = env->types_size==0 ? 8 : 2*env->types_size;
2897 IRType* new_types
2898 = LibVEX_Alloc(new_size * sizeof(IRType));
2899 for (i = 0; i < env->types_used; i++)
2900 new_types[i] = env->types[i];
2901 env->types = new_types;
2902 env->types_size = new_size;
2903 return newIRTemp(env, ty);
sewardjc97096c2004-06-30 09:28:04 +00002904 }
2905}
2906
2907
sewardj17442fe2004-09-20 14:54:28 +00002908/*---------------------------------------------------------------*/
2909/*--- Helper functions for the IR -- finding types of exprs ---*/
2910/*---------------------------------------------------------------*/
2911
sewardjedeb4c42004-09-21 23:39:25 +00002912inline
sewardj17442fe2004-09-20 14:54:28 +00002913IRType typeOfIRTemp ( IRTypeEnv* env, IRTemp tmp )
sewardjc97096c2004-06-30 09:28:04 +00002914{
sewardje539a402004-07-14 18:24:17 +00002915 vassert(tmp >= 0);
2916 vassert(tmp < env->types_used);
2917 return env->types[tmp];
sewardjc97096c2004-06-30 09:28:04 +00002918}
2919
2920
sewardj6efd4a12004-07-15 03:54:23 +00002921IRType typeOfIRConst ( IRConst* con )
2922{
2923 switch (con->tag) {
sewardjba999312004-11-15 15:21:17 +00002924 case Ico_U1: return Ity_I1;
sewardj207557a2004-08-27 12:00:18 +00002925 case Ico_U8: return Ity_I8;
2926 case Ico_U16: return Ity_I16;
2927 case Ico_U32: return Ity_I32;
2928 case Ico_U64: return Ity_I64;
sewardj2019a972011-03-07 16:04:07 +00002929 case Ico_F32: return Ity_F32;
2930 case Ico_F32i: return Ity_F32;
sewardj207557a2004-08-27 12:00:18 +00002931 case Ico_F64: return Ity_F64;
sewardj17442fe2004-09-20 14:54:28 +00002932 case Ico_F64i: return Ity_F64;
sewardj1e6ad742004-12-02 16:16:11 +00002933 case Ico_V128: return Ity_V128;
sewardj37a505b2012-06-29 15:28:24 +00002934 case Ico_V256: return Ity_V256;
sewardj6efd4a12004-07-15 03:54:23 +00002935 default: vpanic("typeOfIRConst");
2936 }
2937}
2938
sewardjc97096c2004-06-30 09:28:04 +00002939IRType typeOfIRExpr ( IRTypeEnv* tyenv, IRExpr* e )
2940{
sewardj40c80262006-02-08 19:30:46 +00002941 IRType t_dst, t_arg1, t_arg2, t_arg3, t_arg4;
sewardjedeb4c42004-09-21 23:39:25 +00002942 start:
sewardjc97096c2004-06-30 09:28:04 +00002943 switch (e->tag) {
sewardjaf1ceca2005-06-30 23:31:27 +00002944 case Iex_Load:
2945 return e->Iex.Load.ty;
sewardjfbcaf332004-07-08 01:46:01 +00002946 case Iex_Get:
2947 return e->Iex.Get.ty;
sewardjbb53f8c2004-08-14 11:50:01 +00002948 case Iex_GetI:
sewardj2d3f77c2004-09-22 23:49:09 +00002949 return e->Iex.GetI.descr->elemTy;
sewardjdd40fdf2006-12-24 02:20:24 +00002950 case Iex_RdTmp:
2951 return typeOfIRTemp(tyenv, e->Iex.RdTmp.tmp);
sewardjc97096c2004-06-30 09:28:04 +00002952 case Iex_Const:
sewardj695cff92004-10-13 14:50:14 +00002953 return typeOfIRConst(e->Iex.Const.con);
sewardj40c80262006-02-08 19:30:46 +00002954 case Iex_Qop:
florian96d7cc32012-06-01 20:41:24 +00002955 typeOfPrimop(e->Iex.Qop.details->op,
sewardj40c80262006-02-08 19:30:46 +00002956 &t_dst, &t_arg1, &t_arg2, &t_arg3, &t_arg4);
2957 return t_dst;
sewardjb183b852006-02-03 16:08:03 +00002958 case Iex_Triop:
florian420bfa92012-06-02 20:29:22 +00002959 typeOfPrimop(e->Iex.Triop.details->op,
sewardj40c80262006-02-08 19:30:46 +00002960 &t_dst, &t_arg1, &t_arg2, &t_arg3, &t_arg4);
sewardjb183b852006-02-03 16:08:03 +00002961 return t_dst;
sewardjc97096c2004-06-30 09:28:04 +00002962 case Iex_Binop:
sewardj40c80262006-02-08 19:30:46 +00002963 typeOfPrimop(e->Iex.Binop.op,
2964 &t_dst, &t_arg1, &t_arg2, &t_arg3, &t_arg4);
sewardj6efd4a12004-07-15 03:54:23 +00002965 return t_dst;
2966 case Iex_Unop:
sewardj40c80262006-02-08 19:30:46 +00002967 typeOfPrimop(e->Iex.Unop.op,
2968 &t_dst, &t_arg1, &t_arg2, &t_arg3, &t_arg4);
sewardj6efd4a12004-07-15 03:54:23 +00002969 return t_dst;
2970 case Iex_CCall:
2971 return e->Iex.CCall.retty;
sewardj4042c7e2004-07-18 01:28:30 +00002972 case Iex_Mux0X:
sewardjedeb4c42004-09-21 23:39:25 +00002973 e = e->Iex.Mux0X.expr0;
2974 goto start;
2975 /* return typeOfIRExpr(tyenv, e->Iex.Mux0X.expr0); */
sewardj443cd9d2004-07-18 23:06:45 +00002976 case Iex_Binder:
2977 vpanic("typeOfIRExpr: Binder is not a valid expression");
sewardjc97096c2004-06-30 09:28:04 +00002978 default:
sewardj6efd4a12004-07-15 03:54:23 +00002979 ppIRExpr(e);
2980 vpanic("typeOfIRExpr");
sewardjc97096c2004-06-30 09:28:04 +00002981 }
sewardjc97096c2004-06-30 09:28:04 +00002982}
sewardj887a11a2004-07-05 17:26:47 +00002983
sewardj6d2638e2004-07-15 09:38:27 +00002984/* Is this any value actually in the enumeration 'IRType' ? */
sewardj496a58d2005-03-20 18:44:44 +00002985Bool isPlausibleIRType ( IRType ty )
sewardj6d2638e2004-07-15 09:38:27 +00002986{
2987 switch (ty) {
sewardjba999312004-11-15 15:21:17 +00002988 case Ity_INVALID: case Ity_I1:
sewardj9b967672005-02-08 11:13:09 +00002989 case Ity_I8: case Ity_I16: case Ity_I32:
2990 case Ity_I64: case Ity_I128:
sewardj2019a972011-03-07 16:04:07 +00002991 case Ity_F32: case Ity_F64: case Ity_F128:
sewardjc6bbd472012-04-02 10:20:48 +00002992 case Ity_D32: case Ity_D64: case Ity_D128:
sewardjc4530ae2012-05-21 10:18:49 +00002993 case Ity_V128: case Ity_V256:
sewardj6d2638e2004-07-15 09:38:27 +00002994 return True;
2995 default:
2996 return False;
2997 }
2998}
2999
sewardj6efd4a12004-07-15 03:54:23 +00003000
sewardj887a11a2004-07-05 17:26:47 +00003001/*---------------------------------------------------------------*/
sewardjcf787902004-11-03 09:08:33 +00003002/*--- Sanity checking -- FLATNESS ---*/
3003/*---------------------------------------------------------------*/
3004
3005/* Check that the canonical flatness constraints hold on an
3006 IRStmt. The only place where any expression is allowed to be
3007 non-atomic is the RHS of IRStmt_Tmp. */
3008
3009/* Relies on:
3010 inline static Bool isAtom ( IRExpr* e ) {
sewardjdd40fdf2006-12-24 02:20:24 +00003011 return e->tag == Iex_RdTmp || e->tag == Iex_Const;
sewardjcf787902004-11-03 09:08:33 +00003012 }
3013*/
3014
3015Bool isFlatIRStmt ( IRStmt* st )
3016{
3017 Int i;
3018 IRExpr* e;
3019 IRDirty* di;
sewardje9d8a262009-07-01 08:06:34 +00003020 IRCAS* cas;
floriand6f38b32012-05-31 15:46:18 +00003021 IRPutI* puti;
florian96d7cc32012-06-01 20:41:24 +00003022 IRQop* qop;
florian420bfa92012-06-02 20:29:22 +00003023 IRTriop* triop;
sewardjcf787902004-11-03 09:08:33 +00003024
3025 switch (st->tag) {
sewardj5a9ffab2005-05-12 17:55:01 +00003026 case Ist_AbiHint:
sewardj478646f2008-05-01 20:13:04 +00003027 return isIRAtom(st->Ist.AbiHint.base)
3028 && isIRAtom(st->Ist.AbiHint.nia);
sewardjcf787902004-11-03 09:08:33 +00003029 case Ist_Put:
sewardj496a58d2005-03-20 18:44:44 +00003030 return isIRAtom(st->Ist.Put.data);
sewardjcf787902004-11-03 09:08:33 +00003031 case Ist_PutI:
floriand6f38b32012-05-31 15:46:18 +00003032 puti = st->Ist.PutI.details;
3033 return toBool( isIRAtom(puti->ix)
3034 && isIRAtom(puti->data) );
sewardjdd40fdf2006-12-24 02:20:24 +00003035 case Ist_WrTmp:
sewardjcf787902004-11-03 09:08:33 +00003036 /* This is the only interesting case. The RHS can be any
3037 expression, *but* all its subexpressions *must* be
3038 atoms. */
sewardjdd40fdf2006-12-24 02:20:24 +00003039 e = st->Ist.WrTmp.data;
sewardjcf787902004-11-03 09:08:33 +00003040 switch (e->tag) {
3041 case Iex_Binder: return True;
3042 case Iex_Get: return True;
sewardj496a58d2005-03-20 18:44:44 +00003043 case Iex_GetI: return isIRAtom(e->Iex.GetI.ix);
sewardjdd40fdf2006-12-24 02:20:24 +00003044 case Iex_RdTmp: return True;
florian96d7cc32012-06-01 20:41:24 +00003045 case Iex_Qop: qop = e->Iex.Qop.details;
3046 return toBool(
3047 isIRAtom(qop->arg1)
3048 && isIRAtom(qop->arg2)
3049 && isIRAtom(qop->arg3)
3050 && isIRAtom(qop->arg4));
florian420bfa92012-06-02 20:29:22 +00003051 case Iex_Triop: triop = e->Iex.Triop.details;
3052 return toBool(
3053 isIRAtom(triop->arg1)
3054 && isIRAtom(triop->arg2)
3055 && isIRAtom(triop->arg3));
sewardja98bf492005-02-07 01:39:17 +00003056 case Iex_Binop: return toBool(
sewardj496a58d2005-03-20 18:44:44 +00003057 isIRAtom(e->Iex.Binop.arg1)
3058 && isIRAtom(e->Iex.Binop.arg2));
3059 case Iex_Unop: return isIRAtom(e->Iex.Unop.arg);
sewardjaf1ceca2005-06-30 23:31:27 +00003060 case Iex_Load: return isIRAtom(e->Iex.Load.addr);
sewardjcf787902004-11-03 09:08:33 +00003061 case Iex_Const: return True;
3062 case Iex_CCall: for (i = 0; e->Iex.CCall.args[i]; i++)
sewardj496a58d2005-03-20 18:44:44 +00003063 if (!isIRAtom(e->Iex.CCall.args[i]))
sewardjcf787902004-11-03 09:08:33 +00003064 return False;
3065 return True;
sewardja98bf492005-02-07 01:39:17 +00003066 case Iex_Mux0X: return toBool (
sewardj496a58d2005-03-20 18:44:44 +00003067 isIRAtom(e->Iex.Mux0X.cond)
3068 && isIRAtom(e->Iex.Mux0X.expr0)
3069 && isIRAtom(e->Iex.Mux0X.exprX));
sewardjcf787902004-11-03 09:08:33 +00003070 default: vpanic("isFlatIRStmt(e)");
3071 }
3072 /*notreached*/
3073 vassert(0);
sewardjaf1ceca2005-06-30 23:31:27 +00003074 case Ist_Store:
3075 return toBool( isIRAtom(st->Ist.Store.addr)
3076 && isIRAtom(st->Ist.Store.data) );
sewardje9d8a262009-07-01 08:06:34 +00003077 case Ist_CAS:
3078 cas = st->Ist.CAS.details;
3079 return toBool( isIRAtom(cas->addr)
3080 && (cas->expdHi ? isIRAtom(cas->expdHi) : True)
3081 && isIRAtom(cas->expdLo)
3082 && (cas->dataHi ? isIRAtom(cas->dataHi) : True)
3083 && isIRAtom(cas->dataLo) );
sewardje768e922009-11-26 17:17:37 +00003084 case Ist_LLSC:
3085 return toBool( isIRAtom(st->Ist.LLSC.addr)
3086 && (st->Ist.LLSC.storedata
3087 ? isIRAtom(st->Ist.LLSC.storedata) : True) );
sewardjcf787902004-11-03 09:08:33 +00003088 case Ist_Dirty:
3089 di = st->Ist.Dirty.details;
sewardj496a58d2005-03-20 18:44:44 +00003090 if (!isIRAtom(di->guard))
sewardjcf787902004-11-03 09:08:33 +00003091 return False;
3092 for (i = 0; di->args[i]; i++)
sewardj496a58d2005-03-20 18:44:44 +00003093 if (!isIRAtom(di->args[i]))
sewardjcf787902004-11-03 09:08:33 +00003094 return False;
sewardj496a58d2005-03-20 18:44:44 +00003095 if (di->mAddr && !isIRAtom(di->mAddr))
sewardjcf787902004-11-03 09:08:33 +00003096 return False;
3097 return True;
sewardjd2445f62005-03-21 00:15:53 +00003098 case Ist_NoOp:
sewardjf1689312005-03-16 18:19:10 +00003099 case Ist_IMark:
sewardjc4356f02007-11-09 21:15:04 +00003100 case Ist_MBE:
sewardj3e838932005-01-07 12:09:15 +00003101 return True;
sewardjcf787902004-11-03 09:08:33 +00003102 case Ist_Exit:
sewardj496a58d2005-03-20 18:44:44 +00003103 return isIRAtom(st->Ist.Exit.guard);
sewardjcf787902004-11-03 09:08:33 +00003104 default:
3105 vpanic("isFlatIRStmt(st)");
3106 }
3107}
3108
3109
3110/*---------------------------------------------------------------*/
sewardje539a402004-07-14 18:24:17 +00003111/*--- Sanity checking ---*/
3112/*---------------------------------------------------------------*/
3113
3114/* Checks:
3115
3116 Everything is type-consistent. No ill-typed anything.
sewardj35439212004-07-14 22:36:10 +00003117 The target address at the end of the BB is a 32- or 64-
3118 bit expression, depending on the guest's word size.
sewardje539a402004-07-14 18:24:17 +00003119
3120 Each temp is assigned only once, before its uses.
sewardjc13e2ed2004-10-31 21:44:54 +00003121*/
3122
3123static inline Int countArgs ( IRExpr** args )
3124{
3125 Int i;
3126 for (i = 0; args[i]; i++)
3127 ;
3128 return i;
3129}
sewardje539a402004-07-14 18:24:17 +00003130
sewardj35439212004-07-14 22:36:10 +00003131static
3132__attribute((noreturn))
sewardjdd40fdf2006-12-24 02:20:24 +00003133void sanityCheckFail ( IRSB* bb, IRStmt* stmt, HChar* what )
sewardje539a402004-07-14 18:24:17 +00003134{
sewardj35439212004-07-14 22:36:10 +00003135 vex_printf("\nIR SANITY CHECK FAILURE\n\n");
sewardjdd40fdf2006-12-24 02:20:24 +00003136 ppIRSB(bb);
sewardj35439212004-07-14 22:36:10 +00003137 if (stmt) {
3138 vex_printf("\nIN STATEMENT:\n\n");
3139 ppIRStmt(stmt);
3140 }
3141 vex_printf("\n\nERROR = %s\n\n", what );
3142 vpanic("sanityCheckFail: exiting due to bad IR");
3143}
3144
sewardjdd40fdf2006-12-24 02:20:24 +00003145static Bool saneIRRegArray ( IRRegArray* arr )
sewardj2d3f77c2004-09-22 23:49:09 +00003146{
3147 if (arr->base < 0 || arr->base > 10000 /* somewhat arbitrary */)
3148 return False;
sewardjba999312004-11-15 15:21:17 +00003149 if (arr->elemTy == Ity_I1)
sewardj2d3f77c2004-09-22 23:49:09 +00003150 return False;
3151 if (arr->nElems <= 0 || arr->nElems > 500 /* somewhat arbitrary */)
3152 return False;
3153 return True;
3154}
3155
sewardj8ea867b2004-10-30 19:03:02 +00003156static Bool saneIRCallee ( IRCallee* cee )
3157{
3158 if (cee->name == NULL)
3159 return False;
3160 if (cee->addr == 0)
3161 return False;
sewardj77352542004-10-30 20:39:01 +00003162 if (cee->regparms < 0 || cee->regparms > 3)
sewardj8ea867b2004-10-30 19:03:02 +00003163 return False;
3164 return True;
3165}
3166
sewardj49bfe672004-11-15 15:46:26 +00003167static Bool saneIRConst ( IRConst* con )
3168{
3169 switch (con->tag) {
3170 case Ico_U1:
sewardja98bf492005-02-07 01:39:17 +00003171 return toBool( con->Ico.U1 == True || con->Ico.U1 == False );
sewardj49bfe672004-11-15 15:46:26 +00003172 default:
3173 /* Is there anything we can meaningfully check? I don't
3174 think so. */
3175 return True;
3176 }
3177}
sewardj35439212004-07-14 22:36:10 +00003178
3179/* Traverse a Stmt/Expr, inspecting IRTemp uses. Report any out of
3180 range ones. Report any which are read and for which the current
3181 def_count is zero. */
3182
3183static
sewardjdd40fdf2006-12-24 02:20:24 +00003184void useBeforeDef_Temp ( IRSB* bb, IRStmt* stmt, IRTemp tmp, Int* def_counts )
sewardj17442fe2004-09-20 14:54:28 +00003185{
3186 if (tmp < 0 || tmp >= bb->tyenv->types_used)
3187 sanityCheckFail(bb,stmt, "out of range Temp in IRExpr");
3188 if (def_counts[tmp] < 1)
3189 sanityCheckFail(bb,stmt, "IRTemp use before def in IRExpr");
3190}
3191
3192static
sewardjdd40fdf2006-12-24 02:20:24 +00003193void useBeforeDef_Expr ( IRSB* bb, IRStmt* stmt, IRExpr* expr, Int* def_counts )
sewardj35439212004-07-14 22:36:10 +00003194{
3195 Int i;
3196 switch (expr->tag) {
3197 case Iex_Get:
3198 break;
sewardjbb53f8c2004-08-14 11:50:01 +00003199 case Iex_GetI:
sewardjeeac8412004-11-02 00:26:55 +00003200 useBeforeDef_Expr(bb,stmt,expr->Iex.GetI.ix,def_counts);
sewardjbb53f8c2004-08-14 11:50:01 +00003201 break;
sewardjdd40fdf2006-12-24 02:20:24 +00003202 case Iex_RdTmp:
3203 useBeforeDef_Temp(bb,stmt,expr->Iex.RdTmp.tmp,def_counts);
sewardj35439212004-07-14 22:36:10 +00003204 break;
florian96d7cc32012-06-01 20:41:24 +00003205 case Iex_Qop: {
3206 IRQop* qop = expr->Iex.Qop.details;
3207 useBeforeDef_Expr(bb,stmt,qop->arg1,def_counts);
3208 useBeforeDef_Expr(bb,stmt,qop->arg2,def_counts);
3209 useBeforeDef_Expr(bb,stmt,qop->arg3,def_counts);
3210 useBeforeDef_Expr(bb,stmt,qop->arg4,def_counts);
sewardj40c80262006-02-08 19:30:46 +00003211 break;
florian96d7cc32012-06-01 20:41:24 +00003212 }
florian420bfa92012-06-02 20:29:22 +00003213 case Iex_Triop: {
3214 IRTriop* triop = expr->Iex.Triop.details;
3215 useBeforeDef_Expr(bb,stmt,triop->arg1,def_counts);
3216 useBeforeDef_Expr(bb,stmt,triop->arg2,def_counts);
3217 useBeforeDef_Expr(bb,stmt,triop->arg3,def_counts);
sewardjb183b852006-02-03 16:08:03 +00003218 break;
florian420bfa92012-06-02 20:29:22 +00003219 }
sewardj35439212004-07-14 22:36:10 +00003220 case Iex_Binop:
3221 useBeforeDef_Expr(bb,stmt,expr->Iex.Binop.arg1,def_counts);
3222 useBeforeDef_Expr(bb,stmt,expr->Iex.Binop.arg2,def_counts);
3223 break;
3224 case Iex_Unop:
3225 useBeforeDef_Expr(bb,stmt,expr->Iex.Unop.arg,def_counts);
3226 break;
sewardjaf1ceca2005-06-30 23:31:27 +00003227 case Iex_Load:
3228 useBeforeDef_Expr(bb,stmt,expr->Iex.Load.addr,def_counts);
sewardj35439212004-07-14 22:36:10 +00003229 break;
3230 case Iex_Const:
3231 break;
3232 case Iex_CCall:
3233 for (i = 0; expr->Iex.CCall.args[i]; i++)
3234 useBeforeDef_Expr(bb,stmt,expr->Iex.CCall.args[i],def_counts);
3235 break;
sewardj4042c7e2004-07-18 01:28:30 +00003236 case Iex_Mux0X:
3237 useBeforeDef_Expr(bb,stmt,expr->Iex.Mux0X.cond,def_counts);
3238 useBeforeDef_Expr(bb,stmt,expr->Iex.Mux0X.expr0,def_counts);
3239 useBeforeDef_Expr(bb,stmt,expr->Iex.Mux0X.exprX,def_counts);
sewardjeeb9ef82004-07-15 12:39:03 +00003240 break;
3241 default:
3242 vpanic("useBeforeDef_Expr");
sewardj35439212004-07-14 22:36:10 +00003243 }
3244}
3245
3246static
sewardjdd40fdf2006-12-24 02:20:24 +00003247void useBeforeDef_Stmt ( IRSB* bb, IRStmt* stmt, Int* def_counts )
sewardj35439212004-07-14 22:36:10 +00003248{
sewardj17442fe2004-09-20 14:54:28 +00003249 Int i;
3250 IRDirty* d;
sewardje9d8a262009-07-01 08:06:34 +00003251 IRCAS* cas;
floriand6f38b32012-05-31 15:46:18 +00003252 IRPutI* puti;
sewardj35439212004-07-14 22:36:10 +00003253 switch (stmt->tag) {
sewardjf1689312005-03-16 18:19:10 +00003254 case Ist_IMark:
3255 break;
sewardj5a9ffab2005-05-12 17:55:01 +00003256 case Ist_AbiHint:
3257 useBeforeDef_Expr(bb,stmt,stmt->Ist.AbiHint.base,def_counts);
sewardj478646f2008-05-01 20:13:04 +00003258 useBeforeDef_Expr(bb,stmt,stmt->Ist.AbiHint.nia,def_counts);
sewardj5a9ffab2005-05-12 17:55:01 +00003259 break;
sewardj35439212004-07-14 22:36:10 +00003260 case Ist_Put:
sewardj6d076362004-09-23 11:06:17 +00003261 useBeforeDef_Expr(bb,stmt,stmt->Ist.Put.data,def_counts);
sewardj35439212004-07-14 22:36:10 +00003262 break;
sewardjd1725d12004-08-12 20:46:53 +00003263 case Ist_PutI:
floriand6f38b32012-05-31 15:46:18 +00003264 puti = stmt->Ist.PutI.details;
3265 useBeforeDef_Expr(bb,stmt,puti->ix,def_counts);
3266 useBeforeDef_Expr(bb,stmt,puti->data,def_counts);
sewardjd1725d12004-08-12 20:46:53 +00003267 break;
sewardjdd40fdf2006-12-24 02:20:24 +00003268 case Ist_WrTmp:
3269 useBeforeDef_Expr(bb,stmt,stmt->Ist.WrTmp.data,def_counts);
sewardj35439212004-07-14 22:36:10 +00003270 break;
sewardjaf1ceca2005-06-30 23:31:27 +00003271 case Ist_Store:
3272 useBeforeDef_Expr(bb,stmt,stmt->Ist.Store.addr,def_counts);
3273 useBeforeDef_Expr(bb,stmt,stmt->Ist.Store.data,def_counts);
sewardj35439212004-07-14 22:36:10 +00003274 break;
sewardje9d8a262009-07-01 08:06:34 +00003275 case Ist_CAS:
3276 cas = stmt->Ist.CAS.details;
3277 useBeforeDef_Expr(bb,stmt,cas->addr,def_counts);
3278 if (cas->expdHi)
3279 useBeforeDef_Expr(bb,stmt,cas->expdHi,def_counts);
3280 useBeforeDef_Expr(bb,stmt,cas->expdLo,def_counts);
3281 if (cas->dataHi)
3282 useBeforeDef_Expr(bb,stmt,cas->dataHi,def_counts);
3283 useBeforeDef_Expr(bb,stmt,cas->dataLo,def_counts);
3284 break;
sewardje768e922009-11-26 17:17:37 +00003285 case Ist_LLSC:
3286 useBeforeDef_Expr(bb,stmt,stmt->Ist.LLSC.addr,def_counts);
3287 if (stmt->Ist.LLSC.storedata != NULL)
3288 useBeforeDef_Expr(bb,stmt,stmt->Ist.LLSC.storedata,def_counts);
3289 break;
sewardj17442fe2004-09-20 14:54:28 +00003290 case Ist_Dirty:
3291 d = stmt->Ist.Dirty.details;
3292 for (i = 0; d->args[i] != NULL; i++)
3293 useBeforeDef_Expr(bb,stmt,d->args[i],def_counts);
3294 if (d->mFx != Ifx_None)
3295 useBeforeDef_Expr(bb,stmt,d->mAddr,def_counts);
3296 break;
sewardjd2445f62005-03-21 00:15:53 +00003297 case Ist_NoOp:
sewardjc4356f02007-11-09 21:15:04 +00003298 case Ist_MBE:
sewardj3e838932005-01-07 12:09:15 +00003299 break;
sewardj35439212004-07-14 22:36:10 +00003300 case Ist_Exit:
sewardj0276d4b2004-11-15 15:30:21 +00003301 useBeforeDef_Expr(bb,stmt,stmt->Ist.Exit.guard,def_counts);
sewardj35439212004-07-14 22:36:10 +00003302 break;
3303 default:
3304 vpanic("useBeforeDef_Stmt");
3305 }
3306}
3307
sewardj6efd4a12004-07-15 03:54:23 +00003308static
sewardjdd40fdf2006-12-24 02:20:24 +00003309void tcExpr ( IRSB* bb, IRStmt* stmt, IRExpr* expr, IRType gWordTy )
sewardj6efd4a12004-07-15 03:54:23 +00003310{
3311 Int i;
sewardj40c80262006-02-08 19:30:46 +00003312 IRType t_dst, t_arg1, t_arg2, t_arg3, t_arg4;
sewardj6efd4a12004-07-15 03:54:23 +00003313 IRTypeEnv* tyenv = bb->tyenv;
3314 switch (expr->tag) {
3315 case Iex_Get:
sewardjdd40fdf2006-12-24 02:20:24 +00003316 case Iex_RdTmp:
sewardj6efd4a12004-07-15 03:54:23 +00003317 break;
sewardjbb53f8c2004-08-14 11:50:01 +00003318 case Iex_GetI:
sewardjeeac8412004-11-02 00:26:55 +00003319 tcExpr(bb,stmt, expr->Iex.GetI.ix, gWordTy );
3320 if (typeOfIRExpr(tyenv,expr->Iex.GetI.ix) != Ity_I32)
3321 sanityCheckFail(bb,stmt,"IRExpr.GetI.ix: not :: Ity_I32");
sewardjdd40fdf2006-12-24 02:20:24 +00003322 if (!saneIRRegArray(expr->Iex.GetI.descr))
sewardj2d3f77c2004-09-22 23:49:09 +00003323 sanityCheckFail(bb,stmt,"IRExpr.GetI.descr: invalid descr");
sewardjbb53f8c2004-08-14 11:50:01 +00003324 break;
sewardj40c80262006-02-08 19:30:46 +00003325 case Iex_Qop: {
3326 IRType ttarg1, ttarg2, ttarg3, ttarg4;
florian96d7cc32012-06-01 20:41:24 +00003327 IRQop* qop = expr->Iex.Qop.details;
3328 tcExpr(bb,stmt, qop->arg1, gWordTy );
3329 tcExpr(bb,stmt, qop->arg2, gWordTy );
3330 tcExpr(bb,stmt, qop->arg3, gWordTy );
3331 tcExpr(bb,stmt, qop->arg4, gWordTy );
3332 typeOfPrimop(qop->op,
sewardj40c80262006-02-08 19:30:46 +00003333 &t_dst, &t_arg1, &t_arg2, &t_arg3, &t_arg4);
3334 if (t_arg1 == Ity_INVALID || t_arg2 == Ity_INVALID
3335 || t_arg3 == Ity_INVALID || t_arg4 == Ity_INVALID) {
3336 vex_printf(" op name: " );
florian96d7cc32012-06-01 20:41:24 +00003337 ppIROp(qop->op);
sewardj40c80262006-02-08 19:30:46 +00003338 vex_printf("\n");
3339 sanityCheckFail(bb,stmt,
3340 "Iex.Qop: wrong arity op\n"
3341 "... name of op precedes BB printout\n");
3342 }
florian96d7cc32012-06-01 20:41:24 +00003343 ttarg1 = typeOfIRExpr(tyenv, qop->arg1);
3344 ttarg2 = typeOfIRExpr(tyenv, qop->arg2);
3345 ttarg3 = typeOfIRExpr(tyenv, qop->arg3);
3346 ttarg4 = typeOfIRExpr(tyenv, qop->arg4);
sewardj40c80262006-02-08 19:30:46 +00003347 if (t_arg1 != ttarg1 || t_arg2 != ttarg2
3348 || t_arg3 != ttarg3 || t_arg4 != ttarg4) {
3349 vex_printf(" op name: ");
florian96d7cc32012-06-01 20:41:24 +00003350 ppIROp(qop->op);
sewardj40c80262006-02-08 19:30:46 +00003351 vex_printf("\n");
3352 vex_printf(" op type is (");
3353 ppIRType(t_arg1);
3354 vex_printf(",");
3355 ppIRType(t_arg2);
3356 vex_printf(",");
3357 ppIRType(t_arg3);
3358 vex_printf(",");
3359 ppIRType(t_arg4);
3360 vex_printf(") -> ");
3361 ppIRType (t_dst);
3362 vex_printf("\narg tys are (");
3363 ppIRType(ttarg1);
3364 vex_printf(",");
3365 ppIRType(ttarg2);
3366 vex_printf(",");
3367 ppIRType(ttarg3);
3368 vex_printf(",");
3369 ppIRType(ttarg4);
3370 vex_printf(")\n");
3371 sanityCheckFail(bb,stmt,
3372 "Iex.Qop: arg tys don't match op tys\n"
3373 "... additional details precede BB printout\n");
3374 }
3375 break;
3376 }
sewardjb183b852006-02-03 16:08:03 +00003377 case Iex_Triop: {
3378 IRType ttarg1, ttarg2, ttarg3;
florian420bfa92012-06-02 20:29:22 +00003379 IRTriop *triop = expr->Iex.Triop.details;
3380 tcExpr(bb,stmt, triop->arg1, gWordTy );
3381 tcExpr(bb,stmt, triop->arg2, gWordTy );
3382 tcExpr(bb,stmt, triop->arg3, gWordTy );
3383 typeOfPrimop(triop->op,
sewardj40c80262006-02-08 19:30:46 +00003384 &t_dst, &t_arg1, &t_arg2, &t_arg3, &t_arg4);
sewardjb183b852006-02-03 16:08:03 +00003385 if (t_arg1 == Ity_INVALID || t_arg2 == Ity_INVALID
sewardj40c80262006-02-08 19:30:46 +00003386 || t_arg3 == Ity_INVALID || t_arg4 != Ity_INVALID) {
sewardjb183b852006-02-03 16:08:03 +00003387 vex_printf(" op name: " );
florian420bfa92012-06-02 20:29:22 +00003388 ppIROp(triop->op);
sewardjb183b852006-02-03 16:08:03 +00003389 vex_printf("\n");
3390 sanityCheckFail(bb,stmt,
3391 "Iex.Triop: wrong arity op\n"
3392 "... name of op precedes BB printout\n");
3393 }
florian420bfa92012-06-02 20:29:22 +00003394 ttarg1 = typeOfIRExpr(tyenv, triop->arg1);
3395 ttarg2 = typeOfIRExpr(tyenv, triop->arg2);
3396 ttarg3 = typeOfIRExpr(tyenv, triop->arg3);
sewardjb183b852006-02-03 16:08:03 +00003397 if (t_arg1 != ttarg1 || t_arg2 != ttarg2 || t_arg3 != ttarg3) {
3398 vex_printf(" op name: ");
florian420bfa92012-06-02 20:29:22 +00003399 ppIROp(triop->op);
sewardjb183b852006-02-03 16:08:03 +00003400 vex_printf("\n");
3401 vex_printf(" op type is (");
3402 ppIRType(t_arg1);
3403 vex_printf(",");
3404 ppIRType(t_arg2);
3405 vex_printf(",");
3406 ppIRType(t_arg3);
3407 vex_printf(") -> ");
3408 ppIRType (t_dst);
3409 vex_printf("\narg tys are (");
3410 ppIRType(ttarg1);
3411 vex_printf(",");
3412 ppIRType(ttarg2);
3413 vex_printf(",");
3414 ppIRType(ttarg3);
3415 vex_printf(")\n");
3416 sanityCheckFail(bb,stmt,
3417 "Iex.Triop: arg tys don't match op tys\n"
3418 "... additional details precede BB printout\n");
3419 }
3420 break;
3421 }
sewardj6d2638e2004-07-15 09:38:27 +00003422 case Iex_Binop: {
3423 IRType ttarg1, ttarg2;
sewardj6efd4a12004-07-15 03:54:23 +00003424 tcExpr(bb,stmt, expr->Iex.Binop.arg1, gWordTy );
3425 tcExpr(bb,stmt, expr->Iex.Binop.arg2, gWordTy );
sewardj40c80262006-02-08 19:30:46 +00003426 typeOfPrimop(expr->Iex.Binop.op,
3427 &t_dst, &t_arg1, &t_arg2, &t_arg3, &t_arg4);
sewardjb183b852006-02-03 16:08:03 +00003428 if (t_arg1 == Ity_INVALID || t_arg2 == Ity_INVALID
sewardj40c80262006-02-08 19:30:46 +00003429 || t_arg3 != Ity_INVALID || t_arg4 != Ity_INVALID) {
sewardj8f3debf2004-09-08 23:42:23 +00003430 vex_printf(" op name: " );
3431 ppIROp(expr->Iex.Binop.op);
3432 vex_printf("\n");
3433 sanityCheckFail(bb,stmt,
3434 "Iex.Binop: wrong arity op\n"
3435 "... name of op precedes BB printout\n");
3436 }
sewardj6d2638e2004-07-15 09:38:27 +00003437 ttarg1 = typeOfIRExpr(tyenv, expr->Iex.Binop.arg1);
3438 ttarg2 = typeOfIRExpr(tyenv, expr->Iex.Binop.arg2);
3439 if (t_arg1 != ttarg1 || t_arg2 != ttarg2) {
3440 vex_printf(" op name: ");
3441 ppIROp(expr->Iex.Binop.op);
3442 vex_printf("\n");
3443 vex_printf(" op type is (");
3444 ppIRType(t_arg1);
3445 vex_printf(",");
3446 ppIRType(t_arg2);
3447 vex_printf(") -> ");
3448 ppIRType (t_dst);
3449 vex_printf("\narg tys are (");
3450 ppIRType(ttarg1);
3451 vex_printf(",");
3452 ppIRType(ttarg2);
3453 vex_printf(")\n");
3454 sanityCheckFail(bb,stmt,
3455 "Iex.Binop: arg tys don't match op tys\n"
3456 "... additional details precede BB printout\n");
sewardj695cff92004-10-13 14:50:14 +00003457 }
sewardj6efd4a12004-07-15 03:54:23 +00003458 break;
sewardj6d2638e2004-07-15 09:38:27 +00003459 }
sewardj6efd4a12004-07-15 03:54:23 +00003460 case Iex_Unop:
3461 tcExpr(bb,stmt, expr->Iex.Unop.arg, gWordTy );
sewardj40c80262006-02-08 19:30:46 +00003462 typeOfPrimop(expr->Iex.Binop.op,
3463 &t_dst, &t_arg1, &t_arg2, &t_arg3, &t_arg4);
sewardjb183b852006-02-03 16:08:03 +00003464 if (t_arg1 == Ity_INVALID || t_arg2 != Ity_INVALID
sewardj40c80262006-02-08 19:30:46 +00003465 || t_arg3 != Ity_INVALID || t_arg4 != Ity_INVALID)
sewardj6efd4a12004-07-15 03:54:23 +00003466 sanityCheckFail(bb,stmt,"Iex.Unop: wrong arity op");
3467 if (t_arg1 != typeOfIRExpr(tyenv, expr->Iex.Unop.arg))
3468 sanityCheckFail(bb,stmt,"Iex.Unop: arg ty doesn't match op ty");
3469 break;
sewardjaf1ceca2005-06-30 23:31:27 +00003470 case Iex_Load:
3471 tcExpr(bb,stmt, expr->Iex.Load.addr, gWordTy);
3472 if (typeOfIRExpr(tyenv, expr->Iex.Load.addr) != gWordTy)
3473 sanityCheckFail(bb,stmt,"Iex.Load.addr: not :: guest word type");
3474 if (expr->Iex.Load.end != Iend_LE && expr->Iex.Load.end != Iend_BE)
3475 sanityCheckFail(bb,stmt,"Iex.Load.end: bogus endianness");
sewardj6efd4a12004-07-15 03:54:23 +00003476 break;
3477 case Iex_CCall:
sewardjc13e2ed2004-10-31 21:44:54 +00003478 if (!saneIRCallee(expr->Iex.CCall.cee))
3479 sanityCheckFail(bb,stmt,"Iex.CCall.cee: bad IRCallee");
sewardjcf787902004-11-03 09:08:33 +00003480 if (expr->Iex.CCall.cee->regparms > countArgs(expr->Iex.CCall.args))
sewardjc13e2ed2004-10-31 21:44:54 +00003481 sanityCheckFail(bb,stmt,"Iex.CCall.cee: #regparms > #args");
sewardj43c56462004-11-06 12:17:57 +00003482 for (i = 0; expr->Iex.CCall.args[i]; i++) {
3483 if (i >= 32)
3484 sanityCheckFail(bb,stmt,"Iex.CCall: > 32 args");
sewardj6efd4a12004-07-15 03:54:23 +00003485 tcExpr(bb,stmt, expr->Iex.CCall.args[i], gWordTy);
sewardj43c56462004-11-06 12:17:57 +00003486 }
sewardjba999312004-11-15 15:21:17 +00003487 if (expr->Iex.CCall.retty == Ity_I1)
3488 sanityCheckFail(bb,stmt,"Iex.CCall.retty: cannot return :: Ity_I1");
sewardj6efd4a12004-07-15 03:54:23 +00003489 for (i = 0; expr->Iex.CCall.args[i]; i++)
sewardjba999312004-11-15 15:21:17 +00003490 if (typeOfIRExpr(tyenv, expr->Iex.CCall.args[i]) == Ity_I1)
3491 sanityCheckFail(bb,stmt,"Iex.CCall.arg: arg :: Ity_I1");
sewardj6efd4a12004-07-15 03:54:23 +00003492 break;
3493 case Iex_Const:
sewardj49bfe672004-11-15 15:46:26 +00003494 if (!saneIRConst(expr->Iex.Const.con))
3495 sanityCheckFail(bb,stmt,"Iex.Const.con: invalid const");
sewardj6efd4a12004-07-15 03:54:23 +00003496 break;
sewardj4042c7e2004-07-18 01:28:30 +00003497 case Iex_Mux0X:
3498 tcExpr(bb,stmt, expr->Iex.Mux0X.cond, gWordTy);
3499 tcExpr(bb,stmt, expr->Iex.Mux0X.expr0, gWordTy);
3500 tcExpr(bb,stmt, expr->Iex.Mux0X.exprX, gWordTy);
3501 if (typeOfIRExpr(tyenv, expr->Iex.Mux0X.cond) != Ity_I8)
3502 sanityCheckFail(bb,stmt,"Iex.Mux0X.cond: cond :: Ity_I8");
3503 if (typeOfIRExpr(tyenv, expr->Iex.Mux0X.expr0)
3504 != typeOfIRExpr(tyenv, expr->Iex.Mux0X.exprX))
3505 sanityCheckFail(bb,stmt,"Iex.Mux0X: expr0/exprX mismatch");
sewardjeeb9ef82004-07-15 12:39:03 +00003506 break;
3507 default:
sewardj6efd4a12004-07-15 03:54:23 +00003508 vpanic("tcExpr");
3509 }
3510}
3511
3512
3513static
sewardjdd40fdf2006-12-24 02:20:24 +00003514void tcStmt ( IRSB* bb, IRStmt* stmt, IRType gWordTy )
sewardj6efd4a12004-07-15 03:54:23 +00003515{
sewardj17442fe2004-09-20 14:54:28 +00003516 Int i;
3517 IRDirty* d;
sewardje9d8a262009-07-01 08:06:34 +00003518 IRCAS* cas;
floriand6f38b32012-05-31 15:46:18 +00003519 IRPutI* puti;
sewardje9d8a262009-07-01 08:06:34 +00003520 IRType tyExpd, tyData;
sewardj6efd4a12004-07-15 03:54:23 +00003521 IRTypeEnv* tyenv = bb->tyenv;
3522 switch (stmt->tag) {
sewardjf1689312005-03-16 18:19:10 +00003523 case Ist_IMark:
3524 /* Somewhat heuristic, but rule out totally implausible
sewardj2f10aa62011-05-27 13:20:56 +00003525 instruction sizes and deltas. */
sewardjf1689312005-03-16 18:19:10 +00003526 if (stmt->Ist.IMark.len < 0 || stmt->Ist.IMark.len > 20)
3527 sanityCheckFail(bb,stmt,"IRStmt.IMark.len: implausible");
sewardj2f10aa62011-05-27 13:20:56 +00003528 if (stmt->Ist.IMark.delta > 1)
3529 sanityCheckFail(bb,stmt,"IRStmt.IMark.delta: implausible");
sewardjf1689312005-03-16 18:19:10 +00003530 break;
sewardj5a9ffab2005-05-12 17:55:01 +00003531 case Ist_AbiHint:
3532 if (typeOfIRExpr(tyenv, stmt->Ist.AbiHint.base) != gWordTy)
3533 sanityCheckFail(bb,stmt,"IRStmt.AbiHint.base: "
3534 "not :: guest word type");
sewardj478646f2008-05-01 20:13:04 +00003535 if (typeOfIRExpr(tyenv, stmt->Ist.AbiHint.nia) != gWordTy)
3536 sanityCheckFail(bb,stmt,"IRStmt.AbiHint.nia: "
3537 "not :: guest word type");
sewardj5a9ffab2005-05-12 17:55:01 +00003538 break;
sewardj6efd4a12004-07-15 03:54:23 +00003539 case Ist_Put:
sewardj6d076362004-09-23 11:06:17 +00003540 tcExpr( bb, stmt, stmt->Ist.Put.data, gWordTy );
sewardjba999312004-11-15 15:21:17 +00003541 if (typeOfIRExpr(tyenv,stmt->Ist.Put.data) == Ity_I1)
3542 sanityCheckFail(bb,stmt,"IRStmt.Put.data: cannot Put :: Ity_I1");
sewardj2d3f77c2004-09-22 23:49:09 +00003543 break;
sewardjd1725d12004-08-12 20:46:53 +00003544 case Ist_PutI:
floriand6f38b32012-05-31 15:46:18 +00003545 puti = stmt->Ist.PutI.details;
3546 tcExpr( bb, stmt, puti->data, gWordTy );
3547 tcExpr( bb, stmt, puti->ix, gWordTy );
3548 if (typeOfIRExpr(tyenv,puti->data) == Ity_I1)
sewardjba999312004-11-15 15:21:17 +00003549 sanityCheckFail(bb,stmt,"IRStmt.PutI.data: cannot PutI :: Ity_I1");
floriand6f38b32012-05-31 15:46:18 +00003550 if (typeOfIRExpr(tyenv,puti->data)
3551 != puti->descr->elemTy)
sewardj6d076362004-09-23 11:06:17 +00003552 sanityCheckFail(bb,stmt,"IRStmt.PutI.data: data ty != elem ty");
floriand6f38b32012-05-31 15:46:18 +00003553 if (typeOfIRExpr(tyenv,puti->ix) != Ity_I32)
sewardjeeac8412004-11-02 00:26:55 +00003554 sanityCheckFail(bb,stmt,"IRStmt.PutI.ix: not :: Ity_I32");
floriand6f38b32012-05-31 15:46:18 +00003555 if (!saneIRRegArray(puti->descr))
sewardj2d3f77c2004-09-22 23:49:09 +00003556 sanityCheckFail(bb,stmt,"IRStmt.PutI.descr: invalid descr");
3557 break;
sewardjdd40fdf2006-12-24 02:20:24 +00003558 case Ist_WrTmp:
3559 tcExpr( bb, stmt, stmt->Ist.WrTmp.data, gWordTy );
3560 if (typeOfIRTemp(tyenv, stmt->Ist.WrTmp.tmp)
3561 != typeOfIRExpr(tyenv, stmt->Ist.WrTmp.data))
sewardj6d2638e2004-07-15 09:38:27 +00003562 sanityCheckFail(bb,stmt,"IRStmt.Put.Tmp: tmp and expr do not match");
sewardj6efd4a12004-07-15 03:54:23 +00003563 break;
sewardjaf1ceca2005-06-30 23:31:27 +00003564 case Ist_Store:
3565 tcExpr( bb, stmt, stmt->Ist.Store.addr, gWordTy );
3566 tcExpr( bb, stmt, stmt->Ist.Store.data, gWordTy );
3567 if (typeOfIRExpr(tyenv, stmt->Ist.Store.addr) != gWordTy)
3568 sanityCheckFail(bb,stmt,"IRStmt.Store.addr: not :: guest word type");
3569 if (typeOfIRExpr(tyenv, stmt->Ist.Store.data) == Ity_I1)
3570 sanityCheckFail(bb,stmt,"IRStmt.Store.data: cannot Store :: Ity_I1");
3571 if (stmt->Ist.Store.end != Iend_LE && stmt->Ist.Store.end != Iend_BE)
3572 sanityCheckFail(bb,stmt,"Ist.Store.end: bogus endianness");
sewardje9d8a262009-07-01 08:06:34 +00003573 break;
3574 case Ist_CAS:
3575 cas = stmt->Ist.CAS.details;
3576 /* make sure it's definitely either a CAS or a DCAS */
3577 if (cas->oldHi == IRTemp_INVALID
3578 && cas->expdHi == NULL && cas->dataHi == NULL) {
3579 /* fine; it's a single cas */
3580 }
3581 else
3582 if (cas->oldHi != IRTemp_INVALID
3583 && cas->expdHi != NULL && cas->dataHi != NULL) {
3584 /* fine; it's a double cas */
3585 }
3586 else {
3587 /* it's some el-mutanto hybrid */
3588 goto bad_cas;
3589 }
3590 /* check the address type */
3591 tcExpr( bb, stmt, cas->addr, gWordTy );
3592 if (typeOfIRExpr(tyenv, cas->addr) != gWordTy) goto bad_cas;
3593 /* check types on the {old,expd,data}Lo components agree */
3594 tyExpd = typeOfIRExpr(tyenv, cas->expdLo);
3595 tyData = typeOfIRExpr(tyenv, cas->dataLo);
3596 if (tyExpd != tyData) goto bad_cas;
3597 if (tyExpd != typeOfIRTemp(tyenv, cas->oldLo))
3598 goto bad_cas;
3599 /* check the base element type is sane */
3600 if (tyExpd == Ity_I8 || tyExpd == Ity_I16 || tyExpd == Ity_I32
3601 || (gWordTy == Ity_I64 && tyExpd == Ity_I64)) {
3602 /* fine */
3603 } else {
3604 goto bad_cas;
3605 }
3606 /* If it's a DCAS, check types on the {old,expd,data}Hi
3607 components too */
3608 if (cas->oldHi != IRTemp_INVALID) {
3609 tyExpd = typeOfIRExpr(tyenv, cas->expdHi);
3610 tyData = typeOfIRExpr(tyenv, cas->dataHi);
3611 if (tyExpd != tyData) goto bad_cas;
3612 if (tyExpd != typeOfIRTemp(tyenv, cas->oldHi))
3613 goto bad_cas;
3614 /* and finally check that oldLo and oldHi have the same
3615 type. This forces equivalence amongst all 6 types. */
3616 if (typeOfIRTemp(tyenv, cas->oldHi)
3617 != typeOfIRTemp(tyenv, cas->oldLo))
3618 goto bad_cas;
3619 }
3620 break;
3621 bad_cas:
3622 sanityCheckFail(bb,stmt,"IRStmt.CAS: ill-formed");
sewardj6efd4a12004-07-15 03:54:23 +00003623 break;
sewardje768e922009-11-26 17:17:37 +00003624 case Ist_LLSC: {
3625 IRType tyRes;
3626 if (typeOfIRExpr(tyenv, stmt->Ist.LLSC.addr) != gWordTy)
3627 sanityCheckFail(bb,stmt,"IRStmt.LLSC.addr: not :: guest word type");
3628 if (stmt->Ist.LLSC.end != Iend_LE && stmt->Ist.LLSC.end != Iend_BE)
3629 sanityCheckFail(bb,stmt,"Ist.LLSC.end: bogus endianness");
3630 tyRes = typeOfIRTemp(tyenv, stmt->Ist.LLSC.result);
3631 if (stmt->Ist.LLSC.storedata == NULL) {
3632 /* it's a LL */
sewardjff7f5b72011-07-11 11:43:38 +00003633 if (tyRes != Ity_I64 && tyRes != Ity_I32
3634 && tyRes != Ity_I16 && tyRes != Ity_I8)
sewardje768e922009-11-26 17:17:37 +00003635 sanityCheckFail(bb,stmt,"Ist.LLSC(LL).result :: bogus");
3636 } else {
3637 /* it's a SC */
3638 if (tyRes != Ity_I1)
3639 sanityCheckFail(bb,stmt,"Ist.LLSC(SC).result: not :: Ity_I1");
3640 tyData = typeOfIRExpr(tyenv, stmt->Ist.LLSC.storedata);
sewardjff7f5b72011-07-11 11:43:38 +00003641 if (tyData != Ity_I64 && tyData != Ity_I32
3642 && tyData != Ity_I16 && tyData != Ity_I8)
sewardj6c299f32009-12-31 18:00:12 +00003643 sanityCheckFail(bb,stmt,
3644 "Ist.LLSC(SC).result :: storedata bogus");
sewardje768e922009-11-26 17:17:37 +00003645 }
3646 break;
3647 }
sewardj17442fe2004-09-20 14:54:28 +00003648 case Ist_Dirty:
3649 /* Mostly check for various kinds of ill-formed dirty calls. */
3650 d = stmt->Ist.Dirty.details;
sewardj8ea867b2004-10-30 19:03:02 +00003651 if (d->cee == NULL) goto bad_dirty;
3652 if (!saneIRCallee(d->cee)) goto bad_dirty;
sewardjcf787902004-11-03 09:08:33 +00003653 if (d->cee->regparms > countArgs(d->args)) goto bad_dirty;
sewardj17442fe2004-09-20 14:54:28 +00003654 if (d->mFx == Ifx_None) {
3655 if (d->mAddr != NULL || d->mSize != 0)
3656 goto bad_dirty;
3657 } else {
3658 if (d->mAddr == NULL || d->mSize == 0)
3659 goto bad_dirty;
3660 }
3661 if (d->nFxState < 0 || d->nFxState > VEX_N_FXSTATE)
3662 goto bad_dirty;
sewardjc5fc7aa2004-10-27 23:00:55 +00003663 if (d->nFxState == 0 && d->needsBBP)
3664 goto bad_dirty;
sewardj17442fe2004-09-20 14:54:28 +00003665 for (i = 0; i < d->nFxState; i++) {
3666 if (d->fxState[i].fx == Ifx_None) goto bad_dirty;
3667 if (d->fxState[i].size <= 0) goto bad_dirty;
sewardjc9069f22012-06-01 16:09:50 +00003668 if (d->fxState[i].nRepeats == 0) {
3669 if (d->fxState[i].repeatLen != 0) goto bad_dirty;
3670 } else {
3671 if (d->fxState[i].repeatLen <= d->fxState[i].size)
3672 goto bad_dirty;
3673 /* the % is safe because of the .size check above */
3674 if ((d->fxState[i].repeatLen % d->fxState[i].size) != 0)
3675 goto bad_dirty;
3676 }
sewardj17442fe2004-09-20 14:54:28 +00003677 }
florian44ab8f72012-07-05 22:05:42 +00003678 /* check guard */
sewardjb8385d82004-11-02 01:34:15 +00003679 if (d->guard == NULL) goto bad_dirty;
sewardj49bfe672004-11-15 15:46:26 +00003680 tcExpr( bb, stmt, d->guard, gWordTy );
sewardjba999312004-11-15 15:21:17 +00003681 if (typeOfIRExpr(tyenv, d->guard) != Ity_I1)
3682 sanityCheckFail(bb,stmt,"IRStmt.Dirty.guard not :: Ity_I1");
sewardjf5dfa3b2012-07-10 16:41:46 +00003683 /* A dirty helper that is executed conditionally (or not at
3684 all) may not return a value. Hence if .tmp is not
3685 IRTemp_INVALID, .guard must be manifestly True at JIT
3686 time. */
3687 if (d->tmp != IRTemp_INVALID
3688 && (d->guard->tag != Iex_Const
3689 || d->guard->Iex.Const.con->Ico.U1 == 0))
florian44ab8f72012-07-05 22:05:42 +00003690 sanityCheckFail(bb,stmt,"IRStmt.Dirty with a return value"
3691 " is executed under a condition");
3692 /* check types, minimally */
sewardj92d168d2004-11-15 14:22:12 +00003693 if (d->tmp != IRTemp_INVALID
sewardjba999312004-11-15 15:21:17 +00003694 && typeOfIRTemp(tyenv, d->tmp) == Ity_I1)
3695 sanityCheckFail(bb,stmt,"IRStmt.Dirty.dst :: Ity_I1");
sewardj17442fe2004-09-20 14:54:28 +00003696 for (i = 0; d->args[i] != NULL; i++) {
sewardj43c56462004-11-06 12:17:57 +00003697 if (i >= 32)
3698 sanityCheckFail(bb,stmt,"IRStmt.Dirty: > 32 args");
sewardjba999312004-11-15 15:21:17 +00003699 if (typeOfIRExpr(tyenv, d->args[i]) == Ity_I1)
3700 sanityCheckFail(bb,stmt,"IRStmt.Dirty.arg[i] :: Ity_I1");
sewardj17442fe2004-09-20 14:54:28 +00003701 }
3702 break;
3703 bad_dirty:
3704 sanityCheckFail(bb,stmt,"IRStmt.Dirty: ill-formed");
sewardje9d8a262009-07-01 08:06:34 +00003705 break;
sewardjd2445f62005-03-21 00:15:53 +00003706 case Ist_NoOp:
sewardjc4356f02007-11-09 21:15:04 +00003707 break;
3708 case Ist_MBE:
3709 switch (stmt->Ist.MBE.event) {
sewardj6d615ba2011-09-26 16:19:43 +00003710 case Imbe_Fence: case Imbe_CancelReservation:
sewardjc4356f02007-11-09 21:15:04 +00003711 break;
3712 default: sanityCheckFail(bb,stmt,"IRStmt.MBE.event: unknown");
3713 break;
3714 }
sewardj3e838932005-01-07 12:09:15 +00003715 break;
sewardj6efd4a12004-07-15 03:54:23 +00003716 case Ist_Exit:
sewardj0276d4b2004-11-15 15:30:21 +00003717 tcExpr( bb, stmt, stmt->Ist.Exit.guard, gWordTy );
3718 if (typeOfIRExpr(tyenv,stmt->Ist.Exit.guard) != Ity_I1)
3719 sanityCheckFail(bb,stmt,"IRStmt.Exit.guard: not :: Ity_I1");
sewardj49bfe672004-11-15 15:46:26 +00003720 if (!saneIRConst(stmt->Ist.Exit.dst))
3721 sanityCheckFail(bb,stmt,"IRStmt.Exit.dst: bad dst");
sewardj6efd4a12004-07-15 03:54:23 +00003722 if (typeOfIRConst(stmt->Ist.Exit.dst) != gWordTy)
3723 sanityCheckFail(bb,stmt,"IRStmt.Exit.dst: not :: guest word type");
sewardjc6f970f2012-04-02 21:54:49 +00003724 /* because it would intersect with host_EvC_* */
3725 if (stmt->Ist.Exit.offsIP < 16)
3726 sanityCheckFail(bb,stmt,"IRStmt.Exit.offsIP: too low");
sewardj6efd4a12004-07-15 03:54:23 +00003727 break;
3728 default:
3729 vpanic("tcStmt");
3730 }
3731}
3732
sewardjdd40fdf2006-12-24 02:20:24 +00003733void sanityCheckIRSB ( IRSB* bb, HChar* caller,
sewardjb9230752004-12-29 19:25:06 +00003734 Bool require_flat, IRType guest_word_size )
sewardj35439212004-07-14 22:36:10 +00003735{
3736 Int i;
3737 IRStmt* stmt;
3738 Int n_temps = bb->tyenv->types_used;
3739 Int* def_counts = LibVEX_Alloc(n_temps * sizeof(Int));
3740
sewardjb9230752004-12-29 19:25:06 +00003741 if (0)
3742 vex_printf("sanityCheck: %s\n", caller);
3743
sewardj35439212004-07-14 22:36:10 +00003744 vassert(guest_word_size == Ity_I32
sewardj695cff92004-10-13 14:50:14 +00003745 || guest_word_size == Ity_I64);
sewardj35439212004-07-14 22:36:10 +00003746
sewardjd7cb8532004-08-17 23:59:23 +00003747 if (bb->stmts_used < 0 || bb->stmts_size < 8
3748 || bb->stmts_used > bb->stmts_size)
3749 /* this BB is so strange we can't even print it */
sewardjdd40fdf2006-12-24 02:20:24 +00003750 vpanic("sanityCheckIRSB: stmts array limits wierd");
sewardjd7cb8532004-08-17 23:59:23 +00003751
sewardj6d2638e2004-07-15 09:38:27 +00003752 /* Ensure each temp has a plausible type. */
3753 for (i = 0; i < n_temps; i++) {
sewardj17442fe2004-09-20 14:54:28 +00003754 IRType ty = typeOfIRTemp(bb->tyenv,(IRTemp)i);
sewardj496a58d2005-03-20 18:44:44 +00003755 if (!isPlausibleIRType(ty)) {
sewardj6d2638e2004-07-15 09:38:27 +00003756 vex_printf("Temp t%d declared with implausible type 0x%x\n",
3757 i, (UInt)ty);
3758 sanityCheckFail(bb,NULL,"Temp declared with implausible type");
3759 }
3760 }
sewardj35439212004-07-14 22:36:10 +00003761
sewardjb9230752004-12-29 19:25:06 +00003762 /* Check for flatness, if required. */
3763 if (require_flat) {
3764 for (i = 0; i < bb->stmts_used; i++) {
3765 stmt = bb->stmts[i];
3766 if (!stmt)
sewardjd2445f62005-03-21 00:15:53 +00003767 sanityCheckFail(bb, stmt, "IRStmt: is NULL");
sewardjb9230752004-12-29 19:25:06 +00003768 if (!isFlatIRStmt(stmt))
3769 sanityCheckFail(bb, stmt, "IRStmt: is not flat");
3770 }
sewardj496a58d2005-03-20 18:44:44 +00003771 if (!isIRAtom(bb->next))
sewardjb9230752004-12-29 19:25:06 +00003772 sanityCheckFail(bb, NULL, "bb->next is not an atom");
3773 }
3774
sewardj35439212004-07-14 22:36:10 +00003775 /* Count the defs of each temp. Only one def is allowed.
3776 Also, check that each used temp has already been defd. */
sewardj6d2638e2004-07-15 09:38:27 +00003777
3778 for (i = 0; i < n_temps; i++)
3779 def_counts[i] = 0;
3780
sewardjd7cb8532004-08-17 23:59:23 +00003781 for (i = 0; i < bb->stmts_used; i++) {
sewardje9d8a262009-07-01 08:06:34 +00003782 IRDirty* d;
3783 IRCAS* cas;
sewardjd7cb8532004-08-17 23:59:23 +00003784 stmt = bb->stmts[i];
sewardje9d8a262009-07-01 08:06:34 +00003785 /* Check any temps used by this statement. */
sewardj35439212004-07-14 22:36:10 +00003786 useBeforeDef_Stmt(bb,stmt,def_counts);
sewardj17442fe2004-09-20 14:54:28 +00003787
sewardje9d8a262009-07-01 08:06:34 +00003788 /* Now make note of any temps defd by this statement. */
3789 switch (stmt->tag) {
3790 case Ist_WrTmp:
sewardjdd40fdf2006-12-24 02:20:24 +00003791 if (stmt->Ist.WrTmp.tmp < 0 || stmt->Ist.WrTmp.tmp >= n_temps)
sewardj17442fe2004-09-20 14:54:28 +00003792 sanityCheckFail(bb, stmt,
3793 "IRStmt.Tmp: destination tmp is out of range");
sewardjdd40fdf2006-12-24 02:20:24 +00003794 def_counts[stmt->Ist.WrTmp.tmp]++;
3795 if (def_counts[stmt->Ist.WrTmp.tmp] > 1)
sewardj17442fe2004-09-20 14:54:28 +00003796 sanityCheckFail(bb, stmt,
sewardjcf787902004-11-03 09:08:33 +00003797 "IRStmt.Tmp: destination tmp is assigned more than once");
sewardje9d8a262009-07-01 08:06:34 +00003798 break;
3799 case Ist_Store:
sewardje9d8a262009-07-01 08:06:34 +00003800 break;
3801 case Ist_Dirty:
3802 if (stmt->Ist.Dirty.details->tmp != IRTemp_INVALID) {
3803 d = stmt->Ist.Dirty.details;
3804 if (d->tmp < 0 || d->tmp >= n_temps)
3805 sanityCheckFail(bb, stmt,
3806 "IRStmt.Dirty: destination tmp is out of range");
3807 def_counts[d->tmp]++;
3808 if (def_counts[d->tmp] > 1)
3809 sanityCheckFail(bb, stmt,
3810 "IRStmt.Dirty: destination tmp is assigned more than once");
3811 }
3812 break;
3813 case Ist_CAS:
3814 cas = stmt->Ist.CAS.details;
sewardje9d8a262009-07-01 08:06:34 +00003815 if (cas->oldHi != IRTemp_INVALID) {
3816 if (cas->oldHi < 0 || cas->oldHi >= n_temps)
3817 sanityCheckFail(bb, stmt,
3818 "IRStmt.CAS: destination tmpHi is out of range");
3819 def_counts[cas->oldHi]++;
3820 if (def_counts[cas->oldHi] > 1)
3821 sanityCheckFail(bb, stmt,
3822 "IRStmt.CAS: destination tmpHi is assigned more than once");
3823 }
3824 if (cas->oldLo < 0 || cas->oldLo >= n_temps)
sewardje768e922009-11-26 17:17:37 +00003825 sanityCheckFail(bb, stmt,
3826 "IRStmt.CAS: destination tmpLo is out of range");
3827 def_counts[cas->oldLo]++;
3828 if (def_counts[cas->oldLo] > 1)
3829 sanityCheckFail(bb, stmt,
3830 "IRStmt.CAS: destination tmpLo is assigned more than once");
3831 break;
3832 case Ist_LLSC:
3833 if (stmt->Ist.LLSC.result < 0 || stmt->Ist.LLSC.result >= n_temps)
3834 sanityCheckFail(bb, stmt,
3835 "IRStmt.LLSC: destination tmp is out of range");
3836 def_counts[stmt->Ist.LLSC.result]++;
3837 if (def_counts[stmt->Ist.LLSC.result] > 1)
3838 sanityCheckFail(bb, stmt,
3839 "IRStmt.LLSC: destination tmp is assigned more than once");
3840 break;
sewardje9d8a262009-07-01 08:06:34 +00003841 default:
sewardje768e922009-11-26 17:17:37 +00003842 /* explicitly handle the rest, so as to keep gcc quiet */
3843 break;
sewardj35439212004-07-14 22:36:10 +00003844 }
3845 }
3846
sewardj6efd4a12004-07-15 03:54:23 +00003847 /* Typecheck everything. */
sewardjd7cb8532004-08-17 23:59:23 +00003848 for (i = 0; i < bb->stmts_used; i++)
sewardj39e3f242004-08-18 16:54:52 +00003849 if (bb->stmts[i])
3850 tcStmt( bb, bb->stmts[i], guest_word_size );
sewardj6efd4a12004-07-15 03:54:23 +00003851 if (typeOfIRExpr(bb->tyenv,bb->next) != guest_word_size)
3852 sanityCheckFail(bb, NULL, "bb->next field has wrong type");
sewardjc6f970f2012-04-02 21:54:49 +00003853 /* because it would intersect with host_EvC_* */
3854 if (bb->offsIP < 16)
3855 sanityCheckFail(bb, NULL, "bb->offsIP: too low");
3856
sewardje539a402004-07-14 18:24:17 +00003857}
3858
sewardj4345f7a2004-09-22 19:49:27 +00003859/*---------------------------------------------------------------*/
3860/*--- Misc helper functions ---*/
3861/*---------------------------------------------------------------*/
3862
3863Bool eqIRConst ( IRConst* c1, IRConst* c2 )
3864{
3865 if (c1->tag != c2->tag)
3866 return False;
3867
3868 switch (c1->tag) {
sewardja98bf492005-02-07 01:39:17 +00003869 case Ico_U1: return toBool( (1 & c1->Ico.U1) == (1 & c2->Ico.U1) );
3870 case Ico_U8: return toBool( c1->Ico.U8 == c2->Ico.U8 );
3871 case Ico_U16: return toBool( c1->Ico.U16 == c2->Ico.U16 );
3872 case Ico_U32: return toBool( c1->Ico.U32 == c2->Ico.U32 );
3873 case Ico_U64: return toBool( c1->Ico.U64 == c2->Ico.U64 );
sewardj2019a972011-03-07 16:04:07 +00003874 case Ico_F32: return toBool( c1->Ico.F32 == c2->Ico.F32 );
3875 case Ico_F32i: return toBool( c1->Ico.F32i == c2->Ico.F32i );
sewardja98bf492005-02-07 01:39:17 +00003876 case Ico_F64: return toBool( c1->Ico.F64 == c2->Ico.F64 );
sewardj0da5eb82007-01-27 00:46:28 +00003877 case Ico_F64i: return toBool( c1->Ico.F64i == c2->Ico.F64i );
3878 case Ico_V128: return toBool( c1->Ico.V128 == c2->Ico.V128 );
sewardj5df0b2f2012-07-18 11:48:23 +00003879 case Ico_V256: return toBool( c1->Ico.V256 == c2->Ico.V256 );
sewardj4345f7a2004-09-22 19:49:27 +00003880 default: vpanic("eqIRConst");
3881 }
3882}
3883
sewardjdd40fdf2006-12-24 02:20:24 +00003884Bool eqIRRegArray ( IRRegArray* descr1, IRRegArray* descr2 )
sewardje98dcf22004-10-04 09:15:11 +00003885{
sewardja98bf492005-02-07 01:39:17 +00003886 return toBool( descr1->base == descr2->base
3887 && descr1->elemTy == descr2->elemTy
3888 && descr1->nElems == descr2->nElems );
sewardje98dcf22004-10-04 09:15:11 +00003889}
3890
sewardj2d3f77c2004-09-22 23:49:09 +00003891Int sizeofIRType ( IRType ty )
3892{
3893 switch (ty) {
sewardjc9a43662004-11-30 18:51:59 +00003894 case Ity_I8: return 1;
3895 case Ity_I16: return 2;
3896 case Ity_I32: return 4;
3897 case Ity_I64: return 8;
sewardj7666c152010-09-28 15:20:47 +00003898 case Ity_I128: return 16;
sewardjc9a43662004-11-30 18:51:59 +00003899 case Ity_F32: return 4;
3900 case Ity_F64: return 8;
sewardj2019a972011-03-07 16:04:07 +00003901 case Ity_F128: return 16;
sewardjc6bbd472012-04-02 10:20:48 +00003902 case Ity_D32: return 4;
3903 case Ity_D64: return 8;
3904 case Ity_D128: return 16;
sewardjc4530ae2012-05-21 10:18:49 +00003905 case Ity_V128: return 16;
3906 case Ity_V256: return 32;
sewardj2d3f77c2004-09-22 23:49:09 +00003907 default: vex_printf("\n"); ppIRType(ty); vex_printf("\n");
3908 vpanic("sizeofIRType");
3909 }
3910}
3911
sewardj49651f42004-10-28 22:11:04 +00003912IRExpr* mkIRExpr_HWord ( HWord hw )
3913{
sewardjf9655262004-10-31 20:02:16 +00003914 vassert(sizeof(void*) == sizeof(HWord));
sewardj49651f42004-10-28 22:11:04 +00003915 if (sizeof(HWord) == 4)
3916 return IRExpr_Const(IRConst_U32((UInt)hw));
3917 if (sizeof(HWord) == 8)
sewardjf9655262004-10-31 20:02:16 +00003918 return IRExpr_Const(IRConst_U64((ULong)hw));
sewardj49651f42004-10-28 22:11:04 +00003919 vpanic("mkIRExpr_HWord");
3920}
sewardj6efd4a12004-07-15 03:54:23 +00003921
sewardj2d49b432005-02-01 00:37:06 +00003922IRDirty* unsafeIRDirty_0_N ( Int regparms, HChar* name, void* addr,
sewardjf9655262004-10-31 20:02:16 +00003923 IRExpr** args )
3924{
3925 IRDirty* d = emptyIRDirty();
sewardjb8385d82004-11-02 01:34:15 +00003926 d->cee = mkIRCallee ( regparms, name, addr );
sewardjba999312004-11-15 15:21:17 +00003927 d->guard = IRExpr_Const(IRConst_U1(True));
sewardjb8385d82004-11-02 01:34:15 +00003928 d->args = args;
sewardjf9655262004-10-31 20:02:16 +00003929 return d;
3930}
3931
3932IRDirty* unsafeIRDirty_1_N ( IRTemp dst,
sewardj2d49b432005-02-01 00:37:06 +00003933 Int regparms, HChar* name, void* addr,
sewardjf9655262004-10-31 20:02:16 +00003934 IRExpr** args )
3935{
3936 IRDirty* d = emptyIRDirty();
sewardjb8385d82004-11-02 01:34:15 +00003937 d->cee = mkIRCallee ( regparms, name, addr );
sewardjba999312004-11-15 15:21:17 +00003938 d->guard = IRExpr_Const(IRConst_U1(True));
sewardjb8385d82004-11-02 01:34:15 +00003939 d->args = args;
3940 d->tmp = dst;
sewardjf9655262004-10-31 20:02:16 +00003941 return d;
3942}
3943
3944IRExpr* mkIRExprCCall ( IRType retty,
sewardj2d49b432005-02-01 00:37:06 +00003945 Int regparms, HChar* name, void* addr,
sewardjf9655262004-10-31 20:02:16 +00003946 IRExpr** args )
3947{
3948 return IRExpr_CCall ( mkIRCallee ( regparms, name, addr ),
3949 retty, args );
3950}
3951
sewardj496a58d2005-03-20 18:44:44 +00003952Bool eqIRAtom ( IRExpr* a1, IRExpr* a2 )
3953{
3954 vassert(isIRAtom(a1));
3955 vassert(isIRAtom(a2));
sewardjdd40fdf2006-12-24 02:20:24 +00003956 if (a1->tag == Iex_RdTmp && a2->tag == Iex_RdTmp)
3957 return toBool(a1->Iex.RdTmp.tmp == a2->Iex.RdTmp.tmp);
sewardj496a58d2005-03-20 18:44:44 +00003958 if (a1->tag == Iex_Const && a2->tag == Iex_Const)
3959 return eqIRConst(a1->Iex.Const.con, a2->Iex.Const.con);
3960 return False;
3961}
3962
sewardje539a402004-07-14 18:24:17 +00003963/*---------------------------------------------------------------*/
sewardjcef7d3e2009-07-02 12:21:59 +00003964/*--- end ir_defs.c ---*/
sewardj887a11a2004-07-05 17:26:47 +00003965/*---------------------------------------------------------------*/