blob: dc339552e24f3dccd056d6ded002449c681d9bd1 [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
sewardj89ae8472013-10-18 14:12:58 +000010 Copyright (C) 2004-2013 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
florian0b70efa2014-09-21 21:53:39 +000070void ppIRConst ( const 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
florian0b70efa2014-09-21 21:53:39 +000094void ppIRCallee ( const IRCallee* ce )
sewardj8ea867b2004-10-30 19:03:02 +000095{
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
florian0b70efa2014-09-21 21:53:39 +0000104void ppIRRegArray ( const 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{
florian1ff47562012-10-21 02:09:51 +0000121 const 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;
sewardje13074c2012-11-08 10:57:08 +0000150 case Iop_ExpCmpNE8 ... Iop_ExpCmpNE64:
151 str = "ExpCmpNE"; base = Iop_ExpCmpNE8; break;
sewardj41f43bc2004-07-08 14:23:22 +0000152 case Iop_Not8 ... Iop_Not64:
153 str = "Not"; base = Iop_Not8; break;
154 /* other cases must explicitly "return;" */
sewardj9690d922004-07-14 01:39:17 +0000155 case Iop_8Uto16: vex_printf("8Uto16"); return;
156 case Iop_8Uto32: vex_printf("8Uto32"); return;
157 case Iop_16Uto32: vex_printf("16Uto32"); return;
158 case Iop_8Sto16: vex_printf("8Sto16"); return;
159 case Iop_8Sto32: vex_printf("8Sto32"); return;
160 case Iop_16Sto32: vex_printf("16Sto32"); return;
sewardjbb53f8c2004-08-14 11:50:01 +0000161 case Iop_32Sto64: vex_printf("32Sto64"); return;
sewardje5427e82004-09-11 19:43:51 +0000162 case Iop_32Uto64: vex_printf("32Uto64"); return;
sewardja2384712004-07-29 14:36:40 +0000163 case Iop_32to8: vex_printf("32to8"); return;
sewardj291a7e82005-04-27 11:42:44 +0000164 case Iop_16Uto64: vex_printf("16Uto64"); return;
165 case Iop_16Sto64: vex_printf("16Sto64"); return;
166 case Iop_8Uto64: vex_printf("8Uto64"); return;
167 case Iop_8Sto64: vex_printf("8Sto64"); return;
168 case Iop_64to16: vex_printf("64to16"); return;
169 case Iop_64to8: vex_printf("64to8"); return;
sewardj6e797c52004-10-13 15:20:17 +0000170
171 case Iop_Not1: vex_printf("Not1"); return;
sewardj9690d922004-07-14 01:39:17 +0000172 case Iop_32to1: vex_printf("32to1"); return;
sewardj291a7e82005-04-27 11:42:44 +0000173 case Iop_64to1: vex_printf("64to1"); return;
sewardj9690d922004-07-14 01:39:17 +0000174 case Iop_1Uto8: vex_printf("1Uto8"); return;
sewardj84ff0652004-08-23 16:16:08 +0000175 case Iop_1Uto32: vex_printf("1Uto32"); return;
sewardj291a7e82005-04-27 11:42:44 +0000176 case Iop_1Uto64: vex_printf("1Uto64"); return;
sewardjfd332772004-11-09 16:01:40 +0000177 case Iop_1Sto8: vex_printf("1Sto8"); return;
sewardj8eda6302004-11-05 01:55:46 +0000178 case Iop_1Sto16: vex_printf("1Sto16"); return;
sewardj415d9352004-11-04 15:20:15 +0000179 case Iop_1Sto32: vex_printf("1Sto32"); return;
sewardjb5874aa2004-11-04 16:57:50 +0000180 case Iop_1Sto64: vex_printf("1Sto64"); return;
sewardj9690d922004-07-14 01:39:17 +0000181
182 case Iop_MullS8: vex_printf("MullS8"); return;
183 case Iop_MullS16: vex_printf("MullS16"); return;
184 case Iop_MullS32: vex_printf("MullS32"); return;
sewardj9b967672005-02-08 11:13:09 +0000185 case Iop_MullS64: vex_printf("MullS64"); return;
sewardj9690d922004-07-14 01:39:17 +0000186 case Iop_MullU8: vex_printf("MullU8"); return;
187 case Iop_MullU16: vex_printf("MullU16"); return;
188 case Iop_MullU32: vex_printf("MullU32"); return;
sewardj9b967672005-02-08 11:13:09 +0000189 case Iop_MullU64: vex_printf("MullU64"); return;
sewardj9690d922004-07-14 01:39:17 +0000190
sewardjf53b7352005-04-06 20:01:56 +0000191 case Iop_Clz64: vex_printf("Clz64"); return;
sewardjce646f22004-08-31 23:55:54 +0000192 case Iop_Clz32: vex_printf("Clz32"); return;
sewardjf53b7352005-04-06 20:01:56 +0000193 case Iop_Ctz64: vex_printf("Ctz64"); return;
sewardjce646f22004-08-31 23:55:54 +0000194 case Iop_Ctz32: vex_printf("Ctz32"); return;
195
sewardj84ff0652004-08-23 16:16:08 +0000196 case Iop_CmpLT32S: vex_printf("CmpLT32S"); return;
197 case Iop_CmpLE32S: vex_printf("CmpLE32S"); return;
198 case Iop_CmpLT32U: vex_printf("CmpLT32U"); return;
199 case Iop_CmpLE32U: vex_printf("CmpLE32U"); return;
200
sewardj98540072005-04-26 01:52:01 +0000201 case Iop_CmpLT64S: vex_printf("CmpLT64S"); return;
202 case Iop_CmpLE64S: vex_printf("CmpLE64S"); return;
203 case Iop_CmpLT64U: vex_printf("CmpLT64U"); return;
204 case Iop_CmpLE64U: vex_printf("CmpLE64U"); return;
205
sewardj0033ddc2005-04-26 23:34:34 +0000206 case Iop_CmpNEZ8: vex_printf("CmpNEZ8"); return;
207 case Iop_CmpNEZ16: vex_printf("CmpNEZ16"); return;
208 case Iop_CmpNEZ32: vex_printf("CmpNEZ32"); return;
209 case Iop_CmpNEZ64: vex_printf("CmpNEZ64"); return;
210
sewardjeb17e492007-08-25 23:07:44 +0000211 case Iop_CmpwNEZ32: vex_printf("CmpwNEZ32"); return;
212 case Iop_CmpwNEZ64: vex_printf("CmpwNEZ64"); return;
213
214 case Iop_Left8: vex_printf("Left8"); return;
215 case Iop_Left16: vex_printf("Left16"); return;
216 case Iop_Left32: vex_printf("Left32"); return;
217 case Iop_Left64: vex_printf("Left64"); return;
sewardj478646f2008-05-01 20:13:04 +0000218 case Iop_Max32U: vex_printf("Max32U"); return;
sewardjeb17e492007-08-25 23:07:44 +0000219
sewardjb51f0f42005-07-18 11:38:02 +0000220 case Iop_CmpORD32U: vex_printf("CmpORD32U"); return;
221 case Iop_CmpORD32S: vex_printf("CmpORD32S"); return;
222
cerion2831b002005-11-30 19:55:22 +0000223 case Iop_CmpORD64U: vex_printf("CmpORD64U"); return;
224 case Iop_CmpORD64S: vex_printf("CmpORD64S"); return;
225
cerion5c8a0cb2005-02-03 13:59:46 +0000226 case Iop_DivU32: vex_printf("DivU32"); return;
227 case Iop_DivS32: vex_printf("DivS32"); return;
cerionf0de28c2005-12-13 20:21:11 +0000228 case Iop_DivU64: vex_printf("DivU64"); return;
229 case Iop_DivS64: vex_printf("DivS64"); return;
sewardje71e56a2011-09-05 12:11:06 +0000230 case Iop_DivU64E: vex_printf("DivU64E"); return;
sewardj4aa412a2011-07-24 14:13:21 +0000231 case Iop_DivS64E: vex_printf("DivS64E"); return;
232 case Iop_DivU32E: vex_printf("DivU32E"); return;
sewardje71e56a2011-09-05 12:11:06 +0000233 case Iop_DivS32E: vex_printf("DivS32E"); return;
cerion5c8a0cb2005-02-03 13:59:46 +0000234
sewardj9690d922004-07-14 01:39:17 +0000235 case Iop_DivModU64to32: vex_printf("DivModU64to32"); return;
236 case Iop_DivModS64to32: vex_printf("DivModS64to32"); return;
237
sewardj343b9d02005-01-31 18:08:45 +0000238 case Iop_DivModU128to64: vex_printf("DivModU128to64"); return;
239 case Iop_DivModS128to64: vex_printf("DivModS128to64"); return;
240
sewardj2019a972011-03-07 16:04:07 +0000241 case Iop_DivModS64to64: vex_printf("DivModS64to64"); return;
242
sewardjb81f8b32004-07-30 10:17:50 +0000243 case Iop_16HIto8: vex_printf("16HIto8"); return;
244 case Iop_16to8: vex_printf("16to8"); return;
245 case Iop_8HLto16: vex_printf("8HLto16"); return;
246
sewardj8c7f1ab2004-07-29 20:31:09 +0000247 case Iop_32HIto16: vex_printf("32HIto16"); return;
248 case Iop_32to16: vex_printf("32to16"); return;
249 case Iop_16HLto32: vex_printf("16HLto32"); return;
250
sewardj9690d922004-07-14 01:39:17 +0000251 case Iop_64HIto32: vex_printf("64HIto32"); return;
sewardj8c7f1ab2004-07-29 20:31:09 +0000252 case Iop_64to32: vex_printf("64to32"); return;
sewardj9690d922004-07-14 01:39:17 +0000253 case Iop_32HLto64: vex_printf("32HLto64"); return;
254
sewardj9b967672005-02-08 11:13:09 +0000255 case Iop_128HIto64: vex_printf("128HIto64"); return;
256 case Iop_128to64: vex_printf("128to64"); return;
257 case Iop_64HLto128: vex_printf("64HLto128"); return;
258
sewardj2019a972011-03-07 16:04:07 +0000259 case Iop_CmpF32: vex_printf("CmpF32"); return;
sewardj2019a972011-03-07 16:04:07 +0000260 case Iop_F32toI32S: vex_printf("F32toI32S"); return;
261 case Iop_F32toI64S: vex_printf("F32toI64S"); return;
sewardj2019a972011-03-07 16:04:07 +0000262 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;
florian1c8f7ff2012-09-01 00:12:11 +0000293 case Iop_I32UtoF128: vex_printf("I32UtoF128"); return;
294 case Iop_I64UtoF128: vex_printf("I64UtoF128"); return;
sewardj2019a972011-03-07 16:04:07 +0000295 case Iop_F128toI32S: vex_printf("F128toI32S"); return;
296 case Iop_F128toI64S: vex_printf("F128toI64S"); return;
florian1c8f7ff2012-09-01 00:12:11 +0000297 case Iop_F128toI32U: vex_printf("F128toI32U"); return;
298 case Iop_F128toI64U: vex_printf("F128toI64U"); return;
sewardj2019a972011-03-07 16:04:07 +0000299 case Iop_F32toF128: vex_printf("F32toF128"); return;
300 case Iop_F64toF128: vex_printf("F64toF128"); return;
301 case Iop_F128toF64: vex_printf("F128toF64"); return;
302 case Iop_F128toF32: vex_printf("F128toF32"); return;
303
304 /* s390 specific */
305 case Iop_MAddF32: vex_printf("s390_MAddF32"); return;
306 case Iop_MSubF32: vex_printf("s390_MSubF32"); return;
307
sewardj442d0be2004-10-15 22:57:13 +0000308 case Iop_ScaleF64: vex_printf("ScaleF64"); return;
309 case Iop_AtanF64: vex_printf("AtanF64"); return;
310 case Iop_Yl2xF64: vex_printf("Yl2xF64"); return;
311 case Iop_Yl2xp1F64: vex_printf("Yl2xp1F64"); return;
312 case Iop_PRemF64: vex_printf("PRemF64"); return;
313 case Iop_PRemC3210F64: vex_printf("PRemC3210F64"); return;
314 case Iop_PRem1F64: vex_printf("PRem1F64"); return;
315 case Iop_PRem1C3210F64: vex_printf("PRem1C3210F64"); return;
316 case Iop_NegF64: vex_printf("NegF64"); return;
sewardj6c299f32009-12-31 18:00:12 +0000317 case Iop_AbsF64: vex_printf("AbsF64"); return;
318 case Iop_NegF32: vex_printf("NegF32"); return;
319 case Iop_AbsF32: vex_printf("AbsF32"); return;
sewardj442d0be2004-10-15 22:57:13 +0000320 case Iop_SqrtF64: vex_printf("SqrtF64"); return;
sewardj6c299f32009-12-31 18:00:12 +0000321 case Iop_SqrtF32: vex_printf("SqrtF32"); return;
sewardjcfded9a2004-09-09 11:44:16 +0000322 case Iop_SinF64: vex_printf("SinF64"); return;
323 case Iop_CosF64: vex_printf("CosF64"); return;
sewardj99016a72004-10-15 22:09:17 +0000324 case Iop_TanF64: vex_printf("TanF64"); return;
sewardj06c32a02004-09-12 12:07:34 +0000325 case Iop_2xm1F64: vex_printf("2xm1F64"); return;
sewardjbdc7d212004-09-09 02:46:40 +0000326
sewardj40c80262006-02-08 19:30:46 +0000327 case Iop_MAddF64: vex_printf("MAddF64"); return;
328 case Iop_MSubF64: vex_printf("MSubF64"); return;
329 case Iop_MAddF64r32: vex_printf("MAddF64r32"); return;
330 case Iop_MSubF64r32: vex_printf("MSubF64r32"); return;
331
sewardj1ddee212014-08-24 14:00:19 +0000332 case Iop_RSqrtEst5GoodF64: vex_printf("RSqrtEst5GoodF64"); return;
sewardj0f1ef862008-08-08 08:37:06 +0000333 case Iop_RoundF64toF64_NEAREST: vex_printf("RoundF64toF64_NEAREST"); return;
334 case Iop_RoundF64toF64_NegINF: vex_printf("RoundF64toF64_NegINF"); return;
335 case Iop_RoundF64toF64_PosINF: vex_printf("RoundF64toF64_PosINF"); return;
336 case Iop_RoundF64toF64_ZERO: vex_printf("RoundF64toF64_ZERO"); return;
337
sewardjb183b852006-02-03 16:08:03 +0000338 case Iop_TruncF64asF32: vex_printf("TruncF64asF32"); return;
sewardjbaf971a2006-01-27 15:09:35 +0000339
sewardj44ce46d2012-07-11 13:19:10 +0000340 case Iop_QAdd32S: vex_printf("QAdd32S"); return;
341 case Iop_QSub32S: vex_printf("QSub32S"); return;
sewardje2ea1762010-09-22 00:56:37 +0000342 case Iop_Add16x2: vex_printf("Add16x2"); return;
343 case Iop_Sub16x2: vex_printf("Sub16x2"); return;
344 case Iop_QAdd16Sx2: vex_printf("QAdd16Sx2"); return;
345 case Iop_QAdd16Ux2: vex_printf("QAdd16Ux2"); return;
346 case Iop_QSub16Sx2: vex_printf("QSub16Sx2"); return;
347 case Iop_QSub16Ux2: vex_printf("QSub16Ux2"); return;
348 case Iop_HAdd16Ux2: vex_printf("HAdd16Ux2"); return;
349 case Iop_HAdd16Sx2: vex_printf("HAdd16Sx2"); return;
350 case Iop_HSub16Ux2: vex_printf("HSub16Ux2"); return;
351 case Iop_HSub16Sx2: vex_printf("HSub16Sx2"); return;
352
353 case Iop_Add8x4: vex_printf("Add8x4"); return;
354 case Iop_Sub8x4: vex_printf("Sub8x4"); return;
355 case Iop_QAdd8Sx4: vex_printf("QAdd8Sx4"); return;
356 case Iop_QAdd8Ux4: vex_printf("QAdd8Ux4"); return;
357 case Iop_QSub8Sx4: vex_printf("QSub8Sx4"); return;
358 case Iop_QSub8Ux4: vex_printf("QSub8Ux4"); return;
359 case Iop_HAdd8Ux4: vex_printf("HAdd8Ux4"); return;
360 case Iop_HAdd8Sx4: vex_printf("HAdd8Sx4"); return;
361 case Iop_HSub8Ux4: vex_printf("HSub8Ux4"); return;
362 case Iop_HSub8Sx4: vex_printf("HSub8Sx4"); return;
sewardj310d6b22010-10-18 16:29:40 +0000363 case Iop_Sad8Ux4: vex_printf("Sad8Ux4"); return;
sewardje2ea1762010-09-22 00:56:37 +0000364
365 case Iop_CmpNEZ16x2: vex_printf("CmpNEZ16x2"); return;
366 case Iop_CmpNEZ8x4: vex_printf("CmpNEZ8x4"); return;
367
sewardj46de4072004-09-11 19:23:24 +0000368 case Iop_CmpF64: vex_printf("CmpF64"); return;
369
sewardj6c299f32009-12-31 18:00:12 +0000370 case Iop_F64toI16S: vex_printf("F64toI16S"); return;
371 case Iop_F64toI32S: vex_printf("F64toI32S"); return;
372 case Iop_F64toI64S: vex_printf("F64toI64S"); return;
sewardj4aa412a2011-07-24 14:13:21 +0000373 case Iop_F64toI64U: vex_printf("F64toI64U"); return;
florian1c8f7ff2012-09-01 00:12:11 +0000374 case Iop_F32toI32U: vex_printf("F32toI32U"); return;
375 case Iop_F32toI64U: vex_printf("F32toI64U"); return;
sewardj3bca9062004-12-04 14:36:09 +0000376
sewardj6c299f32009-12-31 18:00:12 +0000377 case Iop_F64toI32U: vex_printf("F64toI32U"); return;
378
sewardj6c299f32009-12-31 18:00:12 +0000379 case Iop_I32StoF64: vex_printf("I32StoF64"); return;
380 case Iop_I64StoF64: vex_printf("I64StoF64"); return;
sewardj66d5ef22011-04-15 11:55:00 +0000381 case Iop_I64UtoF64: vex_printf("I64UtoF64"); return;
florian1c8f7ff2012-09-01 00:12:11 +0000382 case Iop_I32UtoF32: vex_printf("I32UtoF32"); return;
sewardj66d5ef22011-04-15 11:55:00 +0000383 case Iop_I64UtoF32: vex_printf("I64UtoF32"); return;
sewardj6c299f32009-12-31 18:00:12 +0000384
385 case Iop_I32UtoF64: vex_printf("I32UtoF64"); return;
sewardjcfded9a2004-09-09 11:44:16 +0000386
sewardj89cd0932004-09-08 18:23:25 +0000387 case Iop_F32toF64: vex_printf("F32toF64"); return;
388 case Iop_F64toF32: vex_printf("F64toF32"); return;
sewardjbb53f8c2004-08-14 11:50:01 +0000389
sewardjb183b852006-02-03 16:08:03 +0000390 case Iop_RoundF64toInt: vex_printf("RoundF64toInt"); return;
sewardjd15b5972010-06-27 09:06:34 +0000391 case Iop_RoundF32toInt: vex_printf("RoundF32toInt"); return;
sewardjb183b852006-02-03 16:08:03 +0000392 case Iop_RoundF64toF32: vex_printf("RoundF64toF32"); return;
sewardj3bca9062004-12-04 14:36:09 +0000393
sewardj17442fe2004-09-20 14:54:28 +0000394 case Iop_ReinterpF64asI64: vex_printf("ReinterpF64asI64"); return;
395 case Iop_ReinterpI64asF64: vex_printf("ReinterpI64asF64"); return;
sewardjfc1b5412007-01-09 15:20:07 +0000396 case Iop_ReinterpF32asI32: vex_printf("ReinterpF32asI32"); return;
sewardjfd226452004-12-07 19:02:18 +0000397 case Iop_ReinterpI32asF32: vex_printf("ReinterpI32asF32"); return;
sewardj17442fe2004-09-20 14:54:28 +0000398
sewardj228c7c82008-07-29 09:47:21 +0000399 case Iop_I32UtoFx4: vex_printf("I32UtoFx4"); return;
400 case Iop_I32StoFx4: vex_printf("I32StoFx4"); return;
cerionf294eb32005-11-16 17:21:10 +0000401
sewardj2fdd4162010-08-22 12:59:02 +0000402 case Iop_F32toF16x4: vex_printf("F32toF16x4"); return;
403 case Iop_F16toF32x4: vex_printf("F16toF32x4"); return;
404
sewardj1ddee212014-08-24 14:00:19 +0000405 case Iop_RSqrtEst32Fx4: vex_printf("RSqrtEst32Fx4"); return;
406 case Iop_RSqrtEst32Ux4: vex_printf("RSqrtEst32Ux4"); return;
407 case Iop_RSqrtEst32Fx2: vex_printf("RSqrtEst32Fx2"); return;
408 case Iop_RSqrtEst32Ux2: vex_printf("RSqrtEst32Ux2"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000409
sewardj228c7c82008-07-29 09:47:21 +0000410 case Iop_QFtoI32Ux4_RZ: vex_printf("QFtoI32Ux4_RZ"); return;
411 case Iop_QFtoI32Sx4_RZ: vex_printf("QFtoI32Sx4_RZ"); return;
cerionf294eb32005-11-16 17:21:10 +0000412
sewardj2fdd4162010-08-22 12:59:02 +0000413 case Iop_FtoI32Ux4_RZ: vex_printf("FtoI32Ux4_RZ"); return;
414 case Iop_FtoI32Sx4_RZ: vex_printf("FtoI32Sx4_RZ"); return;
415
416 case Iop_I32UtoFx2: vex_printf("I32UtoFx2"); return;
417 case Iop_I32StoFx2: vex_printf("I32StoFx2"); return;
418
419 case Iop_FtoI32Ux2_RZ: vex_printf("FtoI32Ux2_RZ"); return;
420 case Iop_FtoI32Sx2_RZ: vex_printf("FtoI32Sx2_RZ"); return;
421
sewardj228c7c82008-07-29 09:47:21 +0000422 case Iop_RoundF32x4_RM: vex_printf("RoundF32x4_RM"); return;
423 case Iop_RoundF32x4_RP: vex_printf("RoundF32x4_RP"); return;
424 case Iop_RoundF32x4_RN: vex_printf("RoundF32x4_RN"); return;
425 case Iop_RoundF32x4_RZ: vex_printf("RoundF32x4_RZ"); return;
cerionf294eb32005-11-16 17:21:10 +0000426
sewardj2fdd4162010-08-22 12:59:02 +0000427 case Iop_Abs8x8: vex_printf("Abs8x8"); return;
428 case Iop_Abs16x4: vex_printf("Abs16x4"); return;
429 case Iop_Abs32x2: vex_printf("Abs32x2"); return;
sewardj38a3f862005-01-13 15:06:51 +0000430 case Iop_Add8x8: vex_printf("Add8x8"); return;
431 case Iop_Add16x4: vex_printf("Add16x4"); return;
432 case Iop_Add32x2: vex_printf("Add32x2"); return;
433 case Iop_QAdd8Ux8: vex_printf("QAdd8Ux8"); return;
434 case Iop_QAdd16Ux4: vex_printf("QAdd16Ux4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000435 case Iop_QAdd32Ux2: vex_printf("QAdd32Ux2"); return;
436 case Iop_QAdd64Ux1: vex_printf("QAdd64Ux1"); return;
sewardj38a3f862005-01-13 15:06:51 +0000437 case Iop_QAdd8Sx8: vex_printf("QAdd8Sx8"); return;
438 case Iop_QAdd16Sx4: vex_printf("QAdd16Sx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000439 case Iop_QAdd32Sx2: vex_printf("QAdd32Sx2"); return;
440 case Iop_QAdd64Sx1: vex_printf("QAdd64Sx1"); return;
441 case Iop_PwAdd8x8: vex_printf("PwAdd8x8"); return;
442 case Iop_PwAdd16x4: vex_printf("PwAdd16x4"); return;
443 case Iop_PwAdd32x2: vex_printf("PwAdd32x2"); return;
444 case Iop_PwAdd32Fx2: vex_printf("PwAdd32Fx2"); return;
445 case Iop_PwAddL8Ux8: vex_printf("PwAddL8Ux8"); return;
446 case Iop_PwAddL16Ux4: vex_printf("PwAddL16Ux4"); return;
447 case Iop_PwAddL32Ux2: vex_printf("PwAddL32Ux2"); return;
448 case Iop_PwAddL8Sx8: vex_printf("PwAddL8Sx8"); return;
449 case Iop_PwAddL16Sx4: vex_printf("PwAddL16Sx4"); return;
450 case Iop_PwAddL32Sx2: vex_printf("PwAddL32Sx2"); return;
sewardj38a3f862005-01-13 15:06:51 +0000451 case Iop_Sub8x8: vex_printf("Sub8x8"); return;
452 case Iop_Sub16x4: vex_printf("Sub16x4"); return;
453 case Iop_Sub32x2: vex_printf("Sub32x2"); return;
454 case Iop_QSub8Ux8: vex_printf("QSub8Ux8"); return;
455 case Iop_QSub16Ux4: vex_printf("QSub16Ux4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000456 case Iop_QSub32Ux2: vex_printf("QSub32Ux2"); return;
457 case Iop_QSub64Ux1: vex_printf("QSub64Ux1"); return;
sewardj38a3f862005-01-13 15:06:51 +0000458 case Iop_QSub8Sx8: vex_printf("QSub8Sx8"); return;
459 case Iop_QSub16Sx4: vex_printf("QSub16Sx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000460 case Iop_QSub32Sx2: vex_printf("QSub32Sx2"); return;
461 case Iop_QSub64Sx1: vex_printf("QSub64Sx1"); return;
462 case Iop_Mul8x8: vex_printf("Mul8x8"); return;
sewardj38a3f862005-01-13 15:06:51 +0000463 case Iop_Mul16x4: vex_printf("Mul16x4"); return;
sewardjd166e282008-02-06 11:42:45 +0000464 case Iop_Mul32x2: vex_printf("Mul32x2"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000465 case Iop_Mul32Fx2: vex_printf("Mul32Fx2"); return;
466 case Iop_PolynomialMul8x8: vex_printf("PolynomialMul8x8"); return;
sewardj38a3f862005-01-13 15:06:51 +0000467 case Iop_MulHi16Ux4: vex_printf("MulHi16Ux4"); return;
468 case Iop_MulHi16Sx4: vex_printf("MulHi16Sx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000469 case Iop_QDMulHi16Sx4: vex_printf("QDMulHi16Sx4"); return;
470 case Iop_QDMulHi32Sx2: vex_printf("QDMulHi32Sx2"); return;
471 case Iop_QRDMulHi16Sx4: vex_printf("QRDMulHi16Sx4"); return;
472 case Iop_QRDMulHi32Sx2: vex_printf("QRDMulHi32Sx2"); return;
sewardj51d012a2014-07-21 09:19:50 +0000473 case Iop_QDMull16Sx4: vex_printf("QDMull16Sx4"); return;
474 case Iop_QDMull32Sx2: vex_printf("QDMull32Sx2"); return;
sewardj38a3f862005-01-13 15:06:51 +0000475 case Iop_Avg8Ux8: vex_printf("Avg8Ux8"); return;
476 case Iop_Avg16Ux4: vex_printf("Avg16Ux4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000477 case Iop_Max8Sx8: vex_printf("Max8Sx8"); return;
sewardj38a3f862005-01-13 15:06:51 +0000478 case Iop_Max16Sx4: vex_printf("Max16Sx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000479 case Iop_Max32Sx2: vex_printf("Max32Sx2"); return;
sewardj38a3f862005-01-13 15:06:51 +0000480 case Iop_Max8Ux8: vex_printf("Max8Ux8"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000481 case Iop_Max16Ux4: vex_printf("Max16Ux4"); return;
482 case Iop_Max32Ux2: vex_printf("Max32Ux2"); return;
483 case Iop_Min8Sx8: vex_printf("Min8Sx8"); return;
sewardj38a3f862005-01-13 15:06:51 +0000484 case Iop_Min16Sx4: vex_printf("Min16Sx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000485 case Iop_Min32Sx2: vex_printf("Min32Sx2"); return;
sewardj38a3f862005-01-13 15:06:51 +0000486 case Iop_Min8Ux8: vex_printf("Min8Ux8"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000487 case Iop_Min16Ux4: vex_printf("Min16Ux4"); return;
488 case Iop_Min32Ux2: vex_printf("Min32Ux2"); return;
489 case Iop_PwMax8Sx8: vex_printf("PwMax8Sx8"); return;
490 case Iop_PwMax16Sx4: vex_printf("PwMax16Sx4"); return;
491 case Iop_PwMax32Sx2: vex_printf("PwMax32Sx2"); return;
492 case Iop_PwMax8Ux8: vex_printf("PwMax8Ux8"); return;
493 case Iop_PwMax16Ux4: vex_printf("PwMax16Ux4"); return;
494 case Iop_PwMax32Ux2: vex_printf("PwMax32Ux2"); return;
495 case Iop_PwMin8Sx8: vex_printf("PwMin8Sx8"); return;
496 case Iop_PwMin16Sx4: vex_printf("PwMin16Sx4"); return;
497 case Iop_PwMin32Sx2: vex_printf("PwMin32Sx2"); return;
498 case Iop_PwMin8Ux8: vex_printf("PwMin8Ux8"); return;
499 case Iop_PwMin16Ux4: vex_printf("PwMin16Ux4"); return;
500 case Iop_PwMin32Ux2: vex_printf("PwMin32Ux2"); return;
sewardj38a3f862005-01-13 15:06:51 +0000501 case Iop_CmpEQ8x8: vex_printf("CmpEQ8x8"); return;
502 case Iop_CmpEQ16x4: vex_printf("CmpEQ16x4"); return;
503 case Iop_CmpEQ32x2: vex_printf("CmpEQ32x2"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000504 case Iop_CmpGT8Ux8: vex_printf("CmpGT8Ux8"); return;
505 case Iop_CmpGT16Ux4: vex_printf("CmpGT16Ux4"); return;
506 case Iop_CmpGT32Ux2: vex_printf("CmpGT32Ux2"); return;
sewardj38a3f862005-01-13 15:06:51 +0000507 case Iop_CmpGT8Sx8: vex_printf("CmpGT8Sx8"); return;
508 case Iop_CmpGT16Sx4: vex_printf("CmpGT16Sx4"); return;
509 case Iop_CmpGT32Sx2: vex_printf("CmpGT32Sx2"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000510 case Iop_Cnt8x8: vex_printf("Cnt8x8"); return;
sewardja8c7b0f2014-06-26 08:18:08 +0000511 case Iop_Clz8x8: vex_printf("Clz8x8"); return;
512 case Iop_Clz16x4: vex_printf("Clz16x4"); return;
513 case Iop_Clz32x2: vex_printf("Clz32x2"); return;
514 case Iop_Cls8x8: vex_printf("Cls8x8"); return;
515 case Iop_Cls16x4: vex_printf("Cls16x4"); return;
516 case Iop_Cls32x2: vex_printf("Cls32x2"); return;
sewardjd166e282008-02-06 11:42:45 +0000517 case Iop_ShlN8x8: vex_printf("ShlN8x8"); return;
sewardj38a3f862005-01-13 15:06:51 +0000518 case Iop_ShlN16x4: vex_printf("ShlN16x4"); return;
519 case Iop_ShlN32x2: vex_printf("ShlN32x2"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000520 case Iop_ShrN8x8: vex_printf("ShrN8x8"); return;
sewardj38a3f862005-01-13 15:06:51 +0000521 case Iop_ShrN16x4: vex_printf("ShrN16x4"); return;
522 case Iop_ShrN32x2: vex_printf("ShrN32x2"); return;
sewardjd71ba832006-12-27 01:15:29 +0000523 case Iop_SarN8x8: vex_printf("SarN8x8"); return;
sewardj38a3f862005-01-13 15:06:51 +0000524 case Iop_SarN16x4: vex_printf("SarN16x4"); return;
525 case Iop_SarN32x2: vex_printf("SarN32x2"); return;
sewardj5f438dd2011-06-16 11:36:23 +0000526 case Iop_QNarrowBin16Sto8Ux8: vex_printf("QNarrowBin16Sto8Ux8"); return;
527 case Iop_QNarrowBin16Sto8Sx8: vex_printf("QNarrowBin16Sto8Sx8"); return;
528 case Iop_QNarrowBin32Sto16Sx4: vex_printf("QNarrowBin32Sto16Sx4"); return;
carll48ae46b2013-10-01 15:45:54 +0000529 case Iop_QNarrowBin64Sto32Sx4: vex_printf("QNarrowBin64Sto32Sx4"); return;
530 case Iop_QNarrowBin64Uto32Ux4: vex_printf("QNarrowBin64Uto32Ux4"); return;
sewardjad2c9ea2011-10-22 09:32:16 +0000531 case Iop_NarrowBin16to8x8: vex_printf("NarrowBin16to8x8"); return;
532 case Iop_NarrowBin32to16x4: vex_printf("NarrowBin32to16x4"); return;
carll0c74bb52013-08-12 18:01:40 +0000533 case Iop_NarrowBin64to32x4: vex_printf("NarrowBin64to32x4"); return;
sewardj38a3f862005-01-13 15:06:51 +0000534 case Iop_InterleaveHI8x8: vex_printf("InterleaveHI8x8"); return;
535 case Iop_InterleaveHI16x4: vex_printf("InterleaveHI16x4"); return;
536 case Iop_InterleaveHI32x2: vex_printf("InterleaveHI32x2"); return;
537 case Iop_InterleaveLO8x8: vex_printf("InterleaveLO8x8"); return;
538 case Iop_InterleaveLO16x4: vex_printf("InterleaveLO16x4"); return;
539 case Iop_InterleaveLO32x2: vex_printf("InterleaveLO32x2"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000540 case Iop_CatOddLanes8x8: vex_printf("CatOddLanes8x8"); return;
sewardjd166e282008-02-06 11:42:45 +0000541 case Iop_CatOddLanes16x4: vex_printf("CatOddLanes16x4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000542 case Iop_CatEvenLanes8x8: vex_printf("CatEvenLanes8x8"); return;
sewardjd166e282008-02-06 11:42:45 +0000543 case Iop_CatEvenLanes16x4: vex_printf("CatEvenLanes16x4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000544 case Iop_InterleaveOddLanes8x8: vex_printf("InterleaveOddLanes8x8"); return;
545 case Iop_InterleaveOddLanes16x4: vex_printf("InterleaveOddLanes16x4"); return;
546 case Iop_InterleaveEvenLanes8x8: vex_printf("InterleaveEvenLanes8x8"); return;
547 case Iop_InterleaveEvenLanes16x4: vex_printf("InterleaveEvenLanes16x4"); return;
548 case Iop_Shl8x8: vex_printf("Shl8x8"); return;
549 case Iop_Shl16x4: vex_printf("Shl16x4"); return;
550 case Iop_Shl32x2: vex_printf("Shl32x2"); return;
551 case Iop_Shr8x8: vex_printf("Shr8x8"); return;
552 case Iop_Shr16x4: vex_printf("Shr16x4"); return;
553 case Iop_Shr32x2: vex_printf("Shr32x2"); return;
554 case Iop_QShl8x8: vex_printf("QShl8x8"); return;
555 case Iop_QShl16x4: vex_printf("QShl16x4"); return;
556 case Iop_QShl32x2: vex_printf("QShl32x2"); return;
557 case Iop_QShl64x1: vex_printf("QShl64x1"); return;
558 case Iop_QSal8x8: vex_printf("QSal8x8"); return;
559 case Iop_QSal16x4: vex_printf("QSal16x4"); return;
560 case Iop_QSal32x2: vex_printf("QSal32x2"); return;
561 case Iop_QSal64x1: vex_printf("QSal64x1"); return;
sewardj1dd3ec12014-08-15 09:11:08 +0000562 case Iop_QShlNsatUU8x8: vex_printf("QShlNsatUU8x8"); return;
563 case Iop_QShlNsatUU16x4: vex_printf("QShlNsatUU16x4"); return;
564 case Iop_QShlNsatUU32x2: vex_printf("QShlNsatUU32x2"); return;
565 case Iop_QShlNsatUU64x1: vex_printf("QShlNsatUU64x1"); return;
566 case Iop_QShlNsatSU8x8: vex_printf("QShlNsatSU8x8"); return;
567 case Iop_QShlNsatSU16x4: vex_printf("QShlNsatSU16x4"); return;
568 case Iop_QShlNsatSU32x2: vex_printf("QShlNsatSU32x2"); return;
569 case Iop_QShlNsatSU64x1: vex_printf("QShlNsatSU64x1"); return;
570 case Iop_QShlNsatSS8x8: vex_printf("QShlNsatSS8x8"); return;
571 case Iop_QShlNsatSS16x4: vex_printf("QShlNsatSS16x4"); return;
572 case Iop_QShlNsatSS32x2: vex_printf("QShlNsatSS32x2"); return;
573 case Iop_QShlNsatSS64x1: vex_printf("QShlNsatSS64x1"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000574 case Iop_Sar8x8: vex_printf("Sar8x8"); return;
575 case Iop_Sar16x4: vex_printf("Sar16x4"); return;
576 case Iop_Sar32x2: vex_printf("Sar32x2"); return;
577 case Iop_Sal8x8: vex_printf("Sal8x8"); return;
578 case Iop_Sal16x4: vex_printf("Sal16x4"); return;
579 case Iop_Sal32x2: vex_printf("Sal32x2"); return;
580 case Iop_Sal64x1: vex_printf("Sal64x1"); return;
sewardj228c7c82008-07-29 09:47:21 +0000581 case Iop_Perm8x8: vex_printf("Perm8x8"); return;
sewardj33680352014-06-26 10:49:33 +0000582 case Iop_Reverse8sIn16_x4: vex_printf("Reverse8sIn16_x4"); return;
583 case Iop_Reverse8sIn32_x2: vex_printf("Reverse8sIn32_x2"); return;
584 case Iop_Reverse16sIn32_x2: vex_printf("Reverse16sIn32_x2"); return;
585 case Iop_Reverse8sIn64_x1: vex_printf("Reverse8sIn64_x1"); return;
586 case Iop_Reverse16sIn64_x1: vex_printf("Reverse16sIn64_x1"); return;
587 case Iop_Reverse32sIn64_x1: vex_printf("Reverse32sIn64_x1"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000588 case Iop_Abs32Fx2: vex_printf("Abs32Fx2"); return;
sewardje13074c2012-11-08 10:57:08 +0000589 case Iop_GetMSBs8x8: vex_printf("GetMSBs8x8"); return;
sewardj78a20592012-12-13 18:29:56 +0000590 case Iop_GetMSBs8x16: vex_printf("GetMSBs8x16"); return;
sewardj38a3f862005-01-13 15:06:51 +0000591
sewardj18069182005-01-13 19:16:04 +0000592 case Iop_CmpNEZ32x2: vex_printf("CmpNEZ32x2"); return;
593 case Iop_CmpNEZ16x4: vex_printf("CmpNEZ16x4"); return;
594 case Iop_CmpNEZ8x8: vex_printf("CmpNEZ8x8"); return;
595
sewardj1e6ad742004-12-02 16:16:11 +0000596 case Iop_Add32Fx4: vex_printf("Add32Fx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000597 case Iop_Add32Fx2: vex_printf("Add32Fx2"); return;
sewardj1e6ad742004-12-02 16:16:11 +0000598 case Iop_Add32F0x4: vex_printf("Add32F0x4"); return;
sewardj636ad762004-12-07 11:16:04 +0000599 case Iop_Add64Fx2: vex_printf("Add64Fx2"); return;
600 case Iop_Add64F0x2: vex_printf("Add64F0x2"); return;
sewardj1e6ad742004-12-02 16:16:11 +0000601
sewardj176a59c2004-12-03 20:08:31 +0000602 case Iop_Div32Fx4: vex_printf("Div32Fx4"); return;
603 case Iop_Div32F0x4: vex_printf("Div32F0x4"); return;
sewardj636ad762004-12-07 11:16:04 +0000604 case Iop_Div64Fx2: vex_printf("Div64Fx2"); return;
605 case Iop_Div64F0x2: vex_printf("Div64F0x2"); return;
sewardj176a59c2004-12-03 20:08:31 +0000606
sewardj8eb7ae82012-06-24 14:00:27 +0000607 case Iop_Max32Fx8: vex_printf("Max32Fx8"); return;
sewardj176a59c2004-12-03 20:08:31 +0000608 case Iop_Max32Fx4: vex_printf("Max32Fx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000609 case Iop_Max32Fx2: vex_printf("Max32Fx2"); return;
610 case Iop_PwMax32Fx4: vex_printf("PwMax32Fx4"); return;
611 case Iop_PwMax32Fx2: vex_printf("PwMax32Fx2"); return;
sewardj176a59c2004-12-03 20:08:31 +0000612 case Iop_Max32F0x4: vex_printf("Max32F0x4"); return;
sewardj8eb7ae82012-06-24 14:00:27 +0000613 case Iop_Max64Fx4: vex_printf("Max64Fx4"); return;
sewardj636ad762004-12-07 11:16:04 +0000614 case Iop_Max64Fx2: vex_printf("Max64Fx2"); return;
615 case Iop_Max64F0x2: vex_printf("Max64F0x2"); return;
sewardj176a59c2004-12-03 20:08:31 +0000616
sewardj8eb7ae82012-06-24 14:00:27 +0000617 case Iop_Min32Fx8: vex_printf("Min32Fx8"); return;
sewardj176a59c2004-12-03 20:08:31 +0000618 case Iop_Min32Fx4: vex_printf("Min32Fx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000619 case Iop_Min32Fx2: vex_printf("Min32Fx2"); return;
620 case Iop_PwMin32Fx4: vex_printf("PwMin32Fx4"); return;
621 case Iop_PwMin32Fx2: vex_printf("PwMin32Fx2"); return;
sewardj176a59c2004-12-03 20:08:31 +0000622 case Iop_Min32F0x4: vex_printf("Min32F0x4"); return;
sewardj8eb7ae82012-06-24 14:00:27 +0000623 case Iop_Min64Fx4: vex_printf("Min64Fx4"); return;
sewardj636ad762004-12-07 11:16:04 +0000624 case Iop_Min64Fx2: vex_printf("Min64Fx2"); return;
625 case Iop_Min64F0x2: vex_printf("Min64F0x2"); return;
sewardj176a59c2004-12-03 20:08:31 +0000626
sewardj9636b442004-12-04 01:38:37 +0000627 case Iop_Mul32Fx4: vex_printf("Mul32Fx4"); return;
628 case Iop_Mul32F0x4: vex_printf("Mul32F0x4"); return;
sewardj636ad762004-12-07 11:16:04 +0000629 case Iop_Mul64Fx2: vex_printf("Mul64Fx2"); return;
630 case Iop_Mul64F0x2: vex_printf("Mul64F0x2"); return;
sewardj9636b442004-12-04 01:38:37 +0000631
sewardj1ddee212014-08-24 14:00:19 +0000632 case Iop_RecipEst32Ux2: vex_printf("RecipEst32Ux2"); return;
633 case Iop_RecipEst32Fx2: vex_printf("RecipEst32Fx2"); return;
634 case Iop_RecipEst32Fx4: vex_printf("RecipEst32Fx4"); return;
635 case Iop_RecipEst32Fx8: vex_printf("RecipEst32Fx8"); return;
636 case Iop_RecipEst32Ux4: vex_printf("RecipEst32Ux4"); return;
637 case Iop_RecipEst32F0x4: vex_printf("RecipEst32F0x4"); return;
638 case Iop_RecipStep32Fx2: vex_printf("RecipStep32Fx2"); return;
639 case Iop_RecipStep32Fx4: vex_printf("RecipStep32Fx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000640 case Iop_Abs32Fx4: vex_printf("Abs32Fx4"); return;
sewardjfab09142014-02-10 10:28:13 +0000641 case Iop_Abs64Fx2: vex_printf("Abs64Fx2"); return;
sewardj1ddee212014-08-24 14:00:19 +0000642 case Iop_RSqrtStep32Fx4: vex_printf("RSqrtStep32Fx4"); return;
643 case Iop_RSqrtStep32Fx2: vex_printf("RSqrtStep32Fx2"); return;
sewardj0bd7ce62004-12-05 02:47:40 +0000644
sewardj1ddee212014-08-24 14:00:19 +0000645 case Iop_RSqrtEst32F0x4: vex_printf("RSqrtEst32F0x4"); return;
646 case Iop_RSqrtEst32Fx8: vex_printf("RSqrtEst32Fx8"); return;
sewardjc1e7dfc2004-12-05 19:29:45 +0000647
sewardj636ad762004-12-07 11:16:04 +0000648 case Iop_Sqrt32Fx4: vex_printf("Sqrt32Fx4"); return;
649 case Iop_Sqrt32F0x4: vex_printf("Sqrt32F0x4"); return;
650 case Iop_Sqrt64Fx2: vex_printf("Sqrt64Fx2"); return;
651 case Iop_Sqrt64F0x2: vex_printf("Sqrt64F0x2"); return;
sewardj66becf32012-06-18 23:15:16 +0000652 case Iop_Sqrt32Fx8: vex_printf("Sqrt32Fx8"); return;
653 case Iop_Sqrt64Fx4: vex_printf("Sqrt64Fx4"); return;
654
sewardjc1e7dfc2004-12-05 19:29:45 +0000655 case Iop_Sub32Fx4: vex_printf("Sub32Fx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000656 case Iop_Sub32Fx2: vex_printf("Sub32Fx2"); return;
sewardjc1e7dfc2004-12-05 19:29:45 +0000657 case Iop_Sub32F0x4: vex_printf("Sub32F0x4"); return;
sewardj636ad762004-12-07 11:16:04 +0000658 case Iop_Sub64Fx2: vex_printf("Sub64Fx2"); return;
659 case Iop_Sub64F0x2: vex_printf("Sub64F0x2"); return;
sewardjc1e7dfc2004-12-05 19:29:45 +0000660
sewardj1e6ad742004-12-02 16:16:11 +0000661 case Iop_CmpEQ32Fx4: vex_printf("CmpEQ32Fx4"); return;
662 case Iop_CmpLT32Fx4: vex_printf("CmpLT32Fx4"); return;
663 case Iop_CmpLE32Fx4: vex_printf("CmpLE32Fx4"); return;
cerion206c3642005-11-14 00:35:59 +0000664 case Iop_CmpGT32Fx4: vex_printf("CmpGT32Fx4"); return;
665 case Iop_CmpGE32Fx4: vex_printf("CmpGE32Fx4"); return;
sewardj1e6ad742004-12-02 16:16:11 +0000666 case Iop_CmpUN32Fx4: vex_printf("CmpUN32Fx4"); return;
sewardj636ad762004-12-07 11:16:04 +0000667 case Iop_CmpEQ64Fx2: vex_printf("CmpEQ64Fx2"); return;
668 case Iop_CmpLT64Fx2: vex_printf("CmpLT64Fx2"); return;
669 case Iop_CmpLE64Fx2: vex_printf("CmpLE64Fx2"); return;
670 case Iop_CmpUN64Fx2: vex_printf("CmpUN64Fx2"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000671 case Iop_CmpGT32Fx2: vex_printf("CmpGT32Fx2"); return;
672 case Iop_CmpEQ32Fx2: vex_printf("CmpEQ32Fx2"); return;
673 case Iop_CmpGE32Fx2: vex_printf("CmpGE32Fx2"); return;
sewardj1e6ad742004-12-02 16:16:11 +0000674
675 case Iop_CmpEQ32F0x4: vex_printf("CmpEQ32F0x4"); return;
676 case Iop_CmpLT32F0x4: vex_printf("CmpLT32F0x4"); return;
677 case Iop_CmpLE32F0x4: vex_printf("CmpLE32F0x4"); return;
678 case Iop_CmpUN32F0x4: vex_printf("CmpUN32F0x4"); return;
sewardj636ad762004-12-07 11:16:04 +0000679 case Iop_CmpEQ64F0x2: vex_printf("CmpEQ64F0x2"); return;
680 case Iop_CmpLT64F0x2: vex_printf("CmpLT64F0x2"); return;
681 case Iop_CmpLE64F0x2: vex_printf("CmpLE64F0x2"); return;
682 case Iop_CmpUN64F0x2: vex_printf("CmpUN64F0x2"); return;
sewardjc9a43662004-11-30 18:51:59 +0000683
sewardjfab09142014-02-10 10:28:13 +0000684 case Iop_Neg64Fx2: vex_printf("Neg64Fx2"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000685 case Iop_Neg32Fx4: vex_printf("Neg32Fx4"); return;
686 case Iop_Neg32Fx2: vex_printf("Neg32Fx2"); return;
687
sewardjf0c1c582005-02-07 23:47:38 +0000688 case Iop_V128to64: vex_printf("V128to64"); return;
689 case Iop_V128HIto64: vex_printf("V128HIto64"); return;
690 case Iop_64HLtoV128: vex_printf("64HLtoV128"); return;
sewardja0037df2004-12-10 18:56:29 +0000691
sewardjf0c1c582005-02-07 23:47:38 +0000692 case Iop_64UtoV128: vex_printf("64UtoV128"); return;
693 case Iop_SetV128lo64: vex_printf("SetV128lo64"); return;
sewardjecde6972014-02-05 11:01:19 +0000694
695 case Iop_ZeroHI64ofV128: vex_printf("ZeroHI64ofV128"); return;
696 case Iop_ZeroHI96ofV128: vex_printf("ZeroHI96ofV128"); return;
697 case Iop_ZeroHI112ofV128: vex_printf("ZeroHI112ofV128"); return;
698 case Iop_ZeroHI120ofV128: vex_printf("ZeroHI120ofV128"); return;
sewardjc9a43662004-11-30 18:51:59 +0000699
sewardjf0c1c582005-02-07 23:47:38 +0000700 case Iop_32UtoV128: vex_printf("32UtoV128"); return;
701 case Iop_V128to32: vex_printf("V128to32"); return;
702 case Iop_SetV128lo32: vex_printf("SetV128lo32"); return;
sewardj129b3d92004-12-05 15:42:05 +0000703
cerionf887b3e2005-09-13 16:34:28 +0000704 case Iop_Dup8x16: vex_printf("Dup8x16"); return;
705 case Iop_Dup16x8: vex_printf("Dup16x8"); return;
706 case Iop_Dup32x4: vex_printf("Dup32x4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000707 case Iop_Dup8x8: vex_printf("Dup8x8"); return;
708 case Iop_Dup16x4: vex_printf("Dup16x4"); return;
709 case Iop_Dup32x2: vex_printf("Dup32x2"); return;
cerionf887b3e2005-09-13 16:34:28 +0000710
sewardjf0c1c582005-02-07 23:47:38 +0000711 case Iop_NotV128: vex_printf("NotV128"); return;
712 case Iop_AndV128: vex_printf("AndV128"); return;
713 case Iop_OrV128: vex_printf("OrV128"); return;
714 case Iop_XorV128: vex_printf("XorV128"); return;
sewardj18069182005-01-13 19:16:04 +0000715
sewardj2e383862004-12-12 16:46:47 +0000716 case Iop_CmpNEZ8x16: vex_printf("CmpNEZ8x16"); return;
717 case Iop_CmpNEZ16x8: vex_printf("CmpNEZ16x8"); return;
sewardj70f676d2004-12-10 14:59:57 +0000718 case Iop_CmpNEZ32x4: vex_printf("CmpNEZ32x4"); return;
sewardj109ffdb2004-12-10 21:45:38 +0000719 case Iop_CmpNEZ64x2: vex_printf("CmpNEZ64x2"); return;
sewardj164f9272004-12-09 00:39:32 +0000720
sewardj2fdd4162010-08-22 12:59:02 +0000721 case Iop_Abs8x16: vex_printf("Abs8x16"); return;
722 case Iop_Abs16x8: vex_printf("Abs16x8"); return;
723 case Iop_Abs32x4: vex_printf("Abs32x4"); return;
sewardj25523c42014-06-15 19:36:29 +0000724 case Iop_Abs64x2: vex_printf("Abs64x2"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000725
sewardj164f9272004-12-09 00:39:32 +0000726 case Iop_Add8x16: vex_printf("Add8x16"); return;
727 case Iop_Add16x8: vex_printf("Add16x8"); return;
728 case Iop_Add32x4: vex_printf("Add32x4"); return;
729 case Iop_Add64x2: vex_printf("Add64x2"); return;
730 case Iop_QAdd8Ux16: vex_printf("QAdd8Ux16"); return;
731 case Iop_QAdd16Ux8: vex_printf("QAdd16Ux8"); return;
cerionf887b3e2005-09-13 16:34:28 +0000732 case Iop_QAdd32Ux4: vex_printf("QAdd32Ux4"); return;
sewardj164f9272004-12-09 00:39:32 +0000733 case Iop_QAdd8Sx16: vex_printf("QAdd8Sx16"); return;
734 case Iop_QAdd16Sx8: vex_printf("QAdd16Sx8"); return;
cerionf887b3e2005-09-13 16:34:28 +0000735 case Iop_QAdd32Sx4: vex_printf("QAdd32Sx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000736 case Iop_QAdd64Ux2: vex_printf("QAdd64Ux2"); return;
737 case Iop_QAdd64Sx2: vex_printf("QAdd64Sx2"); return;
sewardjf7003bc2014-08-18 12:28:02 +0000738
739 case Iop_QAddExtUSsatSS8x16: vex_printf("QAddExtUSsatSS8x16"); return;
740 case Iop_QAddExtUSsatSS16x8: vex_printf("QAddExtUSsatSS16x8"); return;
741 case Iop_QAddExtUSsatSS32x4: vex_printf("QAddExtUSsatSS32x4"); return;
742 case Iop_QAddExtUSsatSS64x2: vex_printf("QAddExtUSsatSS64x2"); return;
743 case Iop_QAddExtSUsatUU8x16: vex_printf("QAddExtSUsatUU8x16"); return;
744 case Iop_QAddExtSUsatUU16x8: vex_printf("QAddExtSUsatUU16x8"); return;
745 case Iop_QAddExtSUsatUU32x4: vex_printf("QAddExtSUsatUU32x4"); return;
746 case Iop_QAddExtSUsatUU64x2: vex_printf("QAddExtSUsatUU64x2"); return;
747
sewardj2fdd4162010-08-22 12:59:02 +0000748 case Iop_PwAdd8x16: vex_printf("PwAdd8x16"); return;
749 case Iop_PwAdd16x8: vex_printf("PwAdd16x8"); return;
750 case Iop_PwAdd32x4: vex_printf("PwAdd32x4"); return;
751 case Iop_PwAddL8Ux16: vex_printf("PwAddL8Ux16"); return;
752 case Iop_PwAddL16Ux8: vex_printf("PwAddL16Ux8"); return;
753 case Iop_PwAddL32Ux4: vex_printf("PwAddL32Ux4"); return;
754 case Iop_PwAddL8Sx16: vex_printf("PwAddL8Sx16"); return;
755 case Iop_PwAddL16Sx8: vex_printf("PwAddL16Sx8"); return;
756 case Iop_PwAddL32Sx4: vex_printf("PwAddL32Sx4"); return;
sewardj164f9272004-12-09 00:39:32 +0000757
758 case Iop_Sub8x16: vex_printf("Sub8x16"); return;
759 case Iop_Sub16x8: vex_printf("Sub16x8"); return;
760 case Iop_Sub32x4: vex_printf("Sub32x4"); return;
761 case Iop_Sub64x2: vex_printf("Sub64x2"); return;
762 case Iop_QSub8Ux16: vex_printf("QSub8Ux16"); return;
763 case Iop_QSub16Ux8: vex_printf("QSub16Ux8"); return;
cerionf887b3e2005-09-13 16:34:28 +0000764 case Iop_QSub32Ux4: vex_printf("QSub32Ux4"); return;
sewardj164f9272004-12-09 00:39:32 +0000765 case Iop_QSub8Sx16: vex_printf("QSub8Sx16"); return;
766 case Iop_QSub16Sx8: vex_printf("QSub16Sx8"); return;
cerionf887b3e2005-09-13 16:34:28 +0000767 case Iop_QSub32Sx4: vex_printf("QSub32Sx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000768 case Iop_QSub64Ux2: vex_printf("QSub64Ux2"); return;
769 case Iop_QSub64Sx2: vex_printf("QSub64Sx2"); return;
sewardj164f9272004-12-09 00:39:32 +0000770
sewardj2fdd4162010-08-22 12:59:02 +0000771 case Iop_Mul8x16: vex_printf("Mul8x16"); return;
sewardj164f9272004-12-09 00:39:32 +0000772 case Iop_Mul16x8: vex_printf("Mul16x8"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000773 case Iop_Mul32x4: vex_printf("Mul32x4"); return;
774 case Iop_Mull8Ux8: vex_printf("Mull8Ux8"); return;
775 case Iop_Mull8Sx8: vex_printf("Mull8Sx8"); return;
776 case Iop_Mull16Ux4: vex_printf("Mull16Ux4"); return;
777 case Iop_Mull16Sx4: vex_printf("Mull16Sx4"); return;
778 case Iop_Mull32Ux2: vex_printf("Mull32Ux2"); return;
779 case Iop_Mull32Sx2: vex_printf("Mull32Sx2"); return;
780 case Iop_PolynomialMul8x16: vex_printf("PolynomialMul8x16"); return;
781 case Iop_PolynomialMull8x8: vex_printf("PolynomialMull8x8"); return;
sewardj164f9272004-12-09 00:39:32 +0000782 case Iop_MulHi16Ux8: vex_printf("MulHi16Ux8"); return;
cerionf887b3e2005-09-13 16:34:28 +0000783 case Iop_MulHi32Ux4: vex_printf("MulHi32Ux4"); return;
sewardj164f9272004-12-09 00:39:32 +0000784 case Iop_MulHi16Sx8: vex_printf("MulHi16Sx8"); return;
cerionf887b3e2005-09-13 16:34:28 +0000785 case Iop_MulHi32Sx4: vex_printf("MulHi32Sx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000786 case Iop_QDMulHi16Sx8: vex_printf("QDMulHi16Sx8"); return;
787 case Iop_QDMulHi32Sx4: vex_printf("QDMulHi32Sx4"); return;
788 case Iop_QRDMulHi16Sx8: vex_printf("QRDMulHi16Sx8"); return;
789 case Iop_QRDMulHi32Sx4: vex_printf("QRDMulHi32Sx4"); return;
sewardj164f9272004-12-09 00:39:32 +0000790
cerion1ac656a2005-11-04 19:44:48 +0000791 case Iop_MullEven8Ux16: vex_printf("MullEven8Ux16"); return;
792 case Iop_MullEven16Ux8: vex_printf("MullEven16Ux8"); return;
carll48ae46b2013-10-01 15:45:54 +0000793 case Iop_MullEven32Ux4: vex_printf("MullEven32Ux4"); return;
cerion1ac656a2005-11-04 19:44:48 +0000794 case Iop_MullEven8Sx16: vex_printf("MullEven8Sx16"); return;
795 case Iop_MullEven16Sx8: vex_printf("MullEven16Sx8"); return;
carll48ae46b2013-10-01 15:45:54 +0000796 case Iop_MullEven32Sx4: vex_printf("MullEven32Sx4"); return;
cerion1ac656a2005-11-04 19:44:48 +0000797
carll7deaf952013-10-15 18:11:20 +0000798 case Iop_PolynomialMulAdd8x16:
799 vex_printf("PolynomialMulAdd8x16"); return;
800 case Iop_PolynomialMulAdd16x8:
801 vex_printf("PolynomialMulAdd16x8"); return;
802 case Iop_PolynomialMulAdd32x4:
803 vex_printf("PolynomialMulAdd32x4"); return;
804 case Iop_PolynomialMulAdd64x2:
805 vex_printf("PolynomialMulAdd64x2"); return;
806
sewardj164f9272004-12-09 00:39:32 +0000807 case Iop_Avg8Ux16: vex_printf("Avg8Ux16"); return;
808 case Iop_Avg16Ux8: vex_printf("Avg16Ux8"); return;
cerionf887b3e2005-09-13 16:34:28 +0000809 case Iop_Avg32Ux4: vex_printf("Avg32Ux4"); return;
810 case Iop_Avg8Sx16: vex_printf("Avg8Sx16"); return;
811 case Iop_Avg16Sx8: vex_printf("Avg16Sx8"); return;
812 case Iop_Avg32Sx4: vex_printf("Avg32Sx4"); return;
sewardj164f9272004-12-09 00:39:32 +0000813
cerionf887b3e2005-09-13 16:34:28 +0000814 case Iop_Max8Sx16: vex_printf("Max8Sx16"); return;
sewardj164f9272004-12-09 00:39:32 +0000815 case Iop_Max16Sx8: vex_printf("Max16Sx8"); return;
cerionf887b3e2005-09-13 16:34:28 +0000816 case Iop_Max32Sx4: vex_printf("Max32Sx4"); return;
carll48ae46b2013-10-01 15:45:54 +0000817 case Iop_Max64Sx2: vex_printf("Max64Sx2"); return;
sewardj164f9272004-12-09 00:39:32 +0000818 case Iop_Max8Ux16: vex_printf("Max8Ux16"); return;
cerionf887b3e2005-09-13 16:34:28 +0000819 case Iop_Max16Ux8: vex_printf("Max16Ux8"); return;
820 case Iop_Max32Ux4: vex_printf("Max32Ux4"); return;
carll48ae46b2013-10-01 15:45:54 +0000821 case Iop_Max64Ux2: vex_printf("Max64Ux2"); return;
cerionf887b3e2005-09-13 16:34:28 +0000822
823 case Iop_Min8Sx16: vex_printf("Min8Sx16"); return;
sewardj164f9272004-12-09 00:39:32 +0000824 case Iop_Min16Sx8: vex_printf("Min16Sx8"); return;
cerionf887b3e2005-09-13 16:34:28 +0000825 case Iop_Min32Sx4: vex_printf("Min32Sx4"); return;
carll48ae46b2013-10-01 15:45:54 +0000826 case Iop_Min64Sx2: vex_printf("Min64Sx2"); return;
sewardj164f9272004-12-09 00:39:32 +0000827 case Iop_Min8Ux16: vex_printf("Min8Ux16"); return;
cerionf887b3e2005-09-13 16:34:28 +0000828 case Iop_Min16Ux8: vex_printf("Min16Ux8"); return;
829 case Iop_Min32Ux4: vex_printf("Min32Ux4"); return;
carll48ae46b2013-10-01 15:45:54 +0000830 case Iop_Min64Ux2: vex_printf("Min64Ux2"); return;
sewardj164f9272004-12-09 00:39:32 +0000831
832 case Iop_CmpEQ8x16: vex_printf("CmpEQ8x16"); return;
833 case Iop_CmpEQ16x8: vex_printf("CmpEQ16x8"); return;
834 case Iop_CmpEQ32x4: vex_printf("CmpEQ32x4"); return;
sewardjd8815622011-10-19 15:24:01 +0000835 case Iop_CmpEQ64x2: vex_printf("CmpEQ64x2"); return;
sewardj164f9272004-12-09 00:39:32 +0000836 case Iop_CmpGT8Sx16: vex_printf("CmpGT8Sx16"); return;
837 case Iop_CmpGT16Sx8: vex_printf("CmpGT16Sx8"); return;
838 case Iop_CmpGT32Sx4: vex_printf("CmpGT32Sx4"); return;
sewardj69d98e32010-06-18 08:17:41 +0000839 case Iop_CmpGT64Sx2: vex_printf("CmpGT64Sx2"); return;
cerionf887b3e2005-09-13 16:34:28 +0000840 case Iop_CmpGT8Ux16: vex_printf("CmpGT8Ux16"); return;
841 case Iop_CmpGT16Ux8: vex_printf("CmpGT16Ux8"); return;
842 case Iop_CmpGT32Ux4: vex_printf("CmpGT32Ux4"); return;
carll48ae46b2013-10-01 15:45:54 +0000843 case Iop_CmpGT64Ux2: vex_printf("CmpGT64Ux2"); return;
cerionf887b3e2005-09-13 16:34:28 +0000844
sewardj2fdd4162010-08-22 12:59:02 +0000845 case Iop_Cnt8x16: vex_printf("Cnt8x16"); return;
sewardja8c7b0f2014-06-26 08:18:08 +0000846 case Iop_Clz8x16: vex_printf("Clz8x16"); return;
847 case Iop_Clz16x8: vex_printf("Clz16x8"); return;
848 case Iop_Clz32x4: vex_printf("Clz32x4"); return;
carll7deaf952013-10-15 18:11:20 +0000849 case Iop_Clz64x2: vex_printf("Clz64x2"); return;
sewardja8c7b0f2014-06-26 08:18:08 +0000850 case Iop_Cls8x16: vex_printf("Cls8x16"); return;
851 case Iop_Cls16x8: vex_printf("Cls16x8"); return;
852 case Iop_Cls32x4: vex_printf("Cls32x4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000853
cerionf887b3e2005-09-13 16:34:28 +0000854 case Iop_ShlV128: vex_printf("ShlV128"); return;
855 case Iop_ShrV128: vex_printf("ShrV128"); return;
sewardj164f9272004-12-09 00:39:32 +0000856
cerion2a4b8452005-09-15 16:28:36 +0000857 case Iop_ShlN8x16: vex_printf("ShlN8x16"); return;
sewardj164f9272004-12-09 00:39:32 +0000858 case Iop_ShlN16x8: vex_printf("ShlN16x8"); return;
859 case Iop_ShlN32x4: vex_printf("ShlN32x4"); return;
860 case Iop_ShlN64x2: vex_printf("ShlN64x2"); return;
cerion2a4b8452005-09-15 16:28:36 +0000861 case Iop_ShrN8x16: vex_printf("ShrN8x16"); return;
sewardj164f9272004-12-09 00:39:32 +0000862 case Iop_ShrN16x8: vex_printf("ShrN16x8"); return;
863 case Iop_ShrN32x4: vex_printf("ShrN32x4"); return;
864 case Iop_ShrN64x2: vex_printf("ShrN64x2"); return;
cerion2a4b8452005-09-15 16:28:36 +0000865 case Iop_SarN8x16: vex_printf("SarN8x16"); return;
sewardj164f9272004-12-09 00:39:32 +0000866 case Iop_SarN16x8: vex_printf("SarN16x8"); return;
867 case Iop_SarN32x4: vex_printf("SarN32x4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000868 case Iop_SarN64x2: vex_printf("SarN64x2"); return;
sewardj164f9272004-12-09 00:39:32 +0000869
cerionf887b3e2005-09-13 16:34:28 +0000870 case Iop_Shl8x16: vex_printf("Shl8x16"); return;
871 case Iop_Shl16x8: vex_printf("Shl16x8"); return;
872 case Iop_Shl32x4: vex_printf("Shl32x4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000873 case Iop_Shl64x2: vex_printf("Shl64x2"); return;
874 case Iop_QSal8x16: vex_printf("QSal8x16"); return;
875 case Iop_QSal16x8: vex_printf("QSal16x8"); return;
876 case Iop_QSal32x4: vex_printf("QSal32x4"); return;
877 case Iop_QSal64x2: vex_printf("QSal64x2"); return;
878 case Iop_QShl8x16: vex_printf("QShl8x16"); return;
879 case Iop_QShl16x8: vex_printf("QShl16x8"); return;
880 case Iop_QShl32x4: vex_printf("QShl32x4"); return;
881 case Iop_QShl64x2: vex_printf("QShl64x2"); return;
sewardj1dd3ec12014-08-15 09:11:08 +0000882 case Iop_QShlNsatSS8x16: vex_printf("QShlNsatSS8x16"); return;
883 case Iop_QShlNsatSS16x8: vex_printf("QShlNsatSS16x8"); return;
884 case Iop_QShlNsatSS32x4: vex_printf("QShlNsatSS32x4"); return;
885 case Iop_QShlNsatSS64x2: vex_printf("QShlNsatSS64x2"); return;
886 case Iop_QShlNsatUU8x16: vex_printf("QShlNsatUU8x16"); return;
887 case Iop_QShlNsatUU16x8: vex_printf("QShlNsatUU16x8"); return;
888 case Iop_QShlNsatUU32x4: vex_printf("QShlNsatUU32x4"); return;
889 case Iop_QShlNsatUU64x2: vex_printf("QShlNsatUU64x2"); return;
890 case Iop_QShlNsatSU8x16: vex_printf("QShlNsatSU8x16"); return;
891 case Iop_QShlNsatSU16x8: vex_printf("QShlNsatSU16x8"); return;
892 case Iop_QShlNsatSU32x4: vex_printf("QShlNsatSU32x4"); return;
893 case Iop_QShlNsatSU64x2: vex_printf("QShlNsatSU64x2"); return;
cerionf887b3e2005-09-13 16:34:28 +0000894 case Iop_Shr8x16: vex_printf("Shr8x16"); return;
895 case Iop_Shr16x8: vex_printf("Shr16x8"); return;
896 case Iop_Shr32x4: vex_printf("Shr32x4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000897 case Iop_Shr64x2: vex_printf("Shr64x2"); return;
cerionf887b3e2005-09-13 16:34:28 +0000898 case Iop_Sar8x16: vex_printf("Sar8x16"); return;
899 case Iop_Sar16x8: vex_printf("Sar16x8"); return;
900 case Iop_Sar32x4: vex_printf("Sar32x4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000901 case Iop_Sar64x2: vex_printf("Sar64x2"); return;
902 case Iop_Sal8x16: vex_printf("Sal8x16"); return;
903 case Iop_Sal16x8: vex_printf("Sal16x8"); return;
904 case Iop_Sal32x4: vex_printf("Sal32x4"); return;
905 case Iop_Sal64x2: vex_printf("Sal64x2"); return;
sewardj1bee5612005-11-10 18:10:58 +0000906 case Iop_Rol8x16: vex_printf("Rol8x16"); return;
907 case Iop_Rol16x8: vex_printf("Rol16x8"); return;
908 case Iop_Rol32x4: vex_printf("Rol32x4"); return;
carll48ae46b2013-10-01 15:45:54 +0000909 case Iop_Rol64x2: vex_printf("Rol64x2"); return;
cerionf887b3e2005-09-13 16:34:28 +0000910
sewardj12972182014-08-04 08:09:47 +0000911 case Iop_QandUQsh8x16: vex_printf("QandUQsh8x16"); return;
912 case Iop_QandUQsh16x8: vex_printf("QandUQsh16x8"); return;
913 case Iop_QandUQsh32x4: vex_printf("QandUQsh32x4"); return;
914 case Iop_QandUQsh64x2: vex_printf("QandUQsh64x2"); return;
915 case Iop_QandSQsh8x16: vex_printf("QandSQsh8x16"); return;
916 case Iop_QandSQsh16x8: vex_printf("QandSQsh16x8"); return;
917 case Iop_QandSQsh32x4: vex_printf("QandSQsh32x4"); return;
918 case Iop_QandSQsh64x2: vex_printf("QandSQsh64x2"); return;
919 case Iop_QandUQRsh8x16: vex_printf("QandUQRsh8x16"); return;
920 case Iop_QandUQRsh16x8: vex_printf("QandUQRsh16x8"); return;
921 case Iop_QandUQRsh32x4: vex_printf("QandUQRsh32x4"); return;
922 case Iop_QandUQRsh64x2: vex_printf("QandUQRsh64x2"); return;
923 case Iop_QandSQRsh8x16: vex_printf("QandSQRsh8x16"); return;
924 case Iop_QandSQRsh16x8: vex_printf("QandSQRsh16x8"); return;
925 case Iop_QandSQRsh32x4: vex_printf("QandSQRsh32x4"); return;
926 case Iop_QandSQRsh64x2: vex_printf("QandSQRsh64x2"); return;
927
sewardja6b61f02014-08-17 18:32:14 +0000928 case Iop_Sh8Sx16: vex_printf("Sh8Sx16"); return;
929 case Iop_Sh16Sx8: vex_printf("Sh16Sx8"); return;
930 case Iop_Sh32Sx4: vex_printf("Sh32Sx4"); return;
931 case Iop_Sh64Sx2: vex_printf("Sh64Sx2"); return;
932 case Iop_Sh8Ux16: vex_printf("Sh8Ux16"); return;
933 case Iop_Sh16Ux8: vex_printf("Sh16Ux8"); return;
934 case Iop_Sh32Ux4: vex_printf("Sh32Ux4"); return;
935 case Iop_Sh64Ux2: vex_printf("Sh64Ux2"); return;
936 case Iop_Rsh8Sx16: vex_printf("Rsh8Sx16"); return;
937 case Iop_Rsh16Sx8: vex_printf("Rsh16Sx8"); return;
938 case Iop_Rsh32Sx4: vex_printf("Rsh32Sx4"); return;
939 case Iop_Rsh64Sx2: vex_printf("Rsh64Sx2"); return;
940 case Iop_Rsh8Ux16: vex_printf("Rsh8Ux16"); return;
941 case Iop_Rsh16Ux8: vex_printf("Rsh16Ux8"); return;
942 case Iop_Rsh32Ux4: vex_printf("Rsh32Ux4"); return;
943 case Iop_Rsh64Ux2: vex_printf("Rsh64Ux2"); return;
944
sewardjecedd982014-08-11 14:02:47 +0000945 case Iop_QandQShrNnarrow16Uto8Ux8:
946 vex_printf("QandQShrNnarrow16Uto8Ux8"); return;
947 case Iop_QandQShrNnarrow32Uto16Ux4:
948 vex_printf("QandQShrNnarrow32Uto16Ux4"); return;
949 case Iop_QandQShrNnarrow64Uto32Ux2:
950 vex_printf("QandQShrNnarrow64Uto32Ux2"); return;
951 case Iop_QandQSarNnarrow16Sto8Sx8:
952 vex_printf("QandQSarNnarrow16Sto8Sx8"); return;
953 case Iop_QandQSarNnarrow32Sto16Sx4:
954 vex_printf("QandQSarNnarrow32Sto16Sx4"); return;
955 case Iop_QandQSarNnarrow64Sto32Sx2:
956 vex_printf("QandQSarNnarrow64Sto32Sx2"); return;
957 case Iop_QandQSarNnarrow16Sto8Ux8:
958 vex_printf("QandQSarNnarrow16Sto8Ux8"); return;
959 case Iop_QandQSarNnarrow32Sto16Ux4:
960 vex_printf("QandQSarNnarrow32Sto16Ux4"); return;
961 case Iop_QandQSarNnarrow64Sto32Ux2:
962 vex_printf("QandQSarNnarrow64Sto32Ux2"); return;
963 case Iop_QandQRShrNnarrow16Uto8Ux8:
964 vex_printf("QandQRShrNnarrow16Uto8Ux8"); return;
965 case Iop_QandQRShrNnarrow32Uto16Ux4:
966 vex_printf("QandQRShrNnarrow32Uto16Ux4"); return;
967 case Iop_QandQRShrNnarrow64Uto32Ux2:
968 vex_printf("QandQRShrNnarrow64Uto32Ux2"); return;
969 case Iop_QandQRSarNnarrow16Sto8Sx8:
970 vex_printf("QandQRSarNnarrow16Sto8Sx8"); return;
971 case Iop_QandQRSarNnarrow32Sto16Sx4:
972 vex_printf("QandQRSarNnarrow32Sto16Sx4"); return;
973 case Iop_QandQRSarNnarrow64Sto32Sx2:
974 vex_printf("QandQRSarNnarrow64Sto32Sx2"); return;
975 case Iop_QandQRSarNnarrow16Sto8Ux8:
976 vex_printf("QandQRSarNnarrow16Sto8Ux8"); return;
977 case Iop_QandQRSarNnarrow32Sto16Ux4:
978 vex_printf("QandQRSarNnarrow32Sto16Ux4"); return;
979 case Iop_QandQRSarNnarrow64Sto32Ux2:
980 vex_printf("QandQRSarNnarrow64Sto32Ux2"); return;
981
sewardj5f438dd2011-06-16 11:36:23 +0000982 case Iop_NarrowBin16to8x16: vex_printf("NarrowBin16to8x16"); return;
983 case Iop_NarrowBin32to16x8: vex_printf("NarrowBin32to16x8"); return;
984 case Iop_QNarrowBin16Uto8Ux16: vex_printf("QNarrowBin16Uto8Ux16"); return;
985 case Iop_QNarrowBin32Sto16Ux8: vex_printf("QNarrowBin32Sto16Ux8"); return;
986 case Iop_QNarrowBin16Sto8Ux16: vex_printf("QNarrowBin16Sto8Ux16"); return;
987 case Iop_QNarrowBin32Uto16Ux8: vex_printf("QNarrowBin32Uto16Ux8"); return;
988 case Iop_QNarrowBin16Sto8Sx16: vex_printf("QNarrowBin16Sto8Sx16"); return;
989 case Iop_QNarrowBin32Sto16Sx8: vex_printf("QNarrowBin32Sto16Sx8"); return;
990 case Iop_NarrowUn16to8x8: vex_printf("NarrowUn16to8x8"); return;
991 case Iop_NarrowUn32to16x4: vex_printf("NarrowUn32to16x4"); return;
992 case Iop_NarrowUn64to32x2: vex_printf("NarrowUn64to32x2"); return;
993 case Iop_QNarrowUn16Uto8Ux8: vex_printf("QNarrowUn16Uto8Ux8"); return;
994 case Iop_QNarrowUn32Uto16Ux4: vex_printf("QNarrowUn32Uto16Ux4"); return;
995 case Iop_QNarrowUn64Uto32Ux2: vex_printf("QNarrowUn64Uto32Ux2"); return;
996 case Iop_QNarrowUn16Sto8Sx8: vex_printf("QNarrowUn16Sto8Sx8"); return;
997 case Iop_QNarrowUn32Sto16Sx4: vex_printf("QNarrowUn32Sto16Sx4"); return;
998 case Iop_QNarrowUn64Sto32Sx2: vex_printf("QNarrowUn64Sto32Sx2"); return;
999 case Iop_QNarrowUn16Sto8Ux8: vex_printf("QNarrowUn16Sto8Ux8"); return;
1000 case Iop_QNarrowUn32Sto16Ux4: vex_printf("QNarrowUn32Sto16Ux4"); return;
1001 case Iop_QNarrowUn64Sto32Ux2: vex_printf("QNarrowUn64Sto32Ux2"); return;
1002 case Iop_Widen8Uto16x8: vex_printf("Widen8Uto16x8"); return;
1003 case Iop_Widen16Uto32x4: vex_printf("Widen16Uto32x4"); return;
1004 case Iop_Widen32Uto64x2: vex_printf("Widen32Uto64x2"); return;
1005 case Iop_Widen8Sto16x8: vex_printf("Widen8Sto16x8"); return;
1006 case Iop_Widen16Sto32x4: vex_printf("Widen16Sto32x4"); return;
1007 case Iop_Widen32Sto64x2: vex_printf("Widen32Sto64x2"); return;
sewardj164f9272004-12-09 00:39:32 +00001008
1009 case Iop_InterleaveHI8x16: vex_printf("InterleaveHI8x16"); return;
1010 case Iop_InterleaveHI16x8: vex_printf("InterleaveHI16x8"); return;
1011 case Iop_InterleaveHI32x4: vex_printf("InterleaveHI32x4"); return;
1012 case Iop_InterleaveHI64x2: vex_printf("InterleaveHI64x2"); return;
1013 case Iop_InterleaveLO8x16: vex_printf("InterleaveLO8x16"); return;
1014 case Iop_InterleaveLO16x8: vex_printf("InterleaveLO16x8"); return;
1015 case Iop_InterleaveLO32x4: vex_printf("InterleaveLO32x4"); return;
1016 case Iop_InterleaveLO64x2: vex_printf("InterleaveLO64x2"); return;
1017
sewardj2fdd4162010-08-22 12:59:02 +00001018 case Iop_CatOddLanes8x16: vex_printf("CatOddLanes8x16"); return;
1019 case Iop_CatOddLanes16x8: vex_printf("CatOddLanes16x8"); return;
1020 case Iop_CatOddLanes32x4: vex_printf("CatOddLanes32x4"); return;
1021 case Iop_CatEvenLanes8x16: vex_printf("CatEvenLanes8x16"); return;
1022 case Iop_CatEvenLanes16x8: vex_printf("CatEvenLanes16x8"); return;
1023 case Iop_CatEvenLanes32x4: vex_printf("CatEvenLanes32x4"); return;
1024
1025 case Iop_InterleaveOddLanes8x16: vex_printf("InterleaveOddLanes8x16"); return;
1026 case Iop_InterleaveOddLanes16x8: vex_printf("InterleaveOddLanes16x8"); return;
1027 case Iop_InterleaveOddLanes32x4: vex_printf("InterleaveOddLanes32x4"); return;
1028 case Iop_InterleaveEvenLanes8x16: vex_printf("InterleaveEvenLanes8x16"); return;
1029 case Iop_InterleaveEvenLanes16x8: vex_printf("InterleaveEvenLanes16x8"); return;
1030 case Iop_InterleaveEvenLanes32x4: vex_printf("InterleaveEvenLanes32x4"); return;
1031
1032 case Iop_GetElem8x16: vex_printf("GetElem8x16"); return;
1033 case Iop_GetElem16x8: vex_printf("GetElem16x8"); return;
1034 case Iop_GetElem32x4: vex_printf("GetElem32x4"); return;
1035 case Iop_GetElem64x2: vex_printf("GetElem64x2"); return;
1036
1037 case Iop_GetElem8x8: vex_printf("GetElem8x8"); return;
1038 case Iop_GetElem16x4: vex_printf("GetElem16x4"); return;
1039 case Iop_GetElem32x2: vex_printf("GetElem32x2"); return;
1040 case Iop_SetElem8x8: vex_printf("SetElem8x8"); return;
1041 case Iop_SetElem16x4: vex_printf("SetElem16x4"); return;
1042 case Iop_SetElem32x2: vex_printf("SetElem32x2"); return;
1043
sewardje6b9bd92014-09-01 11:32:47 +00001044 case Iop_Slice64: vex_printf("Slice64"); return;
1045 case Iop_SliceV128: vex_printf("SliceV128"); return;
sewardj2fdd4162010-08-22 12:59:02 +00001046
sewardjdc1f9132005-10-22 12:49:49 +00001047 case Iop_Perm8x16: vex_printf("Perm8x16"); return;
sewardjd8bca7e2012-06-20 11:46:19 +00001048 case Iop_Perm32x4: vex_printf("Perm32x4"); return;
sewardj33680352014-06-26 10:49:33 +00001049 case Iop_Reverse8sIn16_x8: vex_printf("Reverse8sIn16_x8"); return;
1050 case Iop_Reverse8sIn32_x4: vex_printf("Reverse8sIn32_x4"); return;
1051 case Iop_Reverse16sIn32_x4: vex_printf("Reverse16sIn32_x4"); return;
1052 case Iop_Reverse8sIn64_x2: vex_printf("Reverse8sIn64_x2"); return;
1053 case Iop_Reverse16sIn64_x2: vex_printf("Reverse16sIn64_x2"); return;
1054 case Iop_Reverse32sIn64_x2: vex_printf("Reverse32sIn64_x2"); return;
sewardj715d1622014-06-26 12:39:05 +00001055 case Iop_Reverse1sIn8_x16: vex_printf("Reverse1sIn8_x16"); return;
sewardj2fdd4162010-08-22 12:59:02 +00001056
1057 case Iop_F32ToFixed32Ux4_RZ: vex_printf("F32ToFixed32Ux4_RZ"); return;
1058 case Iop_F32ToFixed32Sx4_RZ: vex_printf("F32ToFixed32Sx4_RZ"); return;
1059 case Iop_Fixed32UToF32x4_RN: vex_printf("Fixed32UToF32x4_RN"); return;
1060 case Iop_Fixed32SToF32x4_RN: vex_printf("Fixed32SToF32x4_RN"); return;
1061 case Iop_F32ToFixed32Ux2_RZ: vex_printf("F32ToFixed32Ux2_RZ"); return;
1062 case Iop_F32ToFixed32Sx2_RZ: vex_printf("F32ToFixed32Sx2_RZ"); return;
1063 case Iop_Fixed32UToF32x2_RN: vex_printf("Fixed32UToF32x2_RN"); return;
1064 case Iop_Fixed32SToF32x2_RN: vex_printf("Fixed32SToF32x2_RN"); return;
cerionf887b3e2005-09-13 16:34:28 +00001065
sewardj26217b02012-04-12 17:19:48 +00001066 case Iop_D32toD64: vex_printf("D32toD64"); return;
1067 case Iop_D64toD32: vex_printf("D64toD32"); return;
sewardjc6bbd472012-04-02 10:20:48 +00001068 case Iop_AddD64: vex_printf("AddD64"); return;
1069 case Iop_SubD64: vex_printf("SubD64"); return;
1070 case Iop_MulD64: vex_printf("MulD64"); return;
1071 case Iop_DivD64: vex_printf("DivD64"); return;
sewardj26217b02012-04-12 17:19:48 +00001072 case Iop_ShlD64: vex_printf("ShlD64"); return;
1073 case Iop_ShrD64: vex_printf("ShrD64"); return;
florianb17e16f2013-01-12 22:02:07 +00001074 case Iop_D64toI32S: vex_printf("D64toI32S"); return;
1075 case Iop_D64toI32U: vex_printf("D64toI32U"); return;
sewardj26217b02012-04-12 17:19:48 +00001076 case Iop_D64toI64S: vex_printf("D64toI64S"); return;
florianb17e16f2013-01-12 22:02:07 +00001077 case Iop_D64toI64U: vex_printf("D64toI64U"); return;
1078 case Iop_I32StoD64: vex_printf("I32StoD64"); return;
1079 case Iop_I32UtoD64: vex_printf("I32UtoD64"); return;
sewardj26217b02012-04-12 17:19:48 +00001080 case Iop_I64StoD64: vex_printf("I64StoD64"); return;
florianb17e16f2013-01-12 22:02:07 +00001081 case Iop_I64UtoD64: vex_printf("I64UtoD64"); return;
1082 case Iop_I32StoD128: vex_printf("I32StoD128"); return;
1083 case Iop_I32UtoD128: vex_printf("I32UtoD128"); return;
sewardj26217b02012-04-12 17:19:48 +00001084 case Iop_I64StoD128: vex_printf("I64StoD128"); return;
florianb17e16f2013-01-12 22:02:07 +00001085 case Iop_I64UtoD128: vex_printf("I64UtoD128"); return;
sewardj26217b02012-04-12 17:19:48 +00001086 case Iop_D64toD128: vex_printf("D64toD128"); return;
1087 case Iop_D128toD64: vex_printf("D128toD64"); return;
florianb17e16f2013-01-12 22:02:07 +00001088 case Iop_D128toI32S: vex_printf("D128toI32S"); return;
1089 case Iop_D128toI32U: vex_printf("D128toI32U"); return;
sewardj26217b02012-04-12 17:19:48 +00001090 case Iop_D128toI64S: vex_printf("D128toI64S"); return;
florianb17e16f2013-01-12 22:02:07 +00001091 case Iop_D128toI64U: vex_printf("D128toI64U"); return;
florianb22838d2013-06-17 18:59:51 +00001092 case Iop_F32toD32: vex_printf("F32toD32"); return;
1093 case Iop_F32toD64: vex_printf("F32toD64"); return;
1094 case Iop_F32toD128: vex_printf("F32toD128"); return;
1095 case Iop_F64toD32: vex_printf("F64toD32"); return;
florian37c57f32013-05-05 15:04:30 +00001096 case Iop_F64toD64: vex_printf("F64toD64"); return;
florian37c57f32013-05-05 15:04:30 +00001097 case Iop_F64toD128: vex_printf("F64toD128"); return;
florianb22838d2013-06-17 18:59:51 +00001098 case Iop_F128toD32: vex_printf("F128toD32"); return;
1099 case Iop_F128toD64: vex_printf("F128toD64"); return;
florian37c57f32013-05-05 15:04:30 +00001100 case Iop_F128toD128: vex_printf("F128toD128"); return;
florianb22838d2013-06-17 18:59:51 +00001101 case Iop_D32toF32: vex_printf("D32toF32"); return;
1102 case Iop_D32toF64: vex_printf("D32toF64"); return;
1103 case Iop_D32toF128: vex_printf("D32toF128"); return;
1104 case Iop_D64toF32: vex_printf("D64toF32"); return;
1105 case Iop_D64toF64: vex_printf("D64toF64"); return;
1106 case Iop_D64toF128: vex_printf("D64toF128"); return;
1107 case Iop_D128toF32: vex_printf("D128toF32"); return;
1108 case Iop_D128toF64: vex_printf("D128toF64"); return;
florian37c57f32013-05-05 15:04:30 +00001109 case Iop_D128toF128: vex_printf("D128toF128"); return;
sewardjc6bbd472012-04-02 10:20:48 +00001110 case Iop_AddD128: vex_printf("AddD128"); return;
1111 case Iop_SubD128: vex_printf("SubD128"); return;
1112 case Iop_MulD128: vex_printf("MulD128"); return;
1113 case Iop_DivD128: vex_printf("DivD128"); return;
sewardj26217b02012-04-12 17:19:48 +00001114 case Iop_ShlD128: vex_printf("ShlD128"); return;
1115 case Iop_ShrD128: vex_printf("ShrD128"); return;
sewardj12972182014-08-04 08:09:47 +00001116 case Iop_RoundD64toInt: vex_printf("RoundD64toInt"); return;
1117 case Iop_RoundD128toInt: vex_printf("RoundD128toInt"); return;
1118 case Iop_QuantizeD64: vex_printf("QuantizeD64"); return;
1119 case Iop_QuantizeD128: vex_printf("QuantizeD128"); return;
1120 case Iop_ExtractExpD64: vex_printf("ExtractExpD64"); return;
1121 case Iop_ExtractExpD128: vex_printf("ExtractExpD128"); return;
1122 case Iop_ExtractSigD64: vex_printf("ExtractSigD64"); return;
1123 case Iop_ExtractSigD128: vex_printf("ExtractSigD128"); return;
1124 case Iop_InsertExpD64: vex_printf("InsertExpD64"); return;
1125 case Iop_InsertExpD128: vex_printf("InsertExpD128"); return;
florian20c6bca2012-12-26 17:47:19 +00001126 case Iop_CmpD64: vex_printf("CmpD64"); return;
1127 case Iop_CmpD128: vex_printf("CmpD128"); return;
1128 case Iop_CmpExpD64: vex_printf("CmpExpD64"); return;
1129 case Iop_CmpExpD128: vex_printf("CmpExpD128"); return;
1130 case Iop_D64HLtoD128: vex_printf("D64HLtoD128"); return;
1131 case Iop_D128HItoD64: vex_printf("D128HItoD64"); return;
1132 case Iop_D128LOtoD64: vex_printf("D128LOtoD64"); return;
sewardj12972182014-08-04 08:09:47 +00001133 case Iop_SignificanceRoundD64: vex_printf("SignificanceRoundD64");
sewardjcdc376d2012-04-23 11:21:12 +00001134 return;
sewardj12972182014-08-04 08:09:47 +00001135 case Iop_SignificanceRoundD128: vex_printf("SignificanceRoundD128");
sewardjcdc376d2012-04-23 11:21:12 +00001136 return;
1137 case Iop_ReinterpI64asD64: vex_printf("ReinterpI64asD64"); return;
sewardj5eff1c52012-04-29 20:19:17 +00001138 case Iop_ReinterpD64asI64: vex_printf("ReinterpD64asI64"); return;
sewardjc4530ae2012-05-21 10:18:49 +00001139 case Iop_V256to64_0: vex_printf("V256to64_0"); return;
1140 case Iop_V256to64_1: vex_printf("V256to64_1"); return;
1141 case Iop_V256to64_2: vex_printf("V256to64_2"); return;
1142 case Iop_V256to64_3: vex_printf("V256to64_3"); return;
1143 case Iop_64x4toV256: vex_printf("64x4toV256"); return;
sewardj4b1cc832012-06-13 11:10:20 +00001144 case Iop_V256toV128_0: vex_printf("V256toV128_0"); return;
1145 case Iop_V256toV128_1: vex_printf("V256toV128_1"); return;
1146 case Iop_V128HLtoV256: vex_printf("V128HLtoV256"); return;
sewardj56c30312012-06-12 08:45:39 +00001147 case Iop_DPBtoBCD: vex_printf("DPBtoBCD"); return;
1148 case Iop_BCDtoDPB: vex_printf("BCDtoDPB"); return;
1149 case Iop_Add64Fx4: vex_printf("Add64Fx4"); return;
1150 case Iop_Sub64Fx4: vex_printf("Sub64Fx4"); return;
1151 case Iop_Mul64Fx4: vex_printf("Mul64Fx4"); return;
1152 case Iop_Div64Fx4: vex_printf("Div64Fx4"); return;
1153 case Iop_Add32Fx8: vex_printf("Add32Fx8"); return;
1154 case Iop_Sub32Fx8: vex_printf("Sub32Fx8"); return;
1155 case Iop_Mul32Fx8: vex_printf("Mul32Fx8"); return;
1156 case Iop_Div32Fx8: vex_printf("Div32Fx8"); return;
sewardj4b1cc832012-06-13 11:10:20 +00001157 case Iop_AndV256: vex_printf("AndV256"); return;
sewardj2a2bda92012-06-14 23:32:02 +00001158 case Iop_OrV256: vex_printf("OrV256"); return;
sewardj4b1cc832012-06-13 11:10:20 +00001159 case Iop_XorV256: vex_printf("XorV256"); return;
sewardj2a2bda92012-06-14 23:32:02 +00001160 case Iop_NotV256: vex_printf("NotV256"); return;
sewardj23db8a02012-06-25 07:46:18 +00001161 case Iop_CmpNEZ64x4: vex_printf("CmpNEZ64x4"); return;
1162 case Iop_CmpNEZ32x8: vex_printf("CmpNEZ32x8"); return;
sewardjcc3d2192013-03-27 11:37:33 +00001163 case Iop_CmpNEZ16x16: vex_printf("CmpNEZ16x16"); return;
1164 case Iop_CmpNEZ8x32: vex_printf("CmpNEZ8x32"); return;
1165
1166 case Iop_Add8x32: vex_printf("Add8x32"); return;
1167 case Iop_Add16x16: vex_printf("Add16x16"); return;
1168 case Iop_Add32x8: vex_printf("Add32x8"); return;
1169 case Iop_Add64x4: vex_printf("Add64x4"); return;
1170 case Iop_Sub8x32: vex_printf("Sub8x32"); return;
1171 case Iop_Sub16x16: vex_printf("Sub16x16"); return;
1172 case Iop_Sub32x8: vex_printf("Sub32x8"); return;
1173 case Iop_Sub64x4: vex_printf("Sub64x4"); return;
1174 case Iop_QAdd8Ux32: vex_printf("QAdd8Ux32"); return;
1175 case Iop_QAdd16Ux16: vex_printf("QAdd16Ux16"); return;
1176 case Iop_QAdd8Sx32: vex_printf("QAdd8Sx32"); return;
1177 case Iop_QAdd16Sx16: vex_printf("QAdd16Sx16"); return;
1178 case Iop_QSub8Ux32: vex_printf("QSub8Ux32"); return;
1179 case Iop_QSub16Ux16: vex_printf("QSub16Ux16"); return;
1180 case Iop_QSub8Sx32: vex_printf("QSub8Sx32"); return;
1181 case Iop_QSub16Sx16: vex_printf("QSub16Sx16"); return;
1182
1183 case Iop_Mul16x16: vex_printf("Mul16x16"); return;
1184 case Iop_Mul32x8: vex_printf("Mul32x8"); return;
1185 case Iop_MulHi16Ux16: vex_printf("MulHi16Ux16"); return;
1186 case Iop_MulHi16Sx16: vex_printf("MulHi16Sx16"); return;
1187
1188 case Iop_Avg8Ux32: vex_printf("Avg8Ux32"); return;
1189 case Iop_Avg16Ux16: vex_printf("Avg16Ux16"); return;
1190
1191 case Iop_Max8Sx32: vex_printf("Max8Sx32"); return;
1192 case Iop_Max16Sx16: vex_printf("Max16Sx16"); return;
1193 case Iop_Max32Sx8: vex_printf("Max32Sx8"); return;
1194 case Iop_Max8Ux32: vex_printf("Max8Ux32"); return;
1195 case Iop_Max16Ux16: vex_printf("Max16Ux16"); return;
1196 case Iop_Max32Ux8: vex_printf("Max32Ux8"); return;
1197
1198 case Iop_Min8Sx32: vex_printf("Min8Sx32"); return;
1199 case Iop_Min16Sx16: vex_printf("Min16Sx16"); return;
1200 case Iop_Min32Sx8: vex_printf("Min32Sx8"); return;
1201 case Iop_Min8Ux32: vex_printf("Min8Ux32"); return;
1202 case Iop_Min16Ux16: vex_printf("Min16Ux16"); return;
1203 case Iop_Min32Ux8: vex_printf("Min32Ux8"); return;
1204
1205 case Iop_CmpEQ8x32: vex_printf("CmpEQ8x32"); return;
1206 case Iop_CmpEQ16x16: vex_printf("CmpEQ16x16"); return;
1207 case Iop_CmpEQ32x8: vex_printf("CmpEQ32x8"); return;
1208 case Iop_CmpEQ64x4: vex_printf("CmpEQ64x4"); return;
1209 case Iop_CmpGT8Sx32: vex_printf("CmpGT8Sx32"); return;
1210 case Iop_CmpGT16Sx16: vex_printf("CmpGT16Sx16"); return;
1211 case Iop_CmpGT32Sx8: vex_printf("CmpGT32Sx8"); return;
1212 case Iop_CmpGT64Sx4: vex_printf("CmpGT64Sx4"); return;
1213
1214 case Iop_ShlN16x16: vex_printf("ShlN16x16"); return;
1215 case Iop_ShlN32x8: vex_printf("ShlN32x8"); return;
1216 case Iop_ShlN64x4: vex_printf("ShlN64x4"); return;
1217 case Iop_ShrN16x16: vex_printf("ShrN16x16"); return;
1218 case Iop_ShrN32x8: vex_printf("ShrN32x8"); return;
1219 case Iop_ShrN64x4: vex_printf("ShrN64x4"); return;
1220 case Iop_SarN16x16: vex_printf("SarN16x16"); return;
1221 case Iop_SarN32x8: vex_printf("SarN32x8"); return;
1222
1223 case Iop_Perm32x8: vex_printf("Perm32x8"); return;
1224
carll7deaf952013-10-15 18:11:20 +00001225 case Iop_CipherV128: vex_printf("CipherV128"); return;
1226 case Iop_CipherLV128: vex_printf("CipherLV128"); return;
1227 case Iop_NCipherV128: vex_printf("NCipherV128"); return;
1228 case Iop_NCipherLV128: vex_printf("NCipherLV128"); return;
1229 case Iop_CipherSV128: vex_printf("CipherSV128"); return;
1230
1231 case Iop_SHA256: vex_printf("SHA256"); return;
1232 case Iop_SHA512: vex_printf("SHA512"); return;
1233 case Iop_BCDAdd: vex_printf("BCDAdd"); return;
1234 case Iop_BCDSub: vex_printf("BCDSub"); return;
1235
carll60c6bac2013-10-18 01:19:06 +00001236 case Iop_PwBitMtxXpose64x2: vex_printf("BitMatrixTranspose64x2"); return;
1237
sewardjc9a43662004-11-30 18:51:59 +00001238 default: vpanic("ppIROp(1)");
sewardj41f43bc2004-07-08 14:23:22 +00001239 }
sewardj1fb8c922009-07-12 12:56:53 +00001240
1241 vassert(str);
sewardj41f43bc2004-07-08 14:23:22 +00001242 switch (op - base) {
sewardjecbaee72008-11-01 23:54:45 +00001243 case 0: vex_printf("%s",str); vex_printf("8"); break;
1244 case 1: vex_printf("%s",str); vex_printf("16"); break;
1245 case 2: vex_printf("%s",str); vex_printf("32"); break;
1246 case 3: vex_printf("%s",str); vex_printf("64"); break;
sewardj41f43bc2004-07-08 14:23:22 +00001247 default: vpanic("ppIROp(2)");
1248 }
sewardje3d0d2e2004-06-27 10:42:44 +00001249}
1250
florian0b70efa2014-09-21 21:53:39 +00001251void ppIRExpr ( const IRExpr* e )
sewardje3d0d2e2004-06-27 10:42:44 +00001252{
sewardje87b4842004-07-10 12:23:30 +00001253 Int i;
sewardje3d0d2e2004-06-27 10:42:44 +00001254 switch (e->tag) {
sewardj443cd9d2004-07-18 23:06:45 +00001255 case Iex_Binder:
1256 vex_printf("BIND-%d", e->Iex.Binder.binder);
1257 break;
sewardje3d0d2e2004-06-27 10:42:44 +00001258 case Iex_Get:
sewardjc9a43662004-11-30 18:51:59 +00001259 vex_printf( "GET:" );
sewardjfbcaf332004-07-08 01:46:01 +00001260 ppIRType(e->Iex.Get.ty);
sewardjc9a43662004-11-30 18:51:59 +00001261 vex_printf("(%d)", e->Iex.Get.offset);
sewardjec6ad592004-06-20 12:26:53 +00001262 break;
sewardjbb53f8c2004-08-14 11:50:01 +00001263 case Iex_GetI:
sewardj2d3f77c2004-09-22 23:49:09 +00001264 vex_printf( "GETI" );
sewardjdd40fdf2006-12-24 02:20:24 +00001265 ppIRRegArray(e->Iex.GetI.descr);
sewardj2d3f77c2004-09-22 23:49:09 +00001266 vex_printf("[");
sewardjeeac8412004-11-02 00:26:55 +00001267 ppIRExpr(e->Iex.GetI.ix);
sewardj2d3f77c2004-09-22 23:49:09 +00001268 vex_printf(",%d]", e->Iex.GetI.bias);
sewardjbb53f8c2004-08-14 11:50:01 +00001269 break;
sewardjdd40fdf2006-12-24 02:20:24 +00001270 case Iex_RdTmp:
1271 ppIRTemp(e->Iex.RdTmp.tmp);
sewardjec6ad592004-06-20 12:26:53 +00001272 break;
florian96d7cc32012-06-01 20:41:24 +00001273 case Iex_Qop: {
florian0b70efa2014-09-21 21:53:39 +00001274 const IRQop *qop = e->Iex.Qop.details;
florian96d7cc32012-06-01 20:41:24 +00001275 ppIROp(qop->op);
sewardj40c80262006-02-08 19:30:46 +00001276 vex_printf( "(" );
florian96d7cc32012-06-01 20:41:24 +00001277 ppIRExpr(qop->arg1);
sewardj40c80262006-02-08 19:30:46 +00001278 vex_printf( "," );
florian96d7cc32012-06-01 20:41:24 +00001279 ppIRExpr(qop->arg2);
sewardj40c80262006-02-08 19:30:46 +00001280 vex_printf( "," );
florian96d7cc32012-06-01 20:41:24 +00001281 ppIRExpr(qop->arg3);
sewardj40c80262006-02-08 19:30:46 +00001282 vex_printf( "," );
florian96d7cc32012-06-01 20:41:24 +00001283 ppIRExpr(qop->arg4);
sewardj40c80262006-02-08 19:30:46 +00001284 vex_printf( ")" );
1285 break;
florian96d7cc32012-06-01 20:41:24 +00001286 }
florian420bfa92012-06-02 20:29:22 +00001287 case Iex_Triop: {
florian0b70efa2014-09-21 21:53:39 +00001288 const IRTriop *triop = e->Iex.Triop.details;
florian420bfa92012-06-02 20:29:22 +00001289 ppIROp(triop->op);
sewardjb183b852006-02-03 16:08:03 +00001290 vex_printf( "(" );
florian420bfa92012-06-02 20:29:22 +00001291 ppIRExpr(triop->arg1);
sewardjb183b852006-02-03 16:08:03 +00001292 vex_printf( "," );
florian420bfa92012-06-02 20:29:22 +00001293 ppIRExpr(triop->arg2);
sewardjb183b852006-02-03 16:08:03 +00001294 vex_printf( "," );
florian420bfa92012-06-02 20:29:22 +00001295 ppIRExpr(triop->arg3);
sewardjb183b852006-02-03 16:08:03 +00001296 vex_printf( ")" );
1297 break;
florian420bfa92012-06-02 20:29:22 +00001298 }
sewardje3d0d2e2004-06-27 10:42:44 +00001299 case Iex_Binop:
sewardj35421a32004-07-05 13:12:34 +00001300 ppIROp(e->Iex.Binop.op);
1301 vex_printf( "(" );
1302 ppIRExpr(e->Iex.Binop.arg1);
1303 vex_printf( "," );
1304 ppIRExpr(e->Iex.Binop.arg2);
1305 vex_printf( ")" );
sewardjec6ad592004-06-20 12:26:53 +00001306 break;
sewardje3d0d2e2004-06-27 10:42:44 +00001307 case Iex_Unop:
sewardj35421a32004-07-05 13:12:34 +00001308 ppIROp(e->Iex.Unop.op);
1309 vex_printf( "(" );
1310 ppIRExpr(e->Iex.Unop.arg);
1311 vex_printf( ")" );
sewardjec6ad592004-06-20 12:26:53 +00001312 break;
sewardjaf1ceca2005-06-30 23:31:27 +00001313 case Iex_Load:
sewardje768e922009-11-26 17:17:37 +00001314 vex_printf( "LD%s:", e->Iex.Load.end==Iend_LE ? "le" : "be" );
sewardjaf1ceca2005-06-30 23:31:27 +00001315 ppIRType(e->Iex.Load.ty);
sewardje05c42c2004-07-08 20:25:10 +00001316 vex_printf( "(" );
sewardjaf1ceca2005-06-30 23:31:27 +00001317 ppIRExpr(e->Iex.Load.addr);
sewardj35421a32004-07-05 13:12:34 +00001318 vex_printf( ")" );
sewardjec6ad592004-06-20 12:26:53 +00001319 break;
sewardje3d0d2e2004-06-27 10:42:44 +00001320 case Iex_Const:
sewardj35421a32004-07-05 13:12:34 +00001321 ppIRConst(e->Iex.Const.con);
sewardjec6ad592004-06-20 12:26:53 +00001322 break;
sewardje87b4842004-07-10 12:23:30 +00001323 case Iex_CCall:
sewardj8ea867b2004-10-30 19:03:02 +00001324 ppIRCallee(e->Iex.CCall.cee);
1325 vex_printf("(");
sewardje87b4842004-07-10 12:23:30 +00001326 for (i = 0; e->Iex.CCall.args[i] != NULL; i++) {
sewardj74142b82013-08-08 10:28:59 +00001327 IRExpr* arg = e->Iex.CCall.args[i];
florian90419562013-08-15 20:54:52 +00001328 ppIRExpr(arg);
1329
sewardj74142b82013-08-08 10:28:59 +00001330 if (e->Iex.CCall.args[i+1] != NULL) {
sewardje87b4842004-07-10 12:23:30 +00001331 vex_printf(",");
sewardj74142b82013-08-08 10:28:59 +00001332 }
sewardje87b4842004-07-10 12:23:30 +00001333 }
1334 vex_printf("):");
1335 ppIRType(e->Iex.CCall.retty);
1336 break;
florian99dd03e2013-01-29 03:56:06 +00001337 case Iex_ITE:
1338 vex_printf("ITE(");
1339 ppIRExpr(e->Iex.ITE.cond);
sewardjeeb9ef82004-07-15 12:39:03 +00001340 vex_printf(",");
florian99dd03e2013-01-29 03:56:06 +00001341 ppIRExpr(e->Iex.ITE.iftrue);
sewardjeeb9ef82004-07-15 12:39:03 +00001342 vex_printf(",");
florian99dd03e2013-01-29 03:56:06 +00001343 ppIRExpr(e->Iex.ITE.iffalse);
sewardjeeb9ef82004-07-15 12:39:03 +00001344 vex_printf(")");
1345 break;
florian90419562013-08-15 20:54:52 +00001346 case Iex_VECRET:
1347 vex_printf("VECRET");
1348 break;
1349 case Iex_BBPTR:
1350 vex_printf("BBPTR");
1351 break;
sewardjec6ad592004-06-20 12:26:53 +00001352 default:
sewardj909c06d2005-02-19 22:47:41 +00001353 vpanic("ppIRExpr");
sewardjec6ad592004-06-20 12:26:53 +00001354 }
1355}
1356
sewardj17442fe2004-09-20 14:54:28 +00001357void ppIREffect ( IREffect fx )
1358{
1359 switch (fx) {
1360 case Ifx_None: vex_printf("noFX"); return;
1361 case Ifx_Read: vex_printf("RdFX"); return;
1362 case Ifx_Write: vex_printf("WrFX"); return;
1363 case Ifx_Modify: vex_printf("MoFX"); return;
1364 default: vpanic("ppIREffect");
1365 }
1366}
1367
florian0b70efa2014-09-21 21:53:39 +00001368void ppIRDirty ( const IRDirty* d )
sewardj17442fe2004-09-20 14:54:28 +00001369{
1370 Int i;
sewardj92d168d2004-11-15 14:22:12 +00001371 if (d->tmp != IRTemp_INVALID) {
sewardj4b861de2004-11-03 15:24:42 +00001372 ppIRTemp(d->tmp);
1373 vex_printf(" = ");
1374 }
sewardjb8385d82004-11-02 01:34:15 +00001375 vex_printf("DIRTY ");
1376 ppIRExpr(d->guard);
sewardj17442fe2004-09-20 14:54:28 +00001377 if (d->mFx != Ifx_None) {
sewardj49651f42004-10-28 22:11:04 +00001378 vex_printf(" ");
sewardj17442fe2004-09-20 14:54:28 +00001379 ppIREffect(d->mFx);
1380 vex_printf("-mem(");
1381 ppIRExpr(d->mAddr);
sewardj49651f42004-10-28 22:11:04 +00001382 vex_printf(",%d)", d->mSize);
sewardj17442fe2004-09-20 14:54:28 +00001383 }
1384 for (i = 0; i < d->nFxState; i++) {
sewardj49651f42004-10-28 22:11:04 +00001385 vex_printf(" ");
sewardj17442fe2004-09-20 14:54:28 +00001386 ppIREffect(d->fxState[i].fx);
sewardjc9069f22012-06-01 16:09:50 +00001387 vex_printf("-gst(%u,%u", (UInt)d->fxState[i].offset,
1388 (UInt)d->fxState[i].size);
1389 if (d->fxState[i].nRepeats > 0) {
1390 vex_printf(",reps%u,step%u", (UInt)d->fxState[i].nRepeats,
1391 (UInt)d->fxState[i].repeatLen);
1392 }
1393 vex_printf(")");
sewardj17442fe2004-09-20 14:54:28 +00001394 }
sewardjc5fc7aa2004-10-27 23:00:55 +00001395 vex_printf(" ::: ");
sewardj8ea867b2004-10-30 19:03:02 +00001396 ppIRCallee(d->cee);
1397 vex_printf("(");
sewardj17442fe2004-09-20 14:54:28 +00001398 for (i = 0; d->args[i] != NULL; i++) {
sewardj74142b82013-08-08 10:28:59 +00001399 IRExpr* arg = d->args[i];
florian90419562013-08-15 20:54:52 +00001400 ppIRExpr(arg);
1401
sewardj17442fe2004-09-20 14:54:28 +00001402 if (d->args[i+1] != NULL) {
1403 vex_printf(",");
1404 }
1405 }
1406 vex_printf(")");
1407}
1408
florian0b70efa2014-09-21 21:53:39 +00001409void ppIRCAS ( const IRCAS* cas )
sewardje9d8a262009-07-01 08:06:34 +00001410{
1411 /* Print even structurally invalid constructions, as an aid to
1412 debugging. */
1413 if (cas->oldHi != IRTemp_INVALID) {
1414 ppIRTemp(cas->oldHi);
1415 vex_printf(",");
1416 }
1417 ppIRTemp(cas->oldLo);
1418 vex_printf(" = CAS%s(", cas->end==Iend_LE ? "le" : "be" );
1419 ppIRExpr(cas->addr);
1420 vex_printf("::");
1421 if (cas->expdHi) {
1422 ppIRExpr(cas->expdHi);
1423 vex_printf(",");
1424 }
1425 ppIRExpr(cas->expdLo);
1426 vex_printf("->");
1427 if (cas->dataHi) {
1428 ppIRExpr(cas->dataHi);
1429 vex_printf(",");
1430 }
1431 ppIRExpr(cas->dataLo);
1432 vex_printf(")");
1433}
1434
florian0b70efa2014-09-21 21:53:39 +00001435void ppIRPutI ( const IRPutI* puti )
floriand6f38b32012-05-31 15:46:18 +00001436{
1437 vex_printf( "PUTI" );
1438 ppIRRegArray(puti->descr);
1439 vex_printf("[");
1440 ppIRExpr(puti->ix);
1441 vex_printf(",%d] = ", puti->bias);
1442 ppIRExpr(puti->data);
1443}
1444
florian0b70efa2014-09-21 21:53:39 +00001445void ppIRStoreG ( const IRStoreG* sg )
sewardjcfe046e2013-01-17 14:23:53 +00001446{
1447 vex_printf("if (");
1448 ppIRExpr(sg->guard);
1449 vex_printf(") ST%s(", sg->end==Iend_LE ? "le" : "be");
1450 ppIRExpr(sg->addr);
1451 vex_printf(") = ");
1452 ppIRExpr(sg->data);
1453}
1454
1455void ppIRLoadGOp ( IRLoadGOp cvt )
1456{
1457 switch (cvt) {
1458 case ILGop_INVALID: vex_printf("ILGop_INVALID"); break;
1459 case ILGop_Ident32: vex_printf("Ident32"); break;
1460 case ILGop_16Uto32: vex_printf("16Uto32"); break;
1461 case ILGop_16Sto32: vex_printf("16Sto32"); break;
1462 case ILGop_8Uto32: vex_printf("8Uto32"); break;
1463 case ILGop_8Sto32: vex_printf("8Sto32"); break;
1464 default: vpanic("ppIRLoadGOp");
1465 }
1466}
1467
florian0b70efa2014-09-21 21:53:39 +00001468void ppIRLoadG ( const IRLoadG* lg )
sewardjcfe046e2013-01-17 14:23:53 +00001469{
1470 ppIRTemp(lg->dst);
1471 vex_printf(" = if-strict (");
1472 ppIRExpr(lg->guard);
1473 vex_printf(") ");
1474 ppIRLoadGOp(lg->cvt);
1475 vex_printf("(LD%s(", lg->end==Iend_LE ? "le" : "be");
1476 ppIRExpr(lg->addr);
1477 vex_printf(")) else ");
1478 ppIRExpr(lg->alt);
1479}
1480
sewardj893aada2004-11-29 19:57:54 +00001481void ppIRJumpKind ( IRJumpKind kind )
1482{
1483 switch (kind) {
petarja6a19862012-10-19 14:55:58 +00001484 case Ijk_Boring: vex_printf("Boring"); break;
1485 case Ijk_Call: vex_printf("Call"); break;
1486 case Ijk_Ret: vex_printf("Return"); break;
1487 case Ijk_ClientReq: vex_printf("ClientReq"); break;
1488 case Ijk_Yield: vex_printf("Yield"); break;
1489 case Ijk_EmWarn: vex_printf("EmWarn"); break;
1490 case Ijk_EmFail: vex_printf("EmFail"); break;
1491 case Ijk_NoDecode: vex_printf("NoDecode"); break;
1492 case Ijk_MapFail: vex_printf("MapFail"); break;
sewardj05f5e012014-05-04 10:52:11 +00001493 case Ijk_InvalICache: vex_printf("InvalICache"); break;
sewardj65902992014-05-03 21:20:56 +00001494 case Ijk_FlushDCache: vex_printf("FlushDCache"); break;
petarja6a19862012-10-19 14:55:58 +00001495 case Ijk_NoRedir: vex_printf("NoRedir"); break;
dejanj0e006f22014-02-19 11:56:29 +00001496 case Ijk_SigILL: vex_printf("SigILL"); break;
petarja6a19862012-10-19 14:55:58 +00001497 case Ijk_SigTRAP: vex_printf("SigTRAP"); break;
1498 case Ijk_SigSEGV: vex_printf("SigSEGV"); break;
1499 case Ijk_SigBUS: vex_printf("SigBUS"); break;
1500 case Ijk_SigFPE_IntDiv: vex_printf("SigFPE_IntDiv"); break;
1501 case Ijk_SigFPE_IntOvf: vex_printf("SigFPE_IntOvf"); break;
1502 case Ijk_Sys_syscall: vex_printf("Sys_syscall"); break;
1503 case Ijk_Sys_int32: vex_printf("Sys_int32"); break;
1504 case Ijk_Sys_int128: vex_printf("Sys_int128"); break;
1505 case Ijk_Sys_int129: vex_printf("Sys_int129"); break;
1506 case Ijk_Sys_int130: vex_printf("Sys_int130"); break;
1507 case Ijk_Sys_sysenter: vex_printf("Sys_sysenter"); break;
1508 default: vpanic("ppIRJumpKind");
sewardj893aada2004-11-29 19:57:54 +00001509 }
1510}
1511
sewardjc4356f02007-11-09 21:15:04 +00001512void ppIRMBusEvent ( IRMBusEvent event )
1513{
1514 switch (event) {
sewardj6d615ba2011-09-26 16:19:43 +00001515 case Imbe_Fence:
1516 vex_printf("Fence"); break;
1517 case Imbe_CancelReservation:
1518 vex_printf("CancelReservation"); break;
1519 default:
1520 vpanic("ppIRMBusEvent");
sewardjc4356f02007-11-09 21:15:04 +00001521 }
1522}
1523
florian0b70efa2014-09-21 21:53:39 +00001524void ppIRStmt ( const IRStmt* s )
sewardjec6ad592004-06-20 12:26:53 +00001525{
sewardjd2445f62005-03-21 00:15:53 +00001526 if (!s) {
1527 vex_printf("!!! IRStmt* which is NULL !!!");
1528 return;
1529 }
sewardj17442fe2004-09-20 14:54:28 +00001530 switch (s->tag) {
sewardjd2445f62005-03-21 00:15:53 +00001531 case Ist_NoOp:
1532 vex_printf("IR-NoOp");
1533 break;
sewardjf1689312005-03-16 18:19:10 +00001534 case Ist_IMark:
sewardj2f10aa62011-05-27 13:20:56 +00001535 vex_printf( "------ IMark(0x%llx, %d, %u) ------",
1536 s->Ist.IMark.addr, s->Ist.IMark.len,
1537 (UInt)s->Ist.IMark.delta);
sewardjf1689312005-03-16 18:19:10 +00001538 break;
sewardj5a9ffab2005-05-12 17:55:01 +00001539 case Ist_AbiHint:
1540 vex_printf("====== AbiHint(");
1541 ppIRExpr(s->Ist.AbiHint.base);
sewardj478646f2008-05-01 20:13:04 +00001542 vex_printf(", %d, ", s->Ist.AbiHint.len);
1543 ppIRExpr(s->Ist.AbiHint.nia);
1544 vex_printf(") ======");
sewardj5a9ffab2005-05-12 17:55:01 +00001545 break;
sewardj17442fe2004-09-20 14:54:28 +00001546 case Ist_Put:
1547 vex_printf( "PUT(%d) = ", s->Ist.Put.offset);
sewardj6d076362004-09-23 11:06:17 +00001548 ppIRExpr(s->Ist.Put.data);
sewardj17442fe2004-09-20 14:54:28 +00001549 break;
1550 case Ist_PutI:
floriand6f38b32012-05-31 15:46:18 +00001551 ppIRPutI(s->Ist.PutI.details);
sewardj17442fe2004-09-20 14:54:28 +00001552 break;
sewardjdd40fdf2006-12-24 02:20:24 +00001553 case Ist_WrTmp:
1554 ppIRTemp(s->Ist.WrTmp.tmp);
sewardj17442fe2004-09-20 14:54:28 +00001555 vex_printf( " = " );
sewardjdd40fdf2006-12-24 02:20:24 +00001556 ppIRExpr(s->Ist.WrTmp.data);
sewardj17442fe2004-09-20 14:54:28 +00001557 break;
sewardjaf1ceca2005-06-30 23:31:27 +00001558 case Ist_Store:
1559 vex_printf( "ST%s(", s->Ist.Store.end==Iend_LE ? "le" : "be" );
1560 ppIRExpr(s->Ist.Store.addr);
sewardj17442fe2004-09-20 14:54:28 +00001561 vex_printf( ") = ");
sewardjaf1ceca2005-06-30 23:31:27 +00001562 ppIRExpr(s->Ist.Store.data);
sewardje9d8a262009-07-01 08:06:34 +00001563 break;
sewardjcfe046e2013-01-17 14:23:53 +00001564 case Ist_StoreG:
1565 ppIRStoreG(s->Ist.StoreG.details);
1566 break;
1567 case Ist_LoadG:
1568 ppIRLoadG(s->Ist.LoadG.details);
1569 break;
sewardje9d8a262009-07-01 08:06:34 +00001570 case Ist_CAS:
1571 ppIRCAS(s->Ist.CAS.details);
sewardj17442fe2004-09-20 14:54:28 +00001572 break;
sewardje768e922009-11-26 17:17:37 +00001573 case Ist_LLSC:
1574 if (s->Ist.LLSC.storedata == NULL) {
1575 ppIRTemp(s->Ist.LLSC.result);
1576 vex_printf(" = LD%s-Linked(",
1577 s->Ist.LLSC.end==Iend_LE ? "le" : "be");
1578 ppIRExpr(s->Ist.LLSC.addr);
1579 vex_printf(")");
1580 } else {
1581 ppIRTemp(s->Ist.LLSC.result);
1582 vex_printf(" = ( ST%s-Cond(",
1583 s->Ist.LLSC.end==Iend_LE ? "le" : "be");
1584 ppIRExpr(s->Ist.LLSC.addr);
1585 vex_printf(") = ");
1586 ppIRExpr(s->Ist.LLSC.storedata);
1587 vex_printf(" )");
1588 }
1589 break;
sewardj17442fe2004-09-20 14:54:28 +00001590 case Ist_Dirty:
1591 ppIRDirty(s->Ist.Dirty.details);
1592 break;
sewardjc4356f02007-11-09 21:15:04 +00001593 case Ist_MBE:
1594 vex_printf("IR-");
1595 ppIRMBusEvent(s->Ist.MBE.event);
sewardj3e838932005-01-07 12:09:15 +00001596 break;
sewardj17442fe2004-09-20 14:54:28 +00001597 case Ist_Exit:
1598 vex_printf( "if (" );
sewardj0276d4b2004-11-15 15:30:21 +00001599 ppIRExpr(s->Ist.Exit.guard);
sewardjc6f970f2012-04-02 21:54:49 +00001600 vex_printf( ") { PUT(%d) = ", s->Ist.Exit.offsIP);
sewardj17442fe2004-09-20 14:54:28 +00001601 ppIRConst(s->Ist.Exit.dst);
sewardjc6f970f2012-04-02 21:54:49 +00001602 vex_printf("; exit-");
1603 ppIRJumpKind(s->Ist.Exit.jk);
1604 vex_printf(" } ");
sewardj17442fe2004-09-20 14:54:28 +00001605 break;
1606 default:
1607 vpanic("ppIRStmt");
1608 }
sewardjec6ad592004-06-20 12:26:53 +00001609}
1610
florian0b70efa2014-09-21 21:53:39 +00001611void ppIRTypeEnv ( const IRTypeEnv* env )
1612{
sewardjc97096c2004-06-30 09:28:04 +00001613 UInt i;
sewardje539a402004-07-14 18:24:17 +00001614 for (i = 0; i < env->types_used; i++) {
sewardjc97096c2004-06-30 09:28:04 +00001615 if (i % 8 == 0)
sewardj35421a32004-07-05 13:12:34 +00001616 vex_printf( " ");
sewardje539a402004-07-14 18:24:17 +00001617 ppIRTemp(i);
sewardj35421a32004-07-05 13:12:34 +00001618 vex_printf( ":");
sewardje539a402004-07-14 18:24:17 +00001619 ppIRType(env->types[i]);
sewardjc97096c2004-06-30 09:28:04 +00001620 if (i % 8 == 7)
sewardj35421a32004-07-05 13:12:34 +00001621 vex_printf( "\n");
sewardjc97096c2004-06-30 09:28:04 +00001622 else
sewardj35421a32004-07-05 13:12:34 +00001623 vex_printf( " ");
sewardjc97096c2004-06-30 09:28:04 +00001624 }
sewardje539a402004-07-14 18:24:17 +00001625 if (env->types_used > 0 && env->types_used % 8 != 7)
sewardj35421a32004-07-05 13:12:34 +00001626 vex_printf( "\n");
sewardjc97096c2004-06-30 09:28:04 +00001627}
1628
florian0b70efa2014-09-21 21:53:39 +00001629void ppIRSB ( const IRSB* bb )
sewardjec6ad592004-06-20 12:26:53 +00001630{
sewardjd7cb8532004-08-17 23:59:23 +00001631 Int i;
sewardjdd40fdf2006-12-24 02:20:24 +00001632 vex_printf("IRSB {\n");
sewardj35421a32004-07-05 13:12:34 +00001633 ppIRTypeEnv(bb->tyenv);
sewardj35439212004-07-14 22:36:10 +00001634 vex_printf("\n");
sewardjd7cb8532004-08-17 23:59:23 +00001635 for (i = 0; i < bb->stmts_used; i++) {
sewardjd2445f62005-03-21 00:15:53 +00001636 vex_printf( " ");
1637 ppIRStmt(bb->stmts[i]);
sewardj35421a32004-07-05 13:12:34 +00001638 vex_printf( "\n");
sewardjec6ad592004-06-20 12:26:53 +00001639 }
sewardjc6f970f2012-04-02 21:54:49 +00001640 vex_printf( " PUT(%d) = ", bb->offsIP );
sewardje539a402004-07-14 18:24:17 +00001641 ppIRExpr( bb->next );
sewardjc6f970f2012-04-02 21:54:49 +00001642 vex_printf( "; exit-");
1643 ppIRJumpKind(bb->jumpkind);
sewardj35439212004-07-14 22:36:10 +00001644 vex_printf( "\n}\n");
sewardjec6ad592004-06-20 12:26:53 +00001645}
1646
1647
1648/*---------------------------------------------------------------*/
1649/*--- Constructors ---*/
1650/*---------------------------------------------------------------*/
1651
sewardjc97096c2004-06-30 09:28:04 +00001652
1653/* Constructors -- IRConst */
1654
sewardjba999312004-11-15 15:21:17 +00001655IRConst* IRConst_U1 ( Bool bit )
sewardjb8e75862004-08-19 17:58:45 +00001656{
1657 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
sewardjba999312004-11-15 15:21:17 +00001658 c->tag = Ico_U1;
1659 c->Ico.U1 = bit;
sewardj4b861de2004-11-03 15:24:42 +00001660 /* call me paranoid; I don't care :-) */
1661 vassert(bit == False || bit == True);
sewardjb8e75862004-08-19 17:58:45 +00001662 return c;
1663}
sewardjc97096c2004-06-30 09:28:04 +00001664IRConst* IRConst_U8 ( UChar u8 )
1665{
sewardj35421a32004-07-05 13:12:34 +00001666 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
sewardjc97096c2004-06-30 09:28:04 +00001667 c->tag = Ico_U8;
1668 c->Ico.U8 = u8;
1669 return c;
1670}
1671IRConst* IRConst_U16 ( UShort u16 )
1672{
sewardj35421a32004-07-05 13:12:34 +00001673 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
sewardjc97096c2004-06-30 09:28:04 +00001674 c->tag = Ico_U16;
1675 c->Ico.U16 = u16;
1676 return c;
1677}
1678IRConst* IRConst_U32 ( UInt u32 )
1679{
sewardj35421a32004-07-05 13:12:34 +00001680 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
sewardjc97096c2004-06-30 09:28:04 +00001681 c->tag = Ico_U32;
1682 c->Ico.U32 = u32;
1683 return c;
1684}
1685IRConst* IRConst_U64 ( ULong u64 )
1686{
sewardj35421a32004-07-05 13:12:34 +00001687 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
sewardjc97096c2004-06-30 09:28:04 +00001688 c->tag = Ico_U64;
1689 c->Ico.U64 = u64;
1690 return c;
1691}
sewardj2019a972011-03-07 16:04:07 +00001692IRConst* IRConst_F32 ( Float f32 )
1693{
1694 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
1695 c->tag = Ico_F32;
1696 c->Ico.F32 = f32;
1697 return c;
1698}
1699IRConst* IRConst_F32i ( UInt f32i )
1700{
1701 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
1702 c->tag = Ico_F32i;
1703 c->Ico.F32i = f32i;
1704 return c;
1705}
sewardja58ea662004-08-15 03:12:41 +00001706IRConst* IRConst_F64 ( Double f64 )
1707{
1708 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
1709 c->tag = Ico_F64;
1710 c->Ico.F64 = f64;
1711 return c;
1712}
sewardj17442fe2004-09-20 14:54:28 +00001713IRConst* IRConst_F64i ( ULong f64i )
sewardj207557a2004-08-27 12:00:18 +00001714{
sewardj17442fe2004-09-20 14:54:28 +00001715 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
1716 c->tag = Ico_F64i;
1717 c->Ico.F64i = f64i;
sewardj207557a2004-08-27 12:00:18 +00001718 return c;
1719}
sewardj1e6ad742004-12-02 16:16:11 +00001720IRConst* IRConst_V128 ( UShort con )
1721{
1722 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
1723 c->tag = Ico_V128;
1724 c->Ico.V128 = con;
1725 return c;
1726}
sewardj37a505b2012-06-29 15:28:24 +00001727IRConst* IRConst_V256 ( UInt con )
1728{
1729 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
1730 c->tag = Ico_V256;
1731 c->Ico.V256 = con;
1732 return c;
1733}
sewardjc97096c2004-06-30 09:28:04 +00001734
sewardj8ea867b2004-10-30 19:03:02 +00001735/* Constructors -- IRCallee */
1736
florian1ff47562012-10-21 02:09:51 +00001737IRCallee* mkIRCallee ( Int regparms, const HChar* name, void* addr )
sewardj8ea867b2004-10-30 19:03:02 +00001738{
1739 IRCallee* ce = LibVEX_Alloc(sizeof(IRCallee));
sewardj77352542004-10-30 20:39:01 +00001740 ce->regparms = regparms;
1741 ce->name = name;
1742 ce->addr = addr;
sewardj43c56462004-11-06 12:17:57 +00001743 ce->mcx_mask = 0;
sewardj77352542004-10-30 20:39:01 +00001744 vassert(regparms >= 0 && regparms <= 3);
sewardj8ea867b2004-10-30 19:03:02 +00001745 vassert(name != NULL);
1746 vassert(addr != 0);
1747 return ce;
1748}
1749
1750
sewardjdd40fdf2006-12-24 02:20:24 +00001751/* Constructors -- IRRegArray */
sewardje3d0d2e2004-06-27 10:42:44 +00001752
sewardjdd40fdf2006-12-24 02:20:24 +00001753IRRegArray* mkIRRegArray ( Int base, IRType elemTy, Int nElems )
sewardj2d3f77c2004-09-22 23:49:09 +00001754{
sewardjdd40fdf2006-12-24 02:20:24 +00001755 IRRegArray* arr = LibVEX_Alloc(sizeof(IRRegArray));
1756 arr->base = base;
1757 arr->elemTy = elemTy;
1758 arr->nElems = nElems;
sewardj2d3f77c2004-09-22 23:49:09 +00001759 vassert(!(arr->base < 0 || arr->base > 10000 /* somewhat arbitrary */));
sewardjba999312004-11-15 15:21:17 +00001760 vassert(!(arr->elemTy == Ity_I1));
sewardj2d3f77c2004-09-22 23:49:09 +00001761 vassert(!(arr->nElems <= 0 || arr->nElems > 500 /* somewhat arbitrary */));
1762 return arr;
1763}
1764
1765
1766/* Constructors -- IRExpr */
1767
sewardj443cd9d2004-07-18 23:06:45 +00001768IRExpr* IRExpr_Binder ( Int binder ) {
1769 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
1770 e->tag = Iex_Binder;
1771 e->Iex.Binder.binder = binder;
1772 return e;
1773}
sewardjfbcaf332004-07-08 01:46:01 +00001774IRExpr* IRExpr_Get ( Int off, IRType ty ) {
sewardj35421a32004-07-05 13:12:34 +00001775 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
sewardje3d0d2e2004-06-27 10:42:44 +00001776 e->tag = Iex_Get;
1777 e->Iex.Get.offset = off;
sewardjfbcaf332004-07-08 01:46:01 +00001778 e->Iex.Get.ty = ty;
sewardje3d0d2e2004-06-27 10:42:44 +00001779 return e;
1780}
sewardjdd40fdf2006-12-24 02:20:24 +00001781IRExpr* IRExpr_GetI ( IRRegArray* descr, IRExpr* ix, Int bias ) {
sewardj2d3f77c2004-09-22 23:49:09 +00001782 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
1783 e->tag = Iex_GetI;
1784 e->Iex.GetI.descr = descr;
sewardjeeac8412004-11-02 00:26:55 +00001785 e->Iex.GetI.ix = ix;
sewardj2d3f77c2004-09-22 23:49:09 +00001786 e->Iex.GetI.bias = bias;
sewardjd1725d12004-08-12 20:46:53 +00001787 return e;
1788}
sewardjdd40fdf2006-12-24 02:20:24 +00001789IRExpr* IRExpr_RdTmp ( IRTemp tmp ) {
1790 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
1791 e->tag = Iex_RdTmp;
1792 e->Iex.RdTmp.tmp = tmp;
sewardje3d0d2e2004-06-27 10:42:44 +00001793 return e;
1794}
sewardj40c80262006-02-08 19:30:46 +00001795IRExpr* IRExpr_Qop ( IROp op, IRExpr* arg1, IRExpr* arg2,
1796 IRExpr* arg3, IRExpr* arg4 ) {
1797 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
florian96d7cc32012-06-01 20:41:24 +00001798 IRQop* qop = LibVEX_Alloc(sizeof(IRQop));
1799 qop->op = op;
1800 qop->arg1 = arg1;
1801 qop->arg2 = arg2;
1802 qop->arg3 = arg3;
1803 qop->arg4 = arg4;
sewardj40c80262006-02-08 19:30:46 +00001804 e->tag = Iex_Qop;
florian96d7cc32012-06-01 20:41:24 +00001805 e->Iex.Qop.details = qop;
sewardj40c80262006-02-08 19:30:46 +00001806 return e;
1807}
sewardjb183b852006-02-03 16:08:03 +00001808IRExpr* IRExpr_Triop ( IROp op, IRExpr* arg1,
1809 IRExpr* arg2, IRExpr* arg3 ) {
florian420bfa92012-06-02 20:29:22 +00001810 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
1811 IRTriop* triop = LibVEX_Alloc(sizeof(IRTriop));
1812 triop->op = op;
1813 triop->arg1 = arg1;
1814 triop->arg2 = arg2;
1815 triop->arg3 = arg3;
sewardjb183b852006-02-03 16:08:03 +00001816 e->tag = Iex_Triop;
florian420bfa92012-06-02 20:29:22 +00001817 e->Iex.Triop.details = triop;
sewardjb183b852006-02-03 16:08:03 +00001818 return e;
1819}
sewardjc97096c2004-06-30 09:28:04 +00001820IRExpr* IRExpr_Binop ( IROp op, IRExpr* arg1, IRExpr* arg2 ) {
sewardj35421a32004-07-05 13:12:34 +00001821 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
sewardje3d0d2e2004-06-27 10:42:44 +00001822 e->tag = Iex_Binop;
1823 e->Iex.Binop.op = op;
1824 e->Iex.Binop.arg1 = arg1;
1825 e->Iex.Binop.arg2 = arg2;
1826 return e;
1827}
sewardjc97096c2004-06-30 09:28:04 +00001828IRExpr* IRExpr_Unop ( IROp op, IRExpr* arg ) {
sewardj35421a32004-07-05 13:12:34 +00001829 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
sewardje3d0d2e2004-06-27 10:42:44 +00001830 e->tag = Iex_Unop;
1831 e->Iex.Unop.op = op;
1832 e->Iex.Unop.arg = arg;
1833 return e;
1834}
sewardje768e922009-11-26 17:17:37 +00001835IRExpr* IRExpr_Load ( IREndness end, IRType ty, IRExpr* addr ) {
sewardj35421a32004-07-05 13:12:34 +00001836 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
sewardjaf1ceca2005-06-30 23:31:27 +00001837 e->tag = Iex_Load;
1838 e->Iex.Load.end = end;
1839 e->Iex.Load.ty = ty;
1840 e->Iex.Load.addr = addr;
1841 vassert(end == Iend_LE || end == Iend_BE);
sewardje3d0d2e2004-06-27 10:42:44 +00001842 return e;
1843}
sewardjc97096c2004-06-30 09:28:04 +00001844IRExpr* IRExpr_Const ( IRConst* con ) {
sewardj35421a32004-07-05 13:12:34 +00001845 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
sewardje3d0d2e2004-06-27 10:42:44 +00001846 e->tag = Iex_Const;
1847 e->Iex.Const.con = con;
1848 return e;
sewardjec6ad592004-06-20 12:26:53 +00001849}
sewardj8ea867b2004-10-30 19:03:02 +00001850IRExpr* IRExpr_CCall ( IRCallee* cee, IRType retty, IRExpr** args ) {
sewardje87b4842004-07-10 12:23:30 +00001851 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
1852 e->tag = Iex_CCall;
sewardj8ea867b2004-10-30 19:03:02 +00001853 e->Iex.CCall.cee = cee;
sewardje87b4842004-07-10 12:23:30 +00001854 e->Iex.CCall.retty = retty;
1855 e->Iex.CCall.args = args;
1856 return e;
1857}
florian99dd03e2013-01-29 03:56:06 +00001858IRExpr* IRExpr_ITE ( IRExpr* cond, IRExpr* iftrue, IRExpr* iffalse ) {
sewardjeeb9ef82004-07-15 12:39:03 +00001859 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
florian99dd03e2013-01-29 03:56:06 +00001860 e->tag = Iex_ITE;
1861 e->Iex.ITE.cond = cond;
1862 e->Iex.ITE.iftrue = iftrue;
1863 e->Iex.ITE.iffalse = iffalse;
sewardjeeb9ef82004-07-15 12:39:03 +00001864 return e;
1865}
florian90419562013-08-15 20:54:52 +00001866IRExpr* IRExpr_VECRET ( void ) {
1867 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
1868 e->tag = Iex_VECRET;
1869 return e;
1870}
1871IRExpr* IRExpr_BBPTR ( void ) {
1872 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
1873 e->tag = Iex_BBPTR;
1874 return e;
1875}
sewardjec6ad592004-06-20 12:26:53 +00001876
sewardjec6ad592004-06-20 12:26:53 +00001877
sewardjc5fc7aa2004-10-27 23:00:55 +00001878/* Constructors for NULL-terminated IRExpr expression vectors,
1879 suitable for use as arg lists in clean/dirty helper calls. */
1880
1881IRExpr** mkIRExprVec_0 ( void ) {
1882 IRExpr** vec = LibVEX_Alloc(1 * sizeof(IRExpr*));
1883 vec[0] = NULL;
1884 return vec;
1885}
1886IRExpr** mkIRExprVec_1 ( IRExpr* arg1 ) {
1887 IRExpr** vec = LibVEX_Alloc(2 * sizeof(IRExpr*));
1888 vec[0] = arg1;
1889 vec[1] = NULL;
1890 return vec;
1891}
1892IRExpr** mkIRExprVec_2 ( IRExpr* arg1, IRExpr* arg2 ) {
1893 IRExpr** vec = LibVEX_Alloc(3 * sizeof(IRExpr*));
1894 vec[0] = arg1;
1895 vec[1] = arg2;
1896 vec[2] = NULL;
1897 return vec;
1898}
sewardjf9655262004-10-31 20:02:16 +00001899IRExpr** mkIRExprVec_3 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3 ) {
1900 IRExpr** vec = LibVEX_Alloc(4 * sizeof(IRExpr*));
1901 vec[0] = arg1;
1902 vec[1] = arg2;
1903 vec[2] = arg3;
1904 vec[3] = NULL;
1905 return vec;
1906}
sewardj78ec32b2007-01-08 05:09:55 +00001907IRExpr** mkIRExprVec_4 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3,
1908 IRExpr* arg4 ) {
sewardjf9655262004-10-31 20:02:16 +00001909 IRExpr** vec = LibVEX_Alloc(5 * sizeof(IRExpr*));
1910 vec[0] = arg1;
1911 vec[1] = arg2;
1912 vec[2] = arg3;
1913 vec[3] = arg4;
1914 vec[4] = NULL;
1915 return vec;
1916}
sewardj78ec32b2007-01-08 05:09:55 +00001917IRExpr** mkIRExprVec_5 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3,
1918 IRExpr* arg4, IRExpr* arg5 ) {
sewardjf32c67d2004-11-08 13:10:44 +00001919 IRExpr** vec = LibVEX_Alloc(6 * sizeof(IRExpr*));
1920 vec[0] = arg1;
1921 vec[1] = arg2;
1922 vec[2] = arg3;
1923 vec[3] = arg4;
1924 vec[4] = arg5;
1925 vec[5] = NULL;
1926 return vec;
1927}
sewardj78ec32b2007-01-08 05:09:55 +00001928IRExpr** mkIRExprVec_6 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3,
1929 IRExpr* arg4, IRExpr* arg5, IRExpr* arg6 ) {
1930 IRExpr** vec = LibVEX_Alloc(7 * sizeof(IRExpr*));
1931 vec[0] = arg1;
1932 vec[1] = arg2;
1933 vec[2] = arg3;
1934 vec[3] = arg4;
1935 vec[4] = arg5;
1936 vec[5] = arg6;
1937 vec[6] = NULL;
1938 return vec;
1939}
1940IRExpr** mkIRExprVec_7 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3,
1941 IRExpr* arg4, IRExpr* arg5, IRExpr* arg6,
1942 IRExpr* arg7 ) {
1943 IRExpr** vec = LibVEX_Alloc(8 * sizeof(IRExpr*));
1944 vec[0] = arg1;
1945 vec[1] = arg2;
1946 vec[2] = arg3;
1947 vec[3] = arg4;
1948 vec[4] = arg5;
1949 vec[5] = arg6;
1950 vec[6] = arg7;
1951 vec[7] = NULL;
1952 return vec;
1953}
sewardj2fdd4162010-08-22 12:59:02 +00001954IRExpr** mkIRExprVec_8 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3,
1955 IRExpr* arg4, IRExpr* arg5, IRExpr* arg6,
1956 IRExpr* arg7, IRExpr* arg8 ) {
1957 IRExpr** vec = LibVEX_Alloc(9 * sizeof(IRExpr*));
1958 vec[0] = arg1;
1959 vec[1] = arg2;
1960 vec[2] = arg3;
1961 vec[3] = arg4;
1962 vec[4] = arg5;
1963 vec[5] = arg6;
1964 vec[6] = arg7;
1965 vec[7] = arg8;
1966 vec[8] = NULL;
1967 return vec;
1968}
sewardjc5fc7aa2004-10-27 23:00:55 +00001969
1970
sewardj17442fe2004-09-20 14:54:28 +00001971/* Constructors -- IRDirty */
1972
sewardjc5fc7aa2004-10-27 23:00:55 +00001973IRDirty* emptyIRDirty ( void ) {
sewardj17442fe2004-09-20 14:54:28 +00001974 IRDirty* d = LibVEX_Alloc(sizeof(IRDirty));
sewardj8ea867b2004-10-30 19:03:02 +00001975 d->cee = NULL;
sewardjb8385d82004-11-02 01:34:15 +00001976 d->guard = NULL;
sewardj17442fe2004-09-20 14:54:28 +00001977 d->args = NULL;
sewardj92d168d2004-11-15 14:22:12 +00001978 d->tmp = IRTemp_INVALID;
sewardj17442fe2004-09-20 14:54:28 +00001979 d->mFx = Ifx_None;
1980 d->mAddr = NULL;
1981 d->mSize = 0;
1982 d->nFxState = 0;
1983 return d;
1984}
1985
1986
sewardje9d8a262009-07-01 08:06:34 +00001987/* Constructors -- IRCAS */
1988
1989IRCAS* mkIRCAS ( IRTemp oldHi, IRTemp oldLo,
1990 IREndness end, IRExpr* addr,
1991 IRExpr* expdHi, IRExpr* expdLo,
1992 IRExpr* dataHi, IRExpr* dataLo ) {
1993 IRCAS* cas = LibVEX_Alloc(sizeof(IRCAS));
1994 cas->oldHi = oldHi;
1995 cas->oldLo = oldLo;
1996 cas->end = end;
1997 cas->addr = addr;
1998 cas->expdHi = expdHi;
1999 cas->expdLo = expdLo;
2000 cas->dataHi = dataHi;
2001 cas->dataLo = dataLo;
2002 return cas;
2003}
2004
2005
floriand6f38b32012-05-31 15:46:18 +00002006/* Constructors -- IRPutI */
2007
2008IRPutI* mkIRPutI ( IRRegArray* descr, IRExpr* ix,
2009 Int bias, IRExpr* data )
2010{
2011 IRPutI* puti = LibVEX_Alloc(sizeof(IRPutI));
2012 puti->descr = descr;
2013 puti->ix = ix;
2014 puti->bias = bias;
2015 puti->data = data;
2016 return puti;
2017}
2018
2019
sewardjcfe046e2013-01-17 14:23:53 +00002020/* Constructors -- IRStoreG and IRLoadG */
2021
2022IRStoreG* mkIRStoreG ( IREndness end,
2023 IRExpr* addr, IRExpr* data, IRExpr* guard )
2024{
2025 IRStoreG* sg = LibVEX_Alloc(sizeof(IRStoreG));
2026 sg->end = end;
2027 sg->addr = addr;
2028 sg->data = data;
2029 sg->guard = guard;
2030 return sg;
2031}
2032
2033IRLoadG* mkIRLoadG ( IREndness end, IRLoadGOp cvt,
2034 IRTemp dst, IRExpr* addr, IRExpr* alt, IRExpr* guard )
2035{
2036 IRLoadG* lg = LibVEX_Alloc(sizeof(IRLoadG));
2037 lg->end = end;
2038 lg->cvt = cvt;
2039 lg->dst = dst;
2040 lg->addr = addr;
2041 lg->alt = alt;
2042 lg->guard = guard;
2043 return lg;
2044}
2045
2046
sewardjec6ad592004-06-20 12:26:53 +00002047/* Constructors -- IRStmt */
sewardje3d0d2e2004-06-27 10:42:44 +00002048
sewardjd2445f62005-03-21 00:15:53 +00002049IRStmt* IRStmt_NoOp ( void )
2050{
2051 /* Just use a single static closure. */
2052 static IRStmt static_closure;
2053 static_closure.tag = Ist_NoOp;
2054 return &static_closure;
2055}
sewardj2f10aa62011-05-27 13:20:56 +00002056IRStmt* IRStmt_IMark ( Addr64 addr, Int len, UChar delta ) {
2057 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
2058 s->tag = Ist_IMark;
2059 s->Ist.IMark.addr = addr;
2060 s->Ist.IMark.len = len;
2061 s->Ist.IMark.delta = delta;
sewardjf1689312005-03-16 18:19:10 +00002062 return s;
2063}
sewardj478646f2008-05-01 20:13:04 +00002064IRStmt* IRStmt_AbiHint ( IRExpr* base, Int len, IRExpr* nia ) {
sewardj5a9ffab2005-05-12 17:55:01 +00002065 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
2066 s->tag = Ist_AbiHint;
2067 s->Ist.AbiHint.base = base;
2068 s->Ist.AbiHint.len = len;
sewardj478646f2008-05-01 20:13:04 +00002069 s->Ist.AbiHint.nia = nia;
sewardj5a9ffab2005-05-12 17:55:01 +00002070 return s;
2071}
sewardj6d076362004-09-23 11:06:17 +00002072IRStmt* IRStmt_Put ( Int off, IRExpr* data ) {
sewardj35421a32004-07-05 13:12:34 +00002073 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
sewardje3d0d2e2004-06-27 10:42:44 +00002074 s->tag = Ist_Put;
2075 s->Ist.Put.offset = off;
sewardj6d076362004-09-23 11:06:17 +00002076 s->Ist.Put.data = data;
sewardje3d0d2e2004-06-27 10:42:44 +00002077 return s;
sewardjec6ad592004-06-20 12:26:53 +00002078}
floriand6f38b32012-05-31 15:46:18 +00002079IRStmt* IRStmt_PutI ( IRPutI* details ) {
2080 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
2081 s->tag = Ist_PutI;
2082 s->Ist.PutI.details = details;
sewardjd1725d12004-08-12 20:46:53 +00002083 return s;
2084}
sewardjdd40fdf2006-12-24 02:20:24 +00002085IRStmt* IRStmt_WrTmp ( IRTemp tmp, IRExpr* data ) {
2086 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
2087 s->tag = Ist_WrTmp;
2088 s->Ist.WrTmp.tmp = tmp;
2089 s->Ist.WrTmp.data = data;
sewardje3d0d2e2004-06-27 10:42:44 +00002090 return s;
sewardjec6ad592004-06-20 12:26:53 +00002091}
sewardje768e922009-11-26 17:17:37 +00002092IRStmt* IRStmt_Store ( IREndness end, IRExpr* addr, IRExpr* data ) {
2093 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
2094 s->tag = Ist_Store;
2095 s->Ist.Store.end = end;
2096 s->Ist.Store.addr = addr;
2097 s->Ist.Store.data = data;
sewardjaf1ceca2005-06-30 23:31:27 +00002098 vassert(end == Iend_LE || end == Iend_BE);
sewardje3d0d2e2004-06-27 10:42:44 +00002099 return s;
sewardjec6ad592004-06-20 12:26:53 +00002100}
sewardjcfe046e2013-01-17 14:23:53 +00002101IRStmt* IRStmt_StoreG ( IREndness end, IRExpr* addr, IRExpr* data,
2102 IRExpr* guard ) {
2103 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
2104 s->tag = Ist_StoreG;
2105 s->Ist.StoreG.details = mkIRStoreG(end, addr, data, guard);
2106 vassert(end == Iend_LE || end == Iend_BE);
2107 return s;
2108}
2109IRStmt* IRStmt_LoadG ( IREndness end, IRLoadGOp cvt, IRTemp dst,
2110 IRExpr* addr, IRExpr* alt, IRExpr* guard ) {
2111 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
2112 s->tag = Ist_LoadG;
2113 s->Ist.LoadG.details = mkIRLoadG(end, cvt, dst, addr, alt, guard);
2114 return s;
2115}
sewardje9d8a262009-07-01 08:06:34 +00002116IRStmt* IRStmt_CAS ( IRCAS* cas ) {
2117 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
2118 s->tag = Ist_CAS;
2119 s->Ist.CAS.details = cas;
2120 return s;
2121}
sewardje768e922009-11-26 17:17:37 +00002122IRStmt* IRStmt_LLSC ( IREndness end,
2123 IRTemp result, IRExpr* addr, IRExpr* storedata ) {
2124 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
2125 s->tag = Ist_LLSC;
2126 s->Ist.LLSC.end = end;
2127 s->Ist.LLSC.result = result;
2128 s->Ist.LLSC.addr = addr;
2129 s->Ist.LLSC.storedata = storedata;
2130 return s;
2131}
sewardj17442fe2004-09-20 14:54:28 +00002132IRStmt* IRStmt_Dirty ( IRDirty* d )
2133{
2134 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
2135 s->tag = Ist_Dirty;
2136 s->Ist.Dirty.details = d;
2137 return s;
2138}
sewardjc4356f02007-11-09 21:15:04 +00002139IRStmt* IRStmt_MBE ( IRMBusEvent event )
sewardj3e838932005-01-07 12:09:15 +00002140{
sewardjc4356f02007-11-09 21:15:04 +00002141 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
2142 s->tag = Ist_MBE;
2143 s->Ist.MBE.event = event;
2144 return s;
sewardj3e838932005-01-07 12:09:15 +00002145}
sewardjc6f970f2012-04-02 21:54:49 +00002146IRStmt* IRStmt_Exit ( IRExpr* guard, IRJumpKind jk, IRConst* dst,
2147 Int offsIP ) {
2148 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
2149 s->tag = Ist_Exit;
2150 s->Ist.Exit.guard = guard;
2151 s->Ist.Exit.jk = jk;
2152 s->Ist.Exit.dst = dst;
2153 s->Ist.Exit.offsIP = offsIP;
sewardj64e1d652004-07-12 14:00:46 +00002154 return s;
2155}
sewardje3d0d2e2004-06-27 10:42:44 +00002156
sewardj695cff92004-10-13 14:50:14 +00002157
2158/* Constructors -- IRTypeEnv */
2159
2160IRTypeEnv* emptyIRTypeEnv ( void )
2161{
2162 IRTypeEnv* env = LibVEX_Alloc(sizeof(IRTypeEnv));
2163 env->types = LibVEX_Alloc(8 * sizeof(IRType));
2164 env->types_size = 8;
2165 env->types_used = 0;
2166 return env;
2167}
2168
2169
sewardjdd40fdf2006-12-24 02:20:24 +00002170/* Constructors -- IRSB */
sewardje3d0d2e2004-06-27 10:42:44 +00002171
sewardjdd40fdf2006-12-24 02:20:24 +00002172IRSB* emptyIRSB ( void )
sewardjd7cb8532004-08-17 23:59:23 +00002173{
sewardjdd40fdf2006-12-24 02:20:24 +00002174 IRSB* bb = LibVEX_Alloc(sizeof(IRSB));
sewardjd7cb8532004-08-17 23:59:23 +00002175 bb->tyenv = emptyIRTypeEnv();
2176 bb->stmts_used = 0;
2177 bb->stmts_size = 8;
2178 bb->stmts = LibVEX_Alloc(bb->stmts_size * sizeof(IRStmt*));
2179 bb->next = NULL;
2180 bb->jumpkind = Ijk_Boring;
sewardjc6f970f2012-04-02 21:54:49 +00002181 bb->offsIP = 0;
sewardje3d0d2e2004-06-27 10:42:44 +00002182 return bb;
sewardjec6ad592004-06-20 12:26:53 +00002183}
2184
sewardj695cff92004-10-13 14:50:14 +00002185
2186/*---------------------------------------------------------------*/
2187/*--- (Deep) copy constructors. These make complete copies ---*/
2188/*--- the original, which can be modified without affecting ---*/
2189/*--- the original. ---*/
2190/*---------------------------------------------------------------*/
2191
2192/* Copying IR Expr vectors (for call args). */
2193
2194/* Shallow copy of an IRExpr vector */
2195
sewardjdd40fdf2006-12-24 02:20:24 +00002196IRExpr** shallowCopyIRExprVec ( IRExpr** vec )
sewardjd7cb8532004-08-17 23:59:23 +00002197{
sewardj695cff92004-10-13 14:50:14 +00002198 Int i;
2199 IRExpr** newvec;
2200 for (i = 0; vec[i]; i++)
2201 ;
2202 newvec = LibVEX_Alloc((i+1)*sizeof(IRExpr*));
2203 for (i = 0; vec[i]; i++)
2204 newvec[i] = vec[i];
2205 newvec[i] = NULL;
2206 return newvec;
2207}
2208
2209/* Deep copy of an IRExpr vector */
2210
florian0b70efa2014-09-21 21:53:39 +00002211IRExpr** deepCopyIRExprVec ( IRExpr *const * vec )
sewardj695cff92004-10-13 14:50:14 +00002212{
2213 Int i;
florian0b70efa2014-09-21 21:53:39 +00002214 IRExpr** newvec;
2215 for (i = 0; vec[i]; i++)
2216 ;
2217 newvec = LibVEX_Alloc((i+1)*sizeof(IRExpr*));
2218 for (i = 0; vec[i]; i++)
2219 newvec[i] = deepCopyIRExpr(vec[i]);
2220 newvec[i] = NULL;
sewardj695cff92004-10-13 14:50:14 +00002221 return newvec;
2222}
2223
2224/* Deep copy constructors for all heap-allocated IR types follow. */
2225
florian0b70efa2014-09-21 21:53:39 +00002226IRConst* deepCopyIRConst ( const IRConst* c )
sewardj695cff92004-10-13 14:50:14 +00002227{
2228 switch (c->tag) {
sewardjba999312004-11-15 15:21:17 +00002229 case Ico_U1: return IRConst_U1(c->Ico.U1);
sewardj695cff92004-10-13 14:50:14 +00002230 case Ico_U8: return IRConst_U8(c->Ico.U8);
2231 case Ico_U16: return IRConst_U16(c->Ico.U16);
2232 case Ico_U32: return IRConst_U32(c->Ico.U32);
2233 case Ico_U64: return IRConst_U64(c->Ico.U64);
sewardj2019a972011-03-07 16:04:07 +00002234 case Ico_F32: return IRConst_F32(c->Ico.F32);
2235 case Ico_F32i: return IRConst_F32i(c->Ico.F32i);
sewardj695cff92004-10-13 14:50:14 +00002236 case Ico_F64: return IRConst_F64(c->Ico.F64);
2237 case Ico_F64i: return IRConst_F64i(c->Ico.F64i);
sewardj1e6ad742004-12-02 16:16:11 +00002238 case Ico_V128: return IRConst_V128(c->Ico.V128);
floriane74ce2e2014-09-16 22:33:52 +00002239 case Ico_V256: return IRConst_V256(c->Ico.V256);
sewardjdd40fdf2006-12-24 02:20:24 +00002240 default: vpanic("deepCopyIRConst");
sewardjd7cb8532004-08-17 23:59:23 +00002241 }
sewardj695cff92004-10-13 14:50:14 +00002242}
2243
florian0b70efa2014-09-21 21:53:39 +00002244IRCallee* deepCopyIRCallee ( const IRCallee* ce )
sewardj8ea867b2004-10-30 19:03:02 +00002245{
sewardj43c56462004-11-06 12:17:57 +00002246 IRCallee* ce2 = mkIRCallee(ce->regparms, ce->name, ce->addr);
2247 ce2->mcx_mask = ce->mcx_mask;
2248 return ce2;
sewardj8ea867b2004-10-30 19:03:02 +00002249}
2250
florian0b70efa2014-09-21 21:53:39 +00002251IRRegArray* deepCopyIRRegArray ( const IRRegArray* d )
sewardj695cff92004-10-13 14:50:14 +00002252{
sewardjdd40fdf2006-12-24 02:20:24 +00002253 return mkIRRegArray(d->base, d->elemTy, d->nElems);
sewardj695cff92004-10-13 14:50:14 +00002254}
2255
florian0b70efa2014-09-21 21:53:39 +00002256IRExpr* deepCopyIRExpr ( const IRExpr* e )
sewardj695cff92004-10-13 14:50:14 +00002257{
2258 switch (e->tag) {
2259 case Iex_Get:
2260 return IRExpr_Get(e->Iex.Get.offset, e->Iex.Get.ty);
2261 case Iex_GetI:
sewardjdd40fdf2006-12-24 02:20:24 +00002262 return IRExpr_GetI(deepCopyIRRegArray(e->Iex.GetI.descr),
2263 deepCopyIRExpr(e->Iex.GetI.ix),
sewardj695cff92004-10-13 14:50:14 +00002264 e->Iex.GetI.bias);
sewardjdd40fdf2006-12-24 02:20:24 +00002265 case Iex_RdTmp:
2266 return IRExpr_RdTmp(e->Iex.RdTmp.tmp);
florian96d7cc32012-06-01 20:41:24 +00002267 case Iex_Qop: {
florian0b70efa2014-09-21 21:53:39 +00002268 const IRQop* qop = e->Iex.Qop.details;
florian96d7cc32012-06-01 20:41:24 +00002269
2270 return IRExpr_Qop(qop->op,
2271 deepCopyIRExpr(qop->arg1),
2272 deepCopyIRExpr(qop->arg2),
2273 deepCopyIRExpr(qop->arg3),
2274 deepCopyIRExpr(qop->arg4));
2275 }
florian420bfa92012-06-02 20:29:22 +00002276 case Iex_Triop: {
florian0b70efa2014-09-21 21:53:39 +00002277 const IRTriop *triop = e->Iex.Triop.details;
florian420bfa92012-06-02 20:29:22 +00002278
2279 return IRExpr_Triop(triop->op,
2280 deepCopyIRExpr(triop->arg1),
2281 deepCopyIRExpr(triop->arg2),
2282 deepCopyIRExpr(triop->arg3));
2283 }
sewardj695cff92004-10-13 14:50:14 +00002284 case Iex_Binop:
2285 return IRExpr_Binop(e->Iex.Binop.op,
sewardjdd40fdf2006-12-24 02:20:24 +00002286 deepCopyIRExpr(e->Iex.Binop.arg1),
2287 deepCopyIRExpr(e->Iex.Binop.arg2));
sewardj695cff92004-10-13 14:50:14 +00002288 case Iex_Unop:
2289 return IRExpr_Unop(e->Iex.Unop.op,
sewardjdd40fdf2006-12-24 02:20:24 +00002290 deepCopyIRExpr(e->Iex.Unop.arg));
sewardjaf1ceca2005-06-30 23:31:27 +00002291 case Iex_Load:
sewardje768e922009-11-26 17:17:37 +00002292 return IRExpr_Load(e->Iex.Load.end,
sewardjaf1ceca2005-06-30 23:31:27 +00002293 e->Iex.Load.ty,
sewardjdd40fdf2006-12-24 02:20:24 +00002294 deepCopyIRExpr(e->Iex.Load.addr));
sewardj695cff92004-10-13 14:50:14 +00002295 case Iex_Const:
sewardjdd40fdf2006-12-24 02:20:24 +00002296 return IRExpr_Const(deepCopyIRConst(e->Iex.Const.con));
sewardj695cff92004-10-13 14:50:14 +00002297 case Iex_CCall:
sewardjdd40fdf2006-12-24 02:20:24 +00002298 return IRExpr_CCall(deepCopyIRCallee(e->Iex.CCall.cee),
sewardj695cff92004-10-13 14:50:14 +00002299 e->Iex.CCall.retty,
sewardjdd40fdf2006-12-24 02:20:24 +00002300 deepCopyIRExprVec(e->Iex.CCall.args));
sewardj695cff92004-10-13 14:50:14 +00002301
florian99dd03e2013-01-29 03:56:06 +00002302 case Iex_ITE:
2303 return IRExpr_ITE(deepCopyIRExpr(e->Iex.ITE.cond),
2304 deepCopyIRExpr(e->Iex.ITE.iftrue),
2305 deepCopyIRExpr(e->Iex.ITE.iffalse));
florian90419562013-08-15 20:54:52 +00002306 case Iex_VECRET:
2307 return IRExpr_VECRET();
2308
2309 case Iex_BBPTR:
2310 return IRExpr_BBPTR();
2311
floriane74ce2e2014-09-16 22:33:52 +00002312 case Iex_Binder:
2313 return IRExpr_Binder(e->Iex.Binder.binder);
2314
sewardj695cff92004-10-13 14:50:14 +00002315 default:
sewardjdd40fdf2006-12-24 02:20:24 +00002316 vpanic("deepCopyIRExpr");
sewardj695cff92004-10-13 14:50:14 +00002317 }
2318}
2319
florian0b70efa2014-09-21 21:53:39 +00002320IRDirty* deepCopyIRDirty ( const IRDirty* d )
sewardj695cff92004-10-13 14:50:14 +00002321{
2322 Int i;
2323 IRDirty* d2 = emptyIRDirty();
sewardjdd40fdf2006-12-24 02:20:24 +00002324 d2->cee = deepCopyIRCallee(d->cee);
2325 d2->guard = deepCopyIRExpr(d->guard);
2326 d2->args = deepCopyIRExprVec(d->args);
sewardj695cff92004-10-13 14:50:14 +00002327 d2->tmp = d->tmp;
2328 d2->mFx = d->mFx;
sewardjdd40fdf2006-12-24 02:20:24 +00002329 d2->mAddr = d->mAddr==NULL ? NULL : deepCopyIRExpr(d->mAddr);
sewardj695cff92004-10-13 14:50:14 +00002330 d2->mSize = d->mSize;
2331 d2->nFxState = d->nFxState;
2332 for (i = 0; i < d2->nFxState; i++)
2333 d2->fxState[i] = d->fxState[i];
2334 return d2;
2335}
2336
florian0b70efa2014-09-21 21:53:39 +00002337IRCAS* deepCopyIRCAS ( const IRCAS* cas )
sewardje9d8a262009-07-01 08:06:34 +00002338{
2339 return mkIRCAS( cas->oldHi, cas->oldLo, cas->end,
2340 deepCopyIRExpr(cas->addr),
sewardj05a2c382009-07-17 16:34:30 +00002341 cas->expdHi==NULL ? NULL : deepCopyIRExpr(cas->expdHi),
sewardje9d8a262009-07-01 08:06:34 +00002342 deepCopyIRExpr(cas->expdLo),
sewardj05a2c382009-07-17 16:34:30 +00002343 cas->dataHi==NULL ? NULL : deepCopyIRExpr(cas->dataHi),
sewardje9d8a262009-07-01 08:06:34 +00002344 deepCopyIRExpr(cas->dataLo) );
2345}
2346
florian0b70efa2014-09-21 21:53:39 +00002347IRPutI* deepCopyIRPutI ( const IRPutI * puti )
floriand6f38b32012-05-31 15:46:18 +00002348{
2349 return mkIRPutI( deepCopyIRRegArray(puti->descr),
2350 deepCopyIRExpr(puti->ix),
2351 puti->bias,
2352 deepCopyIRExpr(puti->data));
2353}
2354
florian0b70efa2014-09-21 21:53:39 +00002355IRStmt* deepCopyIRStmt ( const IRStmt* s )
sewardj695cff92004-10-13 14:50:14 +00002356{
2357 switch (s->tag) {
sewardjd2445f62005-03-21 00:15:53 +00002358 case Ist_NoOp:
2359 return IRStmt_NoOp();
sewardj5a9ffab2005-05-12 17:55:01 +00002360 case Ist_AbiHint:
sewardjdd40fdf2006-12-24 02:20:24 +00002361 return IRStmt_AbiHint(deepCopyIRExpr(s->Ist.AbiHint.base),
sewardj478646f2008-05-01 20:13:04 +00002362 s->Ist.AbiHint.len,
2363 deepCopyIRExpr(s->Ist.AbiHint.nia));
sewardjf1689312005-03-16 18:19:10 +00002364 case Ist_IMark:
sewardj2f10aa62011-05-27 13:20:56 +00002365 return IRStmt_IMark(s->Ist.IMark.addr,
2366 s->Ist.IMark.len,
2367 s->Ist.IMark.delta);
sewardj695cff92004-10-13 14:50:14 +00002368 case Ist_Put:
2369 return IRStmt_Put(s->Ist.Put.offset,
sewardjdd40fdf2006-12-24 02:20:24 +00002370 deepCopyIRExpr(s->Ist.Put.data));
sewardj695cff92004-10-13 14:50:14 +00002371 case Ist_PutI:
floriand6f38b32012-05-31 15:46:18 +00002372 return IRStmt_PutI(deepCopyIRPutI(s->Ist.PutI.details));
sewardjdd40fdf2006-12-24 02:20:24 +00002373 case Ist_WrTmp:
2374 return IRStmt_WrTmp(s->Ist.WrTmp.tmp,
2375 deepCopyIRExpr(s->Ist.WrTmp.data));
sewardjaf1ceca2005-06-30 23:31:27 +00002376 case Ist_Store:
2377 return IRStmt_Store(s->Ist.Store.end,
sewardjdd40fdf2006-12-24 02:20:24 +00002378 deepCopyIRExpr(s->Ist.Store.addr),
2379 deepCopyIRExpr(s->Ist.Store.data));
sewardjcfe046e2013-01-17 14:23:53 +00002380 case Ist_StoreG: {
florian0b70efa2014-09-21 21:53:39 +00002381 const IRStoreG* sg = s->Ist.StoreG.details;
sewardjcfe046e2013-01-17 14:23:53 +00002382 return IRStmt_StoreG(sg->end,
2383 deepCopyIRExpr(sg->addr),
2384 deepCopyIRExpr(sg->data),
2385 deepCopyIRExpr(sg->guard));
2386 }
2387 case Ist_LoadG: {
florian0b70efa2014-09-21 21:53:39 +00002388 const IRLoadG* lg = s->Ist.LoadG.details;
sewardjcfe046e2013-01-17 14:23:53 +00002389 return IRStmt_LoadG(lg->end, lg->cvt, lg->dst,
2390 deepCopyIRExpr(lg->addr),
2391 deepCopyIRExpr(lg->alt),
2392 deepCopyIRExpr(lg->guard));
2393 }
sewardje9d8a262009-07-01 08:06:34 +00002394 case Ist_CAS:
2395 return IRStmt_CAS(deepCopyIRCAS(s->Ist.CAS.details));
sewardje768e922009-11-26 17:17:37 +00002396 case Ist_LLSC:
2397 return IRStmt_LLSC(s->Ist.LLSC.end,
2398 s->Ist.LLSC.result,
2399 deepCopyIRExpr(s->Ist.LLSC.addr),
2400 s->Ist.LLSC.storedata
2401 ? deepCopyIRExpr(s->Ist.LLSC.storedata)
2402 : NULL);
sewardj695cff92004-10-13 14:50:14 +00002403 case Ist_Dirty:
sewardjdd40fdf2006-12-24 02:20:24 +00002404 return IRStmt_Dirty(deepCopyIRDirty(s->Ist.Dirty.details));
sewardjc4356f02007-11-09 21:15:04 +00002405 case Ist_MBE:
2406 return IRStmt_MBE(s->Ist.MBE.event);
sewardj695cff92004-10-13 14:50:14 +00002407 case Ist_Exit:
sewardjdd40fdf2006-12-24 02:20:24 +00002408 return IRStmt_Exit(deepCopyIRExpr(s->Ist.Exit.guard),
sewardj893aada2004-11-29 19:57:54 +00002409 s->Ist.Exit.jk,
sewardjc6f970f2012-04-02 21:54:49 +00002410 deepCopyIRConst(s->Ist.Exit.dst),
2411 s->Ist.Exit.offsIP);
sewardj695cff92004-10-13 14:50:14 +00002412 default:
sewardjdd40fdf2006-12-24 02:20:24 +00002413 vpanic("deepCopyIRStmt");
sewardj695cff92004-10-13 14:50:14 +00002414 }
2415}
2416
florian0b70efa2014-09-21 21:53:39 +00002417IRTypeEnv* deepCopyIRTypeEnv ( const IRTypeEnv* src )
sewardj695cff92004-10-13 14:50:14 +00002418{
2419 Int i;
2420 IRTypeEnv* dst = LibVEX_Alloc(sizeof(IRTypeEnv));
2421 dst->types_size = src->types_size;
2422 dst->types_used = src->types_used;
2423 dst->types = LibVEX_Alloc(dst->types_size * sizeof(IRType));
2424 for (i = 0; i < src->types_used; i++)
2425 dst->types[i] = src->types[i];
2426 return dst;
2427}
2428
florian0b70efa2014-09-21 21:53:39 +00002429IRSB* deepCopyIRSB ( const IRSB* bb )
sewardj695cff92004-10-13 14:50:14 +00002430{
2431 Int i;
2432 IRStmt** sts2;
sewardjdd40fdf2006-12-24 02:20:24 +00002433 IRSB* bb2 = deepCopyIRSBExceptStmts(bb);
sewardj695cff92004-10-13 14:50:14 +00002434 bb2->stmts_used = bb2->stmts_size = bb->stmts_used;
2435 sts2 = LibVEX_Alloc(bb2->stmts_used * sizeof(IRStmt*));
2436 for (i = 0; i < bb2->stmts_used; i++)
sewardjdd40fdf2006-12-24 02:20:24 +00002437 sts2[i] = deepCopyIRStmt(bb->stmts[i]);
sewardjc6f970f2012-04-02 21:54:49 +00002438 bb2->stmts = sts2;
sewardj6f2f2832006-11-24 23:32:55 +00002439 return bb2;
2440}
2441
florian0b70efa2014-09-21 21:53:39 +00002442IRSB* deepCopyIRSBExceptStmts ( const IRSB* bb )
sewardj6f2f2832006-11-24 23:32:55 +00002443{
sewardjdd40fdf2006-12-24 02:20:24 +00002444 IRSB* bb2 = emptyIRSB();
2445 bb2->tyenv = deepCopyIRTypeEnv(bb->tyenv);
2446 bb2->next = deepCopyIRExpr(bb->next);
sewardj695cff92004-10-13 14:50:14 +00002447 bb2->jumpkind = bb->jumpkind;
sewardjc6f970f2012-04-02 21:54:49 +00002448 bb2->offsIP = bb->offsIP;
sewardj695cff92004-10-13 14:50:14 +00002449 return bb2;
sewardjd7cb8532004-08-17 23:59:23 +00002450}
2451
sewardjec6ad592004-06-20 12:26:53 +00002452
sewardjc97096c2004-06-30 09:28:04 +00002453/*---------------------------------------------------------------*/
sewardj6efd4a12004-07-15 03:54:23 +00002454/*--- Primop types ---*/
2455/*---------------------------------------------------------------*/
2456
2457static
sewardjb183b852006-02-03 16:08:03 +00002458void typeOfPrimop ( IROp op,
2459 /*OUTs*/
2460 IRType* t_dst,
sewardj40c80262006-02-08 19:30:46 +00002461 IRType* t_arg1, IRType* t_arg2,
2462 IRType* t_arg3, IRType* t_arg4 )
sewardj6efd4a12004-07-15 03:54:23 +00002463{
sewardjb183b852006-02-03 16:08:03 +00002464# define UNARY(_ta1,_td) \
sewardj6efd4a12004-07-15 03:54:23 +00002465 *t_dst = (_td); *t_arg1 = (_ta1); break
sewardjb183b852006-02-03 16:08:03 +00002466# define BINARY(_ta1,_ta2,_td) \
sewardj6efd4a12004-07-15 03:54:23 +00002467 *t_dst = (_td); *t_arg1 = (_ta1); *t_arg2 = (_ta2); break
sewardjb183b852006-02-03 16:08:03 +00002468# define TERNARY(_ta1,_ta2,_ta3,_td) \
2469 *t_dst = (_td); *t_arg1 = (_ta1); \
2470 *t_arg2 = (_ta2); *t_arg3 = (_ta3); break
sewardj40c80262006-02-08 19:30:46 +00002471# define QUATERNARY(_ta1,_ta2,_ta3,_ta4,_td) \
2472 *t_dst = (_td); *t_arg1 = (_ta1); \
2473 *t_arg2 = (_ta2); *t_arg3 = (_ta3); \
2474 *t_arg4 = (_ta4); break
sewardjb183b852006-02-03 16:08:03 +00002475# define COMPARISON(_ta) \
sewardjba999312004-11-15 15:21:17 +00002476 *t_dst = Ity_I1; *t_arg1 = *t_arg2 = (_ta); break;
sewardjb183b852006-02-03 16:08:03 +00002477# define UNARY_COMPARISON(_ta) \
sewardj0033ddc2005-04-26 23:34:34 +00002478 *t_dst = Ity_I1; *t_arg1 = (_ta); break;
sewardj6efd4a12004-07-15 03:54:23 +00002479
sewardjb183b852006-02-03 16:08:03 +00002480 /* Rounding mode values are always Ity_I32, encoded as per
2481 IRRoundingMode */
2482 const IRType ity_RMode = Ity_I32;
2483
sewardj6efd4a12004-07-15 03:54:23 +00002484 *t_dst = Ity_INVALID;
2485 *t_arg1 = Ity_INVALID;
2486 *t_arg2 = Ity_INVALID;
sewardjb183b852006-02-03 16:08:03 +00002487 *t_arg3 = Ity_INVALID;
sewardj40c80262006-02-08 19:30:46 +00002488 *t_arg4 = Ity_INVALID;
sewardj6efd4a12004-07-15 03:54:23 +00002489 switch (op) {
sewardj17442fe2004-09-20 14:54:28 +00002490 case Iop_Add8: case Iop_Sub8: case Iop_Mul8:
2491 case Iop_Or8: case Iop_And8: case Iop_Xor8:
sewardjb183b852006-02-03 16:08:03 +00002492 BINARY(Ity_I8,Ity_I8, Ity_I8);
sewardj6efd4a12004-07-15 03:54:23 +00002493
sewardj17442fe2004-09-20 14:54:28 +00002494 case Iop_Add16: case Iop_Sub16: case Iop_Mul16:
2495 case Iop_Or16: case Iop_And16: case Iop_Xor16:
sewardjb183b852006-02-03 16:08:03 +00002496 BINARY(Ity_I16,Ity_I16, Ity_I16);
sewardj6efd4a12004-07-15 03:54:23 +00002497
sewardjb51f0f42005-07-18 11:38:02 +00002498 case Iop_CmpORD32U:
2499 case Iop_CmpORD32S:
sewardj17442fe2004-09-20 14:54:28 +00002500 case Iop_Add32: case Iop_Sub32: case Iop_Mul32:
2501 case Iop_Or32: case Iop_And32: case Iop_Xor32:
sewardj478646f2008-05-01 20:13:04 +00002502 case Iop_Max32U:
sewardj44ce46d2012-07-11 13:19:10 +00002503 case Iop_QAdd32S: case Iop_QSub32S:
sewardje2ea1762010-09-22 00:56:37 +00002504 case Iop_Add16x2: case Iop_Sub16x2:
2505 case Iop_QAdd16Sx2: case Iop_QAdd16Ux2:
2506 case Iop_QSub16Sx2: case Iop_QSub16Ux2:
2507 case Iop_HAdd16Ux2: case Iop_HAdd16Sx2:
2508 case Iop_HSub16Ux2: case Iop_HSub16Sx2:
2509 case Iop_Add8x4: case Iop_Sub8x4:
2510 case Iop_QAdd8Sx4: case Iop_QAdd8Ux4:
2511 case Iop_QSub8Sx4: case Iop_QSub8Ux4:
2512 case Iop_HAdd8Ux4: case Iop_HAdd8Sx4:
2513 case Iop_HSub8Ux4: case Iop_HSub8Sx4:
sewardj310d6b22010-10-18 16:29:40 +00002514 case Iop_Sad8Ux4:
sewardjb183b852006-02-03 16:08:03 +00002515 BINARY(Ity_I32,Ity_I32, Ity_I32);
sewardj6efd4a12004-07-15 03:54:23 +00002516
sewardj17442fe2004-09-20 14:54:28 +00002517 case Iop_Add64: case Iop_Sub64: case Iop_Mul64:
2518 case Iop_Or64: case Iop_And64: case Iop_Xor64:
cerion2831b002005-11-30 19:55:22 +00002519 case Iop_CmpORD64U:
2520 case Iop_CmpORD64S:
sewardj38a3f862005-01-13 15:06:51 +00002521 case Iop_Avg8Ux8: case Iop_Avg16Ux4:
2522 case Iop_Add8x8: case Iop_Add16x4: case Iop_Add32x2:
sewardj2fdd4162010-08-22 12:59:02 +00002523 case Iop_Add32Fx2: case Iop_Sub32Fx2:
sewardj38a3f862005-01-13 15:06:51 +00002524 case Iop_CmpEQ8x8: case Iop_CmpEQ16x4: case Iop_CmpEQ32x2:
2525 case Iop_CmpGT8Sx8: case Iop_CmpGT16Sx4: case Iop_CmpGT32Sx2:
sewardj2fdd4162010-08-22 12:59:02 +00002526 case Iop_CmpGT8Ux8: case Iop_CmpGT16Ux4: case Iop_CmpGT32Ux2:
2527 case Iop_CmpGT32Fx2: case Iop_CmpEQ32Fx2: case Iop_CmpGE32Fx2:
sewardj38a3f862005-01-13 15:06:51 +00002528 case Iop_InterleaveHI8x8: case Iop_InterleaveLO8x8:
2529 case Iop_InterleaveHI16x4: case Iop_InterleaveLO16x4:
2530 case Iop_InterleaveHI32x2: case Iop_InterleaveLO32x2:
sewardj2fdd4162010-08-22 12:59:02 +00002531 case Iop_CatOddLanes8x8: case Iop_CatEvenLanes8x8:
sewardjd166e282008-02-06 11:42:45 +00002532 case Iop_CatOddLanes16x4: case Iop_CatEvenLanes16x4:
sewardj2fdd4162010-08-22 12:59:02 +00002533 case Iop_InterleaveOddLanes8x8: case Iop_InterleaveEvenLanes8x8:
2534 case Iop_InterleaveOddLanes16x4: case Iop_InterleaveEvenLanes16x4:
sewardjd166e282008-02-06 11:42:45 +00002535 case Iop_Perm8x8:
sewardj2fdd4162010-08-22 12:59:02 +00002536 case Iop_Max8Ux8: case Iop_Max16Ux4: case Iop_Max32Ux2:
2537 case Iop_Max8Sx8: case Iop_Max16Sx4: case Iop_Max32Sx2:
2538 case Iop_Max32Fx2: case Iop_Min32Fx2:
2539 case Iop_PwMax32Fx2: case Iop_PwMin32Fx2:
2540 case Iop_Min8Ux8: case Iop_Min16Ux4: case Iop_Min32Ux2:
2541 case Iop_Min8Sx8: case Iop_Min16Sx4: case Iop_Min32Sx2:
2542 case Iop_PwMax8Ux8: case Iop_PwMax16Ux4: case Iop_PwMax32Ux2:
2543 case Iop_PwMax8Sx8: case Iop_PwMax16Sx4: case Iop_PwMax32Sx2:
2544 case Iop_PwMin8Ux8: case Iop_PwMin16Ux4: case Iop_PwMin32Ux2:
2545 case Iop_PwMin8Sx8: case Iop_PwMin16Sx4: case Iop_PwMin32Sx2:
2546 case Iop_Mul8x8: case Iop_Mul16x4: case Iop_Mul32x2:
2547 case Iop_Mul32Fx2:
2548 case Iop_PolynomialMul8x8:
sewardjd166e282008-02-06 11:42:45 +00002549 case Iop_MulHi16Sx4: case Iop_MulHi16Ux4:
sewardj2fdd4162010-08-22 12:59:02 +00002550 case Iop_QDMulHi16Sx4: case Iop_QDMulHi32Sx2:
2551 case Iop_QRDMulHi16Sx4: case Iop_QRDMulHi32Sx2:
sewardj38a3f862005-01-13 15:06:51 +00002552 case Iop_QAdd8Sx8: case Iop_QAdd16Sx4:
sewardj2fdd4162010-08-22 12:59:02 +00002553 case Iop_QAdd32Sx2: case Iop_QAdd64Sx1:
sewardj38a3f862005-01-13 15:06:51 +00002554 case Iop_QAdd8Ux8: case Iop_QAdd16Ux4:
sewardj2fdd4162010-08-22 12:59:02 +00002555 case Iop_QAdd32Ux2: case Iop_QAdd64Ux1:
2556 case Iop_PwAdd8x8: case Iop_PwAdd16x4: case Iop_PwAdd32x2:
2557 case Iop_PwAdd32Fx2:
sewardj5f438dd2011-06-16 11:36:23 +00002558 case Iop_QNarrowBin32Sto16Sx4:
2559 case Iop_QNarrowBin16Sto8Sx8: case Iop_QNarrowBin16Sto8Ux8:
sewardjad2c9ea2011-10-22 09:32:16 +00002560 case Iop_NarrowBin16to8x8: case Iop_NarrowBin32to16x4:
sewardj38a3f862005-01-13 15:06:51 +00002561 case Iop_Sub8x8: case Iop_Sub16x4: case Iop_Sub32x2:
2562 case Iop_QSub8Sx8: case Iop_QSub16Sx4:
sewardj2fdd4162010-08-22 12:59:02 +00002563 case Iop_QSub32Sx2: case Iop_QSub64Sx1:
sewardj38a3f862005-01-13 15:06:51 +00002564 case Iop_QSub8Ux8: case Iop_QSub16Ux4:
sewardj2fdd4162010-08-22 12:59:02 +00002565 case Iop_QSub32Ux2: case Iop_QSub64Ux1:
2566 case Iop_Shl8x8: case Iop_Shl16x4: case Iop_Shl32x2:
2567 case Iop_Shr8x8: case Iop_Shr16x4: case Iop_Shr32x2:
2568 case Iop_Sar8x8: case Iop_Sar16x4: case Iop_Sar32x2:
2569 case Iop_Sal8x8: case Iop_Sal16x4: case Iop_Sal32x2: case Iop_Sal64x1:
2570 case Iop_QShl8x8: case Iop_QShl16x4: case Iop_QShl32x2: case Iop_QShl64x1:
2571 case Iop_QSal8x8: case Iop_QSal16x4: case Iop_QSal32x2: case Iop_QSal64x1:
sewardj1ddee212014-08-24 14:00:19 +00002572 case Iop_RecipStep32Fx2:
2573 case Iop_RSqrtStep32Fx2:
sewardjb183b852006-02-03 16:08:03 +00002574 BINARY(Ity_I64,Ity_I64, Ity_I64);
sewardj38a3f862005-01-13 15:06:51 +00002575
sewardjd166e282008-02-06 11:42:45 +00002576 case Iop_ShlN32x2: case Iop_ShlN16x4: case Iop_ShlN8x8:
sewardj2fdd4162010-08-22 12:59:02 +00002577 case Iop_ShrN32x2: case Iop_ShrN16x4: case Iop_ShrN8x8:
sewardjd71ba832006-12-27 01:15:29 +00002578 case Iop_SarN32x2: case Iop_SarN16x4: case Iop_SarN8x8:
sewardj1dd3ec12014-08-15 09:11:08 +00002579 case Iop_QShlNsatUU8x8: case Iop_QShlNsatUU16x4:
2580 case Iop_QShlNsatUU32x2: case Iop_QShlNsatUU64x1:
2581 case Iop_QShlNsatSU8x8: case Iop_QShlNsatSU16x4:
2582 case Iop_QShlNsatSU32x2: case Iop_QShlNsatSU64x1:
2583 case Iop_QShlNsatSS8x8: case Iop_QShlNsatSS16x4:
2584 case Iop_QShlNsatSS32x2: case Iop_QShlNsatSS64x1:
sewardjb183b852006-02-03 16:08:03 +00002585 BINARY(Ity_I64,Ity_I8, Ity_I64);
sewardj6efd4a12004-07-15 03:54:23 +00002586
2587 case Iop_Shl8: case Iop_Shr8: case Iop_Sar8:
sewardjb183b852006-02-03 16:08:03 +00002588 BINARY(Ity_I8,Ity_I8, Ity_I8);
sewardj6efd4a12004-07-15 03:54:23 +00002589 case Iop_Shl16: case Iop_Shr16: case Iop_Sar16:
sewardjb183b852006-02-03 16:08:03 +00002590 BINARY(Ity_I16,Ity_I8, Ity_I16);
sewardj6efd4a12004-07-15 03:54:23 +00002591 case Iop_Shl32: case Iop_Shr32: case Iop_Sar32:
sewardjb183b852006-02-03 16:08:03 +00002592 BINARY(Ity_I32,Ity_I8, Ity_I32);
sewardj6efd4a12004-07-15 03:54:23 +00002593 case Iop_Shl64: case Iop_Shr64: case Iop_Sar64:
sewardjb183b852006-02-03 16:08:03 +00002594 BINARY(Ity_I64,Ity_I8, Ity_I64);
sewardj6efd4a12004-07-15 03:54:23 +00002595
sewardjeb17e492007-08-25 23:07:44 +00002596 case Iop_Not8:
sewardjb183b852006-02-03 16:08:03 +00002597 UNARY(Ity_I8, Ity_I8);
sewardjeb17e492007-08-25 23:07:44 +00002598 case Iop_Not16:
sewardjb183b852006-02-03 16:08:03 +00002599 UNARY(Ity_I16, Ity_I16);
sewardjeb17e492007-08-25 23:07:44 +00002600 case Iop_Not32:
sewardje2ea1762010-09-22 00:56:37 +00002601 case Iop_CmpNEZ16x2: case Iop_CmpNEZ8x4:
sewardjb183b852006-02-03 16:08:03 +00002602 UNARY(Ity_I32, Ity_I32);
sewardj18069182005-01-13 19:16:04 +00002603
sewardj0033ddc2005-04-26 23:34:34 +00002604 case Iop_Not64:
sewardj18069182005-01-13 19:16:04 +00002605 case Iop_CmpNEZ32x2: case Iop_CmpNEZ16x4: case Iop_CmpNEZ8x8:
sewardj2fdd4162010-08-22 12:59:02 +00002606 case Iop_Cnt8x8:
sewardja8c7b0f2014-06-26 08:18:08 +00002607 case Iop_Clz8x8: case Iop_Clz16x4: case Iop_Clz32x2:
2608 case Iop_Cls8x8: case Iop_Cls16x4: case Iop_Cls32x2:
sewardj2fdd4162010-08-22 12:59:02 +00002609 case Iop_PwAddL8Ux8: case Iop_PwAddL16Ux4: case Iop_PwAddL32Ux2:
2610 case Iop_PwAddL8Sx8: case Iop_PwAddL16Sx4: case Iop_PwAddL32Sx2:
sewardj33680352014-06-26 10:49:33 +00002611 case Iop_Reverse8sIn64_x1: case Iop_Reverse16sIn64_x1:
2612 case Iop_Reverse32sIn64_x1:
2613 case Iop_Reverse8sIn32_x2: case Iop_Reverse16sIn32_x2:
2614 case Iop_Reverse8sIn16_x4:
sewardj2fdd4162010-08-22 12:59:02 +00002615 case Iop_FtoI32Sx2_RZ: case Iop_FtoI32Ux2_RZ:
2616 case Iop_I32StoFx2: case Iop_I32UtoFx2:
sewardj1ddee212014-08-24 14:00:19 +00002617 case Iop_RecipEst32Ux2: case Iop_RecipEst32Fx2:
sewardj2fdd4162010-08-22 12:59:02 +00002618 case Iop_Abs32Fx2:
sewardj1ddee212014-08-24 14:00:19 +00002619 case Iop_RSqrtEst32Fx2:
2620 case Iop_RSqrtEst32Ux2:
sewardj2fdd4162010-08-22 12:59:02 +00002621 case Iop_Neg32Fx2:
2622 case Iop_Abs8x8: case Iop_Abs16x4: case Iop_Abs32x2:
sewardjb183b852006-02-03 16:08:03 +00002623 UNARY(Ity_I64, Ity_I64);
sewardj6efd4a12004-07-15 03:54:23 +00002624
2625 case Iop_CmpEQ8: case Iop_CmpNE8:
sewardje13074c2012-11-08 10:57:08 +00002626 case Iop_CasCmpEQ8: case Iop_CasCmpNE8: case Iop_ExpCmpNE8:
sewardj6efd4a12004-07-15 03:54:23 +00002627 COMPARISON(Ity_I8);
2628 case Iop_CmpEQ16: case Iop_CmpNE16:
sewardje13074c2012-11-08 10:57:08 +00002629 case Iop_CasCmpEQ16: case Iop_CasCmpNE16: case Iop_ExpCmpNE16:
sewardj6efd4a12004-07-15 03:54:23 +00002630 COMPARISON(Ity_I16);
2631 case Iop_CmpEQ32: case Iop_CmpNE32:
sewardje13074c2012-11-08 10:57:08 +00002632 case Iop_CasCmpEQ32: case Iop_CasCmpNE32: case Iop_ExpCmpNE32:
sewardj17442fe2004-09-20 14:54:28 +00002633 case Iop_CmpLT32S: case Iop_CmpLE32S:
2634 case Iop_CmpLT32U: case Iop_CmpLE32U:
sewardj6efd4a12004-07-15 03:54:23 +00002635 COMPARISON(Ity_I32);
2636 case Iop_CmpEQ64: case Iop_CmpNE64:
sewardje13074c2012-11-08 10:57:08 +00002637 case Iop_CasCmpEQ64: case Iop_CasCmpNE64: case Iop_ExpCmpNE64:
sewardj98540072005-04-26 01:52:01 +00002638 case Iop_CmpLT64S: case Iop_CmpLE64S:
2639 case Iop_CmpLT64U: case Iop_CmpLE64U:
sewardj6efd4a12004-07-15 03:54:23 +00002640 COMPARISON(Ity_I64);
2641
sewardj0033ddc2005-04-26 23:34:34 +00002642 case Iop_CmpNEZ8: UNARY_COMPARISON(Ity_I8);
2643 case Iop_CmpNEZ16: UNARY_COMPARISON(Ity_I16);
2644 case Iop_CmpNEZ32: UNARY_COMPARISON(Ity_I32);
2645 case Iop_CmpNEZ64: UNARY_COMPARISON(Ity_I64);
2646
sewardjeb17e492007-08-25 23:07:44 +00002647 case Iop_Left8: UNARY(Ity_I8, Ity_I8);
2648 case Iop_Left16: UNARY(Ity_I16,Ity_I16);
2649 case Iop_CmpwNEZ32: case Iop_Left32: UNARY(Ity_I32,Ity_I32);
2650 case Iop_CmpwNEZ64: case Iop_Left64: UNARY(Ity_I64,Ity_I64);
sewardj78a20592012-12-13 18:29:56 +00002651
2652 case Iop_GetMSBs8x8: UNARY(Ity_I64, Ity_I8);
2653 case Iop_GetMSBs8x16: UNARY(Ity_V128, Ity_I16);
sewardjeb17e492007-08-25 23:07:44 +00002654
sewardjb81f8b32004-07-30 10:17:50 +00002655 case Iop_MullU8: case Iop_MullS8:
sewardjb183b852006-02-03 16:08:03 +00002656 BINARY(Ity_I8,Ity_I8, Ity_I16);
sewardjb81f8b32004-07-30 10:17:50 +00002657 case Iop_MullU16: case Iop_MullS16:
sewardjb183b852006-02-03 16:08:03 +00002658 BINARY(Ity_I16,Ity_I16, Ity_I32);
sewardj6d2638e2004-07-15 09:38:27 +00002659 case Iop_MullU32: case Iop_MullS32:
sewardjb183b852006-02-03 16:08:03 +00002660 BINARY(Ity_I32,Ity_I32, Ity_I64);
sewardj9b967672005-02-08 11:13:09 +00002661 case Iop_MullU64: case Iop_MullS64:
sewardjb183b852006-02-03 16:08:03 +00002662 BINARY(Ity_I64,Ity_I64, Ity_I128);
sewardj6d2638e2004-07-15 09:38:27 +00002663
sewardj17442fe2004-09-20 14:54:28 +00002664 case Iop_Clz32: case Iop_Ctz32:
sewardjb183b852006-02-03 16:08:03 +00002665 UNARY(Ity_I32, Ity_I32);
sewardjce646f22004-08-31 23:55:54 +00002666
sewardjf53b7352005-04-06 20:01:56 +00002667 case Iop_Clz64: case Iop_Ctz64:
sewardjb183b852006-02-03 16:08:03 +00002668 UNARY(Ity_I64, Ity_I64);
sewardjf53b7352005-04-06 20:01:56 +00002669
sewardje71e56a2011-09-05 12:11:06 +00002670 case Iop_DivU32: case Iop_DivS32: case Iop_DivU32E: case Iop_DivS32E:
sewardjb183b852006-02-03 16:08:03 +00002671 BINARY(Ity_I32,Ity_I32, Ity_I32);
cerion5c8a0cb2005-02-03 13:59:46 +00002672
sewardje71e56a2011-09-05 12:11:06 +00002673 case Iop_DivU64: case Iop_DivS64: case Iop_DivS64E: case Iop_DivU64E:
sewardjb183b852006-02-03 16:08:03 +00002674 BINARY(Ity_I64,Ity_I64, Ity_I64);
cerionf0de28c2005-12-13 20:21:11 +00002675
sewardj17442fe2004-09-20 14:54:28 +00002676 case Iop_DivModU64to32: case Iop_DivModS64to32:
sewardjb183b852006-02-03 16:08:03 +00002677 BINARY(Ity_I64,Ity_I32, Ity_I64);
sewardj6d2638e2004-07-15 09:38:27 +00002678
sewardj343b9d02005-01-31 18:08:45 +00002679 case Iop_DivModU128to64: case Iop_DivModS128to64:
sewardjb183b852006-02-03 16:08:03 +00002680 BINARY(Ity_I128,Ity_I64, Ity_I128);
sewardj343b9d02005-01-31 18:08:45 +00002681
sewardj2019a972011-03-07 16:04:07 +00002682 case Iop_DivModS64to64:
2683 BINARY(Ity_I64,Ity_I64, Ity_I128);
2684
sewardjb81f8b32004-07-30 10:17:50 +00002685 case Iop_16HIto8: case Iop_16to8:
sewardjb183b852006-02-03 16:08:03 +00002686 UNARY(Ity_I16, Ity_I8);
sewardjb81f8b32004-07-30 10:17:50 +00002687 case Iop_8HLto16:
sewardjb183b852006-02-03 16:08:03 +00002688 BINARY(Ity_I8,Ity_I8, Ity_I16);
sewardjb81f8b32004-07-30 10:17:50 +00002689
sewardj8c7f1ab2004-07-29 20:31:09 +00002690 case Iop_32HIto16: case Iop_32to16:
sewardjb183b852006-02-03 16:08:03 +00002691 UNARY(Ity_I32, Ity_I16);
sewardj8c7f1ab2004-07-29 20:31:09 +00002692 case Iop_16HLto32:
sewardjb183b852006-02-03 16:08:03 +00002693 BINARY(Ity_I16,Ity_I16, Ity_I32);
sewardj8c7f1ab2004-07-29 20:31:09 +00002694
2695 case Iop_64HIto32: case Iop_64to32:
sewardjb183b852006-02-03 16:08:03 +00002696 UNARY(Ity_I64, Ity_I32);
sewardj6d2638e2004-07-15 09:38:27 +00002697 case Iop_32HLto64:
sewardjb183b852006-02-03 16:08:03 +00002698 BINARY(Ity_I32,Ity_I32, Ity_I64);
sewardj6d2638e2004-07-15 09:38:27 +00002699
sewardj9b967672005-02-08 11:13:09 +00002700 case Iop_128HIto64: case Iop_128to64:
sewardjb183b852006-02-03 16:08:03 +00002701 UNARY(Ity_I128, Ity_I64);
sewardj9b967672005-02-08 11:13:09 +00002702 case Iop_64HLto128:
sewardjb183b852006-02-03 16:08:03 +00002703 BINARY(Ity_I64,Ity_I64, Ity_I128);
sewardj9b967672005-02-08 11:13:09 +00002704
sewardjb183b852006-02-03 16:08:03 +00002705 case Iop_Not1: UNARY(Ity_I1, Ity_I1);
2706 case Iop_1Uto8: UNARY(Ity_I1, Ity_I8);
2707 case Iop_1Sto8: UNARY(Ity_I1, Ity_I8);
2708 case Iop_1Sto16: UNARY(Ity_I1, Ity_I16);
2709 case Iop_1Uto32: case Iop_1Sto32: UNARY(Ity_I1, Ity_I32);
2710 case Iop_1Sto64: case Iop_1Uto64: UNARY(Ity_I1, Ity_I64);
2711 case Iop_32to1: UNARY(Ity_I32, Ity_I1);
2712 case Iop_64to1: UNARY(Ity_I64, Ity_I1);
sewardj47341042004-09-19 11:55:46 +00002713
sewardj17442fe2004-09-20 14:54:28 +00002714 case Iop_8Uto32: case Iop_8Sto32:
sewardjb183b852006-02-03 16:08:03 +00002715 UNARY(Ity_I8, Ity_I32);
sewardj47341042004-09-19 11:55:46 +00002716
sewardj17442fe2004-09-20 14:54:28 +00002717 case Iop_8Uto16: case Iop_8Sto16:
sewardjb183b852006-02-03 16:08:03 +00002718 UNARY(Ity_I8, Ity_I16);
sewardj47341042004-09-19 11:55:46 +00002719
sewardj17442fe2004-09-20 14:54:28 +00002720 case Iop_16Uto32: case Iop_16Sto32:
sewardjb183b852006-02-03 16:08:03 +00002721 UNARY(Ity_I16, Ity_I32);
sewardj6d2638e2004-07-15 09:38:27 +00002722
sewardj17442fe2004-09-20 14:54:28 +00002723 case Iop_32Sto64: case Iop_32Uto64:
sewardjb183b852006-02-03 16:08:03 +00002724 UNARY(Ity_I32, Ity_I64);
sewardj17442fe2004-09-20 14:54:28 +00002725
sewardj291a7e82005-04-27 11:42:44 +00002726 case Iop_8Uto64: case Iop_8Sto64:
sewardjb183b852006-02-03 16:08:03 +00002727 UNARY(Ity_I8, Ity_I64);
sewardj291a7e82005-04-27 11:42:44 +00002728
2729 case Iop_16Uto64: case Iop_16Sto64:
sewardj291a7e82005-04-27 11:42:44 +00002730 UNARY(Ity_I16, Ity_I64);
sewardjb183b852006-02-03 16:08:03 +00002731 case Iop_64to16:
2732 UNARY(Ity_I64, Ity_I16);
sewardj291a7e82005-04-27 11:42:44 +00002733
sewardjb183b852006-02-03 16:08:03 +00002734 case Iop_32to8: UNARY(Ity_I32, Ity_I8);
2735 case Iop_64to8: UNARY(Ity_I64, Ity_I8);
sewardj17442fe2004-09-20 14:54:28 +00002736
sewardjb183b852006-02-03 16:08:03 +00002737 case Iop_AddF64: case Iop_SubF64:
2738 case Iop_MulF64: case Iop_DivF64:
2739 case Iop_AddF64r32: case Iop_SubF64r32:
2740 case Iop_MulF64r32: case Iop_DivF64r32:
2741 TERNARY(ity_RMode,Ity_F64,Ity_F64, Ity_F64);
2742
sewardj6c299f32009-12-31 18:00:12 +00002743 case Iop_AddF32: case Iop_SubF32:
2744 case Iop_MulF32: case Iop_DivF32:
2745 TERNARY(ity_RMode,Ity_F32,Ity_F32, Ity_F32);
2746
sewardjb183b852006-02-03 16:08:03 +00002747 case Iop_NegF64: case Iop_AbsF64:
2748 UNARY(Ity_F64, Ity_F64);
2749
sewardj6c299f32009-12-31 18:00:12 +00002750 case Iop_NegF32: case Iop_AbsF32:
2751 UNARY(Ity_F32, Ity_F32);
2752
sewardjb183b852006-02-03 16:08:03 +00002753 case Iop_SqrtF64:
sewardjb183b852006-02-03 16:08:03 +00002754 BINARY(ity_RMode,Ity_F64, Ity_F64);
2755
sewardj6c299f32009-12-31 18:00:12 +00002756 case Iop_SqrtF32:
sewardjd15b5972010-06-27 09:06:34 +00002757 case Iop_RoundF32toInt:
sewardj6c299f32009-12-31 18:00:12 +00002758 BINARY(ity_RMode,Ity_F32, Ity_F32);
2759
sewardj2019a972011-03-07 16:04:07 +00002760 case Iop_CmpF32:
2761 BINARY(Ity_F32,Ity_F32, Ity_I32);
2762
sewardjbdc7d212004-09-09 02:46:40 +00002763 case Iop_CmpF64:
sewardjb183b852006-02-03 16:08:03 +00002764 BINARY(Ity_F64,Ity_F64, Ity_I32);
sewardj8f3debf2004-09-08 23:42:23 +00002765
sewardj2019a972011-03-07 16:04:07 +00002766 case Iop_CmpF128:
2767 BINARY(Ity_F128,Ity_F128, Ity_I32);
2768
sewardj6c299f32009-12-31 18:00:12 +00002769 case Iop_F64toI16S: BINARY(ity_RMode,Ity_F64, Ity_I16);
2770 case Iop_F64toI32S: BINARY(ity_RMode,Ity_F64, Ity_I32);
sewardj4aa412a2011-07-24 14:13:21 +00002771 case Iop_F64toI64S: case Iop_F64toI64U:
2772 BINARY(ity_RMode,Ity_F64, Ity_I64);
sewardj8f3debf2004-09-08 23:42:23 +00002773
sewardj6c299f32009-12-31 18:00:12 +00002774 case Iop_F64toI32U: BINARY(ity_RMode,Ity_F64, Ity_I32);
2775
sewardj6c299f32009-12-31 18:00:12 +00002776 case Iop_I32StoF64: UNARY(Ity_I32, Ity_F64);
2777 case Iop_I64StoF64: BINARY(ity_RMode,Ity_I64, Ity_F64);
sewardj66d5ef22011-04-15 11:55:00 +00002778 case Iop_I64UtoF64: BINARY(ity_RMode,Ity_I64, Ity_F64);
sewardj95d6f3a2011-04-27 10:07:42 +00002779 case Iop_I64UtoF32: BINARY(ity_RMode,Ity_I64, Ity_F32);
sewardj6c299f32009-12-31 18:00:12 +00002780
2781 case Iop_I32UtoF64: UNARY(Ity_I32, Ity_F64);
sewardj3bca9062004-12-04 14:36:09 +00002782
sewardj2019a972011-03-07 16:04:07 +00002783 case Iop_F32toI32S: BINARY(ity_RMode,Ity_F32, Ity_I32);
2784 case Iop_F32toI64S: BINARY(ity_RMode,Ity_F32, Ity_I64);
florian1c8f7ff2012-09-01 00:12:11 +00002785 case Iop_F32toI32U: BINARY(ity_RMode,Ity_F32, Ity_I32);
2786 case Iop_F32toI64U: BINARY(ity_RMode,Ity_F32, Ity_I64);
sewardj2019a972011-03-07 16:04:07 +00002787
florian1c8f7ff2012-09-01 00:12:11 +00002788 case Iop_I32UtoF32: BINARY(ity_RMode,Ity_I32, Ity_F32);
sewardj2019a972011-03-07 16:04:07 +00002789 case Iop_I32StoF32: BINARY(ity_RMode,Ity_I32, Ity_F32);
2790 case Iop_I64StoF32: BINARY(ity_RMode,Ity_I64, Ity_F32);
2791
sewardjb183b852006-02-03 16:08:03 +00002792 case Iop_F32toF64: UNARY(Ity_F32, Ity_F64);
2793 case Iop_F64toF32: BINARY(ity_RMode,Ity_F64, Ity_F32);
sewardj4cb918d2004-12-03 19:43:31 +00002794
sewardjb183b852006-02-03 16:08:03 +00002795 case Iop_ReinterpI64asF64: UNARY(Ity_I64, Ity_F64);
2796 case Iop_ReinterpF64asI64: UNARY(Ity_F64, Ity_I64);
2797 case Iop_ReinterpI32asF32: UNARY(Ity_I32, Ity_F32);
sewardjfc1b5412007-01-09 15:20:07 +00002798 case Iop_ReinterpF32asI32: UNARY(Ity_F32, Ity_I32);
sewardj8f3debf2004-09-08 23:42:23 +00002799
sewardjb183b852006-02-03 16:08:03 +00002800 case Iop_AtanF64: case Iop_Yl2xF64: case Iop_Yl2xp1F64:
2801 case Iop_ScaleF64: case Iop_PRemF64: case Iop_PRem1F64:
2802 TERNARY(ity_RMode,Ity_F64,Ity_F64, Ity_F64);
2803
2804 case Iop_PRemC3210F64: case Iop_PRem1C3210F64:
2805 TERNARY(ity_RMode,Ity_F64,Ity_F64, Ity_I32);
2806
2807 case Iop_SinF64: case Iop_CosF64: case Iop_TanF64:
2808 case Iop_2xm1F64:
2809 case Iop_RoundF64toInt: BINARY(ity_RMode,Ity_F64, Ity_F64);
2810
sewardj40c80262006-02-08 19:30:46 +00002811 case Iop_MAddF64: case Iop_MSubF64:
2812 case Iop_MAddF64r32: case Iop_MSubF64r32:
2813 QUATERNARY(ity_RMode,Ity_F64,Ity_F64,Ity_F64, Ity_F64);
2814
sewardj1ddee212014-08-24 14:00:19 +00002815 case Iop_RSqrtEst5GoodF64:
sewardj0f1ef862008-08-08 08:37:06 +00002816 case Iop_RoundF64toF64_NEAREST: case Iop_RoundF64toF64_NegINF:
2817 case Iop_RoundF64toF64_PosINF: case Iop_RoundF64toF64_ZERO:
sewardjb183b852006-02-03 16:08:03 +00002818 UNARY(Ity_F64, Ity_F64);
2819 case Iop_RoundF64toF32:
2820 BINARY(ity_RMode,Ity_F64, Ity_F64);
sewardjb183b852006-02-03 16:08:03 +00002821 case Iop_TruncF64asF32:
2822 UNARY(Ity_F64, Ity_F32);
sewardjbb53f8c2004-08-14 11:50:01 +00002823
cerionf294eb32005-11-16 17:21:10 +00002824 case Iop_I32UtoFx4:
2825 case Iop_I32StoFx4:
2826 case Iop_QFtoI32Ux4_RZ:
2827 case Iop_QFtoI32Sx4_RZ:
sewardj2fdd4162010-08-22 12:59:02 +00002828 case Iop_FtoI32Ux4_RZ:
2829 case Iop_FtoI32Sx4_RZ:
cerionf294eb32005-11-16 17:21:10 +00002830 case Iop_RoundF32x4_RM:
2831 case Iop_RoundF32x4_RP:
2832 case Iop_RoundF32x4_RN:
2833 case Iop_RoundF32x4_RZ:
sewardjfab09142014-02-10 10:28:13 +00002834 case Iop_Abs64Fx2: case Iop_Abs32Fx4:
sewardj1ddee212014-08-24 14:00:19 +00002835 case Iop_RSqrtEst32Fx4:
2836 case Iop_RSqrtEst32Ux4:
cerionf294eb32005-11-16 17:21:10 +00002837 UNARY(Ity_V128, Ity_V128);
2838
sewardj5f438dd2011-06-16 11:36:23 +00002839 case Iop_64HLtoV128:
2840 BINARY(Ity_I64,Ity_I64, Ity_V128);
2841
sewardj2fdd4162010-08-22 12:59:02 +00002842 case Iop_V128to64: case Iop_V128HIto64:
sewardj5f438dd2011-06-16 11:36:23 +00002843 case Iop_NarrowUn16to8x8:
2844 case Iop_NarrowUn32to16x4:
2845 case Iop_NarrowUn64to32x2:
2846 case Iop_QNarrowUn16Uto8Ux8:
2847 case Iop_QNarrowUn32Uto16Ux4:
2848 case Iop_QNarrowUn64Uto32Ux2:
2849 case Iop_QNarrowUn16Sto8Sx8:
2850 case Iop_QNarrowUn32Sto16Sx4:
2851 case Iop_QNarrowUn64Sto32Sx2:
2852 case Iop_QNarrowUn16Sto8Ux8:
2853 case Iop_QNarrowUn32Sto16Ux4:
2854 case Iop_QNarrowUn64Sto32Ux2:
sewardj2fdd4162010-08-22 12:59:02 +00002855 case Iop_F32toF16x4:
sewardjb183b852006-02-03 16:08:03 +00002856 UNARY(Ity_V128, Ity_I64);
sewardjc9a43662004-11-30 18:51:59 +00002857
sewardj5f438dd2011-06-16 11:36:23 +00002858 case Iop_Widen8Uto16x8:
2859 case Iop_Widen16Uto32x4:
2860 case Iop_Widen32Uto64x2:
2861 case Iop_Widen8Sto16x8:
2862 case Iop_Widen16Sto32x4:
2863 case Iop_Widen32Sto64x2:
sewardj2fdd4162010-08-22 12:59:02 +00002864 case Iop_F16toF32x4:
2865 UNARY(Ity_I64, Ity_V128);
2866
sewardjb183b852006-02-03 16:08:03 +00002867 case Iop_V128to32: UNARY(Ity_V128, Ity_I32);
2868 case Iop_32UtoV128: UNARY(Ity_I32, Ity_V128);
2869 case Iop_64UtoV128: UNARY(Ity_I64, Ity_V128);
2870 case Iop_SetV128lo32: BINARY(Ity_V128,Ity_I32, Ity_V128);
2871 case Iop_SetV128lo64: BINARY(Ity_V128,Ity_I64, Ity_V128);
sewardj129b3d92004-12-05 15:42:05 +00002872
sewardjb183b852006-02-03 16:08:03 +00002873 case Iop_Dup8x16: UNARY(Ity_I8, Ity_V128);
2874 case Iop_Dup16x8: UNARY(Ity_I16, Ity_V128);
2875 case Iop_Dup32x4: UNARY(Ity_I32, Ity_V128);
sewardj2fdd4162010-08-22 12:59:02 +00002876 case Iop_Dup8x8: UNARY(Ity_I8, Ity_I64);
2877 case Iop_Dup16x4: UNARY(Ity_I16, Ity_I64);
2878 case Iop_Dup32x2: UNARY(Ity_I32, Ity_I64);
cerionf887b3e2005-09-13 16:34:28 +00002879
sewardj1e6ad742004-12-02 16:16:11 +00002880 case Iop_CmpEQ32Fx4: case Iop_CmpLT32Fx4:
sewardj636ad762004-12-07 11:16:04 +00002881 case Iop_CmpEQ64Fx2: case Iop_CmpLT64Fx2:
sewardj1e6ad742004-12-02 16:16:11 +00002882 case Iop_CmpLE32Fx4: case Iop_CmpUN32Fx4:
sewardj636ad762004-12-07 11:16:04 +00002883 case Iop_CmpLE64Fx2: case Iop_CmpUN64Fx2:
cerion206c3642005-11-14 00:35:59 +00002884 case Iop_CmpGT32Fx4: case Iop_CmpGE32Fx4:
sewardj1e6ad742004-12-02 16:16:11 +00002885 case Iop_CmpEQ32F0x4: case Iop_CmpLT32F0x4:
sewardj636ad762004-12-07 11:16:04 +00002886 case Iop_CmpEQ64F0x2: case Iop_CmpLT64F0x2:
sewardj1e6ad742004-12-02 16:16:11 +00002887 case Iop_CmpLE32F0x4: case Iop_CmpUN32F0x4:
sewardj636ad762004-12-07 11:16:04 +00002888 case Iop_CmpLE64F0x2: case Iop_CmpUN64F0x2:
sewardj9571dc02014-01-26 18:34:23 +00002889 case Iop_Add32F0x4:
2890 case Iop_Add64F0x2:
2891 case Iop_Div32F0x4:
2892 case Iop_Div64F0x2:
sewardj176a59c2004-12-03 20:08:31 +00002893 case Iop_Max32Fx4: case Iop_Max32F0x4:
sewardj2fdd4162010-08-22 12:59:02 +00002894 case Iop_PwMax32Fx4: case Iop_PwMin32Fx4:
sewardj636ad762004-12-07 11:16:04 +00002895 case Iop_Max64Fx2: case Iop_Max64F0x2:
sewardj176a59c2004-12-03 20:08:31 +00002896 case Iop_Min32Fx4: case Iop_Min32F0x4:
sewardj636ad762004-12-07 11:16:04 +00002897 case Iop_Min64Fx2: case Iop_Min64F0x2:
sewardj9571dc02014-01-26 18:34:23 +00002898 case Iop_Mul32F0x4:
2899 case Iop_Mul64F0x2:
2900 case Iop_Sub32F0x4:
2901 case Iop_Sub64F0x2:
sewardjf0c1c582005-02-07 23:47:38 +00002902 case Iop_AndV128: case Iop_OrV128: case Iop_XorV128:
sewardj164f9272004-12-09 00:39:32 +00002903 case Iop_Add8x16: case Iop_Add16x8:
2904 case Iop_Add32x4: case Iop_Add64x2:
sewardj2fdd4162010-08-22 12:59:02 +00002905 case Iop_QAdd8Ux16: case Iop_QAdd16Ux8:
sewardja5a6b752014-06-30 07:33:56 +00002906 case Iop_QAdd32Ux4: case Iop_QAdd64Ux2:
sewardj2fdd4162010-08-22 12:59:02 +00002907 case Iop_QAdd8Sx16: case Iop_QAdd16Sx8:
2908 case Iop_QAdd32Sx4: case Iop_QAdd64Sx2:
sewardjf7003bc2014-08-18 12:28:02 +00002909 case Iop_QAddExtUSsatSS8x16: case Iop_QAddExtUSsatSS16x8:
2910 case Iop_QAddExtUSsatSS32x4: case Iop_QAddExtUSsatSS64x2:
2911 case Iop_QAddExtSUsatUU8x16: case Iop_QAddExtSUsatUU16x8:
2912 case Iop_QAddExtSUsatUU32x4: case Iop_QAddExtSUsatUU64x2:
sewardj2fdd4162010-08-22 12:59:02 +00002913 case Iop_PwAdd8x16: case Iop_PwAdd16x8: case Iop_PwAdd32x4:
sewardj164f9272004-12-09 00:39:32 +00002914 case Iop_Sub8x16: case Iop_Sub16x8:
2915 case Iop_Sub32x4: case Iop_Sub64x2:
sewardj2fdd4162010-08-22 12:59:02 +00002916 case Iop_QSub8Ux16: case Iop_QSub16Ux8:
sewardja5a6b752014-06-30 07:33:56 +00002917 case Iop_QSub32Ux4: case Iop_QSub64Ux2:
sewardj2fdd4162010-08-22 12:59:02 +00002918 case Iop_QSub8Sx16: case Iop_QSub16Sx8:
2919 case Iop_QSub32Sx4: case Iop_QSub64Sx2:
2920 case Iop_Mul8x16: case Iop_Mul16x8: case Iop_Mul32x4:
2921 case Iop_PolynomialMul8x16:
carll7deaf952013-10-15 18:11:20 +00002922 case Iop_PolynomialMulAdd8x16: case Iop_PolynomialMulAdd16x8:
2923 case Iop_PolynomialMulAdd32x4: case Iop_PolynomialMulAdd64x2:
cerionf887b3e2005-09-13 16:34:28 +00002924 case Iop_MulHi16Ux8: case Iop_MulHi32Ux4:
2925 case Iop_MulHi16Sx8: case Iop_MulHi32Sx4:
sewardj2fdd4162010-08-22 12:59:02 +00002926 case Iop_QDMulHi16Sx8: case Iop_QDMulHi32Sx4:
2927 case Iop_QRDMulHi16Sx8: case Iop_QRDMulHi32Sx4:
carll48ae46b2013-10-01 15:45:54 +00002928 case Iop_MullEven8Ux16: case Iop_MullEven16Ux8: case Iop_MullEven32Ux4:
2929 case Iop_MullEven8Sx16: case Iop_MullEven16Sx8: case Iop_MullEven32Sx4:
cerionf887b3e2005-09-13 16:34:28 +00002930 case Iop_Avg8Ux16: case Iop_Avg16Ux8: case Iop_Avg32Ux4:
2931 case Iop_Avg8Sx16: case Iop_Avg16Sx8: case Iop_Avg32Sx4:
2932 case Iop_Max8Sx16: case Iop_Max16Sx8: case Iop_Max32Sx4:
carll48ae46b2013-10-01 15:45:54 +00002933 case Iop_Max64Sx2:
cerionf887b3e2005-09-13 16:34:28 +00002934 case Iop_Max8Ux16: case Iop_Max16Ux8: case Iop_Max32Ux4:
carll48ae46b2013-10-01 15:45:54 +00002935 case Iop_Max64Ux2:
cerionf887b3e2005-09-13 16:34:28 +00002936 case Iop_Min8Sx16: case Iop_Min16Sx8: case Iop_Min32Sx4:
carll48ae46b2013-10-01 15:45:54 +00002937 case Iop_Min64Sx2:
cerionf887b3e2005-09-13 16:34:28 +00002938 case Iop_Min8Ux16: case Iop_Min16Ux8: case Iop_Min32Ux4:
carll48ae46b2013-10-01 15:45:54 +00002939 case Iop_Min64Ux2:
sewardj164f9272004-12-09 00:39:32 +00002940 case Iop_CmpEQ8x16: case Iop_CmpEQ16x8: case Iop_CmpEQ32x4:
sewardjd8815622011-10-19 15:24:01 +00002941 case Iop_CmpEQ64x2:
sewardj164f9272004-12-09 00:39:32 +00002942 case Iop_CmpGT8Sx16: case Iop_CmpGT16Sx8: case Iop_CmpGT32Sx4:
sewardj69d98e32010-06-18 08:17:41 +00002943 case Iop_CmpGT64Sx2:
cerionf887b3e2005-09-13 16:34:28 +00002944 case Iop_CmpGT8Ux16: case Iop_CmpGT16Ux8: case Iop_CmpGT32Ux4:
carll48ae46b2013-10-01 15:45:54 +00002945 case Iop_CmpGT64Ux2:
sewardj2fdd4162010-08-22 12:59:02 +00002946 case Iop_Shl8x16: case Iop_Shl16x8: case Iop_Shl32x4: case Iop_Shl64x2:
sewardj5f438dd2011-06-16 11:36:23 +00002947 case Iop_QShl8x16: case Iop_QShl16x8:
2948 case Iop_QShl32x4: case Iop_QShl64x2:
2949 case Iop_QSal8x16: case Iop_QSal16x8:
2950 case Iop_QSal32x4: case Iop_QSal64x2:
sewardj2fdd4162010-08-22 12:59:02 +00002951 case Iop_Shr8x16: case Iop_Shr16x8: case Iop_Shr32x4: case Iop_Shr64x2:
2952 case Iop_Sar8x16: case Iop_Sar16x8: case Iop_Sar32x4: case Iop_Sar64x2:
2953 case Iop_Sal8x16: case Iop_Sal16x8: case Iop_Sal32x4: case Iop_Sal64x2:
carll48ae46b2013-10-01 15:45:54 +00002954 case Iop_Rol8x16: case Iop_Rol16x8: case Iop_Rol32x4:case Iop_Rol64x2:
sewardj5f438dd2011-06-16 11:36:23 +00002955 case Iop_QNarrowBin16Sto8Ux16: case Iop_QNarrowBin32Sto16Ux8:
2956 case Iop_QNarrowBin16Sto8Sx16: case Iop_QNarrowBin32Sto16Sx8:
2957 case Iop_QNarrowBin16Uto8Ux16: case Iop_QNarrowBin32Uto16Ux8:
carll48ae46b2013-10-01 15:45:54 +00002958 case Iop_QNarrowBin64Sto32Sx4: case Iop_QNarrowBin64Uto32Ux4:
sewardj5f438dd2011-06-16 11:36:23 +00002959 case Iop_NarrowBin16to8x16: case Iop_NarrowBin32to16x8:
carll0c74bb52013-08-12 18:01:40 +00002960 case Iop_NarrowBin64to32x4:
sewardj164f9272004-12-09 00:39:32 +00002961 case Iop_InterleaveHI8x16: case Iop_InterleaveHI16x8:
2962 case Iop_InterleaveHI32x4: case Iop_InterleaveHI64x2:
sewardj2fdd4162010-08-22 12:59:02 +00002963 case Iop_InterleaveLO8x16: case Iop_InterleaveLO16x8:
sewardj164f9272004-12-09 00:39:32 +00002964 case Iop_InterleaveLO32x4: case Iop_InterleaveLO64x2:
sewardj2fdd4162010-08-22 12:59:02 +00002965 case Iop_CatOddLanes8x16: case Iop_CatEvenLanes8x16:
2966 case Iop_CatOddLanes16x8: case Iop_CatEvenLanes16x8:
2967 case Iop_CatOddLanes32x4: case Iop_CatEvenLanes32x4:
2968 case Iop_InterleaveOddLanes8x16: case Iop_InterleaveEvenLanes8x16:
2969 case Iop_InterleaveOddLanes16x8: case Iop_InterleaveEvenLanes16x8:
2970 case Iop_InterleaveOddLanes32x4: case Iop_InterleaveEvenLanes32x4:
sewardjd8bca7e2012-06-20 11:46:19 +00002971 case Iop_Perm8x16: case Iop_Perm32x4:
sewardj1ddee212014-08-24 14:00:19 +00002972 case Iop_RecipStep32Fx4:
2973 case Iop_RSqrtStep32Fx4:
carll7deaf952013-10-15 18:11:20 +00002974 case Iop_CipherV128:
2975 case Iop_CipherLV128:
2976 case Iop_NCipherV128:
2977 case Iop_NCipherLV128:
sewardja6b61f02014-08-17 18:32:14 +00002978 case Iop_Sh8Sx16: case Iop_Sh16Sx8:
2979 case Iop_Sh32Sx4: case Iop_Sh64Sx2:
2980 case Iop_Sh8Ux16: case Iop_Sh16Ux8:
2981 case Iop_Sh32Ux4: case Iop_Sh64Ux2:
2982 case Iop_Rsh8Sx16: case Iop_Rsh16Sx8:
2983 case Iop_Rsh32Sx4: case Iop_Rsh64Sx2:
2984 case Iop_Rsh8Ux16: case Iop_Rsh16Ux8:
2985 case Iop_Rsh32Ux4: case Iop_Rsh64Ux2:
sewardjb183b852006-02-03 16:08:03 +00002986 BINARY(Ity_V128,Ity_V128, Ity_V128);
sewardjc9a43662004-11-30 18:51:59 +00002987
sewardj2fdd4162010-08-22 12:59:02 +00002988 case Iop_PolynomialMull8x8:
2989 case Iop_Mull8Ux8: case Iop_Mull8Sx8:
2990 case Iop_Mull16Ux4: case Iop_Mull16Sx4:
2991 case Iop_Mull32Ux2: case Iop_Mull32Sx2:
2992 BINARY(Ity_I64, Ity_I64, Ity_V128);
2993
sewardjf0c1c582005-02-07 23:47:38 +00002994 case Iop_NotV128:
sewardj1ddee212014-08-24 14:00:19 +00002995 case Iop_RecipEst32Fx4: case Iop_RecipEst32F0x4:
2996 case Iop_RecipEst32Ux4:
2997 case Iop_RSqrtEst32F0x4:
sewardjc1e7dfc2004-12-05 19:29:45 +00002998 case Iop_Sqrt32Fx4: case Iop_Sqrt32F0x4:
sewardj636ad762004-12-07 11:16:04 +00002999 case Iop_Sqrt64Fx2: case Iop_Sqrt64F0x2:
sewardj2e383862004-12-12 16:46:47 +00003000 case Iop_CmpNEZ8x16: case Iop_CmpNEZ16x8:
sewardj109ffdb2004-12-10 21:45:38 +00003001 case Iop_CmpNEZ32x4: case Iop_CmpNEZ64x2:
sewardj2fdd4162010-08-22 12:59:02 +00003002 case Iop_Cnt8x16:
sewardja8c7b0f2014-06-26 08:18:08 +00003003 case Iop_Clz8x16: case Iop_Clz16x8: case Iop_Clz32x4: case Iop_Clz64x2:
3004 case Iop_Cls8x16: case Iop_Cls16x8: case Iop_Cls32x4:
sewardj2fdd4162010-08-22 12:59:02 +00003005 case Iop_PwAddL8Ux16: case Iop_PwAddL16Ux8: case Iop_PwAddL32Ux4:
3006 case Iop_PwAddL8Sx16: case Iop_PwAddL16Sx8: case Iop_PwAddL32Sx4:
sewardj33680352014-06-26 10:49:33 +00003007 case Iop_Reverse8sIn64_x2: case Iop_Reverse16sIn64_x2:
3008 case Iop_Reverse32sIn64_x2:
3009 case Iop_Reverse8sIn32_x4: case Iop_Reverse16sIn32_x4:
3010 case Iop_Reverse8sIn16_x8:
sewardj715d1622014-06-26 12:39:05 +00003011 case Iop_Reverse1sIn8_x16:
sewardjfab09142014-02-10 10:28:13 +00003012 case Iop_Neg64Fx2: case Iop_Neg32Fx4:
sewardj25523c42014-06-15 19:36:29 +00003013 case Iop_Abs8x16: case Iop_Abs16x8: case Iop_Abs32x4: case Iop_Abs64x2:
carll7deaf952013-10-15 18:11:20 +00003014 case Iop_CipherSV128:
carll60c6bac2013-10-18 01:19:06 +00003015 case Iop_PwBitMtxXpose64x2:
sewardjecde6972014-02-05 11:01:19 +00003016 case Iop_ZeroHI64ofV128: case Iop_ZeroHI96ofV128:
3017 case Iop_ZeroHI112ofV128: case Iop_ZeroHI120ofV128:
sewardj0bd7ce62004-12-05 02:47:40 +00003018 UNARY(Ity_V128, Ity_V128);
3019
cerionf887b3e2005-09-13 16:34:28 +00003020 case Iop_ShlV128: case Iop_ShrV128:
sewardjb183b852006-02-03 16:08:03 +00003021 case Iop_ShlN8x16: case Iop_ShlN16x8:
3022 case Iop_ShlN32x4: case Iop_ShlN64x2:
3023 case Iop_ShrN8x16: case Iop_ShrN16x8:
3024 case Iop_ShrN32x4: case Iop_ShrN64x2:
sewardj2fdd4162010-08-22 12:59:02 +00003025 case Iop_SarN8x16: case Iop_SarN16x8:
3026 case Iop_SarN32x4: case Iop_SarN64x2:
sewardj1dd3ec12014-08-15 09:11:08 +00003027 case Iop_QShlNsatUU8x16: case Iop_QShlNsatUU16x8:
3028 case Iop_QShlNsatUU32x4: case Iop_QShlNsatUU64x2:
3029 case Iop_QShlNsatSU8x16: case Iop_QShlNsatSU16x8:
3030 case Iop_QShlNsatSU32x4: case Iop_QShlNsatSU64x2:
3031 case Iop_QShlNsatSS8x16: case Iop_QShlNsatSS16x8:
3032 case Iop_QShlNsatSS32x4: case Iop_QShlNsatSS64x2:
carll7deaf952013-10-15 18:11:20 +00003033 case Iop_SHA256: case Iop_SHA512:
sewardjecedd982014-08-11 14:02:47 +00003034 case Iop_QandQShrNnarrow16Uto8Ux8:
3035 case Iop_QandQShrNnarrow32Uto16Ux4:
3036 case Iop_QandQShrNnarrow64Uto32Ux2:
3037 case Iop_QandQSarNnarrow16Sto8Sx8:
3038 case Iop_QandQSarNnarrow32Sto16Sx4:
3039 case Iop_QandQSarNnarrow64Sto32Sx2:
3040 case Iop_QandQSarNnarrow16Sto8Ux8:
3041 case Iop_QandQSarNnarrow32Sto16Ux4:
3042 case Iop_QandQSarNnarrow64Sto32Ux2:
3043 case Iop_QandQRShrNnarrow16Uto8Ux8:
3044 case Iop_QandQRShrNnarrow32Uto16Ux4:
3045 case Iop_QandQRShrNnarrow64Uto32Ux2:
3046 case Iop_QandQRSarNnarrow16Sto8Sx8:
3047 case Iop_QandQRSarNnarrow32Sto16Sx4:
3048 case Iop_QandQRSarNnarrow64Sto32Sx2:
3049 case Iop_QandQRSarNnarrow16Sto8Ux8:
3050 case Iop_QandQRSarNnarrow32Sto16Ux4:
3051 case Iop_QandQRSarNnarrow64Sto32Ux2:
sewardjb183b852006-02-03 16:08:03 +00003052 BINARY(Ity_V128,Ity_I8, Ity_V128);
sewardj164f9272004-12-09 00:39:32 +00003053
sewardj2fdd4162010-08-22 12:59:02 +00003054 case Iop_F32ToFixed32Ux4_RZ:
3055 case Iop_F32ToFixed32Sx4_RZ:
3056 case Iop_Fixed32UToF32x4_RN:
3057 case Iop_Fixed32SToF32x4_RN:
3058 BINARY(Ity_V128, Ity_I8, Ity_V128);
3059
3060 case Iop_F32ToFixed32Ux2_RZ:
3061 case Iop_F32ToFixed32Sx2_RZ:
3062 case Iop_Fixed32UToF32x2_RN:
3063 case Iop_Fixed32SToF32x2_RN:
3064 BINARY(Ity_I64, Ity_I8, Ity_I64);
3065
3066 case Iop_GetElem8x16:
3067 BINARY(Ity_V128, Ity_I8, Ity_I8);
3068 case Iop_GetElem16x8:
3069 BINARY(Ity_V128, Ity_I8, Ity_I16);
3070 case Iop_GetElem32x4:
3071 BINARY(Ity_V128, Ity_I8, Ity_I32);
3072 case Iop_GetElem64x2:
3073 BINARY(Ity_V128, Ity_I8, Ity_I64);
3074 case Iop_GetElem8x8:
3075 BINARY(Ity_I64, Ity_I8, Ity_I8);
3076 case Iop_GetElem16x4:
3077 BINARY(Ity_I64, Ity_I8, Ity_I16);
3078 case Iop_GetElem32x2:
3079 BINARY(Ity_I64, Ity_I8, Ity_I32);
3080 case Iop_SetElem8x8:
3081 TERNARY(Ity_I64, Ity_I8, Ity_I8, Ity_I64);
3082 case Iop_SetElem16x4:
3083 TERNARY(Ity_I64, Ity_I8, Ity_I16, Ity_I64);
3084 case Iop_SetElem32x2:
3085 TERNARY(Ity_I64, Ity_I8, Ity_I32, Ity_I64);
3086
sewardje6b9bd92014-09-01 11:32:47 +00003087 case Iop_Slice64:
sewardj2fdd4162010-08-22 12:59:02 +00003088 TERNARY(Ity_I64, Ity_I64, Ity_I8, Ity_I64);
sewardje6b9bd92014-09-01 11:32:47 +00003089 case Iop_SliceV128:
sewardj2fdd4162010-08-22 12:59:02 +00003090 TERNARY(Ity_V128, Ity_V128, Ity_I8, Ity_V128);
3091
carll7deaf952013-10-15 18:11:20 +00003092 case Iop_BCDAdd:
3093 case Iop_BCDSub:
3094 TERNARY(Ity_V128,Ity_V128, Ity_I8, Ity_V128);
sewardj51d012a2014-07-21 09:19:50 +00003095 case Iop_QDMull16Sx4: case Iop_QDMull32Sx2:
sewardj2fdd4162010-08-22 12:59:02 +00003096 BINARY(Ity_I64, Ity_I64, Ity_V128);
3097
sewardj9571dc02014-01-26 18:34:23 +00003098 /* s390 specific */
sewardj2019a972011-03-07 16:04:07 +00003099 case Iop_MAddF32:
3100 case Iop_MSubF32:
3101 QUATERNARY(ity_RMode,Ity_F32,Ity_F32,Ity_F32, Ity_F32);
3102
3103 case Iop_F64HLtoF128:
3104 BINARY(Ity_F64,Ity_F64, Ity_F128);
3105
3106 case Iop_F128HItoF64:
3107 case Iop_F128LOtoF64:
3108 UNARY(Ity_F128, Ity_F64);
3109
3110 case Iop_AddF128:
3111 case Iop_SubF128:
3112 case Iop_MulF128:
3113 case Iop_DivF128:
3114 TERNARY(ity_RMode,Ity_F128,Ity_F128, Ity_F128);
3115
sewardj9571dc02014-01-26 18:34:23 +00003116 case Iop_Add64Fx2: case Iop_Sub64Fx2:
3117 case Iop_Mul64Fx2: case Iop_Div64Fx2:
3118 case Iop_Add32Fx4: case Iop_Sub32Fx4:
3119 case Iop_Mul32Fx4: case Iop_Div32Fx4:
3120 TERNARY(ity_RMode,Ity_V128,Ity_V128, Ity_V128);
3121
3122 case Iop_Add64Fx4: case Iop_Sub64Fx4:
3123 case Iop_Mul64Fx4: case Iop_Div64Fx4:
3124 case Iop_Add32Fx8: case Iop_Sub32Fx8:
3125 case Iop_Mul32Fx8: case Iop_Div32Fx8:
3126 TERNARY(ity_RMode,Ity_V256,Ity_V256, Ity_V256);
3127
sewardj2019a972011-03-07 16:04:07 +00003128 case Iop_NegF128:
3129 case Iop_AbsF128:
3130 UNARY(Ity_F128, Ity_F128);
3131
3132 case Iop_SqrtF128:
3133 BINARY(ity_RMode,Ity_F128, Ity_F128);
3134
3135 case Iop_I32StoF128: UNARY(Ity_I32, Ity_F128);
3136 case Iop_I64StoF128: UNARY(Ity_I64, Ity_F128);
3137
florian1c8f7ff2012-09-01 00:12:11 +00003138 case Iop_I32UtoF128: UNARY(Ity_I32, Ity_F128);
3139 case Iop_I64UtoF128: UNARY(Ity_I64, Ity_F128);
3140
sewardj2019a972011-03-07 16:04:07 +00003141 case Iop_F128toI32S: BINARY(ity_RMode,Ity_F128, Ity_I32);
3142 case Iop_F128toI64S: BINARY(ity_RMode,Ity_F128, Ity_I64);
3143
florian1c8f7ff2012-09-01 00:12:11 +00003144 case Iop_F128toI32U: BINARY(ity_RMode,Ity_F128, Ity_I32);
3145 case Iop_F128toI64U: BINARY(ity_RMode,Ity_F128, Ity_I64);
3146
sewardj2019a972011-03-07 16:04:07 +00003147 case Iop_F32toF128: UNARY(Ity_F32, Ity_F128);
3148 case Iop_F64toF128: UNARY(Ity_F64, Ity_F128);
3149
3150 case Iop_F128toF32: BINARY(ity_RMode,Ity_F128, Ity_F32);
3151 case Iop_F128toF64: BINARY(ity_RMode,Ity_F128, Ity_F64);
3152
sewardj26217b02012-04-12 17:19:48 +00003153 case Iop_D32toD64:
florian6dd9f272012-12-19 04:19:54 +00003154 UNARY(Ity_D32, Ity_D64);
3155
sewardjcdc376d2012-04-23 11:21:12 +00003156 case Iop_ExtractExpD64:
carllcea07cc2013-01-22 20:25:31 +00003157 UNARY(Ity_D64, Ity_I64);
sewardj26217b02012-04-12 17:19:48 +00003158
florian4bbd3ec2012-12-27 20:01:13 +00003159 case Iop_ExtractSigD64:
3160 UNARY(Ity_D64, Ity_I64);
3161
sewardjcdc376d2012-04-23 11:21:12 +00003162 case Iop_InsertExpD64:
carllcea07cc2013-01-22 20:25:31 +00003163 BINARY(Ity_I64,Ity_D64, Ity_D64);
sewardjcdc376d2012-04-23 11:21:12 +00003164
3165 case Iop_ExtractExpD128:
carllcea07cc2013-01-22 20:25:31 +00003166 UNARY(Ity_D128, Ity_I64);
sewardjcdc376d2012-04-23 11:21:12 +00003167
carllcea07cc2013-01-22 20:25:31 +00003168 case Iop_ExtractSigD128:
florian4bbd3ec2012-12-27 20:01:13 +00003169 UNARY(Ity_D128, Ity_I64);
3170
sewardjcdc376d2012-04-23 11:21:12 +00003171 case Iop_InsertExpD128:
carllcea07cc2013-01-22 20:25:31 +00003172 BINARY(Ity_I64,Ity_D128, Ity_D128);
sewardjcdc376d2012-04-23 11:21:12 +00003173
sewardj26217b02012-04-12 17:19:48 +00003174 case Iop_D64toD128:
3175 UNARY(Ity_D64, Ity_D128);
3176
sewardj5eff1c52012-04-29 20:19:17 +00003177 case Iop_ReinterpD64asI64:
3178 UNARY(Ity_D64, Ity_I64);
3179
sewardjcdc376d2012-04-23 11:21:12 +00003180 case Iop_ReinterpI64asD64:
3181 UNARY(Ity_I64, Ity_D64);
3182
3183 case Iop_RoundD64toInt:
3184 BINARY(ity_RMode,Ity_D64, Ity_D64);
3185
3186 case Iop_RoundD128toInt:
3187 BINARY(ity_RMode,Ity_D128, Ity_D128);
3188
florianb17e16f2013-01-12 22:02:07 +00003189 case Iop_I32StoD128:
3190 case Iop_I32UtoD128:
3191 UNARY(Ity_I32, Ity_D128);
3192
carllcea07cc2013-01-22 20:25:31 +00003193 case Iop_I64StoD128:
3194 UNARY(Ity_I64, Ity_D128);
sewardj26217b02012-04-12 17:19:48 +00003195
florianb17e16f2013-01-12 22:02:07 +00003196 case Iop_I64UtoD128:
3197 UNARY(Ity_I64, Ity_D128);
3198
sewardj4c96e612012-06-02 23:47:02 +00003199 case Iop_DPBtoBCD:
3200 case Iop_BCDtoDPB:
3201 UNARY(Ity_I64, Ity_I64);
3202
sewardjc6bbd472012-04-02 10:20:48 +00003203 case Iop_D128HItoD64:
3204 case Iop_D128LOtoD64:
3205 UNARY(Ity_D128, Ity_D64);
3206
sewardj26217b02012-04-12 17:19:48 +00003207 case Iop_D128toI64S:
carllcea07cc2013-01-22 20:25:31 +00003208 BINARY(ity_RMode, Ity_D128, Ity_I64);
sewardj26217b02012-04-12 17:19:48 +00003209
florianb17e16f2013-01-12 22:02:07 +00003210 case Iop_D128toI64U:
3211 BINARY(ity_RMode, Ity_D128, Ity_I64);
3212
3213 case Iop_D128toI32S:
3214 case Iop_D128toI32U:
3215 BINARY(ity_RMode, Ity_D128, Ity_I32);
3216
sewardjc6bbd472012-04-02 10:20:48 +00003217 case Iop_D64HLtoD128:
sewardj26217b02012-04-12 17:19:48 +00003218 BINARY(Ity_D64, Ity_D64, Ity_D128);
3219
3220 case Iop_ShlD64:
3221 case Iop_ShrD64:
3222 BINARY(Ity_D64, Ity_I8, Ity_D64 );
3223
florian6dd9f272012-12-19 04:19:54 +00003224 case Iop_D64toD32:
3225 BINARY(ity_RMode, Ity_D64, Ity_D32);
3226
florianb17e16f2013-01-12 22:02:07 +00003227 case Iop_D64toI32S:
3228 case Iop_D64toI32U:
3229 BINARY(ity_RMode, Ity_D64, Ity_I32);
3230
sewardj26217b02012-04-12 17:19:48 +00003231 case Iop_D64toI64S:
carllcea07cc2013-01-22 20:25:31 +00003232 BINARY(ity_RMode, Ity_D64, Ity_I64);
sewardj26217b02012-04-12 17:19:48 +00003233
florianb17e16f2013-01-12 22:02:07 +00003234 case Iop_D64toI64U:
3235 BINARY(ity_RMode, Ity_D64, Ity_I64);
3236
3237 case Iop_I32StoD64:
3238 case Iop_I32UtoD64:
3239 UNARY(Ity_I32, Ity_D64);
3240
carllcea07cc2013-01-22 20:25:31 +00003241 case Iop_I64StoD64:
3242 BINARY(ity_RMode, Ity_I64, Ity_D64);
sewardj26217b02012-04-12 17:19:48 +00003243
florianb17e16f2013-01-12 22:02:07 +00003244 case Iop_I64UtoD64:
3245 BINARY(ity_RMode, Ity_I64, Ity_D64);
3246
florianb22838d2013-06-17 18:59:51 +00003247 case Iop_F32toD32:
3248 BINARY(ity_RMode, Ity_F32, Ity_D32);
3249
3250 case Iop_F32toD64:
3251 BINARY(ity_RMode, Ity_F32, Ity_D64);
3252
3253 case Iop_F32toD128:
3254 BINARY(ity_RMode, Ity_F32, Ity_D128);
3255
3256 case Iop_F64toD32:
3257 BINARY(ity_RMode, Ity_F64, Ity_D32);
3258
florian37c57f32013-05-05 15:04:30 +00003259 case Iop_F64toD64:
3260 BINARY(ity_RMode, Ity_F64, Ity_D64);
3261
florian37c57f32013-05-05 15:04:30 +00003262 case Iop_F64toD128:
3263 BINARY(ity_RMode, Ity_F64, Ity_D128);
3264
florianb22838d2013-06-17 18:59:51 +00003265 case Iop_F128toD32:
3266 BINARY(ity_RMode, Ity_F128, Ity_D32);
3267
3268 case Iop_F128toD64:
3269 BINARY(ity_RMode, Ity_F128, Ity_D64);
florian37c57f32013-05-05 15:04:30 +00003270
3271 case Iop_F128toD128:
3272 BINARY(ity_RMode, Ity_F128, Ity_D128);
3273
florianb22838d2013-06-17 18:59:51 +00003274 case Iop_D32toF32:
3275 BINARY(ity_RMode, Ity_D32, Ity_F32);
3276
3277 case Iop_D32toF64:
3278 BINARY(ity_RMode, Ity_D32, Ity_F64);
3279
3280 case Iop_D32toF128:
3281 BINARY(ity_RMode, Ity_D32, Ity_F128);
3282
3283 case Iop_D64toF32:
3284 BINARY(ity_RMode, Ity_D64, Ity_F32);
3285
3286 case Iop_D64toF64:
3287 BINARY(ity_RMode, Ity_D64, Ity_F64);
3288
3289 case Iop_D64toF128:
3290 BINARY(ity_RMode, Ity_D64, Ity_F128);
3291
3292 case Iop_D128toF32:
3293 BINARY(ity_RMode, Ity_D128, Ity_F32);
3294
3295 case Iop_D128toF64:
3296 BINARY(ity_RMode, Ity_D128, Ity_F64);
3297
florian37c57f32013-05-05 15:04:30 +00003298 case Iop_D128toF128:
3299 BINARY(ity_RMode, Ity_D128, Ity_F128);
3300
sewardjcdc376d2012-04-23 11:21:12 +00003301 case Iop_CmpD64:
florian20c6bca2012-12-26 17:47:19 +00003302 case Iop_CmpExpD64:
sewardjcdc376d2012-04-23 11:21:12 +00003303 BINARY(Ity_D64,Ity_D64, Ity_I32);
3304
3305 case Iop_CmpD128:
florian20c6bca2012-12-26 17:47:19 +00003306 case Iop_CmpExpD128:
sewardjcdc376d2012-04-23 11:21:12 +00003307 BINARY(Ity_D128,Ity_D128, Ity_I32);
3308
3309 case Iop_QuantizeD64:
sewardjcdc376d2012-04-23 11:21:12 +00003310 TERNARY(ity_RMode,Ity_D64,Ity_D64, Ity_D64);
3311
carllcea07cc2013-01-22 20:25:31 +00003312 case Iop_SignificanceRoundD64:
3313 TERNARY(ity_RMode, Ity_I8,Ity_D64, Ity_D64);
3314
sewardjcdc376d2012-04-23 11:21:12 +00003315 case Iop_QuantizeD128:
sewardjcdc376d2012-04-23 11:21:12 +00003316 TERNARY(ity_RMode,Ity_D128,Ity_D128, Ity_D128);
3317
carllcea07cc2013-01-22 20:25:31 +00003318 case Iop_SignificanceRoundD128:
3319 TERNARY(ity_RMode, Ity_I8,Ity_D128, Ity_D128);
3320
sewardj26217b02012-04-12 17:19:48 +00003321 case Iop_ShlD128:
3322 case Iop_ShrD128:
3323 BINARY(Ity_D128, Ity_I8, Ity_D128 );
sewardjc6bbd472012-04-02 10:20:48 +00003324
3325 case Iop_AddD64:
3326 case Iop_SubD64:
3327 case Iop_MulD64:
3328 case Iop_DivD64:
3329 TERNARY( ity_RMode, Ity_D64, Ity_D64, Ity_D64 );
3330
sewardj26217b02012-04-12 17:19:48 +00003331 case Iop_D128toD64:
3332 BINARY( ity_RMode, Ity_D128, Ity_D64 );
3333
sewardjc6bbd472012-04-02 10:20:48 +00003334 case Iop_AddD128:
3335 case Iop_SubD128:
3336 case Iop_MulD128:
3337 case Iop_DivD128:
3338 TERNARY(ity_RMode,Ity_D128,Ity_D128, Ity_D128);
3339
sewardjc4530ae2012-05-21 10:18:49 +00003340 case Iop_V256to64_0: case Iop_V256to64_1:
3341 case Iop_V256to64_2: case Iop_V256to64_3:
3342 UNARY(Ity_V256, Ity_I64);
3343
3344 case Iop_64x4toV256:
3345 QUATERNARY(Ity_I64, Ity_I64, Ity_I64, Ity_I64, Ity_V256);
3346
sewardj2a2bda92012-06-14 23:32:02 +00003347 case Iop_AndV256: case Iop_OrV256:
sewardj4b1cc832012-06-13 11:10:20 +00003348 case Iop_XorV256:
sewardj8eb7ae82012-06-24 14:00:27 +00003349 case Iop_Max32Fx8: case Iop_Min32Fx8:
3350 case Iop_Max64Fx4: case Iop_Min64Fx4:
sewardjcc3d2192013-03-27 11:37:33 +00003351 case Iop_Add8x32: case Iop_Add16x16:
3352 case Iop_Add32x8: case Iop_Add64x4:
3353 case Iop_Sub8x32: case Iop_Sub16x16:
3354 case Iop_Sub32x8: case Iop_Sub64x4:
3355 case Iop_Mul16x16: case Iop_Mul32x8:
3356 case Iop_MulHi16Ux16: case Iop_MulHi16Sx16:
3357 case Iop_Avg8Ux32: case Iop_Avg16Ux16:
3358 case Iop_Max8Sx32: case Iop_Max16Sx16: case Iop_Max32Sx8:
3359 case Iop_Max8Ux32: case Iop_Max16Ux16: case Iop_Max32Ux8:
3360 case Iop_Min8Sx32: case Iop_Min16Sx16: case Iop_Min32Sx8:
3361 case Iop_Min8Ux32: case Iop_Min16Ux16: case Iop_Min32Ux8:
3362 case Iop_CmpEQ8x32: case Iop_CmpEQ16x16:
3363 case Iop_CmpEQ32x8: case Iop_CmpEQ64x4:
3364 case Iop_CmpGT8Sx32: case Iop_CmpGT16Sx16:
3365 case Iop_CmpGT32Sx8: case Iop_CmpGT64Sx4:
3366 case Iop_QAdd8Ux32: case Iop_QAdd16Ux16:
3367 case Iop_QAdd8Sx32: case Iop_QAdd16Sx16:
3368 case Iop_QSub8Ux32: case Iop_QSub16Ux16:
3369 case Iop_QSub8Sx32: case Iop_QSub16Sx16:
3370 case Iop_Perm32x8:
sewardj56c30312012-06-12 08:45:39 +00003371 BINARY(Ity_V256,Ity_V256, Ity_V256);
3372
sewardj4b1cc832012-06-13 11:10:20 +00003373 case Iop_V256toV128_1: case Iop_V256toV128_0:
3374 UNARY(Ity_V256, Ity_V128);
3375
sewardj12972182014-08-04 08:09:47 +00003376 case Iop_QandUQsh8x16: case Iop_QandUQsh16x8:
3377 case Iop_QandUQsh32x4: case Iop_QandUQsh64x2:
3378 case Iop_QandSQsh8x16: case Iop_QandSQsh16x8:
3379 case Iop_QandSQsh32x4: case Iop_QandSQsh64x2:
3380 case Iop_QandUQRsh8x16: case Iop_QandUQRsh16x8:
3381 case Iop_QandUQRsh32x4: case Iop_QandUQRsh64x2:
3382 case Iop_QandSQRsh8x16: case Iop_QandSQRsh16x8:
3383 case Iop_QandSQRsh32x4: case Iop_QandSQRsh64x2:
sewardj4b1cc832012-06-13 11:10:20 +00003384 case Iop_V128HLtoV256:
3385 BINARY(Ity_V128,Ity_V128, Ity_V256);
3386
sewardj2a2bda92012-06-14 23:32:02 +00003387 case Iop_NotV256:
sewardj1ddee212014-08-24 14:00:19 +00003388 case Iop_RSqrtEst32Fx8:
sewardj66becf32012-06-18 23:15:16 +00003389 case Iop_Sqrt32Fx8:
3390 case Iop_Sqrt64Fx4:
sewardj1ddee212014-08-24 14:00:19 +00003391 case Iop_RecipEst32Fx8:
sewardjcc3d2192013-03-27 11:37:33 +00003392 case Iop_CmpNEZ8x32: case Iop_CmpNEZ16x16:
sewardj23db8a02012-06-25 07:46:18 +00003393 case Iop_CmpNEZ64x4: case Iop_CmpNEZ32x8:
sewardj2a2bda92012-06-14 23:32:02 +00003394 UNARY(Ity_V256, Ity_V256);
3395
sewardjcc3d2192013-03-27 11:37:33 +00003396 case Iop_ShlN16x16: case Iop_ShlN32x8:
3397 case Iop_ShlN64x4:
3398 case Iop_ShrN16x16: case Iop_ShrN32x8:
3399 case Iop_ShrN64x4:
3400 case Iop_SarN16x16: case Iop_SarN32x8:
3401 BINARY(Ity_V256,Ity_I8, Ity_V256);
3402
sewardj6efd4a12004-07-15 03:54:23 +00003403 default:
3404 ppIROp(op);
3405 vpanic("typeOfPrimop");
3406 }
3407# undef UNARY
3408# undef BINARY
sewardjb183b852006-02-03 16:08:03 +00003409# undef TERNARY
sewardj6efd4a12004-07-15 03:54:23 +00003410# undef COMPARISON
sewardj0033ddc2005-04-26 23:34:34 +00003411# undef UNARY_COMPARISON
sewardj6efd4a12004-07-15 03:54:23 +00003412}
3413
3414
3415/*---------------------------------------------------------------*/
sewardj695cff92004-10-13 14:50:14 +00003416/*--- Helper functions for the IR -- IR Basic Blocks ---*/
sewardjc97096c2004-06-30 09:28:04 +00003417/*---------------------------------------------------------------*/
3418
sewardjdd40fdf2006-12-24 02:20:24 +00003419void addStmtToIRSB ( IRSB* bb, IRStmt* st )
sewardjd7cb8532004-08-17 23:59:23 +00003420{
3421 Int i;
sewardj695cff92004-10-13 14:50:14 +00003422 if (bb->stmts_used == bb->stmts_size) {
3423 IRStmt** stmts2 = LibVEX_Alloc(2 * bb->stmts_size * sizeof(IRStmt*));
3424 for (i = 0; i < bb->stmts_size; i++)
3425 stmts2[i] = bb->stmts[i];
3426 bb->stmts = stmts2;
3427 bb->stmts_size *= 2;
3428 }
3429 vassert(bb->stmts_used < bb->stmts_size);
3430 bb->stmts[bb->stmts_used] = st;
3431 bb->stmts_used++;
sewardjd7cb8532004-08-17 23:59:23 +00003432}
3433
sewardj695cff92004-10-13 14:50:14 +00003434
3435/*---------------------------------------------------------------*/
3436/*--- Helper functions for the IR -- IR Type Environments ---*/
3437/*---------------------------------------------------------------*/
3438
sewardjd7cb8532004-08-17 23:59:23 +00003439/* Allocate a new IRTemp, given its type. */
sewardje3d0d2e2004-06-27 10:42:44 +00003440
sewardje539a402004-07-14 18:24:17 +00003441IRTemp newIRTemp ( IRTypeEnv* env, IRType ty )
sewardjc97096c2004-06-30 09:28:04 +00003442{
sewardj35421a32004-07-05 13:12:34 +00003443 vassert(env);
sewardje539a402004-07-14 18:24:17 +00003444 vassert(env->types_used >= 0);
3445 vassert(env->types_size >= 0);
3446 vassert(env->types_used <= env->types_size);
3447 if (env->types_used < env->types_size) {
3448 env->types[env->types_used] = ty;
3449 return env->types_used++;
sewardjc97096c2004-06-30 09:28:04 +00003450 } else {
3451 Int i;
sewardje539a402004-07-14 18:24:17 +00003452 Int new_size = env->types_size==0 ? 8 : 2*env->types_size;
3453 IRType* new_types
3454 = LibVEX_Alloc(new_size * sizeof(IRType));
3455 for (i = 0; i < env->types_used; i++)
3456 new_types[i] = env->types[i];
3457 env->types = new_types;
3458 env->types_size = new_size;
3459 return newIRTemp(env, ty);
sewardjc97096c2004-06-30 09:28:04 +00003460 }
3461}
3462
3463
sewardj17442fe2004-09-20 14:54:28 +00003464/*---------------------------------------------------------------*/
3465/*--- Helper functions for the IR -- finding types of exprs ---*/
3466/*---------------------------------------------------------------*/
3467
sewardjedeb4c42004-09-21 23:39:25 +00003468inline
florian0b70efa2014-09-21 21:53:39 +00003469IRType typeOfIRTemp ( const IRTypeEnv* env, IRTemp tmp )
sewardjc97096c2004-06-30 09:28:04 +00003470{
sewardje539a402004-07-14 18:24:17 +00003471 vassert(tmp >= 0);
3472 vassert(tmp < env->types_used);
3473 return env->types[tmp];
sewardjc97096c2004-06-30 09:28:04 +00003474}
3475
florian0b70efa2014-09-21 21:53:39 +00003476IRType typeOfIRConst ( const IRConst* con )
sewardj6efd4a12004-07-15 03:54:23 +00003477{
3478 switch (con->tag) {
sewardjba999312004-11-15 15:21:17 +00003479 case Ico_U1: return Ity_I1;
sewardj207557a2004-08-27 12:00:18 +00003480 case Ico_U8: return Ity_I8;
3481 case Ico_U16: return Ity_I16;
3482 case Ico_U32: return Ity_I32;
3483 case Ico_U64: return Ity_I64;
sewardj2019a972011-03-07 16:04:07 +00003484 case Ico_F32: return Ity_F32;
3485 case Ico_F32i: return Ity_F32;
sewardj207557a2004-08-27 12:00:18 +00003486 case Ico_F64: return Ity_F64;
sewardj17442fe2004-09-20 14:54:28 +00003487 case Ico_F64i: return Ity_F64;
sewardj1e6ad742004-12-02 16:16:11 +00003488 case Ico_V128: return Ity_V128;
sewardj37a505b2012-06-29 15:28:24 +00003489 case Ico_V256: return Ity_V256;
sewardj6efd4a12004-07-15 03:54:23 +00003490 default: vpanic("typeOfIRConst");
3491 }
3492}
3493
sewardjcfe046e2013-01-17 14:23:53 +00003494void typeOfIRLoadGOp ( IRLoadGOp cvt,
3495 /*OUT*/IRType* t_res, /*OUT*/IRType* t_arg )
3496{
3497 switch (cvt) {
3498 case ILGop_Ident32:
3499 *t_res = Ity_I32; *t_arg = Ity_I32; break;
3500 case ILGop_16Uto32: case ILGop_16Sto32:
3501 *t_res = Ity_I32; *t_arg = Ity_I16; break;
3502 case ILGop_8Uto32: case ILGop_8Sto32:
3503 *t_res = Ity_I32; *t_arg = Ity_I8; break;
3504 default:
3505 vpanic("typeOfIRLoadGOp");
3506 }
3507}
3508
florian0b70efa2014-09-21 21:53:39 +00003509IRType typeOfIRExpr ( const IRTypeEnv* tyenv, const IRExpr* e )
sewardjc97096c2004-06-30 09:28:04 +00003510{
sewardj40c80262006-02-08 19:30:46 +00003511 IRType t_dst, t_arg1, t_arg2, t_arg3, t_arg4;
sewardjedeb4c42004-09-21 23:39:25 +00003512 start:
sewardjc97096c2004-06-30 09:28:04 +00003513 switch (e->tag) {
sewardjaf1ceca2005-06-30 23:31:27 +00003514 case Iex_Load:
3515 return e->Iex.Load.ty;
sewardjfbcaf332004-07-08 01:46:01 +00003516 case Iex_Get:
3517 return e->Iex.Get.ty;
sewardjbb53f8c2004-08-14 11:50:01 +00003518 case Iex_GetI:
sewardj2d3f77c2004-09-22 23:49:09 +00003519 return e->Iex.GetI.descr->elemTy;
sewardjdd40fdf2006-12-24 02:20:24 +00003520 case Iex_RdTmp:
3521 return typeOfIRTemp(tyenv, e->Iex.RdTmp.tmp);
sewardjc97096c2004-06-30 09:28:04 +00003522 case Iex_Const:
sewardj695cff92004-10-13 14:50:14 +00003523 return typeOfIRConst(e->Iex.Const.con);
sewardj40c80262006-02-08 19:30:46 +00003524 case Iex_Qop:
florian96d7cc32012-06-01 20:41:24 +00003525 typeOfPrimop(e->Iex.Qop.details->op,
sewardj40c80262006-02-08 19:30:46 +00003526 &t_dst, &t_arg1, &t_arg2, &t_arg3, &t_arg4);
3527 return t_dst;
sewardjb183b852006-02-03 16:08:03 +00003528 case Iex_Triop:
florian420bfa92012-06-02 20:29:22 +00003529 typeOfPrimop(e->Iex.Triop.details->op,
sewardj40c80262006-02-08 19:30:46 +00003530 &t_dst, &t_arg1, &t_arg2, &t_arg3, &t_arg4);
sewardjb183b852006-02-03 16:08:03 +00003531 return t_dst;
sewardjc97096c2004-06-30 09:28:04 +00003532 case Iex_Binop:
sewardj40c80262006-02-08 19:30:46 +00003533 typeOfPrimop(e->Iex.Binop.op,
3534 &t_dst, &t_arg1, &t_arg2, &t_arg3, &t_arg4);
sewardj6efd4a12004-07-15 03:54:23 +00003535 return t_dst;
3536 case Iex_Unop:
sewardj40c80262006-02-08 19:30:46 +00003537 typeOfPrimop(e->Iex.Unop.op,
3538 &t_dst, &t_arg1, &t_arg2, &t_arg3, &t_arg4);
sewardj6efd4a12004-07-15 03:54:23 +00003539 return t_dst;
3540 case Iex_CCall:
3541 return e->Iex.CCall.retty;
florian99dd03e2013-01-29 03:56:06 +00003542 case Iex_ITE:
3543 e = e->Iex.ITE.iffalse;
sewardjedeb4c42004-09-21 23:39:25 +00003544 goto start;
florian99dd03e2013-01-29 03:56:06 +00003545 /* return typeOfIRExpr(tyenv, e->Iex.ITE.iffalse); */
sewardj443cd9d2004-07-18 23:06:45 +00003546 case Iex_Binder:
3547 vpanic("typeOfIRExpr: Binder is not a valid expression");
florian90419562013-08-15 20:54:52 +00003548 case Iex_VECRET:
3549 vpanic("typeOfIRExpr: VECRET is not a valid expression");
3550 case Iex_BBPTR:
3551 vpanic("typeOfIRExpr: BBPTR is not a valid expression");
sewardjc97096c2004-06-30 09:28:04 +00003552 default:
sewardj6efd4a12004-07-15 03:54:23 +00003553 ppIRExpr(e);
3554 vpanic("typeOfIRExpr");
sewardjc97096c2004-06-30 09:28:04 +00003555 }
sewardjc97096c2004-06-30 09:28:04 +00003556}
sewardj887a11a2004-07-05 17:26:47 +00003557
sewardj6d2638e2004-07-15 09:38:27 +00003558/* Is this any value actually in the enumeration 'IRType' ? */
sewardj496a58d2005-03-20 18:44:44 +00003559Bool isPlausibleIRType ( IRType ty )
sewardj6d2638e2004-07-15 09:38:27 +00003560{
3561 switch (ty) {
sewardjba999312004-11-15 15:21:17 +00003562 case Ity_INVALID: case Ity_I1:
sewardj9b967672005-02-08 11:13:09 +00003563 case Ity_I8: case Ity_I16: case Ity_I32:
3564 case Ity_I64: case Ity_I128:
sewardj2019a972011-03-07 16:04:07 +00003565 case Ity_F32: case Ity_F64: case Ity_F128:
sewardjc6bbd472012-04-02 10:20:48 +00003566 case Ity_D32: case Ity_D64: case Ity_D128:
sewardjc4530ae2012-05-21 10:18:49 +00003567 case Ity_V128: case Ity_V256:
sewardj6d2638e2004-07-15 09:38:27 +00003568 return True;
3569 default:
3570 return False;
3571 }
3572}
3573
sewardj6efd4a12004-07-15 03:54:23 +00003574
sewardj887a11a2004-07-05 17:26:47 +00003575/*---------------------------------------------------------------*/
sewardjcf787902004-11-03 09:08:33 +00003576/*--- Sanity checking -- FLATNESS ---*/
3577/*---------------------------------------------------------------*/
3578
3579/* Check that the canonical flatness constraints hold on an
3580 IRStmt. The only place where any expression is allowed to be
3581 non-atomic is the RHS of IRStmt_Tmp. */
3582
3583/* Relies on:
3584 inline static Bool isAtom ( IRExpr* e ) {
sewardjdd40fdf2006-12-24 02:20:24 +00003585 return e->tag == Iex_RdTmp || e->tag == Iex_Const;
sewardjcf787902004-11-03 09:08:33 +00003586 }
3587*/
3588
florian0b70efa2014-09-21 21:53:39 +00003589static inline Bool isIRAtom_or_VECRET_or_BBPTR ( const IRExpr* e )
3590{
florian90419562013-08-15 20:54:52 +00003591 if (isIRAtom(e)) {
3592 return True;
3593 }
3594
3595 return UNLIKELY(is_IRExpr_VECRET_or_BBPTR(e));
sewardj74142b82013-08-08 10:28:59 +00003596}
3597
florian0b70efa2014-09-21 21:53:39 +00003598Bool isFlatIRStmt ( const IRStmt* st )
sewardjcf787902004-11-03 09:08:33 +00003599{
3600 Int i;
florian0b70efa2014-09-21 21:53:39 +00003601 const IRExpr* e;
3602 const IRQop* qop;
3603 const IRTriop* triop;
sewardjcf787902004-11-03 09:08:33 +00003604
3605 switch (st->tag) {
sewardj5a9ffab2005-05-12 17:55:01 +00003606 case Ist_AbiHint:
sewardj478646f2008-05-01 20:13:04 +00003607 return isIRAtom(st->Ist.AbiHint.base)
3608 && isIRAtom(st->Ist.AbiHint.nia);
sewardjcf787902004-11-03 09:08:33 +00003609 case Ist_Put:
sewardj496a58d2005-03-20 18:44:44 +00003610 return isIRAtom(st->Ist.Put.data);
florian0b70efa2014-09-21 21:53:39 +00003611 case Ist_PutI: {
3612 const IRPutI *puti = st->Ist.PutI.details;
floriand6f38b32012-05-31 15:46:18 +00003613 return toBool( isIRAtom(puti->ix)
3614 && isIRAtom(puti->data) );
florian0b70efa2014-09-21 21:53:39 +00003615 }
sewardjdd40fdf2006-12-24 02:20:24 +00003616 case Ist_WrTmp:
sewardjcf787902004-11-03 09:08:33 +00003617 /* This is the only interesting case. The RHS can be any
3618 expression, *but* all its subexpressions *must* be
3619 atoms. */
sewardjdd40fdf2006-12-24 02:20:24 +00003620 e = st->Ist.WrTmp.data;
sewardjcf787902004-11-03 09:08:33 +00003621 switch (e->tag) {
3622 case Iex_Binder: return True;
3623 case Iex_Get: return True;
sewardj496a58d2005-03-20 18:44:44 +00003624 case Iex_GetI: return isIRAtom(e->Iex.GetI.ix);
sewardjdd40fdf2006-12-24 02:20:24 +00003625 case Iex_RdTmp: return True;
florian96d7cc32012-06-01 20:41:24 +00003626 case Iex_Qop: qop = e->Iex.Qop.details;
3627 return toBool(
3628 isIRAtom(qop->arg1)
3629 && isIRAtom(qop->arg2)
3630 && isIRAtom(qop->arg3)
3631 && isIRAtom(qop->arg4));
florian420bfa92012-06-02 20:29:22 +00003632 case Iex_Triop: triop = e->Iex.Triop.details;
3633 return toBool(
3634 isIRAtom(triop->arg1)
3635 && isIRAtom(triop->arg2)
3636 && isIRAtom(triop->arg3));
sewardja98bf492005-02-07 01:39:17 +00003637 case Iex_Binop: return toBool(
sewardj496a58d2005-03-20 18:44:44 +00003638 isIRAtom(e->Iex.Binop.arg1)
3639 && isIRAtom(e->Iex.Binop.arg2));
3640 case Iex_Unop: return isIRAtom(e->Iex.Unop.arg);
sewardjaf1ceca2005-06-30 23:31:27 +00003641 case Iex_Load: return isIRAtom(e->Iex.Load.addr);
sewardjcf787902004-11-03 09:08:33 +00003642 case Iex_Const: return True;
3643 case Iex_CCall: for (i = 0; e->Iex.CCall.args[i]; i++)
sewardj496a58d2005-03-20 18:44:44 +00003644 if (!isIRAtom(e->Iex.CCall.args[i]))
sewardjcf787902004-11-03 09:08:33 +00003645 return False;
3646 return True;
florian99dd03e2013-01-29 03:56:06 +00003647 case Iex_ITE: return toBool (
3648 isIRAtom(e->Iex.ITE.cond)
3649 && isIRAtom(e->Iex.ITE.iftrue)
3650 && isIRAtom(e->Iex.ITE.iffalse));
sewardjcf787902004-11-03 09:08:33 +00003651 default: vpanic("isFlatIRStmt(e)");
3652 }
3653 /*notreached*/
3654 vassert(0);
sewardjaf1ceca2005-06-30 23:31:27 +00003655 case Ist_Store:
3656 return toBool( isIRAtom(st->Ist.Store.addr)
3657 && isIRAtom(st->Ist.Store.data) );
sewardjcfe046e2013-01-17 14:23:53 +00003658 case Ist_StoreG: {
florian0b70efa2014-09-21 21:53:39 +00003659 const IRStoreG* sg = st->Ist.StoreG.details;
sewardjcfe046e2013-01-17 14:23:53 +00003660 return toBool( isIRAtom(sg->addr)
3661 && isIRAtom(sg->data) && isIRAtom(sg->guard) );
3662 }
3663 case Ist_LoadG: {
florian0b70efa2014-09-21 21:53:39 +00003664 const IRLoadG* lg = st->Ist.LoadG.details;
sewardjcfe046e2013-01-17 14:23:53 +00003665 return toBool( isIRAtom(lg->addr)
3666 && isIRAtom(lg->alt) && isIRAtom(lg->guard) );
3667 }
florian0b70efa2014-09-21 21:53:39 +00003668 case Ist_CAS: {
3669 const IRCAS* cas = st->Ist.CAS.details;
sewardje9d8a262009-07-01 08:06:34 +00003670 return toBool( isIRAtom(cas->addr)
3671 && (cas->expdHi ? isIRAtom(cas->expdHi) : True)
3672 && isIRAtom(cas->expdLo)
3673 && (cas->dataHi ? isIRAtom(cas->dataHi) : True)
3674 && isIRAtom(cas->dataLo) );
florian0b70efa2014-09-21 21:53:39 +00003675 }
sewardje768e922009-11-26 17:17:37 +00003676 case Ist_LLSC:
3677 return toBool( isIRAtom(st->Ist.LLSC.addr)
3678 && (st->Ist.LLSC.storedata
3679 ? isIRAtom(st->Ist.LLSC.storedata) : True) );
florian0b70efa2014-09-21 21:53:39 +00003680 case Ist_Dirty: {
3681 const IRDirty* di = st->Ist.Dirty.details;
sewardj496a58d2005-03-20 18:44:44 +00003682 if (!isIRAtom(di->guard))
sewardjcf787902004-11-03 09:08:33 +00003683 return False;
3684 for (i = 0; di->args[i]; i++)
sewardj74142b82013-08-08 10:28:59 +00003685 if (!isIRAtom_or_VECRET_or_BBPTR(di->args[i]))
sewardjcf787902004-11-03 09:08:33 +00003686 return False;
sewardj496a58d2005-03-20 18:44:44 +00003687 if (di->mAddr && !isIRAtom(di->mAddr))
sewardjcf787902004-11-03 09:08:33 +00003688 return False;
3689 return True;
florian0b70efa2014-09-21 21:53:39 +00003690 }
sewardjd2445f62005-03-21 00:15:53 +00003691 case Ist_NoOp:
sewardjf1689312005-03-16 18:19:10 +00003692 case Ist_IMark:
sewardjc4356f02007-11-09 21:15:04 +00003693 case Ist_MBE:
sewardj3e838932005-01-07 12:09:15 +00003694 return True;
sewardjcf787902004-11-03 09:08:33 +00003695 case Ist_Exit:
sewardj496a58d2005-03-20 18:44:44 +00003696 return isIRAtom(st->Ist.Exit.guard);
sewardjcf787902004-11-03 09:08:33 +00003697 default:
3698 vpanic("isFlatIRStmt(st)");
3699 }
3700}
3701
3702
3703/*---------------------------------------------------------------*/
sewardje539a402004-07-14 18:24:17 +00003704/*--- Sanity checking ---*/
3705/*---------------------------------------------------------------*/
3706
3707/* Checks:
3708
3709 Everything is type-consistent. No ill-typed anything.
sewardj35439212004-07-14 22:36:10 +00003710 The target address at the end of the BB is a 32- or 64-
3711 bit expression, depending on the guest's word size.
sewardje539a402004-07-14 18:24:17 +00003712
3713 Each temp is assigned only once, before its uses.
sewardjc13e2ed2004-10-31 21:44:54 +00003714*/
3715
3716static inline Int countArgs ( IRExpr** args )
3717{
3718 Int i;
3719 for (i = 0; args[i]; i++)
3720 ;
3721 return i;
3722}
sewardje539a402004-07-14 18:24:17 +00003723
sewardj35439212004-07-14 22:36:10 +00003724static
3725__attribute((noreturn))
florian0b70efa2014-09-21 21:53:39 +00003726void sanityCheckFail ( const IRSB* bb, const IRStmt* stmt, const HChar* what )
sewardje539a402004-07-14 18:24:17 +00003727{
sewardj35439212004-07-14 22:36:10 +00003728 vex_printf("\nIR SANITY CHECK FAILURE\n\n");
sewardjdd40fdf2006-12-24 02:20:24 +00003729 ppIRSB(bb);
sewardj35439212004-07-14 22:36:10 +00003730 if (stmt) {
3731 vex_printf("\nIN STATEMENT:\n\n");
3732 ppIRStmt(stmt);
3733 }
3734 vex_printf("\n\nERROR = %s\n\n", what );
3735 vpanic("sanityCheckFail: exiting due to bad IR");
3736}
3737
florian0b70efa2014-09-21 21:53:39 +00003738static Bool saneIRRegArray ( const IRRegArray* arr )
sewardj2d3f77c2004-09-22 23:49:09 +00003739{
3740 if (arr->base < 0 || arr->base > 10000 /* somewhat arbitrary */)
3741 return False;
sewardjba999312004-11-15 15:21:17 +00003742 if (arr->elemTy == Ity_I1)
sewardj2d3f77c2004-09-22 23:49:09 +00003743 return False;
3744 if (arr->nElems <= 0 || arr->nElems > 500 /* somewhat arbitrary */)
3745 return False;
3746 return True;
3747}
3748
florian0b70efa2014-09-21 21:53:39 +00003749static Bool saneIRCallee ( const IRCallee* cee )
sewardj8ea867b2004-10-30 19:03:02 +00003750{
3751 if (cee->name == NULL)
3752 return False;
3753 if (cee->addr == 0)
3754 return False;
sewardj77352542004-10-30 20:39:01 +00003755 if (cee->regparms < 0 || cee->regparms > 3)
sewardj8ea867b2004-10-30 19:03:02 +00003756 return False;
3757 return True;
3758}
3759
florian0b70efa2014-09-21 21:53:39 +00003760static Bool saneIRConst ( const IRConst* con )
sewardj49bfe672004-11-15 15:46:26 +00003761{
3762 switch (con->tag) {
3763 case Ico_U1:
sewardja98bf492005-02-07 01:39:17 +00003764 return toBool( con->Ico.U1 == True || con->Ico.U1 == False );
sewardj49bfe672004-11-15 15:46:26 +00003765 default:
3766 /* Is there anything we can meaningfully check? I don't
3767 think so. */
3768 return True;
3769 }
3770}
sewardj35439212004-07-14 22:36:10 +00003771
3772/* Traverse a Stmt/Expr, inspecting IRTemp uses. Report any out of
3773 range ones. Report any which are read and for which the current
3774 def_count is zero. */
3775
3776static
florian0b70efa2014-09-21 21:53:39 +00003777void useBeforeDef_Temp ( const IRSB* bb, const IRStmt* stmt, IRTemp tmp,
3778 Int* def_counts )
sewardj17442fe2004-09-20 14:54:28 +00003779{
3780 if (tmp < 0 || tmp >= bb->tyenv->types_used)
3781 sanityCheckFail(bb,stmt, "out of range Temp in IRExpr");
3782 if (def_counts[tmp] < 1)
3783 sanityCheckFail(bb,stmt, "IRTemp use before def in IRExpr");
3784}
3785
3786static
florian0b70efa2014-09-21 21:53:39 +00003787void useBeforeDef_Expr ( const IRSB* bb, const IRStmt* stmt,
3788 const IRExpr* expr, Int* def_counts )
sewardj35439212004-07-14 22:36:10 +00003789{
3790 Int i;
3791 switch (expr->tag) {
3792 case Iex_Get:
3793 break;
sewardjbb53f8c2004-08-14 11:50:01 +00003794 case Iex_GetI:
sewardjeeac8412004-11-02 00:26:55 +00003795 useBeforeDef_Expr(bb,stmt,expr->Iex.GetI.ix,def_counts);
sewardjbb53f8c2004-08-14 11:50:01 +00003796 break;
sewardjdd40fdf2006-12-24 02:20:24 +00003797 case Iex_RdTmp:
3798 useBeforeDef_Temp(bb,stmt,expr->Iex.RdTmp.tmp,def_counts);
sewardj35439212004-07-14 22:36:10 +00003799 break;
florian96d7cc32012-06-01 20:41:24 +00003800 case Iex_Qop: {
florian0b70efa2014-09-21 21:53:39 +00003801 const IRQop* qop = expr->Iex.Qop.details;
florian96d7cc32012-06-01 20:41:24 +00003802 useBeforeDef_Expr(bb,stmt,qop->arg1,def_counts);
3803 useBeforeDef_Expr(bb,stmt,qop->arg2,def_counts);
3804 useBeforeDef_Expr(bb,stmt,qop->arg3,def_counts);
3805 useBeforeDef_Expr(bb,stmt,qop->arg4,def_counts);
sewardj40c80262006-02-08 19:30:46 +00003806 break;
florian96d7cc32012-06-01 20:41:24 +00003807 }
florian420bfa92012-06-02 20:29:22 +00003808 case Iex_Triop: {
florian0b70efa2014-09-21 21:53:39 +00003809 const IRTriop* triop = expr->Iex.Triop.details;
florian420bfa92012-06-02 20:29:22 +00003810 useBeforeDef_Expr(bb,stmt,triop->arg1,def_counts);
3811 useBeforeDef_Expr(bb,stmt,triop->arg2,def_counts);
3812 useBeforeDef_Expr(bb,stmt,triop->arg3,def_counts);
sewardjb183b852006-02-03 16:08:03 +00003813 break;
florian420bfa92012-06-02 20:29:22 +00003814 }
sewardj35439212004-07-14 22:36:10 +00003815 case Iex_Binop:
3816 useBeforeDef_Expr(bb,stmt,expr->Iex.Binop.arg1,def_counts);
3817 useBeforeDef_Expr(bb,stmt,expr->Iex.Binop.arg2,def_counts);
3818 break;
3819 case Iex_Unop:
3820 useBeforeDef_Expr(bb,stmt,expr->Iex.Unop.arg,def_counts);
3821 break;
sewardjaf1ceca2005-06-30 23:31:27 +00003822 case Iex_Load:
3823 useBeforeDef_Expr(bb,stmt,expr->Iex.Load.addr,def_counts);
sewardj35439212004-07-14 22:36:10 +00003824 break;
3825 case Iex_Const:
3826 break;
3827 case Iex_CCall:
sewardj74142b82013-08-08 10:28:59 +00003828 for (i = 0; expr->Iex.CCall.args[i]; i++) {
florian0b70efa2014-09-21 21:53:39 +00003829 const IRExpr* arg = expr->Iex.CCall.args[i];
florian90419562013-08-15 20:54:52 +00003830 if (UNLIKELY(is_IRExpr_VECRET_or_BBPTR(arg))) {
sewardj74142b82013-08-08 10:28:59 +00003831 /* These aren't allowed in CCall lists. Let's detect
3832 and throw them out here, though, rather than
3833 segfaulting a bit later on. */
3834 sanityCheckFail(bb,stmt, "IRExprP__* value in CCall arg list");
3835 } else {
3836 useBeforeDef_Expr(bb,stmt,arg,def_counts);
3837 }
3838 }
sewardj35439212004-07-14 22:36:10 +00003839 break;
florian99dd03e2013-01-29 03:56:06 +00003840 case Iex_ITE:
3841 useBeforeDef_Expr(bb,stmt,expr->Iex.ITE.cond,def_counts);
3842 useBeforeDef_Expr(bb,stmt,expr->Iex.ITE.iftrue,def_counts);
3843 useBeforeDef_Expr(bb,stmt,expr->Iex.ITE.iffalse,def_counts);
sewardjeeb9ef82004-07-15 12:39:03 +00003844 break;
3845 default:
3846 vpanic("useBeforeDef_Expr");
sewardj35439212004-07-14 22:36:10 +00003847 }
3848}
3849
3850static
florian0b70efa2014-09-21 21:53:39 +00003851void useBeforeDef_Stmt ( const IRSB* bb, const IRStmt* stmt, Int* def_counts )
sewardj35439212004-07-14 22:36:10 +00003852{
sewardjcfe046e2013-01-17 14:23:53 +00003853 Int i;
florian0b70efa2014-09-21 21:53:39 +00003854 const IRDirty* d;
3855 const IRCAS* cas;
3856 const IRPutI* puti;
3857 const IRLoadG* lg;
3858 const IRStoreG* sg;
sewardj35439212004-07-14 22:36:10 +00003859 switch (stmt->tag) {
sewardjf1689312005-03-16 18:19:10 +00003860 case Ist_IMark:
3861 break;
sewardj5a9ffab2005-05-12 17:55:01 +00003862 case Ist_AbiHint:
3863 useBeforeDef_Expr(bb,stmt,stmt->Ist.AbiHint.base,def_counts);
sewardj478646f2008-05-01 20:13:04 +00003864 useBeforeDef_Expr(bb,stmt,stmt->Ist.AbiHint.nia,def_counts);
sewardj5a9ffab2005-05-12 17:55:01 +00003865 break;
sewardj35439212004-07-14 22:36:10 +00003866 case Ist_Put:
sewardj6d076362004-09-23 11:06:17 +00003867 useBeforeDef_Expr(bb,stmt,stmt->Ist.Put.data,def_counts);
sewardj35439212004-07-14 22:36:10 +00003868 break;
sewardjd1725d12004-08-12 20:46:53 +00003869 case Ist_PutI:
floriand6f38b32012-05-31 15:46:18 +00003870 puti = stmt->Ist.PutI.details;
3871 useBeforeDef_Expr(bb,stmt,puti->ix,def_counts);
3872 useBeforeDef_Expr(bb,stmt,puti->data,def_counts);
sewardjd1725d12004-08-12 20:46:53 +00003873 break;
sewardjdd40fdf2006-12-24 02:20:24 +00003874 case Ist_WrTmp:
3875 useBeforeDef_Expr(bb,stmt,stmt->Ist.WrTmp.data,def_counts);
sewardj35439212004-07-14 22:36:10 +00003876 break;
sewardjaf1ceca2005-06-30 23:31:27 +00003877 case Ist_Store:
3878 useBeforeDef_Expr(bb,stmt,stmt->Ist.Store.addr,def_counts);
3879 useBeforeDef_Expr(bb,stmt,stmt->Ist.Store.data,def_counts);
sewardj35439212004-07-14 22:36:10 +00003880 break;
sewardjcfe046e2013-01-17 14:23:53 +00003881 case Ist_StoreG:
3882 sg = stmt->Ist.StoreG.details;
3883 useBeforeDef_Expr(bb,stmt,sg->addr,def_counts);
3884 useBeforeDef_Expr(bb,stmt,sg->data,def_counts);
3885 useBeforeDef_Expr(bb,stmt,sg->guard,def_counts);
3886 break;
3887 case Ist_LoadG:
3888 lg = stmt->Ist.LoadG.details;
3889 useBeforeDef_Expr(bb,stmt,lg->addr,def_counts);
3890 useBeforeDef_Expr(bb,stmt,lg->alt,def_counts);
3891 useBeforeDef_Expr(bb,stmt,lg->guard,def_counts);
3892 break;
sewardje9d8a262009-07-01 08:06:34 +00003893 case Ist_CAS:
3894 cas = stmt->Ist.CAS.details;
3895 useBeforeDef_Expr(bb,stmt,cas->addr,def_counts);
3896 if (cas->expdHi)
3897 useBeforeDef_Expr(bb,stmt,cas->expdHi,def_counts);
3898 useBeforeDef_Expr(bb,stmt,cas->expdLo,def_counts);
3899 if (cas->dataHi)
3900 useBeforeDef_Expr(bb,stmt,cas->dataHi,def_counts);
3901 useBeforeDef_Expr(bb,stmt,cas->dataLo,def_counts);
3902 break;
sewardje768e922009-11-26 17:17:37 +00003903 case Ist_LLSC:
3904 useBeforeDef_Expr(bb,stmt,stmt->Ist.LLSC.addr,def_counts);
3905 if (stmt->Ist.LLSC.storedata != NULL)
3906 useBeforeDef_Expr(bb,stmt,stmt->Ist.LLSC.storedata,def_counts);
3907 break;
sewardj17442fe2004-09-20 14:54:28 +00003908 case Ist_Dirty:
3909 d = stmt->Ist.Dirty.details;
sewardj74142b82013-08-08 10:28:59 +00003910 for (i = 0; d->args[i] != NULL; i++) {
3911 IRExpr* arg = d->args[i];
florian90419562013-08-15 20:54:52 +00003912 if (UNLIKELY(is_IRExpr_VECRET_or_BBPTR(arg))) {
sewardj74142b82013-08-08 10:28:59 +00003913 /* This is ensured by isFlatIRStmt */
florian90419562013-08-15 20:54:52 +00003914 ;
sewardj74142b82013-08-08 10:28:59 +00003915 } else {
3916 useBeforeDef_Expr(bb,stmt,arg,def_counts);
3917 }
3918 }
sewardj17442fe2004-09-20 14:54:28 +00003919 if (d->mFx != Ifx_None)
3920 useBeforeDef_Expr(bb,stmt,d->mAddr,def_counts);
3921 break;
sewardjd2445f62005-03-21 00:15:53 +00003922 case Ist_NoOp:
sewardjc4356f02007-11-09 21:15:04 +00003923 case Ist_MBE:
sewardj3e838932005-01-07 12:09:15 +00003924 break;
sewardj35439212004-07-14 22:36:10 +00003925 case Ist_Exit:
sewardj0276d4b2004-11-15 15:30:21 +00003926 useBeforeDef_Expr(bb,stmt,stmt->Ist.Exit.guard,def_counts);
sewardj35439212004-07-14 22:36:10 +00003927 break;
3928 default:
3929 vpanic("useBeforeDef_Stmt");
3930 }
3931}
3932
sewardj6efd4a12004-07-15 03:54:23 +00003933static
florian0b70efa2014-09-21 21:53:39 +00003934void tcExpr ( const IRSB* bb, const IRStmt* stmt, const IRExpr* expr,
3935 IRType gWordTy )
sewardj6efd4a12004-07-15 03:54:23 +00003936{
3937 Int i;
sewardj40c80262006-02-08 19:30:46 +00003938 IRType t_dst, t_arg1, t_arg2, t_arg3, t_arg4;
florian0b70efa2014-09-21 21:53:39 +00003939 const IRTypeEnv* tyenv = bb->tyenv;
sewardj6efd4a12004-07-15 03:54:23 +00003940 switch (expr->tag) {
3941 case Iex_Get:
sewardjdd40fdf2006-12-24 02:20:24 +00003942 case Iex_RdTmp:
sewardj6efd4a12004-07-15 03:54:23 +00003943 break;
sewardjbb53f8c2004-08-14 11:50:01 +00003944 case Iex_GetI:
sewardjeeac8412004-11-02 00:26:55 +00003945 tcExpr(bb,stmt, expr->Iex.GetI.ix, gWordTy );
3946 if (typeOfIRExpr(tyenv,expr->Iex.GetI.ix) != Ity_I32)
3947 sanityCheckFail(bb,stmt,"IRExpr.GetI.ix: not :: Ity_I32");
sewardjdd40fdf2006-12-24 02:20:24 +00003948 if (!saneIRRegArray(expr->Iex.GetI.descr))
sewardj2d3f77c2004-09-22 23:49:09 +00003949 sanityCheckFail(bb,stmt,"IRExpr.GetI.descr: invalid descr");
sewardjbb53f8c2004-08-14 11:50:01 +00003950 break;
sewardj40c80262006-02-08 19:30:46 +00003951 case Iex_Qop: {
3952 IRType ttarg1, ttarg2, ttarg3, ttarg4;
florian0b70efa2014-09-21 21:53:39 +00003953 const IRQop* qop = expr->Iex.Qop.details;
florian96d7cc32012-06-01 20:41:24 +00003954 tcExpr(bb,stmt, qop->arg1, gWordTy );
3955 tcExpr(bb,stmt, qop->arg2, gWordTy );
3956 tcExpr(bb,stmt, qop->arg3, gWordTy );
3957 tcExpr(bb,stmt, qop->arg4, gWordTy );
3958 typeOfPrimop(qop->op,
sewardj40c80262006-02-08 19:30:46 +00003959 &t_dst, &t_arg1, &t_arg2, &t_arg3, &t_arg4);
3960 if (t_arg1 == Ity_INVALID || t_arg2 == Ity_INVALID
3961 || t_arg3 == Ity_INVALID || t_arg4 == Ity_INVALID) {
3962 vex_printf(" op name: " );
florian96d7cc32012-06-01 20:41:24 +00003963 ppIROp(qop->op);
sewardj40c80262006-02-08 19:30:46 +00003964 vex_printf("\n");
3965 sanityCheckFail(bb,stmt,
3966 "Iex.Qop: wrong arity op\n"
3967 "... name of op precedes BB printout\n");
3968 }
florian96d7cc32012-06-01 20:41:24 +00003969 ttarg1 = typeOfIRExpr(tyenv, qop->arg1);
3970 ttarg2 = typeOfIRExpr(tyenv, qop->arg2);
3971 ttarg3 = typeOfIRExpr(tyenv, qop->arg3);
3972 ttarg4 = typeOfIRExpr(tyenv, qop->arg4);
sewardj40c80262006-02-08 19:30:46 +00003973 if (t_arg1 != ttarg1 || t_arg2 != ttarg2
3974 || t_arg3 != ttarg3 || t_arg4 != ttarg4) {
3975 vex_printf(" op name: ");
florian96d7cc32012-06-01 20:41:24 +00003976 ppIROp(qop->op);
sewardj40c80262006-02-08 19:30:46 +00003977 vex_printf("\n");
3978 vex_printf(" op type is (");
3979 ppIRType(t_arg1);
3980 vex_printf(",");
3981 ppIRType(t_arg2);
3982 vex_printf(",");
3983 ppIRType(t_arg3);
3984 vex_printf(",");
3985 ppIRType(t_arg4);
3986 vex_printf(") -> ");
3987 ppIRType (t_dst);
3988 vex_printf("\narg tys are (");
3989 ppIRType(ttarg1);
3990 vex_printf(",");
3991 ppIRType(ttarg2);
3992 vex_printf(",");
3993 ppIRType(ttarg3);
3994 vex_printf(",");
3995 ppIRType(ttarg4);
3996 vex_printf(")\n");
3997 sanityCheckFail(bb,stmt,
3998 "Iex.Qop: arg tys don't match op tys\n"
3999 "... additional details precede BB printout\n");
4000 }
4001 break;
4002 }
sewardjb183b852006-02-03 16:08:03 +00004003 case Iex_Triop: {
4004 IRType ttarg1, ttarg2, ttarg3;
florian0b70efa2014-09-21 21:53:39 +00004005 const IRTriop *triop = expr->Iex.Triop.details;
florian420bfa92012-06-02 20:29:22 +00004006 tcExpr(bb,stmt, triop->arg1, gWordTy );
4007 tcExpr(bb,stmt, triop->arg2, gWordTy );
4008 tcExpr(bb,stmt, triop->arg3, gWordTy );
4009 typeOfPrimop(triop->op,
sewardj40c80262006-02-08 19:30:46 +00004010 &t_dst, &t_arg1, &t_arg2, &t_arg3, &t_arg4);
sewardjb183b852006-02-03 16:08:03 +00004011 if (t_arg1 == Ity_INVALID || t_arg2 == Ity_INVALID
sewardj40c80262006-02-08 19:30:46 +00004012 || t_arg3 == Ity_INVALID || t_arg4 != Ity_INVALID) {
sewardjb183b852006-02-03 16:08:03 +00004013 vex_printf(" op name: " );
florian420bfa92012-06-02 20:29:22 +00004014 ppIROp(triop->op);
sewardjb183b852006-02-03 16:08:03 +00004015 vex_printf("\n");
4016 sanityCheckFail(bb,stmt,
4017 "Iex.Triop: wrong arity op\n"
4018 "... name of op precedes BB printout\n");
4019 }
florian420bfa92012-06-02 20:29:22 +00004020 ttarg1 = typeOfIRExpr(tyenv, triop->arg1);
4021 ttarg2 = typeOfIRExpr(tyenv, triop->arg2);
4022 ttarg3 = typeOfIRExpr(tyenv, triop->arg3);
sewardjb183b852006-02-03 16:08:03 +00004023 if (t_arg1 != ttarg1 || t_arg2 != ttarg2 || t_arg3 != ttarg3) {
4024 vex_printf(" op name: ");
florian420bfa92012-06-02 20:29:22 +00004025 ppIROp(triop->op);
sewardjb183b852006-02-03 16:08:03 +00004026 vex_printf("\n");
4027 vex_printf(" op type is (");
4028 ppIRType(t_arg1);
4029 vex_printf(",");
4030 ppIRType(t_arg2);
4031 vex_printf(",");
4032 ppIRType(t_arg3);
4033 vex_printf(") -> ");
4034 ppIRType (t_dst);
4035 vex_printf("\narg tys are (");
4036 ppIRType(ttarg1);
4037 vex_printf(",");
4038 ppIRType(ttarg2);
4039 vex_printf(",");
4040 ppIRType(ttarg3);
4041 vex_printf(")\n");
4042 sanityCheckFail(bb,stmt,
4043 "Iex.Triop: arg tys don't match op tys\n"
4044 "... additional details precede BB printout\n");
4045 }
4046 break;
4047 }
sewardj6d2638e2004-07-15 09:38:27 +00004048 case Iex_Binop: {
4049 IRType ttarg1, ttarg2;
sewardj6efd4a12004-07-15 03:54:23 +00004050 tcExpr(bb,stmt, expr->Iex.Binop.arg1, gWordTy );
4051 tcExpr(bb,stmt, expr->Iex.Binop.arg2, gWordTy );
sewardj40c80262006-02-08 19:30:46 +00004052 typeOfPrimop(expr->Iex.Binop.op,
4053 &t_dst, &t_arg1, &t_arg2, &t_arg3, &t_arg4);
sewardjb183b852006-02-03 16:08:03 +00004054 if (t_arg1 == Ity_INVALID || t_arg2 == Ity_INVALID
sewardj40c80262006-02-08 19:30:46 +00004055 || t_arg3 != Ity_INVALID || t_arg4 != Ity_INVALID) {
sewardj8f3debf2004-09-08 23:42:23 +00004056 vex_printf(" op name: " );
4057 ppIROp(expr->Iex.Binop.op);
4058 vex_printf("\n");
4059 sanityCheckFail(bb,stmt,
4060 "Iex.Binop: wrong arity op\n"
4061 "... name of op precedes BB printout\n");
4062 }
sewardj6d2638e2004-07-15 09:38:27 +00004063 ttarg1 = typeOfIRExpr(tyenv, expr->Iex.Binop.arg1);
4064 ttarg2 = typeOfIRExpr(tyenv, expr->Iex.Binop.arg2);
4065 if (t_arg1 != ttarg1 || t_arg2 != ttarg2) {
4066 vex_printf(" op name: ");
4067 ppIROp(expr->Iex.Binop.op);
4068 vex_printf("\n");
4069 vex_printf(" op type is (");
4070 ppIRType(t_arg1);
4071 vex_printf(",");
4072 ppIRType(t_arg2);
4073 vex_printf(") -> ");
4074 ppIRType (t_dst);
4075 vex_printf("\narg tys are (");
4076 ppIRType(ttarg1);
4077 vex_printf(",");
4078 ppIRType(ttarg2);
4079 vex_printf(")\n");
4080 sanityCheckFail(bb,stmt,
4081 "Iex.Binop: arg tys don't match op tys\n"
4082 "... additional details precede BB printout\n");
sewardj695cff92004-10-13 14:50:14 +00004083 }
sewardj6efd4a12004-07-15 03:54:23 +00004084 break;
sewardj6d2638e2004-07-15 09:38:27 +00004085 }
sewardj6efd4a12004-07-15 03:54:23 +00004086 case Iex_Unop:
4087 tcExpr(bb,stmt, expr->Iex.Unop.arg, gWordTy );
floriana60e8432012-08-16 00:11:20 +00004088 typeOfPrimop(expr->Iex.Unop.op,
sewardj40c80262006-02-08 19:30:46 +00004089 &t_dst, &t_arg1, &t_arg2, &t_arg3, &t_arg4);
sewardjb183b852006-02-03 16:08:03 +00004090 if (t_arg1 == Ity_INVALID || t_arg2 != Ity_INVALID
sewardj40c80262006-02-08 19:30:46 +00004091 || t_arg3 != Ity_INVALID || t_arg4 != Ity_INVALID)
sewardj6efd4a12004-07-15 03:54:23 +00004092 sanityCheckFail(bb,stmt,"Iex.Unop: wrong arity op");
4093 if (t_arg1 != typeOfIRExpr(tyenv, expr->Iex.Unop.arg))
4094 sanityCheckFail(bb,stmt,"Iex.Unop: arg ty doesn't match op ty");
4095 break;
sewardjaf1ceca2005-06-30 23:31:27 +00004096 case Iex_Load:
4097 tcExpr(bb,stmt, expr->Iex.Load.addr, gWordTy);
4098 if (typeOfIRExpr(tyenv, expr->Iex.Load.addr) != gWordTy)
4099 sanityCheckFail(bb,stmt,"Iex.Load.addr: not :: guest word type");
4100 if (expr->Iex.Load.end != Iend_LE && expr->Iex.Load.end != Iend_BE)
4101 sanityCheckFail(bb,stmt,"Iex.Load.end: bogus endianness");
sewardj6efd4a12004-07-15 03:54:23 +00004102 break;
4103 case Iex_CCall:
sewardjc13e2ed2004-10-31 21:44:54 +00004104 if (!saneIRCallee(expr->Iex.CCall.cee))
4105 sanityCheckFail(bb,stmt,"Iex.CCall.cee: bad IRCallee");
sewardjcf787902004-11-03 09:08:33 +00004106 if (expr->Iex.CCall.cee->regparms > countArgs(expr->Iex.CCall.args))
sewardjc13e2ed2004-10-31 21:44:54 +00004107 sanityCheckFail(bb,stmt,"Iex.CCall.cee: #regparms > #args");
sewardj43c56462004-11-06 12:17:57 +00004108 for (i = 0; expr->Iex.CCall.args[i]; i++) {
4109 if (i >= 32)
4110 sanityCheckFail(bb,stmt,"Iex.CCall: > 32 args");
sewardj74142b82013-08-08 10:28:59 +00004111 IRExpr* arg = expr->Iex.CCall.args[i];
florian90419562013-08-15 20:54:52 +00004112 if (UNLIKELY(is_IRExpr_VECRET_or_BBPTR(arg)))
sewardj74142b82013-08-08 10:28:59 +00004113 sanityCheckFail(bb,stmt,"Iex.CCall.args: is VECRET/BBPTR");
4114 tcExpr(bb,stmt, arg, gWordTy);
sewardj43c56462004-11-06 12:17:57 +00004115 }
sewardjba999312004-11-15 15:21:17 +00004116 if (expr->Iex.CCall.retty == Ity_I1)
4117 sanityCheckFail(bb,stmt,"Iex.CCall.retty: cannot return :: Ity_I1");
sewardj6efd4a12004-07-15 03:54:23 +00004118 for (i = 0; expr->Iex.CCall.args[i]; i++)
sewardjba999312004-11-15 15:21:17 +00004119 if (typeOfIRExpr(tyenv, expr->Iex.CCall.args[i]) == Ity_I1)
4120 sanityCheckFail(bb,stmt,"Iex.CCall.arg: arg :: Ity_I1");
sewardj6efd4a12004-07-15 03:54:23 +00004121 break;
4122 case Iex_Const:
sewardj49bfe672004-11-15 15:46:26 +00004123 if (!saneIRConst(expr->Iex.Const.con))
4124 sanityCheckFail(bb,stmt,"Iex.Const.con: invalid const");
sewardj6efd4a12004-07-15 03:54:23 +00004125 break;
florian99dd03e2013-01-29 03:56:06 +00004126 case Iex_ITE:
4127 tcExpr(bb,stmt, expr->Iex.ITE.cond, gWordTy);
4128 tcExpr(bb,stmt, expr->Iex.ITE.iftrue, gWordTy);
4129 tcExpr(bb,stmt, expr->Iex.ITE.iffalse, gWordTy);
4130 if (typeOfIRExpr(tyenv, expr->Iex.ITE.cond) != Ity_I1)
4131 sanityCheckFail(bb,stmt,"Iex.ITE.cond: cond :: Ity_I1");
4132 if (typeOfIRExpr(tyenv, expr->Iex.ITE.iftrue)
4133 != typeOfIRExpr(tyenv, expr->Iex.ITE.iffalse))
4134 sanityCheckFail(bb,stmt,"Iex.ITE: iftrue/iffalse mismatch");
sewardjeeb9ef82004-07-15 12:39:03 +00004135 break;
sewardj74142b82013-08-08 10:28:59 +00004136 default:
sewardj6efd4a12004-07-15 03:54:23 +00004137 vpanic("tcExpr");
4138 }
4139}
4140
4141
4142static
florian0b70efa2014-09-21 21:53:39 +00004143void tcStmt ( const IRSB* bb, const IRStmt* stmt, IRType gWordTy )
sewardj6efd4a12004-07-15 03:54:23 +00004144{
sewardj17442fe2004-09-20 14:54:28 +00004145 Int i;
sewardje9d8a262009-07-01 08:06:34 +00004146 IRType tyExpd, tyData;
florian0b70efa2014-09-21 21:53:39 +00004147 const IRTypeEnv* tyenv = bb->tyenv;
sewardj6efd4a12004-07-15 03:54:23 +00004148 switch (stmt->tag) {
sewardjf1689312005-03-16 18:19:10 +00004149 case Ist_IMark:
4150 /* Somewhat heuristic, but rule out totally implausible
sewardj2f10aa62011-05-27 13:20:56 +00004151 instruction sizes and deltas. */
sewardjf1689312005-03-16 18:19:10 +00004152 if (stmt->Ist.IMark.len < 0 || stmt->Ist.IMark.len > 20)
4153 sanityCheckFail(bb,stmt,"IRStmt.IMark.len: implausible");
sewardj2f10aa62011-05-27 13:20:56 +00004154 if (stmt->Ist.IMark.delta > 1)
4155 sanityCheckFail(bb,stmt,"IRStmt.IMark.delta: implausible");
sewardjf1689312005-03-16 18:19:10 +00004156 break;
sewardj5a9ffab2005-05-12 17:55:01 +00004157 case Ist_AbiHint:
4158 if (typeOfIRExpr(tyenv, stmt->Ist.AbiHint.base) != gWordTy)
4159 sanityCheckFail(bb,stmt,"IRStmt.AbiHint.base: "
4160 "not :: guest word type");
sewardj478646f2008-05-01 20:13:04 +00004161 if (typeOfIRExpr(tyenv, stmt->Ist.AbiHint.nia) != gWordTy)
4162 sanityCheckFail(bb,stmt,"IRStmt.AbiHint.nia: "
4163 "not :: guest word type");
sewardj5a9ffab2005-05-12 17:55:01 +00004164 break;
sewardj6efd4a12004-07-15 03:54:23 +00004165 case Ist_Put:
sewardj6d076362004-09-23 11:06:17 +00004166 tcExpr( bb, stmt, stmt->Ist.Put.data, gWordTy );
sewardjba999312004-11-15 15:21:17 +00004167 if (typeOfIRExpr(tyenv,stmt->Ist.Put.data) == Ity_I1)
4168 sanityCheckFail(bb,stmt,"IRStmt.Put.data: cannot Put :: Ity_I1");
sewardj2d3f77c2004-09-22 23:49:09 +00004169 break;
florian0b70efa2014-09-21 21:53:39 +00004170 case Ist_PutI:{
4171 const IRPutI* puti = stmt->Ist.PutI.details;
floriand6f38b32012-05-31 15:46:18 +00004172 tcExpr( bb, stmt, puti->data, gWordTy );
4173 tcExpr( bb, stmt, puti->ix, gWordTy );
4174 if (typeOfIRExpr(tyenv,puti->data) == Ity_I1)
sewardjba999312004-11-15 15:21:17 +00004175 sanityCheckFail(bb,stmt,"IRStmt.PutI.data: cannot PutI :: Ity_I1");
floriand6f38b32012-05-31 15:46:18 +00004176 if (typeOfIRExpr(tyenv,puti->data)
4177 != puti->descr->elemTy)
sewardj6d076362004-09-23 11:06:17 +00004178 sanityCheckFail(bb,stmt,"IRStmt.PutI.data: data ty != elem ty");
floriand6f38b32012-05-31 15:46:18 +00004179 if (typeOfIRExpr(tyenv,puti->ix) != Ity_I32)
sewardjeeac8412004-11-02 00:26:55 +00004180 sanityCheckFail(bb,stmt,"IRStmt.PutI.ix: not :: Ity_I32");
floriand6f38b32012-05-31 15:46:18 +00004181 if (!saneIRRegArray(puti->descr))
sewardj2d3f77c2004-09-22 23:49:09 +00004182 sanityCheckFail(bb,stmt,"IRStmt.PutI.descr: invalid descr");
4183 break;
florian0b70efa2014-09-21 21:53:39 +00004184 }
sewardjdd40fdf2006-12-24 02:20:24 +00004185 case Ist_WrTmp:
4186 tcExpr( bb, stmt, stmt->Ist.WrTmp.data, gWordTy );
4187 if (typeOfIRTemp(tyenv, stmt->Ist.WrTmp.tmp)
4188 != typeOfIRExpr(tyenv, stmt->Ist.WrTmp.data))
sewardjcfe046e2013-01-17 14:23:53 +00004189 sanityCheckFail(bb,stmt,
4190 "IRStmt.Put.Tmp: tmp and expr do not match");
sewardj6efd4a12004-07-15 03:54:23 +00004191 break;
sewardjaf1ceca2005-06-30 23:31:27 +00004192 case Ist_Store:
4193 tcExpr( bb, stmt, stmt->Ist.Store.addr, gWordTy );
4194 tcExpr( bb, stmt, stmt->Ist.Store.data, gWordTy );
4195 if (typeOfIRExpr(tyenv, stmt->Ist.Store.addr) != gWordTy)
sewardjcfe046e2013-01-17 14:23:53 +00004196 sanityCheckFail(bb,stmt,
4197 "IRStmt.Store.addr: not :: guest word type");
sewardjaf1ceca2005-06-30 23:31:27 +00004198 if (typeOfIRExpr(tyenv, stmt->Ist.Store.data) == Ity_I1)
sewardjcfe046e2013-01-17 14:23:53 +00004199 sanityCheckFail(bb,stmt,
4200 "IRStmt.Store.data: cannot Store :: Ity_I1");
sewardjaf1ceca2005-06-30 23:31:27 +00004201 if (stmt->Ist.Store.end != Iend_LE && stmt->Ist.Store.end != Iend_BE)
4202 sanityCheckFail(bb,stmt,"Ist.Store.end: bogus endianness");
sewardje9d8a262009-07-01 08:06:34 +00004203 break;
sewardjcfe046e2013-01-17 14:23:53 +00004204 case Ist_StoreG: {
florian0b70efa2014-09-21 21:53:39 +00004205 const IRStoreG* sg = stmt->Ist.StoreG.details;
sewardjcfe046e2013-01-17 14:23:53 +00004206 tcExpr( bb, stmt, sg->addr, gWordTy );
4207 tcExpr( bb, stmt, sg->data, gWordTy );
4208 tcExpr( bb, stmt, sg->guard, gWordTy );
4209 if (typeOfIRExpr(tyenv, sg->addr) != gWordTy)
4210 sanityCheckFail(bb,stmt,"IRStmtG...addr: not :: guest word type");
4211 if (typeOfIRExpr(tyenv, sg->data) == Ity_I1)
4212 sanityCheckFail(bb,stmt,"IRStmtG...data: cannot Store :: Ity_I1");
4213 if (typeOfIRExpr(tyenv, sg->guard) != Ity_I1)
4214 sanityCheckFail(bb,stmt,"IRStmtG...guard: not :: Ity_I1");
4215 if (sg->end != Iend_LE && sg->end != Iend_BE)
4216 sanityCheckFail(bb,stmt,"IRStmtG...end: bogus endianness");
4217 break;
4218 }
4219 case Ist_LoadG: {
florian0b70efa2014-09-21 21:53:39 +00004220 const IRLoadG* lg = stmt->Ist.LoadG.details;
sewardjcfe046e2013-01-17 14:23:53 +00004221 tcExpr( bb, stmt, lg->addr, gWordTy );
4222 tcExpr( bb, stmt, lg->alt, gWordTy );
4223 tcExpr( bb, stmt, lg->guard, gWordTy );
4224 if (typeOfIRExpr(tyenv, lg->guard) != Ity_I1)
4225 sanityCheckFail(bb,stmt,"IRStmt.LoadG.guard: not :: Ity_I1");
4226 if (typeOfIRExpr(tyenv, lg->addr) != gWordTy)
4227 sanityCheckFail(bb,stmt,"IRStmt.LoadG.addr: not "
4228 ":: guest word type");
4229 if (typeOfIRExpr(tyenv, lg->alt) != typeOfIRTemp(tyenv, lg->dst))
4230 sanityCheckFail(bb,stmt,"IRStmt.LoadG: dst/alt type mismatch");
4231 IRTemp cvtRes = Ity_INVALID, cvtArg = Ity_INVALID;
4232 typeOfIRLoadGOp(lg->cvt, &cvtRes, &cvtArg);
4233 if (cvtRes != typeOfIRTemp(tyenv, lg->dst))
4234 sanityCheckFail(bb,stmt,"IRStmt.LoadG: dst/loaded type mismatch");
4235 break;
4236 }
florian0b70efa2014-09-21 21:53:39 +00004237 case Ist_CAS: {
4238 const IRCAS* cas = stmt->Ist.CAS.details;
sewardje9d8a262009-07-01 08:06:34 +00004239 /* make sure it's definitely either a CAS or a DCAS */
4240 if (cas->oldHi == IRTemp_INVALID
4241 && cas->expdHi == NULL && cas->dataHi == NULL) {
4242 /* fine; it's a single cas */
4243 }
4244 else
4245 if (cas->oldHi != IRTemp_INVALID
4246 && cas->expdHi != NULL && cas->dataHi != NULL) {
4247 /* fine; it's a double cas */
4248 }
4249 else {
4250 /* it's some el-mutanto hybrid */
4251 goto bad_cas;
4252 }
4253 /* check the address type */
4254 tcExpr( bb, stmt, cas->addr, gWordTy );
4255 if (typeOfIRExpr(tyenv, cas->addr) != gWordTy) goto bad_cas;
4256 /* check types on the {old,expd,data}Lo components agree */
4257 tyExpd = typeOfIRExpr(tyenv, cas->expdLo);
4258 tyData = typeOfIRExpr(tyenv, cas->dataLo);
4259 if (tyExpd != tyData) goto bad_cas;
4260 if (tyExpd != typeOfIRTemp(tyenv, cas->oldLo))
4261 goto bad_cas;
4262 /* check the base element type is sane */
4263 if (tyExpd == Ity_I8 || tyExpd == Ity_I16 || tyExpd == Ity_I32
4264 || (gWordTy == Ity_I64 && tyExpd == Ity_I64)) {
4265 /* fine */
4266 } else {
4267 goto bad_cas;
4268 }
4269 /* If it's a DCAS, check types on the {old,expd,data}Hi
4270 components too */
4271 if (cas->oldHi != IRTemp_INVALID) {
4272 tyExpd = typeOfIRExpr(tyenv, cas->expdHi);
4273 tyData = typeOfIRExpr(tyenv, cas->dataHi);
4274 if (tyExpd != tyData) goto bad_cas;
4275 if (tyExpd != typeOfIRTemp(tyenv, cas->oldHi))
4276 goto bad_cas;
4277 /* and finally check that oldLo and oldHi have the same
4278 type. This forces equivalence amongst all 6 types. */
4279 if (typeOfIRTemp(tyenv, cas->oldHi)
4280 != typeOfIRTemp(tyenv, cas->oldLo))
4281 goto bad_cas;
4282 }
4283 break;
4284 bad_cas:
4285 sanityCheckFail(bb,stmt,"IRStmt.CAS: ill-formed");
sewardj6efd4a12004-07-15 03:54:23 +00004286 break;
florian0b70efa2014-09-21 21:53:39 +00004287 }
sewardje768e922009-11-26 17:17:37 +00004288 case Ist_LLSC: {
4289 IRType tyRes;
4290 if (typeOfIRExpr(tyenv, stmt->Ist.LLSC.addr) != gWordTy)
4291 sanityCheckFail(bb,stmt,"IRStmt.LLSC.addr: not :: guest word type");
4292 if (stmt->Ist.LLSC.end != Iend_LE && stmt->Ist.LLSC.end != Iend_BE)
4293 sanityCheckFail(bb,stmt,"Ist.LLSC.end: bogus endianness");
4294 tyRes = typeOfIRTemp(tyenv, stmt->Ist.LLSC.result);
4295 if (stmt->Ist.LLSC.storedata == NULL) {
4296 /* it's a LL */
sewardjff7f5b72011-07-11 11:43:38 +00004297 if (tyRes != Ity_I64 && tyRes != Ity_I32
4298 && tyRes != Ity_I16 && tyRes != Ity_I8)
sewardje768e922009-11-26 17:17:37 +00004299 sanityCheckFail(bb,stmt,"Ist.LLSC(LL).result :: bogus");
4300 } else {
4301 /* it's a SC */
4302 if (tyRes != Ity_I1)
4303 sanityCheckFail(bb,stmt,"Ist.LLSC(SC).result: not :: Ity_I1");
4304 tyData = typeOfIRExpr(tyenv, stmt->Ist.LLSC.storedata);
sewardjff7f5b72011-07-11 11:43:38 +00004305 if (tyData != Ity_I64 && tyData != Ity_I32
4306 && tyData != Ity_I16 && tyData != Ity_I8)
sewardj6c299f32009-12-31 18:00:12 +00004307 sanityCheckFail(bb,stmt,
4308 "Ist.LLSC(SC).result :: storedata bogus");
sewardje768e922009-11-26 17:17:37 +00004309 }
4310 break;
4311 }
sewardj74142b82013-08-08 10:28:59 +00004312 case Ist_Dirty: {
sewardj17442fe2004-09-20 14:54:28 +00004313 /* Mostly check for various kinds of ill-formed dirty calls. */
florian0b70efa2014-09-21 21:53:39 +00004314 const IRDirty* d = stmt->Ist.Dirty.details;
sewardj8ea867b2004-10-30 19:03:02 +00004315 if (d->cee == NULL) goto bad_dirty;
4316 if (!saneIRCallee(d->cee)) goto bad_dirty;
sewardjcf787902004-11-03 09:08:33 +00004317 if (d->cee->regparms > countArgs(d->args)) goto bad_dirty;
sewardj17442fe2004-09-20 14:54:28 +00004318 if (d->mFx == Ifx_None) {
4319 if (d->mAddr != NULL || d->mSize != 0)
4320 goto bad_dirty;
4321 } else {
4322 if (d->mAddr == NULL || d->mSize == 0)
4323 goto bad_dirty;
4324 }
4325 if (d->nFxState < 0 || d->nFxState > VEX_N_FXSTATE)
4326 goto bad_dirty;
4327 for (i = 0; i < d->nFxState; i++) {
4328 if (d->fxState[i].fx == Ifx_None) goto bad_dirty;
4329 if (d->fxState[i].size <= 0) goto bad_dirty;
sewardjc9069f22012-06-01 16:09:50 +00004330 if (d->fxState[i].nRepeats == 0) {
4331 if (d->fxState[i].repeatLen != 0) goto bad_dirty;
4332 } else {
4333 if (d->fxState[i].repeatLen <= d->fxState[i].size)
4334 goto bad_dirty;
4335 /* the % is safe because of the .size check above */
4336 if ((d->fxState[i].repeatLen % d->fxState[i].size) != 0)
4337 goto bad_dirty;
4338 }
sewardj17442fe2004-09-20 14:54:28 +00004339 }
florian44ab8f72012-07-05 22:05:42 +00004340 /* check guard */
sewardjb8385d82004-11-02 01:34:15 +00004341 if (d->guard == NULL) goto bad_dirty;
sewardj49bfe672004-11-15 15:46:26 +00004342 tcExpr( bb, stmt, d->guard, gWordTy );
sewardjba999312004-11-15 15:21:17 +00004343 if (typeOfIRExpr(tyenv, d->guard) != Ity_I1)
4344 sanityCheckFail(bb,stmt,"IRStmt.Dirty.guard not :: Ity_I1");
florian44ab8f72012-07-05 22:05:42 +00004345 /* check types, minimally */
sewardj74142b82013-08-08 10:28:59 +00004346 IRType retTy = Ity_INVALID;
4347 if (d->tmp != IRTemp_INVALID) {
4348 retTy = typeOfIRTemp(tyenv, d->tmp);
4349 if (retTy == Ity_I1)
4350 sanityCheckFail(bb,stmt,"IRStmt.Dirty.dst :: Ity_I1");
4351 }
4352 UInt nVECRETs = 0, nBBPTRs = 0;
sewardj17442fe2004-09-20 14:54:28 +00004353 for (i = 0; d->args[i] != NULL; i++) {
sewardj43c56462004-11-06 12:17:57 +00004354 if (i >= 32)
4355 sanityCheckFail(bb,stmt,"IRStmt.Dirty: > 32 args");
florian0b70efa2014-09-21 21:53:39 +00004356 const IRExpr* arg = d->args[i];
florian90419562013-08-15 20:54:52 +00004357 if (UNLIKELY(arg->tag == Iex_VECRET)) {
4358 nVECRETs++;
4359 } else if (UNLIKELY(arg->tag == Iex_BBPTR)) {
4360 nBBPTRs++;
sewardj74142b82013-08-08 10:28:59 +00004361 } else {
4362 if (typeOfIRExpr(tyenv, arg) == Ity_I1)
4363 sanityCheckFail(bb,stmt,"IRStmt.Dirty.arg[i] :: Ity_I1");
4364 }
4365 if (nBBPTRs > 1) {
4366 sanityCheckFail(bb,stmt,"IRStmt.Dirty.args: > 1 BBPTR arg");
4367 }
4368 if (nVECRETs == 1) {
4369 /* Fn must return V128 or V256. */
4370 if (retTy != Ity_V128 && retTy != Ity_V256)
4371 sanityCheckFail(bb,stmt,
4372 "IRStmt.Dirty.args: VECRET present, "
4373 "but fn does not return V128 or V256");
4374 } else if (nVECRETs == 0) {
4375 /* Fn must not return V128 or V256 */
4376 if (retTy == Ity_V128 || retTy == Ity_V256)
4377 sanityCheckFail(bb,stmt,
4378 "IRStmt.Dirty.args: VECRET not present, "
4379 "but fn returns V128 or V256");
4380 } else {
4381 sanityCheckFail(bb,stmt,
4382 "IRStmt.Dirty.args: > 1 VECRET present");
4383 }
sewardj17442fe2004-09-20 14:54:28 +00004384 }
sewardj74142b82013-08-08 10:28:59 +00004385 if (nBBPTRs > 1) {
4386 sanityCheckFail(bb,stmt,
4387 "IRStmt.Dirty.args: > 1 BBPTR present");
4388 }
4389 /* If you ask for the baseblock pointer, you have to make
4390 some declaration about access to the guest state too. */
4391 if (d->nFxState == 0 && nBBPTRs != 0) {
4392 sanityCheckFail(bb,stmt,
4393 "IRStmt.Dirty.args: BBPTR requested, "
4394 "but no fxState declared");
4395 }
4396 break;
sewardj17442fe2004-09-20 14:54:28 +00004397 bad_dirty:
4398 sanityCheckFail(bb,stmt,"IRStmt.Dirty: ill-formed");
sewardje9d8a262009-07-01 08:06:34 +00004399 break;
sewardj74142b82013-08-08 10:28:59 +00004400 }
sewardjd2445f62005-03-21 00:15:53 +00004401 case Ist_NoOp:
sewardjc4356f02007-11-09 21:15:04 +00004402 break;
4403 case Ist_MBE:
4404 switch (stmt->Ist.MBE.event) {
sewardj6d615ba2011-09-26 16:19:43 +00004405 case Imbe_Fence: case Imbe_CancelReservation:
sewardjc4356f02007-11-09 21:15:04 +00004406 break;
4407 default: sanityCheckFail(bb,stmt,"IRStmt.MBE.event: unknown");
4408 break;
4409 }
sewardj3e838932005-01-07 12:09:15 +00004410 break;
sewardj6efd4a12004-07-15 03:54:23 +00004411 case Ist_Exit:
sewardj0276d4b2004-11-15 15:30:21 +00004412 tcExpr( bb, stmt, stmt->Ist.Exit.guard, gWordTy );
4413 if (typeOfIRExpr(tyenv,stmt->Ist.Exit.guard) != Ity_I1)
4414 sanityCheckFail(bb,stmt,"IRStmt.Exit.guard: not :: Ity_I1");
sewardj49bfe672004-11-15 15:46:26 +00004415 if (!saneIRConst(stmt->Ist.Exit.dst))
4416 sanityCheckFail(bb,stmt,"IRStmt.Exit.dst: bad dst");
sewardj6efd4a12004-07-15 03:54:23 +00004417 if (typeOfIRConst(stmt->Ist.Exit.dst) != gWordTy)
4418 sanityCheckFail(bb,stmt,"IRStmt.Exit.dst: not :: guest word type");
sewardjc6f970f2012-04-02 21:54:49 +00004419 /* because it would intersect with host_EvC_* */
4420 if (stmt->Ist.Exit.offsIP < 16)
4421 sanityCheckFail(bb,stmt,"IRStmt.Exit.offsIP: too low");
sewardj6efd4a12004-07-15 03:54:23 +00004422 break;
4423 default:
4424 vpanic("tcStmt");
4425 }
4426}
4427
florian0b70efa2014-09-21 21:53:39 +00004428void sanityCheckIRSB ( const IRSB* bb, const HChar* caller,
sewardjb9230752004-12-29 19:25:06 +00004429 Bool require_flat, IRType guest_word_size )
sewardj35439212004-07-14 22:36:10 +00004430{
4431 Int i;
sewardj35439212004-07-14 22:36:10 +00004432 Int n_temps = bb->tyenv->types_used;
4433 Int* def_counts = LibVEX_Alloc(n_temps * sizeof(Int));
4434
sewardjb9230752004-12-29 19:25:06 +00004435 if (0)
4436 vex_printf("sanityCheck: %s\n", caller);
4437
sewardj35439212004-07-14 22:36:10 +00004438 vassert(guest_word_size == Ity_I32
sewardj695cff92004-10-13 14:50:14 +00004439 || guest_word_size == Ity_I64);
sewardj35439212004-07-14 22:36:10 +00004440
sewardjd7cb8532004-08-17 23:59:23 +00004441 if (bb->stmts_used < 0 || bb->stmts_size < 8
4442 || bb->stmts_used > bb->stmts_size)
4443 /* this BB is so strange we can't even print it */
sewardjdd40fdf2006-12-24 02:20:24 +00004444 vpanic("sanityCheckIRSB: stmts array limits wierd");
sewardjd7cb8532004-08-17 23:59:23 +00004445
sewardj6d2638e2004-07-15 09:38:27 +00004446 /* Ensure each temp has a plausible type. */
4447 for (i = 0; i < n_temps; i++) {
sewardj17442fe2004-09-20 14:54:28 +00004448 IRType ty = typeOfIRTemp(bb->tyenv,(IRTemp)i);
sewardj496a58d2005-03-20 18:44:44 +00004449 if (!isPlausibleIRType(ty)) {
sewardj6d2638e2004-07-15 09:38:27 +00004450 vex_printf("Temp t%d declared with implausible type 0x%x\n",
4451 i, (UInt)ty);
4452 sanityCheckFail(bb,NULL,"Temp declared with implausible type");
4453 }
4454 }
sewardj35439212004-07-14 22:36:10 +00004455
florian0b70efa2014-09-21 21:53:39 +00004456 const IRStmt* stmt;
4457
sewardjb9230752004-12-29 19:25:06 +00004458 /* Check for flatness, if required. */
4459 if (require_flat) {
4460 for (i = 0; i < bb->stmts_used; i++) {
4461 stmt = bb->stmts[i];
4462 if (!stmt)
sewardjd2445f62005-03-21 00:15:53 +00004463 sanityCheckFail(bb, stmt, "IRStmt: is NULL");
sewardjb9230752004-12-29 19:25:06 +00004464 if (!isFlatIRStmt(stmt))
4465 sanityCheckFail(bb, stmt, "IRStmt: is not flat");
4466 }
sewardj496a58d2005-03-20 18:44:44 +00004467 if (!isIRAtom(bb->next))
sewardjb9230752004-12-29 19:25:06 +00004468 sanityCheckFail(bb, NULL, "bb->next is not an atom");
4469 }
4470
sewardj35439212004-07-14 22:36:10 +00004471 /* Count the defs of each temp. Only one def is allowed.
4472 Also, check that each used temp has already been defd. */
sewardj6d2638e2004-07-15 09:38:27 +00004473
4474 for (i = 0; i < n_temps; i++)
4475 def_counts[i] = 0;
4476
sewardjd7cb8532004-08-17 23:59:23 +00004477 for (i = 0; i < bb->stmts_used; i++) {
4478 stmt = bb->stmts[i];
sewardje9d8a262009-07-01 08:06:34 +00004479 /* Check any temps used by this statement. */
sewardj35439212004-07-14 22:36:10 +00004480 useBeforeDef_Stmt(bb,stmt,def_counts);
sewardj17442fe2004-09-20 14:54:28 +00004481
sewardje9d8a262009-07-01 08:06:34 +00004482 /* Now make note of any temps defd by this statement. */
4483 switch (stmt->tag) {
4484 case Ist_WrTmp:
sewardjdd40fdf2006-12-24 02:20:24 +00004485 if (stmt->Ist.WrTmp.tmp < 0 || stmt->Ist.WrTmp.tmp >= n_temps)
sewardj17442fe2004-09-20 14:54:28 +00004486 sanityCheckFail(bb, stmt,
4487 "IRStmt.Tmp: destination tmp is out of range");
sewardjdd40fdf2006-12-24 02:20:24 +00004488 def_counts[stmt->Ist.WrTmp.tmp]++;
4489 if (def_counts[stmt->Ist.WrTmp.tmp] > 1)
sewardj17442fe2004-09-20 14:54:28 +00004490 sanityCheckFail(bb, stmt,
sewardjcf787902004-11-03 09:08:33 +00004491 "IRStmt.Tmp: destination tmp is assigned more than once");
sewardje9d8a262009-07-01 08:06:34 +00004492 break;
florian0b70efa2014-09-21 21:53:39 +00004493 case Ist_LoadG: {
4494 const IRLoadG* lg = stmt->Ist.LoadG.details;
sewardjcfe046e2013-01-17 14:23:53 +00004495 if (lg->dst < 0 || lg->dst >= n_temps)
4496 sanityCheckFail(bb, stmt,
4497 "IRStmt.LoadG: destination tmp is out of range");
4498 def_counts[lg->dst]++;
4499 if (def_counts[lg->dst] > 1)
4500 sanityCheckFail(bb, stmt,
4501 "IRStmt.LoadG: destination tmp is assigned more than once");
sewardje9d8a262009-07-01 08:06:34 +00004502 break;
florian0b70efa2014-09-21 21:53:39 +00004503 }
4504 case Ist_Dirty: {
4505 const IRDirty* d = stmt->Ist.Dirty.details;
sewardjcfe046e2013-01-17 14:23:53 +00004506 if (d->tmp != IRTemp_INVALID) {
sewardje9d8a262009-07-01 08:06:34 +00004507 if (d->tmp < 0 || d->tmp >= n_temps)
4508 sanityCheckFail(bb, stmt,
4509 "IRStmt.Dirty: destination tmp is out of range");
4510 def_counts[d->tmp]++;
4511 if (def_counts[d->tmp] > 1)
4512 sanityCheckFail(bb, stmt,
4513 "IRStmt.Dirty: destination tmp is assigned more than once");
4514 }
4515 break;
florian0b70efa2014-09-21 21:53:39 +00004516 }
4517 case Ist_CAS: {
4518 const IRCAS* cas = stmt->Ist.CAS.details;
sewardje9d8a262009-07-01 08:06:34 +00004519 if (cas->oldHi != IRTemp_INVALID) {
4520 if (cas->oldHi < 0 || cas->oldHi >= n_temps)
4521 sanityCheckFail(bb, stmt,
4522 "IRStmt.CAS: destination tmpHi is out of range");
4523 def_counts[cas->oldHi]++;
4524 if (def_counts[cas->oldHi] > 1)
4525 sanityCheckFail(bb, stmt,
4526 "IRStmt.CAS: destination tmpHi is assigned more than once");
4527 }
4528 if (cas->oldLo < 0 || cas->oldLo >= n_temps)
sewardje768e922009-11-26 17:17:37 +00004529 sanityCheckFail(bb, stmt,
4530 "IRStmt.CAS: destination tmpLo is out of range");
4531 def_counts[cas->oldLo]++;
4532 if (def_counts[cas->oldLo] > 1)
4533 sanityCheckFail(bb, stmt,
4534 "IRStmt.CAS: destination tmpLo is assigned more than once");
4535 break;
florian0b70efa2014-09-21 21:53:39 +00004536 }
sewardje768e922009-11-26 17:17:37 +00004537 case Ist_LLSC:
4538 if (stmt->Ist.LLSC.result < 0 || stmt->Ist.LLSC.result >= n_temps)
4539 sanityCheckFail(bb, stmt,
4540 "IRStmt.LLSC: destination tmp is out of range");
4541 def_counts[stmt->Ist.LLSC.result]++;
4542 if (def_counts[stmt->Ist.LLSC.result] > 1)
4543 sanityCheckFail(bb, stmt,
4544 "IRStmt.LLSC: destination tmp is assigned more than once");
4545 break;
sewardje9d8a262009-07-01 08:06:34 +00004546 default:
sewardje768e922009-11-26 17:17:37 +00004547 /* explicitly handle the rest, so as to keep gcc quiet */
4548 break;
sewardj35439212004-07-14 22:36:10 +00004549 }
4550 }
4551
sewardj6efd4a12004-07-15 03:54:23 +00004552 /* Typecheck everything. */
sewardjd7cb8532004-08-17 23:59:23 +00004553 for (i = 0; i < bb->stmts_used; i++)
sewardj39e3f242004-08-18 16:54:52 +00004554 if (bb->stmts[i])
4555 tcStmt( bb, bb->stmts[i], guest_word_size );
sewardj6efd4a12004-07-15 03:54:23 +00004556 if (typeOfIRExpr(bb->tyenv,bb->next) != guest_word_size)
4557 sanityCheckFail(bb, NULL, "bb->next field has wrong type");
sewardjc6f970f2012-04-02 21:54:49 +00004558 /* because it would intersect with host_EvC_* */
4559 if (bb->offsIP < 16)
4560 sanityCheckFail(bb, NULL, "bb->offsIP: too low");
sewardje539a402004-07-14 18:24:17 +00004561}
4562
sewardj4345f7a2004-09-22 19:49:27 +00004563/*---------------------------------------------------------------*/
4564/*--- Misc helper functions ---*/
4565/*---------------------------------------------------------------*/
4566
florian0b70efa2014-09-21 21:53:39 +00004567Bool eqIRConst ( const IRConst* c1, const IRConst* c2 )
sewardj4345f7a2004-09-22 19:49:27 +00004568{
4569 if (c1->tag != c2->tag)
4570 return False;
4571
4572 switch (c1->tag) {
sewardja98bf492005-02-07 01:39:17 +00004573 case Ico_U1: return toBool( (1 & c1->Ico.U1) == (1 & c2->Ico.U1) );
4574 case Ico_U8: return toBool( c1->Ico.U8 == c2->Ico.U8 );
4575 case Ico_U16: return toBool( c1->Ico.U16 == c2->Ico.U16 );
4576 case Ico_U32: return toBool( c1->Ico.U32 == c2->Ico.U32 );
4577 case Ico_U64: return toBool( c1->Ico.U64 == c2->Ico.U64 );
sewardj2019a972011-03-07 16:04:07 +00004578 case Ico_F32: return toBool( c1->Ico.F32 == c2->Ico.F32 );
4579 case Ico_F32i: return toBool( c1->Ico.F32i == c2->Ico.F32i );
sewardja98bf492005-02-07 01:39:17 +00004580 case Ico_F64: return toBool( c1->Ico.F64 == c2->Ico.F64 );
sewardj0da5eb82007-01-27 00:46:28 +00004581 case Ico_F64i: return toBool( c1->Ico.F64i == c2->Ico.F64i );
4582 case Ico_V128: return toBool( c1->Ico.V128 == c2->Ico.V128 );
sewardj5df0b2f2012-07-18 11:48:23 +00004583 case Ico_V256: return toBool( c1->Ico.V256 == c2->Ico.V256 );
sewardj4345f7a2004-09-22 19:49:27 +00004584 default: vpanic("eqIRConst");
4585 }
4586}
4587
florian0b70efa2014-09-21 21:53:39 +00004588Bool eqIRRegArray ( const IRRegArray* descr1, const IRRegArray* descr2 )
sewardje98dcf22004-10-04 09:15:11 +00004589{
sewardja98bf492005-02-07 01:39:17 +00004590 return toBool( descr1->base == descr2->base
4591 && descr1->elemTy == descr2->elemTy
4592 && descr1->nElems == descr2->nElems );
sewardje98dcf22004-10-04 09:15:11 +00004593}
4594
sewardj2d3f77c2004-09-22 23:49:09 +00004595Int sizeofIRType ( IRType ty )
4596{
4597 switch (ty) {
sewardjc9a43662004-11-30 18:51:59 +00004598 case Ity_I8: return 1;
4599 case Ity_I16: return 2;
4600 case Ity_I32: return 4;
4601 case Ity_I64: return 8;
sewardj7666c152010-09-28 15:20:47 +00004602 case Ity_I128: return 16;
sewardjc9a43662004-11-30 18:51:59 +00004603 case Ity_F32: return 4;
4604 case Ity_F64: return 8;
sewardj2019a972011-03-07 16:04:07 +00004605 case Ity_F128: return 16;
sewardjc6bbd472012-04-02 10:20:48 +00004606 case Ity_D32: return 4;
4607 case Ity_D64: return 8;
4608 case Ity_D128: return 16;
sewardjc4530ae2012-05-21 10:18:49 +00004609 case Ity_V128: return 16;
4610 case Ity_V256: return 32;
sewardj2d3f77c2004-09-22 23:49:09 +00004611 default: vex_printf("\n"); ppIRType(ty); vex_printf("\n");
4612 vpanic("sizeofIRType");
4613 }
4614}
4615
sewardj7d009132014-02-20 17:43:38 +00004616IRType integerIRTypeOfSize ( Int szB )
4617{
4618 switch (szB) {
4619 case 8: return Ity_I64;
4620 case 4: return Ity_I32;
4621 case 2: return Ity_I16;
4622 case 1: return Ity_I8;
4623 default: vpanic("integerIRTypeOfSize");
4624 }
4625}
4626
sewardj49651f42004-10-28 22:11:04 +00004627IRExpr* mkIRExpr_HWord ( HWord hw )
4628{
sewardjf9655262004-10-31 20:02:16 +00004629 vassert(sizeof(void*) == sizeof(HWord));
sewardj49651f42004-10-28 22:11:04 +00004630 if (sizeof(HWord) == 4)
4631 return IRExpr_Const(IRConst_U32((UInt)hw));
4632 if (sizeof(HWord) == 8)
sewardjf9655262004-10-31 20:02:16 +00004633 return IRExpr_Const(IRConst_U64((ULong)hw));
sewardj49651f42004-10-28 22:11:04 +00004634 vpanic("mkIRExpr_HWord");
4635}
sewardj6efd4a12004-07-15 03:54:23 +00004636
florian1ff47562012-10-21 02:09:51 +00004637IRDirty* unsafeIRDirty_0_N ( Int regparms, const HChar* name, void* addr,
sewardjf9655262004-10-31 20:02:16 +00004638 IRExpr** args )
4639{
4640 IRDirty* d = emptyIRDirty();
sewardjb8385d82004-11-02 01:34:15 +00004641 d->cee = mkIRCallee ( regparms, name, addr );
sewardjba999312004-11-15 15:21:17 +00004642 d->guard = IRExpr_Const(IRConst_U1(True));
sewardjb8385d82004-11-02 01:34:15 +00004643 d->args = args;
sewardjf9655262004-10-31 20:02:16 +00004644 return d;
4645}
4646
4647IRDirty* unsafeIRDirty_1_N ( IRTemp dst,
florian1ff47562012-10-21 02:09:51 +00004648 Int regparms, const HChar* name, void* addr,
sewardjf9655262004-10-31 20:02:16 +00004649 IRExpr** args )
4650{
4651 IRDirty* d = emptyIRDirty();
sewardjb8385d82004-11-02 01:34:15 +00004652 d->cee = mkIRCallee ( regparms, name, addr );
sewardjba999312004-11-15 15:21:17 +00004653 d->guard = IRExpr_Const(IRConst_U1(True));
sewardjb8385d82004-11-02 01:34:15 +00004654 d->args = args;
4655 d->tmp = dst;
sewardjf9655262004-10-31 20:02:16 +00004656 return d;
4657}
4658
4659IRExpr* mkIRExprCCall ( IRType retty,
florian1ff47562012-10-21 02:09:51 +00004660 Int regparms, const HChar* name, void* addr,
sewardjf9655262004-10-31 20:02:16 +00004661 IRExpr** args )
4662{
4663 return IRExpr_CCall ( mkIRCallee ( regparms, name, addr ),
4664 retty, args );
4665}
4666
florian0b70efa2014-09-21 21:53:39 +00004667Bool eqIRAtom ( const IRExpr* a1, const IRExpr* a2 )
sewardj496a58d2005-03-20 18:44:44 +00004668{
4669 vassert(isIRAtom(a1));
4670 vassert(isIRAtom(a2));
sewardjdd40fdf2006-12-24 02:20:24 +00004671 if (a1->tag == Iex_RdTmp && a2->tag == Iex_RdTmp)
4672 return toBool(a1->Iex.RdTmp.tmp == a2->Iex.RdTmp.tmp);
sewardj496a58d2005-03-20 18:44:44 +00004673 if (a1->tag == Iex_Const && a2->tag == Iex_Const)
4674 return eqIRConst(a1->Iex.Const.con, a2->Iex.Const.con);
4675 return False;
4676}
4677
sewardje539a402004-07-14 18:24:17 +00004678/*---------------------------------------------------------------*/
sewardjcef7d3e2009-07-02 12:21:59 +00004679/*--- end ir_defs.c ---*/
sewardj887a11a2004-07-05 17:26:47 +00004680/*---------------------------------------------------------------*/