blob: db5a836f519cabfb043f75bd40fd875607ad62d6 [file] [log] [blame]
sewardjec6ad592004-06-20 12:26:53 +00001
2/*---------------------------------------------------------------*/
sewardj752f9062010-05-03 21:38:49 +00003/*--- begin ir_defs.c ---*/
sewardjec6ad592004-06-20 12:26:53 +00004/*---------------------------------------------------------------*/
5
sewardjf8ed9d82004-11-12 17:40:23 +00006/*
sewardj752f9062010-05-03 21:38:49 +00007 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
sewardjf8ed9d82004-11-12 17:40:23 +00009
sewardj25e54732012-08-05 15:36:51 +000010 Copyright (C) 2004-2012 OpenWorks LLP
sewardj752f9062010-05-03 21:38:49 +000011 info@open-works.net
sewardjf8ed9d82004-11-12 17:40:23 +000012
sewardj752f9062010-05-03 21:38:49 +000013 This program is free software; you can redistribute it and/or
14 modify it under the terms of the GNU General Public License as
15 published by the Free Software Foundation; either version 2 of the
16 License, or (at your option) any later version.
sewardjf8ed9d82004-11-12 17:40:23 +000017
sewardj752f9062010-05-03 21:38:49 +000018 This program is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
sewardj7bd6ffe2005-08-03 16:07:36 +000026 02110-1301, USA.
27
sewardj752f9062010-05-03 21:38:49 +000028 The GNU General Public License is contained in the file COPYING.
sewardjf8ed9d82004-11-12 17:40:23 +000029
30 Neither the names of the U.S. Department of Energy nor the
31 University of California nor the names of its contributors may be
32 used to endorse or promote products derived from this software
33 without prior written permission.
sewardjf8ed9d82004-11-12 17:40:23 +000034*/
35
sewardj887a11a2004-07-05 17:26:47 +000036#include "libvex_basictypes.h"
37#include "libvex_ir.h"
38#include "libvex.h"
sewardjec6ad592004-06-20 12:26:53 +000039
sewardjcef7d3e2009-07-02 12:21:59 +000040#include "main_util.h"
sewardjc0ee2ed2004-07-27 10:29:41 +000041
sewardjec6ad592004-06-20 12:26:53 +000042
43/*---------------------------------------------------------------*/
44/*--- Printing the IR ---*/
45/*---------------------------------------------------------------*/
46
sewardj35421a32004-07-05 13:12:34 +000047void ppIRType ( IRType ty )
sewardjec6ad592004-06-20 12:26:53 +000048{
sewardj3e838932005-01-07 12:09:15 +000049 switch (ty) {
50 case Ity_INVALID: vex_printf("Ity_INVALID"); break;
sewardj9b967672005-02-08 11:13:09 +000051 case Ity_I1: vex_printf( "I1"); break;
52 case Ity_I8: vex_printf( "I8"); break;
53 case Ity_I16: vex_printf( "I16"); break;
54 case Ity_I32: vex_printf( "I32"); break;
55 case Ity_I64: vex_printf( "I64"); break;
56 case Ity_I128: vex_printf( "I128"); break;
57 case Ity_F32: vex_printf( "F32"); break;
58 case Ity_F64: vex_printf( "F64"); break;
sewardj2019a972011-03-07 16:04:07 +000059 case Ity_F128: vex_printf( "F128"); break;
sewardjc6bbd472012-04-02 10:20:48 +000060 case Ity_D32: vex_printf( "D32"); break;
61 case Ity_D64: vex_printf( "D64"); break;
62 case Ity_D128: vex_printf( "D128"); break;
sewardjc4530ae2012-05-21 10:18:49 +000063 case Ity_V128: vex_printf( "V128"); break;
64 case Ity_V256: vex_printf( "V256"); break;
sewardj3e838932005-01-07 12:09:15 +000065 default: vex_printf("ty = 0x%x\n", (Int)ty);
66 vpanic("ppIRType");
67 }
sewardjec6ad592004-06-20 12:26:53 +000068}
69
sewardj35421a32004-07-05 13:12:34 +000070void ppIRConst ( IRConst* con )
sewardjec6ad592004-06-20 12:26:53 +000071{
sewardj2019a972011-03-07 16:04:07 +000072 union { ULong i64; Double f64; UInt i32; Float f32; } u;
sewardj63327402006-01-25 03:26:27 +000073 vassert(sizeof(ULong) == sizeof(Double));
sewardj2d3f77c2004-09-22 23:49:09 +000074 switch (con->tag) {
sewardjba999312004-11-15 15:21:17 +000075 case Ico_U1: vex_printf( "%d:I1", con->Ico.U1 ? 1 : 0); break;
sewardj2d3f77c2004-09-22 23:49:09 +000076 case Ico_U8: vex_printf( "0x%x:I8", (UInt)(con->Ico.U8)); break;
77 case Ico_U16: vex_printf( "0x%x:I16", (UInt)(con->Ico.U16)); break;
78 case Ico_U32: vex_printf( "0x%x:I32", (UInt)(con->Ico.U32)); break;
79 case Ico_U64: vex_printf( "0x%llx:I64", (ULong)(con->Ico.U64)); break;
sewardj2019a972011-03-07 16:04:07 +000080 case Ico_F32: u.f32 = con->Ico.F32;
81 vex_printf( "F32{0x%x}", u.i32);
82 break;
83 case Ico_F32i: vex_printf( "F32i{0x%x}", con->Ico.F32i); break;
sewardja162c2c2005-12-18 03:07:11 +000084 case Ico_F64: u.f64 = con->Ico.F64;
85 vex_printf( "F64{0x%llx}", u.i64);
sewardj695cff92004-10-13 14:50:14 +000086 break;
sewardj2d3f77c2004-09-22 23:49:09 +000087 case Ico_F64i: vex_printf( "F64i{0x%llx}", con->Ico.F64i); break;
sewardj1e6ad742004-12-02 16:16:11 +000088 case Ico_V128: vex_printf( "V128{0x%04x}", (UInt)(con->Ico.V128)); break;
sewardj37a505b2012-06-29 15:28:24 +000089 case Ico_V256: vex_printf( "V256{0x%08x}", con->Ico.V256); break;
sewardj2d3f77c2004-09-22 23:49:09 +000090 default: vpanic("ppIRConst");
91 }
92}
93
sewardj8ea867b2004-10-30 19:03:02 +000094void ppIRCallee ( IRCallee* ce )
95{
96 vex_printf("%s", ce->name);
sewardj77352542004-10-30 20:39:01 +000097 if (ce->regparms > 0)
sewardj43c56462004-11-06 12:17:57 +000098 vex_printf("[rp=%d]", ce->regparms);
99 if (ce->mcx_mask > 0)
100 vex_printf("[mcx=0x%x]", ce->mcx_mask);
sewardj8ea867b2004-10-30 19:03:02 +0000101 vex_printf("{%p}", (void*)ce->addr);
102}
103
sewardjdd40fdf2006-12-24 02:20:24 +0000104void ppIRRegArray ( IRRegArray* arr )
sewardj2d3f77c2004-09-22 23:49:09 +0000105{
sewardj0bfea7f2004-10-04 07:15:48 +0000106 vex_printf("(%d:%dx", arr->base, arr->nElems);
sewardj2d3f77c2004-09-22 23:49:09 +0000107 ppIRType(arr->elemTy);
sewardj0bfea7f2004-10-04 07:15:48 +0000108 vex_printf(")");
sewardje3d0d2e2004-06-27 10:42:44 +0000109}
110
sewardj35421a32004-07-05 13:12:34 +0000111void ppIRTemp ( IRTemp tmp )
sewardje3d0d2e2004-06-27 10:42:44 +0000112{
sewardj92d168d2004-11-15 14:22:12 +0000113 if (tmp == IRTemp_INVALID)
114 vex_printf("IRTemp_INVALID");
sewardjfbcaf332004-07-08 01:46:01 +0000115 else
sewardj41f43bc2004-07-08 14:23:22 +0000116 vex_printf( "t%d", (Int)tmp);
sewardje3d0d2e2004-06-27 10:42:44 +0000117}
118
sewardj35421a32004-07-05 13:12:34 +0000119void ppIROp ( IROp op )
sewardje3d0d2e2004-06-27 10:42:44 +0000120{
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
332 case Iop_Est5FRSqrt: vex_printf("Est5FRSqrt"); 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
405 case Iop_Rsqrte32Fx4: vex_printf("VRsqrte32Fx4"); return;
406 case Iop_Rsqrte32x4: vex_printf("VRsqrte32x4"); return;
407 case Iop_Rsqrte32Fx2: vex_printf("VRsqrte32Fx2"); return;
408 case Iop_Rsqrte32x2: vex_printf("VRsqrte32x2"); return;
409
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;
473 case Iop_QDMulLong16Sx4: vex_printf("QDMulLong16Sx4"); return;
474 case Iop_QDMulLong32Sx2: vex_printf("QDMulLong32Sx2"); 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;
511 case Iop_Clz8Sx8: vex_printf("Clz8Sx8"); return;
512 case Iop_Clz16Sx4: vex_printf("Clz16Sx4"); return;
513 case Iop_Clz32Sx2: vex_printf("Clz32Sx2"); return;
514 case Iop_Cls8Sx8: vex_printf("Cls8Sx8"); return;
515 case Iop_Cls16Sx4: vex_printf("Cls16Sx4"); return;
516 case Iop_Cls32Sx2: vex_printf("Cls32Sx2"); 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;
sewardjad2c9ea2011-10-22 09:32:16 +0000529 case Iop_NarrowBin16to8x8: vex_printf("NarrowBin16to8x8"); return;
530 case Iop_NarrowBin32to16x4: vex_printf("NarrowBin32to16x4"); return;
sewardj38a3f862005-01-13 15:06:51 +0000531 case Iop_InterleaveHI8x8: vex_printf("InterleaveHI8x8"); return;
532 case Iop_InterleaveHI16x4: vex_printf("InterleaveHI16x4"); return;
533 case Iop_InterleaveHI32x2: vex_printf("InterleaveHI32x2"); return;
534 case Iop_InterleaveLO8x8: vex_printf("InterleaveLO8x8"); return;
535 case Iop_InterleaveLO16x4: vex_printf("InterleaveLO16x4"); return;
536 case Iop_InterleaveLO32x2: vex_printf("InterleaveLO32x2"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000537 case Iop_CatOddLanes8x8: vex_printf("CatOddLanes8x8"); return;
sewardjd166e282008-02-06 11:42:45 +0000538 case Iop_CatOddLanes16x4: vex_printf("CatOddLanes16x4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000539 case Iop_CatEvenLanes8x8: vex_printf("CatEvenLanes8x8"); return;
sewardjd166e282008-02-06 11:42:45 +0000540 case Iop_CatEvenLanes16x4: vex_printf("CatEvenLanes16x4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000541 case Iop_InterleaveOddLanes8x8: vex_printf("InterleaveOddLanes8x8"); return;
542 case Iop_InterleaveOddLanes16x4: vex_printf("InterleaveOddLanes16x4"); return;
543 case Iop_InterleaveEvenLanes8x8: vex_printf("InterleaveEvenLanes8x8"); return;
544 case Iop_InterleaveEvenLanes16x4: vex_printf("InterleaveEvenLanes16x4"); return;
545 case Iop_Shl8x8: vex_printf("Shl8x8"); return;
546 case Iop_Shl16x4: vex_printf("Shl16x4"); return;
547 case Iop_Shl32x2: vex_printf("Shl32x2"); return;
548 case Iop_Shr8x8: vex_printf("Shr8x8"); return;
549 case Iop_Shr16x4: vex_printf("Shr16x4"); return;
550 case Iop_Shr32x2: vex_printf("Shr32x2"); return;
551 case Iop_QShl8x8: vex_printf("QShl8x8"); return;
552 case Iop_QShl16x4: vex_printf("QShl16x4"); return;
553 case Iop_QShl32x2: vex_printf("QShl32x2"); return;
554 case Iop_QShl64x1: vex_printf("QShl64x1"); return;
555 case Iop_QSal8x8: vex_printf("QSal8x8"); return;
556 case Iop_QSal16x4: vex_printf("QSal16x4"); return;
557 case Iop_QSal32x2: vex_printf("QSal32x2"); return;
558 case Iop_QSal64x1: vex_printf("QSal64x1"); return;
559 case Iop_QShlN8x8: vex_printf("QShlN8x8"); return;
560 case Iop_QShlN16x4: vex_printf("QShlN16x4"); return;
561 case Iop_QShlN32x2: vex_printf("QShlN32x2"); return;
562 case Iop_QShlN64x1: vex_printf("QShlN64x1"); return;
563 case Iop_QShlN8Sx8: vex_printf("QShlN8Sx8"); return;
564 case Iop_QShlN16Sx4: vex_printf("QShlN16Sx4"); return;
565 case Iop_QShlN32Sx2: vex_printf("QShlN32Sx2"); return;
566 case Iop_QShlN64Sx1: vex_printf("QShlN64Sx1"); return;
567 case Iop_QSalN8x8: vex_printf("QSalN8x8"); return;
568 case Iop_QSalN16x4: vex_printf("QSalN16x4"); return;
569 case Iop_QSalN32x2: vex_printf("QSalN32x2"); return;
570 case Iop_QSalN64x1: vex_printf("QSalN64x1"); return;
571 case Iop_Sar8x8: vex_printf("Sar8x8"); return;
572 case Iop_Sar16x4: vex_printf("Sar16x4"); return;
573 case Iop_Sar32x2: vex_printf("Sar32x2"); return;
574 case Iop_Sal8x8: vex_printf("Sal8x8"); return;
575 case Iop_Sal16x4: vex_printf("Sal16x4"); return;
576 case Iop_Sal32x2: vex_printf("Sal32x2"); return;
577 case Iop_Sal64x1: vex_printf("Sal64x1"); return;
sewardj228c7c82008-07-29 09:47:21 +0000578 case Iop_Perm8x8: vex_printf("Perm8x8"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000579 case Iop_Reverse16_8x8: vex_printf("Reverse16_8x8"); return;
580 case Iop_Reverse32_8x8: vex_printf("Reverse32_8x8"); return;
581 case Iop_Reverse32_16x4: vex_printf("Reverse32_16x4"); return;
582 case Iop_Reverse64_8x8: vex_printf("Reverse64_8x8"); return;
583 case Iop_Reverse64_16x4: vex_printf("Reverse64_16x4"); return;
584 case Iop_Reverse64_32x2: vex_printf("Reverse64_32x2"); return;
585 case Iop_Abs32Fx2: vex_printf("Abs32Fx2"); return;
sewardje13074c2012-11-08 10:57:08 +0000586 case Iop_GetMSBs8x8: vex_printf("GetMSBs8x8"); return;
sewardj78a20592012-12-13 18:29:56 +0000587 case Iop_GetMSBs8x16: vex_printf("GetMSBs8x16"); return;
sewardj38a3f862005-01-13 15:06:51 +0000588
sewardj18069182005-01-13 19:16:04 +0000589 case Iop_CmpNEZ32x2: vex_printf("CmpNEZ32x2"); return;
590 case Iop_CmpNEZ16x4: vex_printf("CmpNEZ16x4"); return;
591 case Iop_CmpNEZ8x8: vex_printf("CmpNEZ8x8"); return;
592
sewardj1e6ad742004-12-02 16:16:11 +0000593 case Iop_Add32Fx4: vex_printf("Add32Fx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000594 case Iop_Add32Fx2: vex_printf("Add32Fx2"); return;
sewardj1e6ad742004-12-02 16:16:11 +0000595 case Iop_Add32F0x4: vex_printf("Add32F0x4"); return;
sewardj636ad762004-12-07 11:16:04 +0000596 case Iop_Add64Fx2: vex_printf("Add64Fx2"); return;
597 case Iop_Add64F0x2: vex_printf("Add64F0x2"); return;
sewardj1e6ad742004-12-02 16:16:11 +0000598
sewardj176a59c2004-12-03 20:08:31 +0000599 case Iop_Div32Fx4: vex_printf("Div32Fx4"); return;
600 case Iop_Div32F0x4: vex_printf("Div32F0x4"); return;
sewardj636ad762004-12-07 11:16:04 +0000601 case Iop_Div64Fx2: vex_printf("Div64Fx2"); return;
602 case Iop_Div64F0x2: vex_printf("Div64F0x2"); return;
sewardj176a59c2004-12-03 20:08:31 +0000603
sewardj8eb7ae82012-06-24 14:00:27 +0000604 case Iop_Max32Fx8: vex_printf("Max32Fx8"); return;
sewardj176a59c2004-12-03 20:08:31 +0000605 case Iop_Max32Fx4: vex_printf("Max32Fx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000606 case Iop_Max32Fx2: vex_printf("Max32Fx2"); return;
607 case Iop_PwMax32Fx4: vex_printf("PwMax32Fx4"); return;
608 case Iop_PwMax32Fx2: vex_printf("PwMax32Fx2"); return;
sewardj176a59c2004-12-03 20:08:31 +0000609 case Iop_Max32F0x4: vex_printf("Max32F0x4"); return;
sewardj8eb7ae82012-06-24 14:00:27 +0000610 case Iop_Max64Fx4: vex_printf("Max64Fx4"); return;
sewardj636ad762004-12-07 11:16:04 +0000611 case Iop_Max64Fx2: vex_printf("Max64Fx2"); return;
612 case Iop_Max64F0x2: vex_printf("Max64F0x2"); return;
sewardj176a59c2004-12-03 20:08:31 +0000613
sewardj8eb7ae82012-06-24 14:00:27 +0000614 case Iop_Min32Fx8: vex_printf("Min32Fx8"); return;
sewardj176a59c2004-12-03 20:08:31 +0000615 case Iop_Min32Fx4: vex_printf("Min32Fx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000616 case Iop_Min32Fx2: vex_printf("Min32Fx2"); return;
617 case Iop_PwMin32Fx4: vex_printf("PwMin32Fx4"); return;
618 case Iop_PwMin32Fx2: vex_printf("PwMin32Fx2"); return;
sewardj176a59c2004-12-03 20:08:31 +0000619 case Iop_Min32F0x4: vex_printf("Min32F0x4"); return;
sewardj8eb7ae82012-06-24 14:00:27 +0000620 case Iop_Min64Fx4: vex_printf("Min64Fx4"); return;
sewardj636ad762004-12-07 11:16:04 +0000621 case Iop_Min64Fx2: vex_printf("Min64Fx2"); return;
622 case Iop_Min64F0x2: vex_printf("Min64F0x2"); return;
sewardj176a59c2004-12-03 20:08:31 +0000623
sewardj9636b442004-12-04 01:38:37 +0000624 case Iop_Mul32Fx4: vex_printf("Mul32Fx4"); return;
625 case Iop_Mul32F0x4: vex_printf("Mul32F0x4"); return;
sewardj636ad762004-12-07 11:16:04 +0000626 case Iop_Mul64Fx2: vex_printf("Mul64Fx2"); return;
627 case Iop_Mul64F0x2: vex_printf("Mul64F0x2"); return;
sewardj9636b442004-12-04 01:38:37 +0000628
sewardj2fdd4162010-08-22 12:59:02 +0000629 case Iop_Recip32x2: vex_printf("Recip32x2"); return;
630 case Iop_Recip32Fx2: vex_printf("Recip32Fx2"); return;
sewardj0bd7ce62004-12-05 02:47:40 +0000631 case Iop_Recip32Fx4: vex_printf("Recip32Fx4"); return;
sewardj82096922012-06-24 14:57:59 +0000632 case Iop_Recip32Fx8: vex_printf("Recip32Fx8"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000633 case Iop_Recip32x4: vex_printf("Recip32x4"); return;
sewardj0bd7ce62004-12-05 02:47:40 +0000634 case Iop_Recip32F0x4: vex_printf("Recip32F0x4"); return;
sewardj636ad762004-12-07 11:16:04 +0000635 case Iop_Recip64Fx2: vex_printf("Recip64Fx2"); return;
636 case Iop_Recip64F0x2: vex_printf("Recip64F0x2"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000637 case Iop_Recps32Fx2: vex_printf("VRecps32Fx2"); return;
638 case Iop_Recps32Fx4: vex_printf("VRecps32Fx4"); return;
639 case Iop_Abs32Fx4: vex_printf("Abs32Fx4"); return;
640 case Iop_Rsqrts32Fx4: vex_printf("VRsqrts32Fx4"); return;
641 case Iop_Rsqrts32Fx2: vex_printf("VRsqrts32Fx2"); return;
sewardj0bd7ce62004-12-05 02:47:40 +0000642
sewardjc1e7dfc2004-12-05 19:29:45 +0000643 case Iop_RSqrt32Fx4: vex_printf("RSqrt32Fx4"); return;
644 case Iop_RSqrt32F0x4: vex_printf("RSqrt32F0x4"); return;
sewardj66becf32012-06-18 23:15:16 +0000645 case Iop_RSqrt32Fx8: vex_printf("RSqrt32Fx8"); return;
sewardj636ad762004-12-07 11:16:04 +0000646 case Iop_RSqrt64Fx2: vex_printf("RSqrt64Fx2"); return;
647 case Iop_RSqrt64F0x2: vex_printf("RSqrt64F0x2"); return;
sewardjc1e7dfc2004-12-05 19:29:45 +0000648
sewardj636ad762004-12-07 11:16:04 +0000649 case Iop_Sqrt32Fx4: vex_printf("Sqrt32Fx4"); return;
650 case Iop_Sqrt32F0x4: vex_printf("Sqrt32F0x4"); return;
651 case Iop_Sqrt64Fx2: vex_printf("Sqrt64Fx2"); return;
652 case Iop_Sqrt64F0x2: vex_printf("Sqrt64F0x2"); return;
sewardj66becf32012-06-18 23:15:16 +0000653 case Iop_Sqrt32Fx8: vex_printf("Sqrt32Fx8"); return;
654 case Iop_Sqrt64Fx4: vex_printf("Sqrt64Fx4"); return;
655
sewardjc1e7dfc2004-12-05 19:29:45 +0000656 case Iop_Sub32Fx4: vex_printf("Sub32Fx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000657 case Iop_Sub32Fx2: vex_printf("Sub32Fx2"); return;
sewardjc1e7dfc2004-12-05 19:29:45 +0000658 case Iop_Sub32F0x4: vex_printf("Sub32F0x4"); return;
sewardj636ad762004-12-07 11:16:04 +0000659 case Iop_Sub64Fx2: vex_printf("Sub64Fx2"); return;
660 case Iop_Sub64F0x2: vex_printf("Sub64F0x2"); return;
sewardjc1e7dfc2004-12-05 19:29:45 +0000661
sewardj1e6ad742004-12-02 16:16:11 +0000662 case Iop_CmpEQ32Fx4: vex_printf("CmpEQ32Fx4"); return;
663 case Iop_CmpLT32Fx4: vex_printf("CmpLT32Fx4"); return;
664 case Iop_CmpLE32Fx4: vex_printf("CmpLE32Fx4"); return;
cerion206c3642005-11-14 00:35:59 +0000665 case Iop_CmpGT32Fx4: vex_printf("CmpGT32Fx4"); return;
666 case Iop_CmpGE32Fx4: vex_printf("CmpGE32Fx4"); return;
sewardj1e6ad742004-12-02 16:16:11 +0000667 case Iop_CmpUN32Fx4: vex_printf("CmpUN32Fx4"); return;
sewardj636ad762004-12-07 11:16:04 +0000668 case Iop_CmpEQ64Fx2: vex_printf("CmpEQ64Fx2"); return;
669 case Iop_CmpLT64Fx2: vex_printf("CmpLT64Fx2"); return;
670 case Iop_CmpLE64Fx2: vex_printf("CmpLE64Fx2"); return;
671 case Iop_CmpUN64Fx2: vex_printf("CmpUN64Fx2"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000672 case Iop_CmpGT32Fx2: vex_printf("CmpGT32Fx2"); return;
673 case Iop_CmpEQ32Fx2: vex_printf("CmpEQ32Fx2"); return;
674 case Iop_CmpGE32Fx2: vex_printf("CmpGE32Fx2"); return;
sewardj1e6ad742004-12-02 16:16:11 +0000675
676 case Iop_CmpEQ32F0x4: vex_printf("CmpEQ32F0x4"); return;
677 case Iop_CmpLT32F0x4: vex_printf("CmpLT32F0x4"); return;
678 case Iop_CmpLE32F0x4: vex_printf("CmpLE32F0x4"); return;
679 case Iop_CmpUN32F0x4: vex_printf("CmpUN32F0x4"); return;
sewardj636ad762004-12-07 11:16:04 +0000680 case Iop_CmpEQ64F0x2: vex_printf("CmpEQ64F0x2"); return;
681 case Iop_CmpLT64F0x2: vex_printf("CmpLT64F0x2"); return;
682 case Iop_CmpLE64F0x2: vex_printf("CmpLE64F0x2"); return;
683 case Iop_CmpUN64F0x2: vex_printf("CmpUN64F0x2"); return;
sewardjc9a43662004-11-30 18:51:59 +0000684
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;
sewardjc9a43662004-11-30 18:51:59 +0000694
sewardjf0c1c582005-02-07 23:47:38 +0000695 case Iop_32UtoV128: vex_printf("32UtoV128"); return;
696 case Iop_V128to32: vex_printf("V128to32"); return;
697 case Iop_SetV128lo32: vex_printf("SetV128lo32"); return;
sewardj129b3d92004-12-05 15:42:05 +0000698
cerionf887b3e2005-09-13 16:34:28 +0000699 case Iop_Dup8x16: vex_printf("Dup8x16"); return;
700 case Iop_Dup16x8: vex_printf("Dup16x8"); return;
701 case Iop_Dup32x4: vex_printf("Dup32x4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000702 case Iop_Dup8x8: vex_printf("Dup8x8"); return;
703 case Iop_Dup16x4: vex_printf("Dup16x4"); return;
704 case Iop_Dup32x2: vex_printf("Dup32x2"); return;
cerionf887b3e2005-09-13 16:34:28 +0000705
sewardjf0c1c582005-02-07 23:47:38 +0000706 case Iop_NotV128: vex_printf("NotV128"); return;
707 case Iop_AndV128: vex_printf("AndV128"); return;
708 case Iop_OrV128: vex_printf("OrV128"); return;
709 case Iop_XorV128: vex_printf("XorV128"); return;
sewardj18069182005-01-13 19:16:04 +0000710
sewardj2e383862004-12-12 16:46:47 +0000711 case Iop_CmpNEZ8x16: vex_printf("CmpNEZ8x16"); return;
712 case Iop_CmpNEZ16x8: vex_printf("CmpNEZ16x8"); return;
sewardj70f676d2004-12-10 14:59:57 +0000713 case Iop_CmpNEZ32x4: vex_printf("CmpNEZ32x4"); return;
sewardj109ffdb2004-12-10 21:45:38 +0000714 case Iop_CmpNEZ64x2: vex_printf("CmpNEZ64x2"); return;
sewardj164f9272004-12-09 00:39:32 +0000715
sewardj2fdd4162010-08-22 12:59:02 +0000716 case Iop_Abs8x16: vex_printf("Abs8x16"); return;
717 case Iop_Abs16x8: vex_printf("Abs16x8"); return;
718 case Iop_Abs32x4: vex_printf("Abs32x4"); return;
719
sewardj164f9272004-12-09 00:39:32 +0000720 case Iop_Add8x16: vex_printf("Add8x16"); return;
721 case Iop_Add16x8: vex_printf("Add16x8"); return;
722 case Iop_Add32x4: vex_printf("Add32x4"); return;
723 case Iop_Add64x2: vex_printf("Add64x2"); return;
724 case Iop_QAdd8Ux16: vex_printf("QAdd8Ux16"); return;
725 case Iop_QAdd16Ux8: vex_printf("QAdd16Ux8"); return;
cerionf887b3e2005-09-13 16:34:28 +0000726 case Iop_QAdd32Ux4: vex_printf("QAdd32Ux4"); return;
sewardj164f9272004-12-09 00:39:32 +0000727 case Iop_QAdd8Sx16: vex_printf("QAdd8Sx16"); return;
728 case Iop_QAdd16Sx8: vex_printf("QAdd16Sx8"); return;
cerionf887b3e2005-09-13 16:34:28 +0000729 case Iop_QAdd32Sx4: vex_printf("QAdd32Sx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000730 case Iop_QAdd64Ux2: vex_printf("QAdd64Ux2"); return;
731 case Iop_QAdd64Sx2: vex_printf("QAdd64Sx2"); return;
732 case Iop_PwAdd8x16: vex_printf("PwAdd8x16"); return;
733 case Iop_PwAdd16x8: vex_printf("PwAdd16x8"); return;
734 case Iop_PwAdd32x4: vex_printf("PwAdd32x4"); return;
735 case Iop_PwAddL8Ux16: vex_printf("PwAddL8Ux16"); return;
736 case Iop_PwAddL16Ux8: vex_printf("PwAddL16Ux8"); return;
737 case Iop_PwAddL32Ux4: vex_printf("PwAddL32Ux4"); return;
738 case Iop_PwAddL8Sx16: vex_printf("PwAddL8Sx16"); return;
739 case Iop_PwAddL16Sx8: vex_printf("PwAddL16Sx8"); return;
740 case Iop_PwAddL32Sx4: vex_printf("PwAddL32Sx4"); return;
sewardj164f9272004-12-09 00:39:32 +0000741
742 case Iop_Sub8x16: vex_printf("Sub8x16"); return;
743 case Iop_Sub16x8: vex_printf("Sub16x8"); return;
744 case Iop_Sub32x4: vex_printf("Sub32x4"); return;
745 case Iop_Sub64x2: vex_printf("Sub64x2"); return;
746 case Iop_QSub8Ux16: vex_printf("QSub8Ux16"); return;
747 case Iop_QSub16Ux8: vex_printf("QSub16Ux8"); return;
cerionf887b3e2005-09-13 16:34:28 +0000748 case Iop_QSub32Ux4: vex_printf("QSub32Ux4"); return;
sewardj164f9272004-12-09 00:39:32 +0000749 case Iop_QSub8Sx16: vex_printf("QSub8Sx16"); return;
750 case Iop_QSub16Sx8: vex_printf("QSub16Sx8"); return;
cerionf887b3e2005-09-13 16:34:28 +0000751 case Iop_QSub32Sx4: vex_printf("QSub32Sx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000752 case Iop_QSub64Ux2: vex_printf("QSub64Ux2"); return;
753 case Iop_QSub64Sx2: vex_printf("QSub64Sx2"); return;
sewardj164f9272004-12-09 00:39:32 +0000754
sewardj2fdd4162010-08-22 12:59:02 +0000755 case Iop_Mul8x16: vex_printf("Mul8x16"); return;
sewardj164f9272004-12-09 00:39:32 +0000756 case Iop_Mul16x8: vex_printf("Mul16x8"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000757 case Iop_Mul32x4: vex_printf("Mul32x4"); return;
758 case Iop_Mull8Ux8: vex_printf("Mull8Ux8"); return;
759 case Iop_Mull8Sx8: vex_printf("Mull8Sx8"); return;
760 case Iop_Mull16Ux4: vex_printf("Mull16Ux4"); return;
761 case Iop_Mull16Sx4: vex_printf("Mull16Sx4"); return;
762 case Iop_Mull32Ux2: vex_printf("Mull32Ux2"); return;
763 case Iop_Mull32Sx2: vex_printf("Mull32Sx2"); return;
764 case Iop_PolynomialMul8x16: vex_printf("PolynomialMul8x16"); return;
765 case Iop_PolynomialMull8x8: vex_printf("PolynomialMull8x8"); return;
sewardj164f9272004-12-09 00:39:32 +0000766 case Iop_MulHi16Ux8: vex_printf("MulHi16Ux8"); return;
cerionf887b3e2005-09-13 16:34:28 +0000767 case Iop_MulHi32Ux4: vex_printf("MulHi32Ux4"); return;
sewardj164f9272004-12-09 00:39:32 +0000768 case Iop_MulHi16Sx8: vex_printf("MulHi16Sx8"); return;
cerionf887b3e2005-09-13 16:34:28 +0000769 case Iop_MulHi32Sx4: vex_printf("MulHi32Sx4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000770 case Iop_QDMulHi16Sx8: vex_printf("QDMulHi16Sx8"); return;
771 case Iop_QDMulHi32Sx4: vex_printf("QDMulHi32Sx4"); return;
772 case Iop_QRDMulHi16Sx8: vex_printf("QRDMulHi16Sx8"); return;
773 case Iop_QRDMulHi32Sx4: vex_printf("QRDMulHi32Sx4"); return;
sewardj164f9272004-12-09 00:39:32 +0000774
cerion1ac656a2005-11-04 19:44:48 +0000775 case Iop_MullEven8Ux16: vex_printf("MullEven8Ux16"); return;
776 case Iop_MullEven16Ux8: vex_printf("MullEven16Ux8"); return;
777 case Iop_MullEven8Sx16: vex_printf("MullEven8Sx16"); return;
778 case Iop_MullEven16Sx8: vex_printf("MullEven16Sx8"); return;
779
sewardj164f9272004-12-09 00:39:32 +0000780 case Iop_Avg8Ux16: vex_printf("Avg8Ux16"); return;
781 case Iop_Avg16Ux8: vex_printf("Avg16Ux8"); return;
cerionf887b3e2005-09-13 16:34:28 +0000782 case Iop_Avg32Ux4: vex_printf("Avg32Ux4"); return;
783 case Iop_Avg8Sx16: vex_printf("Avg8Sx16"); return;
784 case Iop_Avg16Sx8: vex_printf("Avg16Sx8"); return;
785 case Iop_Avg32Sx4: vex_printf("Avg32Sx4"); return;
sewardj164f9272004-12-09 00:39:32 +0000786
cerionf887b3e2005-09-13 16:34:28 +0000787 case Iop_Max8Sx16: vex_printf("Max8Sx16"); return;
sewardj164f9272004-12-09 00:39:32 +0000788 case Iop_Max16Sx8: vex_printf("Max16Sx8"); return;
cerionf887b3e2005-09-13 16:34:28 +0000789 case Iop_Max32Sx4: vex_printf("Max32Sx4"); return;
sewardj164f9272004-12-09 00:39:32 +0000790 case Iop_Max8Ux16: vex_printf("Max8Ux16"); return;
cerionf887b3e2005-09-13 16:34:28 +0000791 case Iop_Max16Ux8: vex_printf("Max16Ux8"); return;
792 case Iop_Max32Ux4: vex_printf("Max32Ux4"); return;
793
794 case Iop_Min8Sx16: vex_printf("Min8Sx16"); return;
sewardj164f9272004-12-09 00:39:32 +0000795 case Iop_Min16Sx8: vex_printf("Min16Sx8"); return;
cerionf887b3e2005-09-13 16:34:28 +0000796 case Iop_Min32Sx4: vex_printf("Min32Sx4"); return;
sewardj164f9272004-12-09 00:39:32 +0000797 case Iop_Min8Ux16: vex_printf("Min8Ux16"); return;
cerionf887b3e2005-09-13 16:34:28 +0000798 case Iop_Min16Ux8: vex_printf("Min16Ux8"); return;
799 case Iop_Min32Ux4: vex_printf("Min32Ux4"); return;
sewardj164f9272004-12-09 00:39:32 +0000800
801 case Iop_CmpEQ8x16: vex_printf("CmpEQ8x16"); return;
802 case Iop_CmpEQ16x8: vex_printf("CmpEQ16x8"); return;
803 case Iop_CmpEQ32x4: vex_printf("CmpEQ32x4"); return;
sewardjd8815622011-10-19 15:24:01 +0000804 case Iop_CmpEQ64x2: vex_printf("CmpEQ64x2"); return;
sewardj164f9272004-12-09 00:39:32 +0000805 case Iop_CmpGT8Sx16: vex_printf("CmpGT8Sx16"); return;
806 case Iop_CmpGT16Sx8: vex_printf("CmpGT16Sx8"); return;
807 case Iop_CmpGT32Sx4: vex_printf("CmpGT32Sx4"); return;
sewardj69d98e32010-06-18 08:17:41 +0000808 case Iop_CmpGT64Sx2: vex_printf("CmpGT64Sx2"); return;
cerionf887b3e2005-09-13 16:34:28 +0000809 case Iop_CmpGT8Ux16: vex_printf("CmpGT8Ux16"); return;
810 case Iop_CmpGT16Ux8: vex_printf("CmpGT16Ux8"); return;
811 case Iop_CmpGT32Ux4: vex_printf("CmpGT32Ux4"); return;
812
sewardj2fdd4162010-08-22 12:59:02 +0000813 case Iop_Cnt8x16: vex_printf("Cnt8x16"); return;
814 case Iop_Clz8Sx16: vex_printf("Clz8Sx16"); return;
815 case Iop_Clz16Sx8: vex_printf("Clz16Sx8"); return;
816 case Iop_Clz32Sx4: vex_printf("Clz32Sx4"); return;
817 case Iop_Cls8Sx16: vex_printf("Cls8Sx16"); return;
818 case Iop_Cls16Sx8: vex_printf("Cls16Sx8"); return;
819 case Iop_Cls32Sx4: vex_printf("Cls32Sx4"); return;
820
cerionf887b3e2005-09-13 16:34:28 +0000821 case Iop_ShlV128: vex_printf("ShlV128"); return;
822 case Iop_ShrV128: vex_printf("ShrV128"); return;
sewardj164f9272004-12-09 00:39:32 +0000823
cerion2a4b8452005-09-15 16:28:36 +0000824 case Iop_ShlN8x16: vex_printf("ShlN8x16"); return;
sewardj164f9272004-12-09 00:39:32 +0000825 case Iop_ShlN16x8: vex_printf("ShlN16x8"); return;
826 case Iop_ShlN32x4: vex_printf("ShlN32x4"); return;
827 case Iop_ShlN64x2: vex_printf("ShlN64x2"); return;
cerion2a4b8452005-09-15 16:28:36 +0000828 case Iop_ShrN8x16: vex_printf("ShrN8x16"); return;
sewardj164f9272004-12-09 00:39:32 +0000829 case Iop_ShrN16x8: vex_printf("ShrN16x8"); return;
830 case Iop_ShrN32x4: vex_printf("ShrN32x4"); return;
831 case Iop_ShrN64x2: vex_printf("ShrN64x2"); return;
cerion2a4b8452005-09-15 16:28:36 +0000832 case Iop_SarN8x16: vex_printf("SarN8x16"); return;
sewardj164f9272004-12-09 00:39:32 +0000833 case Iop_SarN16x8: vex_printf("SarN16x8"); return;
834 case Iop_SarN32x4: vex_printf("SarN32x4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000835 case Iop_SarN64x2: vex_printf("SarN64x2"); return;
sewardj164f9272004-12-09 00:39:32 +0000836
cerionf887b3e2005-09-13 16:34:28 +0000837 case Iop_Shl8x16: vex_printf("Shl8x16"); return;
838 case Iop_Shl16x8: vex_printf("Shl16x8"); return;
839 case Iop_Shl32x4: vex_printf("Shl32x4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000840 case Iop_Shl64x2: vex_printf("Shl64x2"); return;
841 case Iop_QSal8x16: vex_printf("QSal8x16"); return;
842 case Iop_QSal16x8: vex_printf("QSal16x8"); return;
843 case Iop_QSal32x4: vex_printf("QSal32x4"); return;
844 case Iop_QSal64x2: vex_printf("QSal64x2"); return;
845 case Iop_QShl8x16: vex_printf("QShl8x16"); return;
846 case Iop_QShl16x8: vex_printf("QShl16x8"); return;
847 case Iop_QShl32x4: vex_printf("QShl32x4"); return;
848 case Iop_QShl64x2: vex_printf("QShl64x2"); return;
849 case Iop_QSalN8x16: vex_printf("QSalN8x16"); return;
850 case Iop_QSalN16x8: vex_printf("QSalN16x8"); return;
851 case Iop_QSalN32x4: vex_printf("QSalN32x4"); return;
852 case Iop_QSalN64x2: vex_printf("QSalN64x2"); return;
853 case Iop_QShlN8x16: vex_printf("QShlN8x16"); return;
854 case Iop_QShlN16x8: vex_printf("QShlN16x8"); return;
855 case Iop_QShlN32x4: vex_printf("QShlN32x4"); return;
856 case Iop_QShlN64x2: vex_printf("QShlN64x2"); return;
857 case Iop_QShlN8Sx16: vex_printf("QShlN8Sx16"); return;
858 case Iop_QShlN16Sx8: vex_printf("QShlN16Sx8"); return;
859 case Iop_QShlN32Sx4: vex_printf("QShlN32Sx4"); return;
860 case Iop_QShlN64Sx2: vex_printf("QShlN64Sx2"); return;
cerionf887b3e2005-09-13 16:34:28 +0000861 case Iop_Shr8x16: vex_printf("Shr8x16"); return;
862 case Iop_Shr16x8: vex_printf("Shr16x8"); return;
863 case Iop_Shr32x4: vex_printf("Shr32x4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000864 case Iop_Shr64x2: vex_printf("Shr64x2"); return;
cerionf887b3e2005-09-13 16:34:28 +0000865 case Iop_Sar8x16: vex_printf("Sar8x16"); return;
866 case Iop_Sar16x8: vex_printf("Sar16x8"); return;
867 case Iop_Sar32x4: vex_printf("Sar32x4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000868 case Iop_Sar64x2: vex_printf("Sar64x2"); return;
869 case Iop_Sal8x16: vex_printf("Sal8x16"); return;
870 case Iop_Sal16x8: vex_printf("Sal16x8"); return;
871 case Iop_Sal32x4: vex_printf("Sal32x4"); return;
872 case Iop_Sal64x2: vex_printf("Sal64x2"); return;
sewardj1bee5612005-11-10 18:10:58 +0000873 case Iop_Rol8x16: vex_printf("Rol8x16"); return;
874 case Iop_Rol16x8: vex_printf("Rol16x8"); return;
875 case Iop_Rol32x4: vex_printf("Rol32x4"); return;
cerionf887b3e2005-09-13 16:34:28 +0000876
sewardj5f438dd2011-06-16 11:36:23 +0000877 case Iop_NarrowBin16to8x16: vex_printf("NarrowBin16to8x16"); return;
878 case Iop_NarrowBin32to16x8: vex_printf("NarrowBin32to16x8"); return;
879 case Iop_QNarrowBin16Uto8Ux16: vex_printf("QNarrowBin16Uto8Ux16"); return;
880 case Iop_QNarrowBin32Sto16Ux8: vex_printf("QNarrowBin32Sto16Ux8"); return;
881 case Iop_QNarrowBin16Sto8Ux16: vex_printf("QNarrowBin16Sto8Ux16"); return;
882 case Iop_QNarrowBin32Uto16Ux8: vex_printf("QNarrowBin32Uto16Ux8"); return;
883 case Iop_QNarrowBin16Sto8Sx16: vex_printf("QNarrowBin16Sto8Sx16"); return;
884 case Iop_QNarrowBin32Sto16Sx8: vex_printf("QNarrowBin32Sto16Sx8"); return;
885 case Iop_NarrowUn16to8x8: vex_printf("NarrowUn16to8x8"); return;
886 case Iop_NarrowUn32to16x4: vex_printf("NarrowUn32to16x4"); return;
887 case Iop_NarrowUn64to32x2: vex_printf("NarrowUn64to32x2"); return;
888 case Iop_QNarrowUn16Uto8Ux8: vex_printf("QNarrowUn16Uto8Ux8"); return;
889 case Iop_QNarrowUn32Uto16Ux4: vex_printf("QNarrowUn32Uto16Ux4"); return;
890 case Iop_QNarrowUn64Uto32Ux2: vex_printf("QNarrowUn64Uto32Ux2"); return;
891 case Iop_QNarrowUn16Sto8Sx8: vex_printf("QNarrowUn16Sto8Sx8"); return;
892 case Iop_QNarrowUn32Sto16Sx4: vex_printf("QNarrowUn32Sto16Sx4"); return;
893 case Iop_QNarrowUn64Sto32Sx2: vex_printf("QNarrowUn64Sto32Sx2"); return;
894 case Iop_QNarrowUn16Sto8Ux8: vex_printf("QNarrowUn16Sto8Ux8"); return;
895 case Iop_QNarrowUn32Sto16Ux4: vex_printf("QNarrowUn32Sto16Ux4"); return;
896 case Iop_QNarrowUn64Sto32Ux2: vex_printf("QNarrowUn64Sto32Ux2"); return;
897 case Iop_Widen8Uto16x8: vex_printf("Widen8Uto16x8"); return;
898 case Iop_Widen16Uto32x4: vex_printf("Widen16Uto32x4"); return;
899 case Iop_Widen32Uto64x2: vex_printf("Widen32Uto64x2"); return;
900 case Iop_Widen8Sto16x8: vex_printf("Widen8Sto16x8"); return;
901 case Iop_Widen16Sto32x4: vex_printf("Widen16Sto32x4"); return;
902 case Iop_Widen32Sto64x2: vex_printf("Widen32Sto64x2"); return;
sewardj164f9272004-12-09 00:39:32 +0000903
904 case Iop_InterleaveHI8x16: vex_printf("InterleaveHI8x16"); return;
905 case Iop_InterleaveHI16x8: vex_printf("InterleaveHI16x8"); return;
906 case Iop_InterleaveHI32x4: vex_printf("InterleaveHI32x4"); return;
907 case Iop_InterleaveHI64x2: vex_printf("InterleaveHI64x2"); return;
908 case Iop_InterleaveLO8x16: vex_printf("InterleaveLO8x16"); return;
909 case Iop_InterleaveLO16x8: vex_printf("InterleaveLO16x8"); return;
910 case Iop_InterleaveLO32x4: vex_printf("InterleaveLO32x4"); return;
911 case Iop_InterleaveLO64x2: vex_printf("InterleaveLO64x2"); return;
912
sewardj2fdd4162010-08-22 12:59:02 +0000913 case Iop_CatOddLanes8x16: vex_printf("CatOddLanes8x16"); return;
914 case Iop_CatOddLanes16x8: vex_printf("CatOddLanes16x8"); return;
915 case Iop_CatOddLanes32x4: vex_printf("CatOddLanes32x4"); return;
916 case Iop_CatEvenLanes8x16: vex_printf("CatEvenLanes8x16"); return;
917 case Iop_CatEvenLanes16x8: vex_printf("CatEvenLanes16x8"); return;
918 case Iop_CatEvenLanes32x4: vex_printf("CatEvenLanes32x4"); return;
919
920 case Iop_InterleaveOddLanes8x16: vex_printf("InterleaveOddLanes8x16"); return;
921 case Iop_InterleaveOddLanes16x8: vex_printf("InterleaveOddLanes16x8"); return;
922 case Iop_InterleaveOddLanes32x4: vex_printf("InterleaveOddLanes32x4"); return;
923 case Iop_InterleaveEvenLanes8x16: vex_printf("InterleaveEvenLanes8x16"); return;
924 case Iop_InterleaveEvenLanes16x8: vex_printf("InterleaveEvenLanes16x8"); return;
925 case Iop_InterleaveEvenLanes32x4: vex_printf("InterleaveEvenLanes32x4"); return;
926
927 case Iop_GetElem8x16: vex_printf("GetElem8x16"); return;
928 case Iop_GetElem16x8: vex_printf("GetElem16x8"); return;
929 case Iop_GetElem32x4: vex_printf("GetElem32x4"); return;
930 case Iop_GetElem64x2: vex_printf("GetElem64x2"); return;
931
932 case Iop_GetElem8x8: vex_printf("GetElem8x8"); return;
933 case Iop_GetElem16x4: vex_printf("GetElem16x4"); return;
934 case Iop_GetElem32x2: vex_printf("GetElem32x2"); return;
935 case Iop_SetElem8x8: vex_printf("SetElem8x8"); return;
936 case Iop_SetElem16x4: vex_printf("SetElem16x4"); return;
937 case Iop_SetElem32x2: vex_printf("SetElem32x2"); return;
938
939 case Iop_Extract64: vex_printf("Extract64"); return;
940 case Iop_ExtractV128: vex_printf("ExtractV128"); return;
941
sewardjdc1f9132005-10-22 12:49:49 +0000942 case Iop_Perm8x16: vex_printf("Perm8x16"); return;
sewardjd8bca7e2012-06-20 11:46:19 +0000943 case Iop_Perm32x4: vex_printf("Perm32x4"); return;
sewardj2fdd4162010-08-22 12:59:02 +0000944 case Iop_Reverse16_8x16: vex_printf("Reverse16_8x16"); return;
945 case Iop_Reverse32_8x16: vex_printf("Reverse32_8x16"); return;
946 case Iop_Reverse32_16x8: vex_printf("Reverse32_16x8"); return;
947 case Iop_Reverse64_8x16: vex_printf("Reverse64_8x16"); return;
948 case Iop_Reverse64_16x8: vex_printf("Reverse64_16x8"); return;
949 case Iop_Reverse64_32x4: vex_printf("Reverse64_32x4"); return;
950
951 case Iop_F32ToFixed32Ux4_RZ: vex_printf("F32ToFixed32Ux4_RZ"); return;
952 case Iop_F32ToFixed32Sx4_RZ: vex_printf("F32ToFixed32Sx4_RZ"); return;
953 case Iop_Fixed32UToF32x4_RN: vex_printf("Fixed32UToF32x4_RN"); return;
954 case Iop_Fixed32SToF32x4_RN: vex_printf("Fixed32SToF32x4_RN"); return;
955 case Iop_F32ToFixed32Ux2_RZ: vex_printf("F32ToFixed32Ux2_RZ"); return;
956 case Iop_F32ToFixed32Sx2_RZ: vex_printf("F32ToFixed32Sx2_RZ"); return;
957 case Iop_Fixed32UToF32x2_RN: vex_printf("Fixed32UToF32x2_RN"); return;
958 case Iop_Fixed32SToF32x2_RN: vex_printf("Fixed32SToF32x2_RN"); return;
cerionf887b3e2005-09-13 16:34:28 +0000959
sewardj26217b02012-04-12 17:19:48 +0000960 case Iop_D32toD64: vex_printf("D32toD64"); return;
961 case Iop_D64toD32: vex_printf("D64toD32"); return;
sewardjc6bbd472012-04-02 10:20:48 +0000962 case Iop_AddD64: vex_printf("AddD64"); return;
963 case Iop_SubD64: vex_printf("SubD64"); return;
964 case Iop_MulD64: vex_printf("MulD64"); return;
965 case Iop_DivD64: vex_printf("DivD64"); return;
sewardj26217b02012-04-12 17:19:48 +0000966 case Iop_ShlD64: vex_printf("ShlD64"); return;
967 case Iop_ShrD64: vex_printf("ShrD64"); return;
florianb17e16f2013-01-12 22:02:07 +0000968 case Iop_D64toI32S: vex_printf("D64toI32S"); return;
969 case Iop_D64toI32U: vex_printf("D64toI32U"); return;
sewardj26217b02012-04-12 17:19:48 +0000970 case Iop_D64toI64S: vex_printf("D64toI64S"); return;
florianb17e16f2013-01-12 22:02:07 +0000971 case Iop_D64toI64U: vex_printf("D64toI64U"); return;
972 case Iop_I32StoD64: vex_printf("I32StoD64"); return;
973 case Iop_I32UtoD64: vex_printf("I32UtoD64"); return;
sewardj26217b02012-04-12 17:19:48 +0000974 case Iop_I64StoD64: vex_printf("I64StoD64"); return;
florianb17e16f2013-01-12 22:02:07 +0000975 case Iop_I64UtoD64: vex_printf("I64UtoD64"); return;
976 case Iop_I32StoD128: vex_printf("I32StoD128"); return;
977 case Iop_I32UtoD128: vex_printf("I32UtoD128"); return;
sewardj26217b02012-04-12 17:19:48 +0000978 case Iop_I64StoD128: vex_printf("I64StoD128"); return;
florianb17e16f2013-01-12 22:02:07 +0000979 case Iop_I64UtoD128: vex_printf("I64UtoD128"); return;
sewardj26217b02012-04-12 17:19:48 +0000980 case Iop_D64toD128: vex_printf("D64toD128"); return;
981 case Iop_D128toD64: vex_printf("D128toD64"); return;
florianb17e16f2013-01-12 22:02:07 +0000982 case Iop_D128toI32S: vex_printf("D128toI32S"); return;
983 case Iop_D128toI32U: vex_printf("D128toI32U"); return;
sewardj26217b02012-04-12 17:19:48 +0000984 case Iop_D128toI64S: vex_printf("D128toI64S"); return;
florianb17e16f2013-01-12 22:02:07 +0000985 case Iop_D128toI64U: vex_printf("D128toI64U"); return;
florianb22838d2013-06-17 18:59:51 +0000986 case Iop_F32toD32: vex_printf("F32toD32"); return;
987 case Iop_F32toD64: vex_printf("F32toD64"); return;
988 case Iop_F32toD128: vex_printf("F32toD128"); return;
989 case Iop_F64toD32: vex_printf("F64toD32"); return;
florian37c57f32013-05-05 15:04:30 +0000990 case Iop_F64toD64: vex_printf("F64toD64"); return;
florian37c57f32013-05-05 15:04:30 +0000991 case Iop_F64toD128: vex_printf("F64toD128"); return;
florianb22838d2013-06-17 18:59:51 +0000992 case Iop_F128toD32: vex_printf("F128toD32"); return;
993 case Iop_F128toD64: vex_printf("F128toD64"); return;
florian37c57f32013-05-05 15:04:30 +0000994 case Iop_F128toD128: vex_printf("F128toD128"); return;
florianb22838d2013-06-17 18:59:51 +0000995 case Iop_D32toF32: vex_printf("D32toF32"); return;
996 case Iop_D32toF64: vex_printf("D32toF64"); return;
997 case Iop_D32toF128: vex_printf("D32toF128"); return;
998 case Iop_D64toF32: vex_printf("D64toF32"); return;
999 case Iop_D64toF64: vex_printf("D64toF64"); return;
1000 case Iop_D64toF128: vex_printf("D64toF128"); return;
1001 case Iop_D128toF32: vex_printf("D128toF32"); return;
1002 case Iop_D128toF64: vex_printf("D128toF64"); return;
florian37c57f32013-05-05 15:04:30 +00001003 case Iop_D128toF128: vex_printf("D128toF128"); return;
sewardjc6bbd472012-04-02 10:20:48 +00001004 case Iop_AddD128: vex_printf("AddD128"); return;
1005 case Iop_SubD128: vex_printf("SubD128"); return;
1006 case Iop_MulD128: vex_printf("MulD128"); return;
1007 case Iop_DivD128: vex_printf("DivD128"); return;
sewardj26217b02012-04-12 17:19:48 +00001008 case Iop_ShlD128: vex_printf("ShlD128"); return;
1009 case Iop_ShrD128: vex_printf("ShrD128"); return;
sewardjcdc376d2012-04-23 11:21:12 +00001010 case Iop_RoundD64toInt: vex_printf("Iop_RoundD64toInt"); return;
1011 case Iop_RoundD128toInt: vex_printf("Iop_RoundD128toInt"); return;
1012 case Iop_QuantizeD64: vex_printf("Iop_QuantizeD64"); return;
1013 case Iop_QuantizeD128: vex_printf("Iop_QuantizeD128"); return;
1014 case Iop_ExtractExpD64: vex_printf("Iop_ExtractExpD64"); return;
1015 case Iop_ExtractExpD128: vex_printf("Iop_ExtractExpD128"); return;
florian4bbd3ec2012-12-27 20:01:13 +00001016 case Iop_ExtractSigD64: vex_printf("Iop_ExtractSigD64"); return;
1017 case Iop_ExtractSigD128: vex_printf("Iop_ExtractSigD128"); return;
sewardjcdc376d2012-04-23 11:21:12 +00001018 case Iop_InsertExpD64: vex_printf("Iop_InsertExpD64"); return;
1019 case Iop_InsertExpD128: vex_printf("Iop_InsertExpD128"); return;
florian20c6bca2012-12-26 17:47:19 +00001020 case Iop_CmpD64: vex_printf("CmpD64"); return;
1021 case Iop_CmpD128: vex_printf("CmpD128"); return;
1022 case Iop_CmpExpD64: vex_printf("CmpExpD64"); return;
1023 case Iop_CmpExpD128: vex_printf("CmpExpD128"); return;
1024 case Iop_D64HLtoD128: vex_printf("D64HLtoD128"); return;
1025 case Iop_D128HItoD64: vex_printf("D128HItoD64"); return;
1026 case Iop_D128LOtoD64: vex_printf("D128LOtoD64"); return;
sewardjcdc376d2012-04-23 11:21:12 +00001027 case Iop_SignificanceRoundD64: vex_printf("Iop_SignificanceRoundD64");
1028 return;
1029 case Iop_SignificanceRoundD128: vex_printf("Iop_SignificanceRoundD128");
1030 return;
1031 case Iop_ReinterpI64asD64: vex_printf("ReinterpI64asD64"); return;
sewardj5eff1c52012-04-29 20:19:17 +00001032 case Iop_ReinterpD64asI64: vex_printf("ReinterpD64asI64"); return;
sewardjc4530ae2012-05-21 10:18:49 +00001033 case Iop_V256to64_0: vex_printf("V256to64_0"); return;
1034 case Iop_V256to64_1: vex_printf("V256to64_1"); return;
1035 case Iop_V256to64_2: vex_printf("V256to64_2"); return;
1036 case Iop_V256to64_3: vex_printf("V256to64_3"); return;
1037 case Iop_64x4toV256: vex_printf("64x4toV256"); return;
sewardj4b1cc832012-06-13 11:10:20 +00001038 case Iop_V256toV128_0: vex_printf("V256toV128_0"); return;
1039 case Iop_V256toV128_1: vex_printf("V256toV128_1"); return;
1040 case Iop_V128HLtoV256: vex_printf("V128HLtoV256"); return;
sewardj56c30312012-06-12 08:45:39 +00001041 case Iop_DPBtoBCD: vex_printf("DPBtoBCD"); return;
1042 case Iop_BCDtoDPB: vex_printf("BCDtoDPB"); return;
1043 case Iop_Add64Fx4: vex_printf("Add64Fx4"); return;
1044 case Iop_Sub64Fx4: vex_printf("Sub64Fx4"); return;
1045 case Iop_Mul64Fx4: vex_printf("Mul64Fx4"); return;
1046 case Iop_Div64Fx4: vex_printf("Div64Fx4"); return;
1047 case Iop_Add32Fx8: vex_printf("Add32Fx8"); return;
1048 case Iop_Sub32Fx8: vex_printf("Sub32Fx8"); return;
1049 case Iop_Mul32Fx8: vex_printf("Mul32Fx8"); return;
1050 case Iop_Div32Fx8: vex_printf("Div32Fx8"); return;
sewardj4b1cc832012-06-13 11:10:20 +00001051 case Iop_AndV256: vex_printf("AndV256"); return;
sewardj2a2bda92012-06-14 23:32:02 +00001052 case Iop_OrV256: vex_printf("OrV256"); return;
sewardj4b1cc832012-06-13 11:10:20 +00001053 case Iop_XorV256: vex_printf("XorV256"); return;
sewardj2a2bda92012-06-14 23:32:02 +00001054 case Iop_NotV256: vex_printf("NotV256"); return;
sewardj23db8a02012-06-25 07:46:18 +00001055 case Iop_CmpNEZ64x4: vex_printf("CmpNEZ64x4"); return;
1056 case Iop_CmpNEZ32x8: vex_printf("CmpNEZ32x8"); return;
sewardjcc3d2192013-03-27 11:37:33 +00001057 case Iop_CmpNEZ16x16: vex_printf("CmpNEZ16x16"); return;
1058 case Iop_CmpNEZ8x32: vex_printf("CmpNEZ8x32"); return;
1059
1060 case Iop_Add8x32: vex_printf("Add8x32"); return;
1061 case Iop_Add16x16: vex_printf("Add16x16"); return;
1062 case Iop_Add32x8: vex_printf("Add32x8"); return;
1063 case Iop_Add64x4: vex_printf("Add64x4"); return;
1064 case Iop_Sub8x32: vex_printf("Sub8x32"); return;
1065 case Iop_Sub16x16: vex_printf("Sub16x16"); return;
1066 case Iop_Sub32x8: vex_printf("Sub32x8"); return;
1067 case Iop_Sub64x4: vex_printf("Sub64x4"); return;
1068 case Iop_QAdd8Ux32: vex_printf("QAdd8Ux32"); return;
1069 case Iop_QAdd16Ux16: vex_printf("QAdd16Ux16"); return;
1070 case Iop_QAdd8Sx32: vex_printf("QAdd8Sx32"); return;
1071 case Iop_QAdd16Sx16: vex_printf("QAdd16Sx16"); return;
1072 case Iop_QSub8Ux32: vex_printf("QSub8Ux32"); return;
1073 case Iop_QSub16Ux16: vex_printf("QSub16Ux16"); return;
1074 case Iop_QSub8Sx32: vex_printf("QSub8Sx32"); return;
1075 case Iop_QSub16Sx16: vex_printf("QSub16Sx16"); return;
1076
1077 case Iop_Mul16x16: vex_printf("Mul16x16"); return;
1078 case Iop_Mul32x8: vex_printf("Mul32x8"); return;
1079 case Iop_MulHi16Ux16: vex_printf("MulHi16Ux16"); return;
1080 case Iop_MulHi16Sx16: vex_printf("MulHi16Sx16"); return;
1081
1082 case Iop_Avg8Ux32: vex_printf("Avg8Ux32"); return;
1083 case Iop_Avg16Ux16: vex_printf("Avg16Ux16"); return;
1084
1085 case Iop_Max8Sx32: vex_printf("Max8Sx32"); return;
1086 case Iop_Max16Sx16: vex_printf("Max16Sx16"); return;
1087 case Iop_Max32Sx8: vex_printf("Max32Sx8"); return;
1088 case Iop_Max8Ux32: vex_printf("Max8Ux32"); return;
1089 case Iop_Max16Ux16: vex_printf("Max16Ux16"); return;
1090 case Iop_Max32Ux8: vex_printf("Max32Ux8"); return;
1091
1092 case Iop_Min8Sx32: vex_printf("Min8Sx32"); return;
1093 case Iop_Min16Sx16: vex_printf("Min16Sx16"); return;
1094 case Iop_Min32Sx8: vex_printf("Min32Sx8"); return;
1095 case Iop_Min8Ux32: vex_printf("Min8Ux32"); return;
1096 case Iop_Min16Ux16: vex_printf("Min16Ux16"); return;
1097 case Iop_Min32Ux8: vex_printf("Min32Ux8"); return;
1098
1099 case Iop_CmpEQ8x32: vex_printf("CmpEQ8x32"); return;
1100 case Iop_CmpEQ16x16: vex_printf("CmpEQ16x16"); return;
1101 case Iop_CmpEQ32x8: vex_printf("CmpEQ32x8"); return;
1102 case Iop_CmpEQ64x4: vex_printf("CmpEQ64x4"); return;
1103 case Iop_CmpGT8Sx32: vex_printf("CmpGT8Sx32"); return;
1104 case Iop_CmpGT16Sx16: vex_printf("CmpGT16Sx16"); return;
1105 case Iop_CmpGT32Sx8: vex_printf("CmpGT32Sx8"); return;
1106 case Iop_CmpGT64Sx4: vex_printf("CmpGT64Sx4"); return;
1107
1108 case Iop_ShlN16x16: vex_printf("ShlN16x16"); return;
1109 case Iop_ShlN32x8: vex_printf("ShlN32x8"); return;
1110 case Iop_ShlN64x4: vex_printf("ShlN64x4"); return;
1111 case Iop_ShrN16x16: vex_printf("ShrN16x16"); return;
1112 case Iop_ShrN32x8: vex_printf("ShrN32x8"); return;
1113 case Iop_ShrN64x4: vex_printf("ShrN64x4"); return;
1114 case Iop_SarN16x16: vex_printf("SarN16x16"); return;
1115 case Iop_SarN32x8: vex_printf("SarN32x8"); return;
1116
1117 case Iop_Perm32x8: vex_printf("Perm32x8"); return;
1118
sewardjc9a43662004-11-30 18:51:59 +00001119 default: vpanic("ppIROp(1)");
sewardj41f43bc2004-07-08 14:23:22 +00001120 }
sewardj1fb8c922009-07-12 12:56:53 +00001121
1122 vassert(str);
sewardj41f43bc2004-07-08 14:23:22 +00001123 switch (op - base) {
sewardjecbaee72008-11-01 23:54:45 +00001124 case 0: vex_printf("%s",str); vex_printf("8"); break;
1125 case 1: vex_printf("%s",str); vex_printf("16"); break;
1126 case 2: vex_printf("%s",str); vex_printf("32"); break;
1127 case 3: vex_printf("%s",str); vex_printf("64"); break;
sewardj41f43bc2004-07-08 14:23:22 +00001128 default: vpanic("ppIROp(2)");
1129 }
sewardje3d0d2e2004-06-27 10:42:44 +00001130}
1131
sewardj35421a32004-07-05 13:12:34 +00001132void ppIRExpr ( IRExpr* e )
sewardje3d0d2e2004-06-27 10:42:44 +00001133{
sewardje87b4842004-07-10 12:23:30 +00001134 Int i;
sewardje3d0d2e2004-06-27 10:42:44 +00001135 switch (e->tag) {
sewardj443cd9d2004-07-18 23:06:45 +00001136 case Iex_Binder:
1137 vex_printf("BIND-%d", e->Iex.Binder.binder);
1138 break;
sewardje3d0d2e2004-06-27 10:42:44 +00001139 case Iex_Get:
sewardjc9a43662004-11-30 18:51:59 +00001140 vex_printf( "GET:" );
sewardjfbcaf332004-07-08 01:46:01 +00001141 ppIRType(e->Iex.Get.ty);
sewardjc9a43662004-11-30 18:51:59 +00001142 vex_printf("(%d)", e->Iex.Get.offset);
sewardjec6ad592004-06-20 12:26:53 +00001143 break;
sewardjbb53f8c2004-08-14 11:50:01 +00001144 case Iex_GetI:
sewardj2d3f77c2004-09-22 23:49:09 +00001145 vex_printf( "GETI" );
sewardjdd40fdf2006-12-24 02:20:24 +00001146 ppIRRegArray(e->Iex.GetI.descr);
sewardj2d3f77c2004-09-22 23:49:09 +00001147 vex_printf("[");
sewardjeeac8412004-11-02 00:26:55 +00001148 ppIRExpr(e->Iex.GetI.ix);
sewardj2d3f77c2004-09-22 23:49:09 +00001149 vex_printf(",%d]", e->Iex.GetI.bias);
sewardjbb53f8c2004-08-14 11:50:01 +00001150 break;
sewardjdd40fdf2006-12-24 02:20:24 +00001151 case Iex_RdTmp:
1152 ppIRTemp(e->Iex.RdTmp.tmp);
sewardjec6ad592004-06-20 12:26:53 +00001153 break;
florian96d7cc32012-06-01 20:41:24 +00001154 case Iex_Qop: {
1155 IRQop *qop = e->Iex.Qop.details;
1156 ppIROp(qop->op);
sewardj40c80262006-02-08 19:30:46 +00001157 vex_printf( "(" );
florian96d7cc32012-06-01 20:41:24 +00001158 ppIRExpr(qop->arg1);
sewardj40c80262006-02-08 19:30:46 +00001159 vex_printf( "," );
florian96d7cc32012-06-01 20:41:24 +00001160 ppIRExpr(qop->arg2);
sewardj40c80262006-02-08 19:30:46 +00001161 vex_printf( "," );
florian96d7cc32012-06-01 20:41:24 +00001162 ppIRExpr(qop->arg3);
sewardj40c80262006-02-08 19:30:46 +00001163 vex_printf( "," );
florian96d7cc32012-06-01 20:41:24 +00001164 ppIRExpr(qop->arg4);
sewardj40c80262006-02-08 19:30:46 +00001165 vex_printf( ")" );
1166 break;
florian96d7cc32012-06-01 20:41:24 +00001167 }
florian420bfa92012-06-02 20:29:22 +00001168 case Iex_Triop: {
1169 IRTriop *triop = e->Iex.Triop.details;
1170 ppIROp(triop->op);
sewardjb183b852006-02-03 16:08:03 +00001171 vex_printf( "(" );
florian420bfa92012-06-02 20:29:22 +00001172 ppIRExpr(triop->arg1);
sewardjb183b852006-02-03 16:08:03 +00001173 vex_printf( "," );
florian420bfa92012-06-02 20:29:22 +00001174 ppIRExpr(triop->arg2);
sewardjb183b852006-02-03 16:08:03 +00001175 vex_printf( "," );
florian420bfa92012-06-02 20:29:22 +00001176 ppIRExpr(triop->arg3);
sewardjb183b852006-02-03 16:08:03 +00001177 vex_printf( ")" );
1178 break;
florian420bfa92012-06-02 20:29:22 +00001179 }
sewardje3d0d2e2004-06-27 10:42:44 +00001180 case Iex_Binop:
sewardj35421a32004-07-05 13:12:34 +00001181 ppIROp(e->Iex.Binop.op);
1182 vex_printf( "(" );
1183 ppIRExpr(e->Iex.Binop.arg1);
1184 vex_printf( "," );
1185 ppIRExpr(e->Iex.Binop.arg2);
1186 vex_printf( ")" );
sewardjec6ad592004-06-20 12:26:53 +00001187 break;
sewardje3d0d2e2004-06-27 10:42:44 +00001188 case Iex_Unop:
sewardj35421a32004-07-05 13:12:34 +00001189 ppIROp(e->Iex.Unop.op);
1190 vex_printf( "(" );
1191 ppIRExpr(e->Iex.Unop.arg);
1192 vex_printf( ")" );
sewardjec6ad592004-06-20 12:26:53 +00001193 break;
sewardjaf1ceca2005-06-30 23:31:27 +00001194 case Iex_Load:
sewardje768e922009-11-26 17:17:37 +00001195 vex_printf( "LD%s:", e->Iex.Load.end==Iend_LE ? "le" : "be" );
sewardjaf1ceca2005-06-30 23:31:27 +00001196 ppIRType(e->Iex.Load.ty);
sewardje05c42c2004-07-08 20:25:10 +00001197 vex_printf( "(" );
sewardjaf1ceca2005-06-30 23:31:27 +00001198 ppIRExpr(e->Iex.Load.addr);
sewardj35421a32004-07-05 13:12:34 +00001199 vex_printf( ")" );
sewardjec6ad592004-06-20 12:26:53 +00001200 break;
sewardje3d0d2e2004-06-27 10:42:44 +00001201 case Iex_Const:
sewardj35421a32004-07-05 13:12:34 +00001202 ppIRConst(e->Iex.Const.con);
sewardjec6ad592004-06-20 12:26:53 +00001203 break;
sewardje87b4842004-07-10 12:23:30 +00001204 case Iex_CCall:
sewardj8ea867b2004-10-30 19:03:02 +00001205 ppIRCallee(e->Iex.CCall.cee);
1206 vex_printf("(");
sewardje87b4842004-07-10 12:23:30 +00001207 for (i = 0; e->Iex.CCall.args[i] != NULL; i++) {
1208 ppIRExpr(e->Iex.CCall.args[i]);
1209 if (e->Iex.CCall.args[i+1] != NULL)
1210 vex_printf(",");
1211 }
1212 vex_printf("):");
1213 ppIRType(e->Iex.CCall.retty);
1214 break;
florian99dd03e2013-01-29 03:56:06 +00001215 case Iex_ITE:
1216 vex_printf("ITE(");
1217 ppIRExpr(e->Iex.ITE.cond);
sewardjeeb9ef82004-07-15 12:39:03 +00001218 vex_printf(",");
florian99dd03e2013-01-29 03:56:06 +00001219 ppIRExpr(e->Iex.ITE.iftrue);
sewardjeeb9ef82004-07-15 12:39:03 +00001220 vex_printf(",");
florian99dd03e2013-01-29 03:56:06 +00001221 ppIRExpr(e->Iex.ITE.iffalse);
sewardjeeb9ef82004-07-15 12:39:03 +00001222 vex_printf(")");
1223 break;
sewardjec6ad592004-06-20 12:26:53 +00001224 default:
sewardj909c06d2005-02-19 22:47:41 +00001225 vpanic("ppIRExpr");
sewardjec6ad592004-06-20 12:26:53 +00001226 }
1227}
1228
sewardj17442fe2004-09-20 14:54:28 +00001229void ppIREffect ( IREffect fx )
1230{
1231 switch (fx) {
1232 case Ifx_None: vex_printf("noFX"); return;
1233 case Ifx_Read: vex_printf("RdFX"); return;
1234 case Ifx_Write: vex_printf("WrFX"); return;
1235 case Ifx_Modify: vex_printf("MoFX"); return;
1236 default: vpanic("ppIREffect");
1237 }
1238}
1239
1240void ppIRDirty ( IRDirty* d )
1241{
1242 Int i;
sewardj92d168d2004-11-15 14:22:12 +00001243 if (d->tmp != IRTemp_INVALID) {
sewardj4b861de2004-11-03 15:24:42 +00001244 ppIRTemp(d->tmp);
1245 vex_printf(" = ");
1246 }
sewardjb8385d82004-11-02 01:34:15 +00001247 vex_printf("DIRTY ");
1248 ppIRExpr(d->guard);
sewardjc5fc7aa2004-10-27 23:00:55 +00001249 if (d->needsBBP)
1250 vex_printf(" NeedsBBP");
sewardj17442fe2004-09-20 14:54:28 +00001251 if (d->mFx != Ifx_None) {
sewardj49651f42004-10-28 22:11:04 +00001252 vex_printf(" ");
sewardj17442fe2004-09-20 14:54:28 +00001253 ppIREffect(d->mFx);
1254 vex_printf("-mem(");
1255 ppIRExpr(d->mAddr);
sewardj49651f42004-10-28 22:11:04 +00001256 vex_printf(",%d)", d->mSize);
sewardj17442fe2004-09-20 14:54:28 +00001257 }
1258 for (i = 0; i < d->nFxState; i++) {
sewardj49651f42004-10-28 22:11:04 +00001259 vex_printf(" ");
sewardj17442fe2004-09-20 14:54:28 +00001260 ppIREffect(d->fxState[i].fx);
sewardjc9069f22012-06-01 16:09:50 +00001261 vex_printf("-gst(%u,%u", (UInt)d->fxState[i].offset,
1262 (UInt)d->fxState[i].size);
1263 if (d->fxState[i].nRepeats > 0) {
1264 vex_printf(",reps%u,step%u", (UInt)d->fxState[i].nRepeats,
1265 (UInt)d->fxState[i].repeatLen);
1266 }
1267 vex_printf(")");
sewardj17442fe2004-09-20 14:54:28 +00001268 }
sewardjc5fc7aa2004-10-27 23:00:55 +00001269 vex_printf(" ::: ");
sewardj8ea867b2004-10-30 19:03:02 +00001270 ppIRCallee(d->cee);
1271 vex_printf("(");
sewardj17442fe2004-09-20 14:54:28 +00001272 for (i = 0; d->args[i] != NULL; i++) {
1273 ppIRExpr(d->args[i]);
1274 if (d->args[i+1] != NULL) {
1275 vex_printf(",");
1276 }
1277 }
1278 vex_printf(")");
1279}
1280
sewardje9d8a262009-07-01 08:06:34 +00001281void ppIRCAS ( IRCAS* cas )
1282{
1283 /* Print even structurally invalid constructions, as an aid to
1284 debugging. */
1285 if (cas->oldHi != IRTemp_INVALID) {
1286 ppIRTemp(cas->oldHi);
1287 vex_printf(",");
1288 }
1289 ppIRTemp(cas->oldLo);
1290 vex_printf(" = CAS%s(", cas->end==Iend_LE ? "le" : "be" );
1291 ppIRExpr(cas->addr);
1292 vex_printf("::");
1293 if (cas->expdHi) {
1294 ppIRExpr(cas->expdHi);
1295 vex_printf(",");
1296 }
1297 ppIRExpr(cas->expdLo);
1298 vex_printf("->");
1299 if (cas->dataHi) {
1300 ppIRExpr(cas->dataHi);
1301 vex_printf(",");
1302 }
1303 ppIRExpr(cas->dataLo);
1304 vex_printf(")");
1305}
1306
floriand6f38b32012-05-31 15:46:18 +00001307void ppIRPutI ( IRPutI* puti )
1308{
1309 vex_printf( "PUTI" );
1310 ppIRRegArray(puti->descr);
1311 vex_printf("[");
1312 ppIRExpr(puti->ix);
1313 vex_printf(",%d] = ", puti->bias);
1314 ppIRExpr(puti->data);
1315}
1316
sewardjcfe046e2013-01-17 14:23:53 +00001317void ppIRStoreG ( IRStoreG* sg )
1318{
1319 vex_printf("if (");
1320 ppIRExpr(sg->guard);
1321 vex_printf(") ST%s(", sg->end==Iend_LE ? "le" : "be");
1322 ppIRExpr(sg->addr);
1323 vex_printf(") = ");
1324 ppIRExpr(sg->data);
1325}
1326
1327void ppIRLoadGOp ( IRLoadGOp cvt )
1328{
1329 switch (cvt) {
1330 case ILGop_INVALID: vex_printf("ILGop_INVALID"); break;
1331 case ILGop_Ident32: vex_printf("Ident32"); break;
1332 case ILGop_16Uto32: vex_printf("16Uto32"); break;
1333 case ILGop_16Sto32: vex_printf("16Sto32"); break;
1334 case ILGop_8Uto32: vex_printf("8Uto32"); break;
1335 case ILGop_8Sto32: vex_printf("8Sto32"); break;
1336 default: vpanic("ppIRLoadGOp");
1337 }
1338}
1339
1340void ppIRLoadG ( IRLoadG* lg )
1341{
1342 ppIRTemp(lg->dst);
1343 vex_printf(" = if-strict (");
1344 ppIRExpr(lg->guard);
1345 vex_printf(") ");
1346 ppIRLoadGOp(lg->cvt);
1347 vex_printf("(LD%s(", lg->end==Iend_LE ? "le" : "be");
1348 ppIRExpr(lg->addr);
1349 vex_printf(")) else ");
1350 ppIRExpr(lg->alt);
1351}
1352
sewardj893aada2004-11-29 19:57:54 +00001353void ppIRJumpKind ( IRJumpKind kind )
1354{
1355 switch (kind) {
petarja6a19862012-10-19 14:55:58 +00001356 case Ijk_Boring: vex_printf("Boring"); break;
1357 case Ijk_Call: vex_printf("Call"); break;
1358 case Ijk_Ret: vex_printf("Return"); break;
1359 case Ijk_ClientReq: vex_printf("ClientReq"); break;
1360 case Ijk_Yield: vex_printf("Yield"); break;
1361 case Ijk_EmWarn: vex_printf("EmWarn"); break;
1362 case Ijk_EmFail: vex_printf("EmFail"); break;
1363 case Ijk_NoDecode: vex_printf("NoDecode"); break;
1364 case Ijk_MapFail: vex_printf("MapFail"); break;
1365 case Ijk_TInval: vex_printf("Invalidate"); break;
1366 case Ijk_NoRedir: vex_printf("NoRedir"); break;
1367 case Ijk_SigTRAP: vex_printf("SigTRAP"); break;
1368 case Ijk_SigSEGV: vex_printf("SigSEGV"); break;
1369 case Ijk_SigBUS: vex_printf("SigBUS"); break;
1370 case Ijk_SigFPE_IntDiv: vex_printf("SigFPE_IntDiv"); break;
1371 case Ijk_SigFPE_IntOvf: vex_printf("SigFPE_IntOvf"); break;
1372 case Ijk_Sys_syscall: vex_printf("Sys_syscall"); break;
1373 case Ijk_Sys_int32: vex_printf("Sys_int32"); break;
1374 case Ijk_Sys_int128: vex_printf("Sys_int128"); break;
1375 case Ijk_Sys_int129: vex_printf("Sys_int129"); break;
1376 case Ijk_Sys_int130: vex_printf("Sys_int130"); break;
1377 case Ijk_Sys_sysenter: vex_printf("Sys_sysenter"); break;
1378 default: vpanic("ppIRJumpKind");
sewardj893aada2004-11-29 19:57:54 +00001379 }
1380}
1381
sewardjc4356f02007-11-09 21:15:04 +00001382void ppIRMBusEvent ( IRMBusEvent event )
1383{
1384 switch (event) {
sewardj6d615ba2011-09-26 16:19:43 +00001385 case Imbe_Fence:
1386 vex_printf("Fence"); break;
1387 case Imbe_CancelReservation:
1388 vex_printf("CancelReservation"); break;
1389 default:
1390 vpanic("ppIRMBusEvent");
sewardjc4356f02007-11-09 21:15:04 +00001391 }
1392}
1393
sewardj35421a32004-07-05 13:12:34 +00001394void ppIRStmt ( IRStmt* s )
sewardjec6ad592004-06-20 12:26:53 +00001395{
sewardjd2445f62005-03-21 00:15:53 +00001396 if (!s) {
1397 vex_printf("!!! IRStmt* which is NULL !!!");
1398 return;
1399 }
sewardj17442fe2004-09-20 14:54:28 +00001400 switch (s->tag) {
sewardjd2445f62005-03-21 00:15:53 +00001401 case Ist_NoOp:
1402 vex_printf("IR-NoOp");
1403 break;
sewardjf1689312005-03-16 18:19:10 +00001404 case Ist_IMark:
sewardj2f10aa62011-05-27 13:20:56 +00001405 vex_printf( "------ IMark(0x%llx, %d, %u) ------",
1406 s->Ist.IMark.addr, s->Ist.IMark.len,
1407 (UInt)s->Ist.IMark.delta);
sewardjf1689312005-03-16 18:19:10 +00001408 break;
sewardj5a9ffab2005-05-12 17:55:01 +00001409 case Ist_AbiHint:
1410 vex_printf("====== AbiHint(");
1411 ppIRExpr(s->Ist.AbiHint.base);
sewardj478646f2008-05-01 20:13:04 +00001412 vex_printf(", %d, ", s->Ist.AbiHint.len);
1413 ppIRExpr(s->Ist.AbiHint.nia);
1414 vex_printf(") ======");
sewardj5a9ffab2005-05-12 17:55:01 +00001415 break;
sewardj17442fe2004-09-20 14:54:28 +00001416 case Ist_Put:
1417 vex_printf( "PUT(%d) = ", s->Ist.Put.offset);
sewardj6d076362004-09-23 11:06:17 +00001418 ppIRExpr(s->Ist.Put.data);
sewardj17442fe2004-09-20 14:54:28 +00001419 break;
1420 case Ist_PutI:
floriand6f38b32012-05-31 15:46:18 +00001421 ppIRPutI(s->Ist.PutI.details);
sewardj17442fe2004-09-20 14:54:28 +00001422 break;
sewardjdd40fdf2006-12-24 02:20:24 +00001423 case Ist_WrTmp:
1424 ppIRTemp(s->Ist.WrTmp.tmp);
sewardj17442fe2004-09-20 14:54:28 +00001425 vex_printf( " = " );
sewardjdd40fdf2006-12-24 02:20:24 +00001426 ppIRExpr(s->Ist.WrTmp.data);
sewardj17442fe2004-09-20 14:54:28 +00001427 break;
sewardjaf1ceca2005-06-30 23:31:27 +00001428 case Ist_Store:
1429 vex_printf( "ST%s(", s->Ist.Store.end==Iend_LE ? "le" : "be" );
1430 ppIRExpr(s->Ist.Store.addr);
sewardj17442fe2004-09-20 14:54:28 +00001431 vex_printf( ") = ");
sewardjaf1ceca2005-06-30 23:31:27 +00001432 ppIRExpr(s->Ist.Store.data);
sewardje9d8a262009-07-01 08:06:34 +00001433 break;
sewardjcfe046e2013-01-17 14:23:53 +00001434 case Ist_StoreG:
1435 ppIRStoreG(s->Ist.StoreG.details);
1436 break;
1437 case Ist_LoadG:
1438 ppIRLoadG(s->Ist.LoadG.details);
1439 break;
sewardje9d8a262009-07-01 08:06:34 +00001440 case Ist_CAS:
1441 ppIRCAS(s->Ist.CAS.details);
sewardj17442fe2004-09-20 14:54:28 +00001442 break;
sewardje768e922009-11-26 17:17:37 +00001443 case Ist_LLSC:
1444 if (s->Ist.LLSC.storedata == NULL) {
1445 ppIRTemp(s->Ist.LLSC.result);
1446 vex_printf(" = LD%s-Linked(",
1447 s->Ist.LLSC.end==Iend_LE ? "le" : "be");
1448 ppIRExpr(s->Ist.LLSC.addr);
1449 vex_printf(")");
1450 } else {
1451 ppIRTemp(s->Ist.LLSC.result);
1452 vex_printf(" = ( ST%s-Cond(",
1453 s->Ist.LLSC.end==Iend_LE ? "le" : "be");
1454 ppIRExpr(s->Ist.LLSC.addr);
1455 vex_printf(") = ");
1456 ppIRExpr(s->Ist.LLSC.storedata);
1457 vex_printf(" )");
1458 }
1459 break;
sewardj17442fe2004-09-20 14:54:28 +00001460 case Ist_Dirty:
1461 ppIRDirty(s->Ist.Dirty.details);
1462 break;
sewardjc4356f02007-11-09 21:15:04 +00001463 case Ist_MBE:
1464 vex_printf("IR-");
1465 ppIRMBusEvent(s->Ist.MBE.event);
sewardj3e838932005-01-07 12:09:15 +00001466 break;
sewardj17442fe2004-09-20 14:54:28 +00001467 case Ist_Exit:
1468 vex_printf( "if (" );
sewardj0276d4b2004-11-15 15:30:21 +00001469 ppIRExpr(s->Ist.Exit.guard);
sewardjc6f970f2012-04-02 21:54:49 +00001470 vex_printf( ") { PUT(%d) = ", s->Ist.Exit.offsIP);
sewardj17442fe2004-09-20 14:54:28 +00001471 ppIRConst(s->Ist.Exit.dst);
sewardjc6f970f2012-04-02 21:54:49 +00001472 vex_printf("; exit-");
1473 ppIRJumpKind(s->Ist.Exit.jk);
1474 vex_printf(" } ");
sewardj17442fe2004-09-20 14:54:28 +00001475 break;
1476 default:
1477 vpanic("ppIRStmt");
1478 }
sewardjec6ad592004-06-20 12:26:53 +00001479}
1480
sewardj35421a32004-07-05 13:12:34 +00001481void ppIRTypeEnv ( IRTypeEnv* env ) {
sewardjc97096c2004-06-30 09:28:04 +00001482 UInt i;
sewardje539a402004-07-14 18:24:17 +00001483 for (i = 0; i < env->types_used; i++) {
sewardjc97096c2004-06-30 09:28:04 +00001484 if (i % 8 == 0)
sewardj35421a32004-07-05 13:12:34 +00001485 vex_printf( " ");
sewardje539a402004-07-14 18:24:17 +00001486 ppIRTemp(i);
sewardj35421a32004-07-05 13:12:34 +00001487 vex_printf( ":");
sewardje539a402004-07-14 18:24:17 +00001488 ppIRType(env->types[i]);
sewardjc97096c2004-06-30 09:28:04 +00001489 if (i % 8 == 7)
sewardj35421a32004-07-05 13:12:34 +00001490 vex_printf( "\n");
sewardjc97096c2004-06-30 09:28:04 +00001491 else
sewardj35421a32004-07-05 13:12:34 +00001492 vex_printf( " ");
sewardjc97096c2004-06-30 09:28:04 +00001493 }
sewardje539a402004-07-14 18:24:17 +00001494 if (env->types_used > 0 && env->types_used % 8 != 7)
sewardj35421a32004-07-05 13:12:34 +00001495 vex_printf( "\n");
sewardjc97096c2004-06-30 09:28:04 +00001496}
1497
sewardjdd40fdf2006-12-24 02:20:24 +00001498void ppIRSB ( IRSB* bb )
sewardjec6ad592004-06-20 12:26:53 +00001499{
sewardjd7cb8532004-08-17 23:59:23 +00001500 Int i;
sewardjdd40fdf2006-12-24 02:20:24 +00001501 vex_printf("IRSB {\n");
sewardj35421a32004-07-05 13:12:34 +00001502 ppIRTypeEnv(bb->tyenv);
sewardj35439212004-07-14 22:36:10 +00001503 vex_printf("\n");
sewardjd7cb8532004-08-17 23:59:23 +00001504 for (i = 0; i < bb->stmts_used; i++) {
sewardjd2445f62005-03-21 00:15:53 +00001505 vex_printf( " ");
1506 ppIRStmt(bb->stmts[i]);
sewardj35421a32004-07-05 13:12:34 +00001507 vex_printf( "\n");
sewardjec6ad592004-06-20 12:26:53 +00001508 }
sewardjc6f970f2012-04-02 21:54:49 +00001509 vex_printf( " PUT(%d) = ", bb->offsIP );
sewardje539a402004-07-14 18:24:17 +00001510 ppIRExpr( bb->next );
sewardjc6f970f2012-04-02 21:54:49 +00001511 vex_printf( "; exit-");
1512 ppIRJumpKind(bb->jumpkind);
sewardj35439212004-07-14 22:36:10 +00001513 vex_printf( "\n}\n");
sewardjec6ad592004-06-20 12:26:53 +00001514}
1515
1516
1517/*---------------------------------------------------------------*/
1518/*--- Constructors ---*/
1519/*---------------------------------------------------------------*/
1520
sewardjc97096c2004-06-30 09:28:04 +00001521
1522/* Constructors -- IRConst */
1523
sewardjba999312004-11-15 15:21:17 +00001524IRConst* IRConst_U1 ( Bool bit )
sewardjb8e75862004-08-19 17:58:45 +00001525{
1526 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
sewardjba999312004-11-15 15:21:17 +00001527 c->tag = Ico_U1;
1528 c->Ico.U1 = bit;
sewardj4b861de2004-11-03 15:24:42 +00001529 /* call me paranoid; I don't care :-) */
1530 vassert(bit == False || bit == True);
sewardjb8e75862004-08-19 17:58:45 +00001531 return c;
1532}
sewardjc97096c2004-06-30 09:28:04 +00001533IRConst* IRConst_U8 ( UChar u8 )
1534{
sewardj35421a32004-07-05 13:12:34 +00001535 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
sewardjc97096c2004-06-30 09:28:04 +00001536 c->tag = Ico_U8;
1537 c->Ico.U8 = u8;
1538 return c;
1539}
1540IRConst* IRConst_U16 ( UShort u16 )
1541{
sewardj35421a32004-07-05 13:12:34 +00001542 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
sewardjc97096c2004-06-30 09:28:04 +00001543 c->tag = Ico_U16;
1544 c->Ico.U16 = u16;
1545 return c;
1546}
1547IRConst* IRConst_U32 ( UInt u32 )
1548{
sewardj35421a32004-07-05 13:12:34 +00001549 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
sewardjc97096c2004-06-30 09:28:04 +00001550 c->tag = Ico_U32;
1551 c->Ico.U32 = u32;
1552 return c;
1553}
1554IRConst* IRConst_U64 ( ULong u64 )
1555{
sewardj35421a32004-07-05 13:12:34 +00001556 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
sewardjc97096c2004-06-30 09:28:04 +00001557 c->tag = Ico_U64;
1558 c->Ico.U64 = u64;
1559 return c;
1560}
sewardj2019a972011-03-07 16:04:07 +00001561IRConst* IRConst_F32 ( Float f32 )
1562{
1563 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
1564 c->tag = Ico_F32;
1565 c->Ico.F32 = f32;
1566 return c;
1567}
1568IRConst* IRConst_F32i ( UInt f32i )
1569{
1570 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
1571 c->tag = Ico_F32i;
1572 c->Ico.F32i = f32i;
1573 return c;
1574}
sewardja58ea662004-08-15 03:12:41 +00001575IRConst* IRConst_F64 ( Double f64 )
1576{
1577 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
1578 c->tag = Ico_F64;
1579 c->Ico.F64 = f64;
1580 return c;
1581}
sewardj17442fe2004-09-20 14:54:28 +00001582IRConst* IRConst_F64i ( ULong f64i )
sewardj207557a2004-08-27 12:00:18 +00001583{
sewardj17442fe2004-09-20 14:54:28 +00001584 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
1585 c->tag = Ico_F64i;
1586 c->Ico.F64i = f64i;
sewardj207557a2004-08-27 12:00:18 +00001587 return c;
1588}
sewardj1e6ad742004-12-02 16:16:11 +00001589IRConst* IRConst_V128 ( UShort con )
1590{
1591 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
1592 c->tag = Ico_V128;
1593 c->Ico.V128 = con;
1594 return c;
1595}
sewardj37a505b2012-06-29 15:28:24 +00001596IRConst* IRConst_V256 ( UInt con )
1597{
1598 IRConst* c = LibVEX_Alloc(sizeof(IRConst));
1599 c->tag = Ico_V256;
1600 c->Ico.V256 = con;
1601 return c;
1602}
sewardjc97096c2004-06-30 09:28:04 +00001603
sewardj8ea867b2004-10-30 19:03:02 +00001604/* Constructors -- IRCallee */
1605
florian1ff47562012-10-21 02:09:51 +00001606IRCallee* mkIRCallee ( Int regparms, const HChar* name, void* addr )
sewardj8ea867b2004-10-30 19:03:02 +00001607{
1608 IRCallee* ce = LibVEX_Alloc(sizeof(IRCallee));
sewardj77352542004-10-30 20:39:01 +00001609 ce->regparms = regparms;
1610 ce->name = name;
1611 ce->addr = addr;
sewardj43c56462004-11-06 12:17:57 +00001612 ce->mcx_mask = 0;
sewardj77352542004-10-30 20:39:01 +00001613 vassert(regparms >= 0 && regparms <= 3);
sewardj8ea867b2004-10-30 19:03:02 +00001614 vassert(name != NULL);
1615 vassert(addr != 0);
1616 return ce;
1617}
1618
1619
sewardjdd40fdf2006-12-24 02:20:24 +00001620/* Constructors -- IRRegArray */
sewardje3d0d2e2004-06-27 10:42:44 +00001621
sewardjdd40fdf2006-12-24 02:20:24 +00001622IRRegArray* mkIRRegArray ( Int base, IRType elemTy, Int nElems )
sewardj2d3f77c2004-09-22 23:49:09 +00001623{
sewardjdd40fdf2006-12-24 02:20:24 +00001624 IRRegArray* arr = LibVEX_Alloc(sizeof(IRRegArray));
1625 arr->base = base;
1626 arr->elemTy = elemTy;
1627 arr->nElems = nElems;
sewardj2d3f77c2004-09-22 23:49:09 +00001628 vassert(!(arr->base < 0 || arr->base > 10000 /* somewhat arbitrary */));
sewardjba999312004-11-15 15:21:17 +00001629 vassert(!(arr->elemTy == Ity_I1));
sewardj2d3f77c2004-09-22 23:49:09 +00001630 vassert(!(arr->nElems <= 0 || arr->nElems > 500 /* somewhat arbitrary */));
1631 return arr;
1632}
1633
1634
1635/* Constructors -- IRExpr */
1636
sewardj443cd9d2004-07-18 23:06:45 +00001637IRExpr* IRExpr_Binder ( Int binder ) {
1638 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
1639 e->tag = Iex_Binder;
1640 e->Iex.Binder.binder = binder;
1641 return e;
1642}
sewardjfbcaf332004-07-08 01:46:01 +00001643IRExpr* IRExpr_Get ( Int off, IRType ty ) {
sewardj35421a32004-07-05 13:12:34 +00001644 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
sewardje3d0d2e2004-06-27 10:42:44 +00001645 e->tag = Iex_Get;
1646 e->Iex.Get.offset = off;
sewardjfbcaf332004-07-08 01:46:01 +00001647 e->Iex.Get.ty = ty;
sewardje3d0d2e2004-06-27 10:42:44 +00001648 return e;
1649}
sewardjdd40fdf2006-12-24 02:20:24 +00001650IRExpr* IRExpr_GetI ( IRRegArray* descr, IRExpr* ix, Int bias ) {
sewardj2d3f77c2004-09-22 23:49:09 +00001651 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
1652 e->tag = Iex_GetI;
1653 e->Iex.GetI.descr = descr;
sewardjeeac8412004-11-02 00:26:55 +00001654 e->Iex.GetI.ix = ix;
sewardj2d3f77c2004-09-22 23:49:09 +00001655 e->Iex.GetI.bias = bias;
sewardjd1725d12004-08-12 20:46:53 +00001656 return e;
1657}
sewardjdd40fdf2006-12-24 02:20:24 +00001658IRExpr* IRExpr_RdTmp ( IRTemp tmp ) {
1659 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
1660 e->tag = Iex_RdTmp;
1661 e->Iex.RdTmp.tmp = tmp;
sewardje3d0d2e2004-06-27 10:42:44 +00001662 return e;
1663}
sewardj40c80262006-02-08 19:30:46 +00001664IRExpr* IRExpr_Qop ( IROp op, IRExpr* arg1, IRExpr* arg2,
1665 IRExpr* arg3, IRExpr* arg4 ) {
1666 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
florian96d7cc32012-06-01 20:41:24 +00001667 IRQop* qop = LibVEX_Alloc(sizeof(IRQop));
1668 qop->op = op;
1669 qop->arg1 = arg1;
1670 qop->arg2 = arg2;
1671 qop->arg3 = arg3;
1672 qop->arg4 = arg4;
sewardj40c80262006-02-08 19:30:46 +00001673 e->tag = Iex_Qop;
florian96d7cc32012-06-01 20:41:24 +00001674 e->Iex.Qop.details = qop;
sewardj40c80262006-02-08 19:30:46 +00001675 return e;
1676}
sewardjb183b852006-02-03 16:08:03 +00001677IRExpr* IRExpr_Triop ( IROp op, IRExpr* arg1,
1678 IRExpr* arg2, IRExpr* arg3 ) {
florian420bfa92012-06-02 20:29:22 +00001679 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
1680 IRTriop* triop = LibVEX_Alloc(sizeof(IRTriop));
1681 triop->op = op;
1682 triop->arg1 = arg1;
1683 triop->arg2 = arg2;
1684 triop->arg3 = arg3;
sewardjb183b852006-02-03 16:08:03 +00001685 e->tag = Iex_Triop;
florian420bfa92012-06-02 20:29:22 +00001686 e->Iex.Triop.details = triop;
sewardjb183b852006-02-03 16:08:03 +00001687 return e;
1688}
sewardjc97096c2004-06-30 09:28:04 +00001689IRExpr* IRExpr_Binop ( IROp op, IRExpr* arg1, IRExpr* arg2 ) {
sewardj35421a32004-07-05 13:12:34 +00001690 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
sewardje3d0d2e2004-06-27 10:42:44 +00001691 e->tag = Iex_Binop;
1692 e->Iex.Binop.op = op;
1693 e->Iex.Binop.arg1 = arg1;
1694 e->Iex.Binop.arg2 = arg2;
1695 return e;
1696}
sewardjc97096c2004-06-30 09:28:04 +00001697IRExpr* IRExpr_Unop ( IROp op, IRExpr* arg ) {
sewardj35421a32004-07-05 13:12:34 +00001698 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
sewardje3d0d2e2004-06-27 10:42:44 +00001699 e->tag = Iex_Unop;
1700 e->Iex.Unop.op = op;
1701 e->Iex.Unop.arg = arg;
1702 return e;
1703}
sewardje768e922009-11-26 17:17:37 +00001704IRExpr* IRExpr_Load ( IREndness end, IRType ty, IRExpr* addr ) {
sewardj35421a32004-07-05 13:12:34 +00001705 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
sewardjaf1ceca2005-06-30 23:31:27 +00001706 e->tag = Iex_Load;
1707 e->Iex.Load.end = end;
1708 e->Iex.Load.ty = ty;
1709 e->Iex.Load.addr = addr;
1710 vassert(end == Iend_LE || end == Iend_BE);
sewardje3d0d2e2004-06-27 10:42:44 +00001711 return e;
1712}
sewardjc97096c2004-06-30 09:28:04 +00001713IRExpr* IRExpr_Const ( IRConst* con ) {
sewardj35421a32004-07-05 13:12:34 +00001714 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
sewardje3d0d2e2004-06-27 10:42:44 +00001715 e->tag = Iex_Const;
1716 e->Iex.Const.con = con;
1717 return e;
sewardjec6ad592004-06-20 12:26:53 +00001718}
sewardj8ea867b2004-10-30 19:03:02 +00001719IRExpr* IRExpr_CCall ( IRCallee* cee, IRType retty, IRExpr** args ) {
sewardje87b4842004-07-10 12:23:30 +00001720 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
1721 e->tag = Iex_CCall;
sewardj8ea867b2004-10-30 19:03:02 +00001722 e->Iex.CCall.cee = cee;
sewardje87b4842004-07-10 12:23:30 +00001723 e->Iex.CCall.retty = retty;
1724 e->Iex.CCall.args = args;
1725 return e;
1726}
florian99dd03e2013-01-29 03:56:06 +00001727IRExpr* IRExpr_ITE ( IRExpr* cond, IRExpr* iftrue, IRExpr* iffalse ) {
sewardjeeb9ef82004-07-15 12:39:03 +00001728 IRExpr* e = LibVEX_Alloc(sizeof(IRExpr));
florian99dd03e2013-01-29 03:56:06 +00001729 e->tag = Iex_ITE;
1730 e->Iex.ITE.cond = cond;
1731 e->Iex.ITE.iftrue = iftrue;
1732 e->Iex.ITE.iffalse = iffalse;
sewardjeeb9ef82004-07-15 12:39:03 +00001733 return e;
1734}
sewardjec6ad592004-06-20 12:26:53 +00001735
sewardjec6ad592004-06-20 12:26:53 +00001736
sewardjc5fc7aa2004-10-27 23:00:55 +00001737/* Constructors for NULL-terminated IRExpr expression vectors,
1738 suitable for use as arg lists in clean/dirty helper calls. */
1739
1740IRExpr** mkIRExprVec_0 ( void ) {
1741 IRExpr** vec = LibVEX_Alloc(1 * sizeof(IRExpr*));
1742 vec[0] = NULL;
1743 return vec;
1744}
1745IRExpr** mkIRExprVec_1 ( IRExpr* arg1 ) {
1746 IRExpr** vec = LibVEX_Alloc(2 * sizeof(IRExpr*));
1747 vec[0] = arg1;
1748 vec[1] = NULL;
1749 return vec;
1750}
1751IRExpr** mkIRExprVec_2 ( IRExpr* arg1, IRExpr* arg2 ) {
1752 IRExpr** vec = LibVEX_Alloc(3 * sizeof(IRExpr*));
1753 vec[0] = arg1;
1754 vec[1] = arg2;
1755 vec[2] = NULL;
1756 return vec;
1757}
sewardjf9655262004-10-31 20:02:16 +00001758IRExpr** mkIRExprVec_3 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3 ) {
1759 IRExpr** vec = LibVEX_Alloc(4 * sizeof(IRExpr*));
1760 vec[0] = arg1;
1761 vec[1] = arg2;
1762 vec[2] = arg3;
1763 vec[3] = NULL;
1764 return vec;
1765}
sewardj78ec32b2007-01-08 05:09:55 +00001766IRExpr** mkIRExprVec_4 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3,
1767 IRExpr* arg4 ) {
sewardjf9655262004-10-31 20:02:16 +00001768 IRExpr** vec = LibVEX_Alloc(5 * sizeof(IRExpr*));
1769 vec[0] = arg1;
1770 vec[1] = arg2;
1771 vec[2] = arg3;
1772 vec[3] = arg4;
1773 vec[4] = NULL;
1774 return vec;
1775}
sewardj78ec32b2007-01-08 05:09:55 +00001776IRExpr** mkIRExprVec_5 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3,
1777 IRExpr* arg4, IRExpr* arg5 ) {
sewardjf32c67d2004-11-08 13:10:44 +00001778 IRExpr** vec = LibVEX_Alloc(6 * sizeof(IRExpr*));
1779 vec[0] = arg1;
1780 vec[1] = arg2;
1781 vec[2] = arg3;
1782 vec[3] = arg4;
1783 vec[4] = arg5;
1784 vec[5] = NULL;
1785 return vec;
1786}
sewardj78ec32b2007-01-08 05:09:55 +00001787IRExpr** mkIRExprVec_6 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3,
1788 IRExpr* arg4, IRExpr* arg5, IRExpr* arg6 ) {
1789 IRExpr** vec = LibVEX_Alloc(7 * sizeof(IRExpr*));
1790 vec[0] = arg1;
1791 vec[1] = arg2;
1792 vec[2] = arg3;
1793 vec[3] = arg4;
1794 vec[4] = arg5;
1795 vec[5] = arg6;
1796 vec[6] = NULL;
1797 return vec;
1798}
1799IRExpr** mkIRExprVec_7 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3,
1800 IRExpr* arg4, IRExpr* arg5, IRExpr* arg6,
1801 IRExpr* arg7 ) {
1802 IRExpr** vec = LibVEX_Alloc(8 * sizeof(IRExpr*));
1803 vec[0] = arg1;
1804 vec[1] = arg2;
1805 vec[2] = arg3;
1806 vec[3] = arg4;
1807 vec[4] = arg5;
1808 vec[5] = arg6;
1809 vec[6] = arg7;
1810 vec[7] = NULL;
1811 return vec;
1812}
sewardj2fdd4162010-08-22 12:59:02 +00001813IRExpr** mkIRExprVec_8 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3,
1814 IRExpr* arg4, IRExpr* arg5, IRExpr* arg6,
1815 IRExpr* arg7, IRExpr* arg8 ) {
1816 IRExpr** vec = LibVEX_Alloc(9 * sizeof(IRExpr*));
1817 vec[0] = arg1;
1818 vec[1] = arg2;
1819 vec[2] = arg3;
1820 vec[3] = arg4;
1821 vec[4] = arg5;
1822 vec[5] = arg6;
1823 vec[6] = arg7;
1824 vec[7] = arg8;
1825 vec[8] = NULL;
1826 return vec;
1827}
sewardjc5fc7aa2004-10-27 23:00:55 +00001828
1829
sewardj17442fe2004-09-20 14:54:28 +00001830/* Constructors -- IRDirty */
1831
sewardjc5fc7aa2004-10-27 23:00:55 +00001832IRDirty* emptyIRDirty ( void ) {
sewardj17442fe2004-09-20 14:54:28 +00001833 IRDirty* d = LibVEX_Alloc(sizeof(IRDirty));
sewardj8ea867b2004-10-30 19:03:02 +00001834 d->cee = NULL;
sewardjb8385d82004-11-02 01:34:15 +00001835 d->guard = NULL;
sewardj17442fe2004-09-20 14:54:28 +00001836 d->args = NULL;
sewardj92d168d2004-11-15 14:22:12 +00001837 d->tmp = IRTemp_INVALID;
sewardj17442fe2004-09-20 14:54:28 +00001838 d->mFx = Ifx_None;
1839 d->mAddr = NULL;
1840 d->mSize = 0;
sewardjc5fc7aa2004-10-27 23:00:55 +00001841 d->needsBBP = False;
sewardj17442fe2004-09-20 14:54:28 +00001842 d->nFxState = 0;
1843 return d;
1844}
1845
1846
sewardje9d8a262009-07-01 08:06:34 +00001847/* Constructors -- IRCAS */
1848
1849IRCAS* mkIRCAS ( IRTemp oldHi, IRTemp oldLo,
1850 IREndness end, IRExpr* addr,
1851 IRExpr* expdHi, IRExpr* expdLo,
1852 IRExpr* dataHi, IRExpr* dataLo ) {
1853 IRCAS* cas = LibVEX_Alloc(sizeof(IRCAS));
1854 cas->oldHi = oldHi;
1855 cas->oldLo = oldLo;
1856 cas->end = end;
1857 cas->addr = addr;
1858 cas->expdHi = expdHi;
1859 cas->expdLo = expdLo;
1860 cas->dataHi = dataHi;
1861 cas->dataLo = dataLo;
1862 return cas;
1863}
1864
1865
floriand6f38b32012-05-31 15:46:18 +00001866/* Constructors -- IRPutI */
1867
1868IRPutI* mkIRPutI ( IRRegArray* descr, IRExpr* ix,
1869 Int bias, IRExpr* data )
1870{
1871 IRPutI* puti = LibVEX_Alloc(sizeof(IRPutI));
1872 puti->descr = descr;
1873 puti->ix = ix;
1874 puti->bias = bias;
1875 puti->data = data;
1876 return puti;
1877}
1878
1879
sewardjcfe046e2013-01-17 14:23:53 +00001880/* Constructors -- IRStoreG and IRLoadG */
1881
1882IRStoreG* mkIRStoreG ( IREndness end,
1883 IRExpr* addr, IRExpr* data, IRExpr* guard )
1884{
1885 IRStoreG* sg = LibVEX_Alloc(sizeof(IRStoreG));
1886 sg->end = end;
1887 sg->addr = addr;
1888 sg->data = data;
1889 sg->guard = guard;
1890 return sg;
1891}
1892
1893IRLoadG* mkIRLoadG ( IREndness end, IRLoadGOp cvt,
1894 IRTemp dst, IRExpr* addr, IRExpr* alt, IRExpr* guard )
1895{
1896 IRLoadG* lg = LibVEX_Alloc(sizeof(IRLoadG));
1897 lg->end = end;
1898 lg->cvt = cvt;
1899 lg->dst = dst;
1900 lg->addr = addr;
1901 lg->alt = alt;
1902 lg->guard = guard;
1903 return lg;
1904}
1905
1906
sewardjec6ad592004-06-20 12:26:53 +00001907/* Constructors -- IRStmt */
sewardje3d0d2e2004-06-27 10:42:44 +00001908
sewardjd2445f62005-03-21 00:15:53 +00001909IRStmt* IRStmt_NoOp ( void )
1910{
1911 /* Just use a single static closure. */
1912 static IRStmt static_closure;
1913 static_closure.tag = Ist_NoOp;
1914 return &static_closure;
1915}
sewardj2f10aa62011-05-27 13:20:56 +00001916IRStmt* IRStmt_IMark ( Addr64 addr, Int len, UChar delta ) {
1917 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
1918 s->tag = Ist_IMark;
1919 s->Ist.IMark.addr = addr;
1920 s->Ist.IMark.len = len;
1921 s->Ist.IMark.delta = delta;
sewardjf1689312005-03-16 18:19:10 +00001922 return s;
1923}
sewardj478646f2008-05-01 20:13:04 +00001924IRStmt* IRStmt_AbiHint ( IRExpr* base, Int len, IRExpr* nia ) {
sewardj5a9ffab2005-05-12 17:55:01 +00001925 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
1926 s->tag = Ist_AbiHint;
1927 s->Ist.AbiHint.base = base;
1928 s->Ist.AbiHint.len = len;
sewardj478646f2008-05-01 20:13:04 +00001929 s->Ist.AbiHint.nia = nia;
sewardj5a9ffab2005-05-12 17:55:01 +00001930 return s;
1931}
sewardj6d076362004-09-23 11:06:17 +00001932IRStmt* IRStmt_Put ( Int off, IRExpr* data ) {
sewardj35421a32004-07-05 13:12:34 +00001933 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
sewardje3d0d2e2004-06-27 10:42:44 +00001934 s->tag = Ist_Put;
1935 s->Ist.Put.offset = off;
sewardj6d076362004-09-23 11:06:17 +00001936 s->Ist.Put.data = data;
sewardje3d0d2e2004-06-27 10:42:44 +00001937 return s;
sewardjec6ad592004-06-20 12:26:53 +00001938}
floriand6f38b32012-05-31 15:46:18 +00001939IRStmt* IRStmt_PutI ( IRPutI* details ) {
1940 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
1941 s->tag = Ist_PutI;
1942 s->Ist.PutI.details = details;
sewardjd1725d12004-08-12 20:46:53 +00001943 return s;
1944}
sewardjdd40fdf2006-12-24 02:20:24 +00001945IRStmt* IRStmt_WrTmp ( IRTemp tmp, IRExpr* data ) {
1946 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
1947 s->tag = Ist_WrTmp;
1948 s->Ist.WrTmp.tmp = tmp;
1949 s->Ist.WrTmp.data = data;
sewardje3d0d2e2004-06-27 10:42:44 +00001950 return s;
sewardjec6ad592004-06-20 12:26:53 +00001951}
sewardje768e922009-11-26 17:17:37 +00001952IRStmt* IRStmt_Store ( IREndness end, IRExpr* addr, IRExpr* data ) {
1953 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
1954 s->tag = Ist_Store;
1955 s->Ist.Store.end = end;
1956 s->Ist.Store.addr = addr;
1957 s->Ist.Store.data = data;
sewardjaf1ceca2005-06-30 23:31:27 +00001958 vassert(end == Iend_LE || end == Iend_BE);
sewardje3d0d2e2004-06-27 10:42:44 +00001959 return s;
sewardjec6ad592004-06-20 12:26:53 +00001960}
sewardjcfe046e2013-01-17 14:23:53 +00001961IRStmt* IRStmt_StoreG ( IREndness end, IRExpr* addr, IRExpr* data,
1962 IRExpr* guard ) {
1963 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
1964 s->tag = Ist_StoreG;
1965 s->Ist.StoreG.details = mkIRStoreG(end, addr, data, guard);
1966 vassert(end == Iend_LE || end == Iend_BE);
1967 return s;
1968}
1969IRStmt* IRStmt_LoadG ( IREndness end, IRLoadGOp cvt, IRTemp dst,
1970 IRExpr* addr, IRExpr* alt, IRExpr* guard ) {
1971 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
1972 s->tag = Ist_LoadG;
1973 s->Ist.LoadG.details = mkIRLoadG(end, cvt, dst, addr, alt, guard);
1974 return s;
1975}
sewardje9d8a262009-07-01 08:06:34 +00001976IRStmt* IRStmt_CAS ( IRCAS* cas ) {
1977 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
1978 s->tag = Ist_CAS;
1979 s->Ist.CAS.details = cas;
1980 return s;
1981}
sewardje768e922009-11-26 17:17:37 +00001982IRStmt* IRStmt_LLSC ( IREndness end,
1983 IRTemp result, IRExpr* addr, IRExpr* storedata ) {
1984 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
1985 s->tag = Ist_LLSC;
1986 s->Ist.LLSC.end = end;
1987 s->Ist.LLSC.result = result;
1988 s->Ist.LLSC.addr = addr;
1989 s->Ist.LLSC.storedata = storedata;
1990 return s;
1991}
sewardj17442fe2004-09-20 14:54:28 +00001992IRStmt* IRStmt_Dirty ( IRDirty* d )
1993{
1994 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
1995 s->tag = Ist_Dirty;
1996 s->Ist.Dirty.details = d;
1997 return s;
1998}
sewardjc4356f02007-11-09 21:15:04 +00001999IRStmt* IRStmt_MBE ( IRMBusEvent event )
sewardj3e838932005-01-07 12:09:15 +00002000{
sewardjc4356f02007-11-09 21:15:04 +00002001 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
2002 s->tag = Ist_MBE;
2003 s->Ist.MBE.event = event;
2004 return s;
sewardj3e838932005-01-07 12:09:15 +00002005}
sewardjc6f970f2012-04-02 21:54:49 +00002006IRStmt* IRStmt_Exit ( IRExpr* guard, IRJumpKind jk, IRConst* dst,
2007 Int offsIP ) {
2008 IRStmt* s = LibVEX_Alloc(sizeof(IRStmt));
2009 s->tag = Ist_Exit;
2010 s->Ist.Exit.guard = guard;
2011 s->Ist.Exit.jk = jk;
2012 s->Ist.Exit.dst = dst;
2013 s->Ist.Exit.offsIP = offsIP;
sewardj64e1d652004-07-12 14:00:46 +00002014 return s;
2015}
sewardje3d0d2e2004-06-27 10:42:44 +00002016
sewardj695cff92004-10-13 14:50:14 +00002017
2018/* Constructors -- IRTypeEnv */
2019
2020IRTypeEnv* emptyIRTypeEnv ( void )
2021{
2022 IRTypeEnv* env = LibVEX_Alloc(sizeof(IRTypeEnv));
2023 env->types = LibVEX_Alloc(8 * sizeof(IRType));
2024 env->types_size = 8;
2025 env->types_used = 0;
2026 return env;
2027}
2028
2029
sewardjdd40fdf2006-12-24 02:20:24 +00002030/* Constructors -- IRSB */
sewardje3d0d2e2004-06-27 10:42:44 +00002031
sewardjdd40fdf2006-12-24 02:20:24 +00002032IRSB* emptyIRSB ( void )
sewardjd7cb8532004-08-17 23:59:23 +00002033{
sewardjdd40fdf2006-12-24 02:20:24 +00002034 IRSB* bb = LibVEX_Alloc(sizeof(IRSB));
sewardjd7cb8532004-08-17 23:59:23 +00002035 bb->tyenv = emptyIRTypeEnv();
2036 bb->stmts_used = 0;
2037 bb->stmts_size = 8;
2038 bb->stmts = LibVEX_Alloc(bb->stmts_size * sizeof(IRStmt*));
2039 bb->next = NULL;
2040 bb->jumpkind = Ijk_Boring;
sewardjc6f970f2012-04-02 21:54:49 +00002041 bb->offsIP = 0;
sewardje3d0d2e2004-06-27 10:42:44 +00002042 return bb;
sewardjec6ad592004-06-20 12:26:53 +00002043}
2044
sewardj695cff92004-10-13 14:50:14 +00002045
2046/*---------------------------------------------------------------*/
2047/*--- (Deep) copy constructors. These make complete copies ---*/
2048/*--- the original, which can be modified without affecting ---*/
2049/*--- the original. ---*/
2050/*---------------------------------------------------------------*/
2051
2052/* Copying IR Expr vectors (for call args). */
2053
2054/* Shallow copy of an IRExpr vector */
2055
sewardjdd40fdf2006-12-24 02:20:24 +00002056IRExpr** shallowCopyIRExprVec ( IRExpr** vec )
sewardjd7cb8532004-08-17 23:59:23 +00002057{
sewardj695cff92004-10-13 14:50:14 +00002058 Int i;
2059 IRExpr** newvec;
2060 for (i = 0; vec[i]; i++)
2061 ;
2062 newvec = LibVEX_Alloc((i+1)*sizeof(IRExpr*));
2063 for (i = 0; vec[i]; i++)
2064 newvec[i] = vec[i];
2065 newvec[i] = NULL;
2066 return newvec;
2067}
2068
2069/* Deep copy of an IRExpr vector */
2070
sewardjdd40fdf2006-12-24 02:20:24 +00002071IRExpr** deepCopyIRExprVec ( IRExpr** vec )
sewardj695cff92004-10-13 14:50:14 +00002072{
2073 Int i;
sewardjdd40fdf2006-12-24 02:20:24 +00002074 IRExpr** newvec = shallowCopyIRExprVec( vec );
sewardj695cff92004-10-13 14:50:14 +00002075 for (i = 0; newvec[i]; i++)
sewardjdd40fdf2006-12-24 02:20:24 +00002076 newvec[i] = deepCopyIRExpr(newvec[i]);
sewardj695cff92004-10-13 14:50:14 +00002077 return newvec;
2078}
2079
2080/* Deep copy constructors for all heap-allocated IR types follow. */
2081
sewardjdd40fdf2006-12-24 02:20:24 +00002082IRConst* deepCopyIRConst ( IRConst* c )
sewardj695cff92004-10-13 14:50:14 +00002083{
2084 switch (c->tag) {
sewardjba999312004-11-15 15:21:17 +00002085 case Ico_U1: return IRConst_U1(c->Ico.U1);
sewardj695cff92004-10-13 14:50:14 +00002086 case Ico_U8: return IRConst_U8(c->Ico.U8);
2087 case Ico_U16: return IRConst_U16(c->Ico.U16);
2088 case Ico_U32: return IRConst_U32(c->Ico.U32);
2089 case Ico_U64: return IRConst_U64(c->Ico.U64);
sewardj2019a972011-03-07 16:04:07 +00002090 case Ico_F32: return IRConst_F32(c->Ico.F32);
2091 case Ico_F32i: return IRConst_F32i(c->Ico.F32i);
sewardj695cff92004-10-13 14:50:14 +00002092 case Ico_F64: return IRConst_F64(c->Ico.F64);
2093 case Ico_F64i: return IRConst_F64i(c->Ico.F64i);
sewardj1e6ad742004-12-02 16:16:11 +00002094 case Ico_V128: return IRConst_V128(c->Ico.V128);
sewardjdd40fdf2006-12-24 02:20:24 +00002095 default: vpanic("deepCopyIRConst");
sewardjd7cb8532004-08-17 23:59:23 +00002096 }
sewardj695cff92004-10-13 14:50:14 +00002097}
2098
sewardjdd40fdf2006-12-24 02:20:24 +00002099IRCallee* deepCopyIRCallee ( IRCallee* ce )
sewardj8ea867b2004-10-30 19:03:02 +00002100{
sewardj43c56462004-11-06 12:17:57 +00002101 IRCallee* ce2 = mkIRCallee(ce->regparms, ce->name, ce->addr);
2102 ce2->mcx_mask = ce->mcx_mask;
2103 return ce2;
sewardj8ea867b2004-10-30 19:03:02 +00002104}
2105
sewardjdd40fdf2006-12-24 02:20:24 +00002106IRRegArray* deepCopyIRRegArray ( IRRegArray* d )
sewardj695cff92004-10-13 14:50:14 +00002107{
sewardjdd40fdf2006-12-24 02:20:24 +00002108 return mkIRRegArray(d->base, d->elemTy, d->nElems);
sewardj695cff92004-10-13 14:50:14 +00002109}
2110
sewardjdd40fdf2006-12-24 02:20:24 +00002111IRExpr* deepCopyIRExpr ( IRExpr* e )
sewardj695cff92004-10-13 14:50:14 +00002112{
2113 switch (e->tag) {
2114 case Iex_Get:
2115 return IRExpr_Get(e->Iex.Get.offset, e->Iex.Get.ty);
2116 case Iex_GetI:
sewardjdd40fdf2006-12-24 02:20:24 +00002117 return IRExpr_GetI(deepCopyIRRegArray(e->Iex.GetI.descr),
2118 deepCopyIRExpr(e->Iex.GetI.ix),
sewardj695cff92004-10-13 14:50:14 +00002119 e->Iex.GetI.bias);
sewardjdd40fdf2006-12-24 02:20:24 +00002120 case Iex_RdTmp:
2121 return IRExpr_RdTmp(e->Iex.RdTmp.tmp);
florian96d7cc32012-06-01 20:41:24 +00002122 case Iex_Qop: {
2123 IRQop* qop = e->Iex.Qop.details;
2124
2125 return IRExpr_Qop(qop->op,
2126 deepCopyIRExpr(qop->arg1),
2127 deepCopyIRExpr(qop->arg2),
2128 deepCopyIRExpr(qop->arg3),
2129 deepCopyIRExpr(qop->arg4));
2130 }
florian420bfa92012-06-02 20:29:22 +00002131 case Iex_Triop: {
2132 IRTriop *triop = e->Iex.Triop.details;
2133
2134 return IRExpr_Triop(triop->op,
2135 deepCopyIRExpr(triop->arg1),
2136 deepCopyIRExpr(triop->arg2),
2137 deepCopyIRExpr(triop->arg3));
2138 }
sewardj695cff92004-10-13 14:50:14 +00002139 case Iex_Binop:
2140 return IRExpr_Binop(e->Iex.Binop.op,
sewardjdd40fdf2006-12-24 02:20:24 +00002141 deepCopyIRExpr(e->Iex.Binop.arg1),
2142 deepCopyIRExpr(e->Iex.Binop.arg2));
sewardj695cff92004-10-13 14:50:14 +00002143 case Iex_Unop:
2144 return IRExpr_Unop(e->Iex.Unop.op,
sewardjdd40fdf2006-12-24 02:20:24 +00002145 deepCopyIRExpr(e->Iex.Unop.arg));
sewardjaf1ceca2005-06-30 23:31:27 +00002146 case Iex_Load:
sewardje768e922009-11-26 17:17:37 +00002147 return IRExpr_Load(e->Iex.Load.end,
sewardjaf1ceca2005-06-30 23:31:27 +00002148 e->Iex.Load.ty,
sewardjdd40fdf2006-12-24 02:20:24 +00002149 deepCopyIRExpr(e->Iex.Load.addr));
sewardj695cff92004-10-13 14:50:14 +00002150 case Iex_Const:
sewardjdd40fdf2006-12-24 02:20:24 +00002151 return IRExpr_Const(deepCopyIRConst(e->Iex.Const.con));
sewardj695cff92004-10-13 14:50:14 +00002152 case Iex_CCall:
sewardjdd40fdf2006-12-24 02:20:24 +00002153 return IRExpr_CCall(deepCopyIRCallee(e->Iex.CCall.cee),
sewardj695cff92004-10-13 14:50:14 +00002154 e->Iex.CCall.retty,
sewardjdd40fdf2006-12-24 02:20:24 +00002155 deepCopyIRExprVec(e->Iex.CCall.args));
sewardj695cff92004-10-13 14:50:14 +00002156
florian99dd03e2013-01-29 03:56:06 +00002157 case Iex_ITE:
2158 return IRExpr_ITE(deepCopyIRExpr(e->Iex.ITE.cond),
2159 deepCopyIRExpr(e->Iex.ITE.iftrue),
2160 deepCopyIRExpr(e->Iex.ITE.iffalse));
sewardj695cff92004-10-13 14:50:14 +00002161 default:
sewardjdd40fdf2006-12-24 02:20:24 +00002162 vpanic("deepCopyIRExpr");
sewardj695cff92004-10-13 14:50:14 +00002163 }
2164}
2165
sewardjdd40fdf2006-12-24 02:20:24 +00002166IRDirty* deepCopyIRDirty ( IRDirty* d )
sewardj695cff92004-10-13 14:50:14 +00002167{
2168 Int i;
2169 IRDirty* d2 = emptyIRDirty();
sewardjdd40fdf2006-12-24 02:20:24 +00002170 d2->cee = deepCopyIRCallee(d->cee);
2171 d2->guard = deepCopyIRExpr(d->guard);
2172 d2->args = deepCopyIRExprVec(d->args);
sewardj695cff92004-10-13 14:50:14 +00002173 d2->tmp = d->tmp;
2174 d2->mFx = d->mFx;
sewardjdd40fdf2006-12-24 02:20:24 +00002175 d2->mAddr = d->mAddr==NULL ? NULL : deepCopyIRExpr(d->mAddr);
sewardj695cff92004-10-13 14:50:14 +00002176 d2->mSize = d->mSize;
sewardjc5fc7aa2004-10-27 23:00:55 +00002177 d2->needsBBP = d->needsBBP;
sewardj695cff92004-10-13 14:50:14 +00002178 d2->nFxState = d->nFxState;
2179 for (i = 0; i < d2->nFxState; i++)
2180 d2->fxState[i] = d->fxState[i];
2181 return d2;
2182}
2183
sewardje9d8a262009-07-01 08:06:34 +00002184IRCAS* deepCopyIRCAS ( IRCAS* cas )
2185{
2186 return mkIRCAS( cas->oldHi, cas->oldLo, cas->end,
2187 deepCopyIRExpr(cas->addr),
sewardj05a2c382009-07-17 16:34:30 +00002188 cas->expdHi==NULL ? NULL : deepCopyIRExpr(cas->expdHi),
sewardje9d8a262009-07-01 08:06:34 +00002189 deepCopyIRExpr(cas->expdLo),
sewardj05a2c382009-07-17 16:34:30 +00002190 cas->dataHi==NULL ? NULL : deepCopyIRExpr(cas->dataHi),
sewardje9d8a262009-07-01 08:06:34 +00002191 deepCopyIRExpr(cas->dataLo) );
2192}
2193
floriand6f38b32012-05-31 15:46:18 +00002194IRPutI* deepCopyIRPutI ( IRPutI * puti )
2195{
2196 return mkIRPutI( deepCopyIRRegArray(puti->descr),
2197 deepCopyIRExpr(puti->ix),
2198 puti->bias,
2199 deepCopyIRExpr(puti->data));
2200}
2201
sewardjdd40fdf2006-12-24 02:20:24 +00002202IRStmt* deepCopyIRStmt ( IRStmt* s )
sewardj695cff92004-10-13 14:50:14 +00002203{
2204 switch (s->tag) {
sewardjd2445f62005-03-21 00:15:53 +00002205 case Ist_NoOp:
2206 return IRStmt_NoOp();
sewardj5a9ffab2005-05-12 17:55:01 +00002207 case Ist_AbiHint:
sewardjdd40fdf2006-12-24 02:20:24 +00002208 return IRStmt_AbiHint(deepCopyIRExpr(s->Ist.AbiHint.base),
sewardj478646f2008-05-01 20:13:04 +00002209 s->Ist.AbiHint.len,
2210 deepCopyIRExpr(s->Ist.AbiHint.nia));
sewardjf1689312005-03-16 18:19:10 +00002211 case Ist_IMark:
sewardj2f10aa62011-05-27 13:20:56 +00002212 return IRStmt_IMark(s->Ist.IMark.addr,
2213 s->Ist.IMark.len,
2214 s->Ist.IMark.delta);
sewardj695cff92004-10-13 14:50:14 +00002215 case Ist_Put:
2216 return IRStmt_Put(s->Ist.Put.offset,
sewardjdd40fdf2006-12-24 02:20:24 +00002217 deepCopyIRExpr(s->Ist.Put.data));
sewardj695cff92004-10-13 14:50:14 +00002218 case Ist_PutI:
floriand6f38b32012-05-31 15:46:18 +00002219 return IRStmt_PutI(deepCopyIRPutI(s->Ist.PutI.details));
sewardjdd40fdf2006-12-24 02:20:24 +00002220 case Ist_WrTmp:
2221 return IRStmt_WrTmp(s->Ist.WrTmp.tmp,
2222 deepCopyIRExpr(s->Ist.WrTmp.data));
sewardjaf1ceca2005-06-30 23:31:27 +00002223 case Ist_Store:
2224 return IRStmt_Store(s->Ist.Store.end,
sewardjdd40fdf2006-12-24 02:20:24 +00002225 deepCopyIRExpr(s->Ist.Store.addr),
2226 deepCopyIRExpr(s->Ist.Store.data));
sewardjcfe046e2013-01-17 14:23:53 +00002227 case Ist_StoreG: {
2228 IRStoreG* sg = s->Ist.StoreG.details;
2229 return IRStmt_StoreG(sg->end,
2230 deepCopyIRExpr(sg->addr),
2231 deepCopyIRExpr(sg->data),
2232 deepCopyIRExpr(sg->guard));
2233 }
2234 case Ist_LoadG: {
2235 IRLoadG* lg = s->Ist.LoadG.details;
2236 return IRStmt_LoadG(lg->end, lg->cvt, lg->dst,
2237 deepCopyIRExpr(lg->addr),
2238 deepCopyIRExpr(lg->alt),
2239 deepCopyIRExpr(lg->guard));
2240 }
sewardje9d8a262009-07-01 08:06:34 +00002241 case Ist_CAS:
2242 return IRStmt_CAS(deepCopyIRCAS(s->Ist.CAS.details));
sewardje768e922009-11-26 17:17:37 +00002243 case Ist_LLSC:
2244 return IRStmt_LLSC(s->Ist.LLSC.end,
2245 s->Ist.LLSC.result,
2246 deepCopyIRExpr(s->Ist.LLSC.addr),
2247 s->Ist.LLSC.storedata
2248 ? deepCopyIRExpr(s->Ist.LLSC.storedata)
2249 : NULL);
sewardj695cff92004-10-13 14:50:14 +00002250 case Ist_Dirty:
sewardjdd40fdf2006-12-24 02:20:24 +00002251 return IRStmt_Dirty(deepCopyIRDirty(s->Ist.Dirty.details));
sewardjc4356f02007-11-09 21:15:04 +00002252 case Ist_MBE:
2253 return IRStmt_MBE(s->Ist.MBE.event);
sewardj695cff92004-10-13 14:50:14 +00002254 case Ist_Exit:
sewardjdd40fdf2006-12-24 02:20:24 +00002255 return IRStmt_Exit(deepCopyIRExpr(s->Ist.Exit.guard),
sewardj893aada2004-11-29 19:57:54 +00002256 s->Ist.Exit.jk,
sewardjc6f970f2012-04-02 21:54:49 +00002257 deepCopyIRConst(s->Ist.Exit.dst),
2258 s->Ist.Exit.offsIP);
sewardj695cff92004-10-13 14:50:14 +00002259 default:
sewardjdd40fdf2006-12-24 02:20:24 +00002260 vpanic("deepCopyIRStmt");
sewardj695cff92004-10-13 14:50:14 +00002261 }
2262}
2263
sewardjdd40fdf2006-12-24 02:20:24 +00002264IRTypeEnv* deepCopyIRTypeEnv ( IRTypeEnv* src )
sewardj695cff92004-10-13 14:50:14 +00002265{
2266 Int i;
2267 IRTypeEnv* dst = LibVEX_Alloc(sizeof(IRTypeEnv));
2268 dst->types_size = src->types_size;
2269 dst->types_used = src->types_used;
2270 dst->types = LibVEX_Alloc(dst->types_size * sizeof(IRType));
2271 for (i = 0; i < src->types_used; i++)
2272 dst->types[i] = src->types[i];
2273 return dst;
2274}
2275
sewardjdd40fdf2006-12-24 02:20:24 +00002276IRSB* deepCopyIRSB ( IRSB* bb )
sewardj695cff92004-10-13 14:50:14 +00002277{
2278 Int i;
2279 IRStmt** sts2;
sewardjdd40fdf2006-12-24 02:20:24 +00002280 IRSB* bb2 = deepCopyIRSBExceptStmts(bb);
sewardj695cff92004-10-13 14:50:14 +00002281 bb2->stmts_used = bb2->stmts_size = bb->stmts_used;
2282 sts2 = LibVEX_Alloc(bb2->stmts_used * sizeof(IRStmt*));
2283 for (i = 0; i < bb2->stmts_used; i++)
sewardjdd40fdf2006-12-24 02:20:24 +00002284 sts2[i] = deepCopyIRStmt(bb->stmts[i]);
sewardjc6f970f2012-04-02 21:54:49 +00002285 bb2->stmts = sts2;
sewardj6f2f2832006-11-24 23:32:55 +00002286 return bb2;
2287}
2288
sewardjdd40fdf2006-12-24 02:20:24 +00002289IRSB* deepCopyIRSBExceptStmts ( IRSB* bb )
sewardj6f2f2832006-11-24 23:32:55 +00002290{
sewardjdd40fdf2006-12-24 02:20:24 +00002291 IRSB* bb2 = emptyIRSB();
2292 bb2->tyenv = deepCopyIRTypeEnv(bb->tyenv);
2293 bb2->next = deepCopyIRExpr(bb->next);
sewardj695cff92004-10-13 14:50:14 +00002294 bb2->jumpkind = bb->jumpkind;
sewardjc6f970f2012-04-02 21:54:49 +00002295 bb2->offsIP = bb->offsIP;
sewardj695cff92004-10-13 14:50:14 +00002296 return bb2;
sewardjd7cb8532004-08-17 23:59:23 +00002297}
2298
sewardjec6ad592004-06-20 12:26:53 +00002299
sewardjc97096c2004-06-30 09:28:04 +00002300/*---------------------------------------------------------------*/
sewardj6efd4a12004-07-15 03:54:23 +00002301/*--- Primop types ---*/
2302/*---------------------------------------------------------------*/
2303
2304static
sewardjb183b852006-02-03 16:08:03 +00002305void typeOfPrimop ( IROp op,
2306 /*OUTs*/
2307 IRType* t_dst,
sewardj40c80262006-02-08 19:30:46 +00002308 IRType* t_arg1, IRType* t_arg2,
2309 IRType* t_arg3, IRType* t_arg4 )
sewardj6efd4a12004-07-15 03:54:23 +00002310{
sewardjb183b852006-02-03 16:08:03 +00002311# define UNARY(_ta1,_td) \
sewardj6efd4a12004-07-15 03:54:23 +00002312 *t_dst = (_td); *t_arg1 = (_ta1); break
sewardjb183b852006-02-03 16:08:03 +00002313# define BINARY(_ta1,_ta2,_td) \
sewardj6efd4a12004-07-15 03:54:23 +00002314 *t_dst = (_td); *t_arg1 = (_ta1); *t_arg2 = (_ta2); break
sewardjb183b852006-02-03 16:08:03 +00002315# define TERNARY(_ta1,_ta2,_ta3,_td) \
2316 *t_dst = (_td); *t_arg1 = (_ta1); \
2317 *t_arg2 = (_ta2); *t_arg3 = (_ta3); break
sewardj40c80262006-02-08 19:30:46 +00002318# define QUATERNARY(_ta1,_ta2,_ta3,_ta4,_td) \
2319 *t_dst = (_td); *t_arg1 = (_ta1); \
2320 *t_arg2 = (_ta2); *t_arg3 = (_ta3); \
2321 *t_arg4 = (_ta4); break
sewardjb183b852006-02-03 16:08:03 +00002322# define COMPARISON(_ta) \
sewardjba999312004-11-15 15:21:17 +00002323 *t_dst = Ity_I1; *t_arg1 = *t_arg2 = (_ta); break;
sewardjb183b852006-02-03 16:08:03 +00002324# define UNARY_COMPARISON(_ta) \
sewardj0033ddc2005-04-26 23:34:34 +00002325 *t_dst = Ity_I1; *t_arg1 = (_ta); break;
sewardj6efd4a12004-07-15 03:54:23 +00002326
sewardjb183b852006-02-03 16:08:03 +00002327 /* Rounding mode values are always Ity_I32, encoded as per
2328 IRRoundingMode */
2329 const IRType ity_RMode = Ity_I32;
2330
sewardj6efd4a12004-07-15 03:54:23 +00002331 *t_dst = Ity_INVALID;
2332 *t_arg1 = Ity_INVALID;
2333 *t_arg2 = Ity_INVALID;
sewardjb183b852006-02-03 16:08:03 +00002334 *t_arg3 = Ity_INVALID;
sewardj40c80262006-02-08 19:30:46 +00002335 *t_arg4 = Ity_INVALID;
sewardj6efd4a12004-07-15 03:54:23 +00002336 switch (op) {
sewardj17442fe2004-09-20 14:54:28 +00002337 case Iop_Add8: case Iop_Sub8: case Iop_Mul8:
2338 case Iop_Or8: case Iop_And8: case Iop_Xor8:
sewardjb183b852006-02-03 16:08:03 +00002339 BINARY(Ity_I8,Ity_I8, Ity_I8);
sewardj6efd4a12004-07-15 03:54:23 +00002340
sewardj17442fe2004-09-20 14:54:28 +00002341 case Iop_Add16: case Iop_Sub16: case Iop_Mul16:
2342 case Iop_Or16: case Iop_And16: case Iop_Xor16:
sewardjb183b852006-02-03 16:08:03 +00002343 BINARY(Ity_I16,Ity_I16, Ity_I16);
sewardj6efd4a12004-07-15 03:54:23 +00002344
sewardjb51f0f42005-07-18 11:38:02 +00002345 case Iop_CmpORD32U:
2346 case Iop_CmpORD32S:
sewardj17442fe2004-09-20 14:54:28 +00002347 case Iop_Add32: case Iop_Sub32: case Iop_Mul32:
2348 case Iop_Or32: case Iop_And32: case Iop_Xor32:
sewardj478646f2008-05-01 20:13:04 +00002349 case Iop_Max32U:
sewardj44ce46d2012-07-11 13:19:10 +00002350 case Iop_QAdd32S: case Iop_QSub32S:
sewardje2ea1762010-09-22 00:56:37 +00002351 case Iop_Add16x2: case Iop_Sub16x2:
2352 case Iop_QAdd16Sx2: case Iop_QAdd16Ux2:
2353 case Iop_QSub16Sx2: case Iop_QSub16Ux2:
2354 case Iop_HAdd16Ux2: case Iop_HAdd16Sx2:
2355 case Iop_HSub16Ux2: case Iop_HSub16Sx2:
2356 case Iop_Add8x4: case Iop_Sub8x4:
2357 case Iop_QAdd8Sx4: case Iop_QAdd8Ux4:
2358 case Iop_QSub8Sx4: case Iop_QSub8Ux4:
2359 case Iop_HAdd8Ux4: case Iop_HAdd8Sx4:
2360 case Iop_HSub8Ux4: case Iop_HSub8Sx4:
sewardj310d6b22010-10-18 16:29:40 +00002361 case Iop_Sad8Ux4:
sewardjb183b852006-02-03 16:08:03 +00002362 BINARY(Ity_I32,Ity_I32, Ity_I32);
sewardj6efd4a12004-07-15 03:54:23 +00002363
sewardj17442fe2004-09-20 14:54:28 +00002364 case Iop_Add64: case Iop_Sub64: case Iop_Mul64:
2365 case Iop_Or64: case Iop_And64: case Iop_Xor64:
cerion2831b002005-11-30 19:55:22 +00002366 case Iop_CmpORD64U:
2367 case Iop_CmpORD64S:
sewardj38a3f862005-01-13 15:06:51 +00002368 case Iop_Avg8Ux8: case Iop_Avg16Ux4:
2369 case Iop_Add8x8: case Iop_Add16x4: case Iop_Add32x2:
sewardj2fdd4162010-08-22 12:59:02 +00002370 case Iop_Add32Fx2: case Iop_Sub32Fx2:
sewardj38a3f862005-01-13 15:06:51 +00002371 case Iop_CmpEQ8x8: case Iop_CmpEQ16x4: case Iop_CmpEQ32x2:
2372 case Iop_CmpGT8Sx8: case Iop_CmpGT16Sx4: case Iop_CmpGT32Sx2:
sewardj2fdd4162010-08-22 12:59:02 +00002373 case Iop_CmpGT8Ux8: case Iop_CmpGT16Ux4: case Iop_CmpGT32Ux2:
2374 case Iop_CmpGT32Fx2: case Iop_CmpEQ32Fx2: case Iop_CmpGE32Fx2:
sewardj38a3f862005-01-13 15:06:51 +00002375 case Iop_InterleaveHI8x8: case Iop_InterleaveLO8x8:
2376 case Iop_InterleaveHI16x4: case Iop_InterleaveLO16x4:
2377 case Iop_InterleaveHI32x2: case Iop_InterleaveLO32x2:
sewardj2fdd4162010-08-22 12:59:02 +00002378 case Iop_CatOddLanes8x8: case Iop_CatEvenLanes8x8:
sewardjd166e282008-02-06 11:42:45 +00002379 case Iop_CatOddLanes16x4: case Iop_CatEvenLanes16x4:
sewardj2fdd4162010-08-22 12:59:02 +00002380 case Iop_InterleaveOddLanes8x8: case Iop_InterleaveEvenLanes8x8:
2381 case Iop_InterleaveOddLanes16x4: case Iop_InterleaveEvenLanes16x4:
sewardjd166e282008-02-06 11:42:45 +00002382 case Iop_Perm8x8:
sewardj2fdd4162010-08-22 12:59:02 +00002383 case Iop_Max8Ux8: case Iop_Max16Ux4: case Iop_Max32Ux2:
2384 case Iop_Max8Sx8: case Iop_Max16Sx4: case Iop_Max32Sx2:
2385 case Iop_Max32Fx2: case Iop_Min32Fx2:
2386 case Iop_PwMax32Fx2: case Iop_PwMin32Fx2:
2387 case Iop_Min8Ux8: case Iop_Min16Ux4: case Iop_Min32Ux2:
2388 case Iop_Min8Sx8: case Iop_Min16Sx4: case Iop_Min32Sx2:
2389 case Iop_PwMax8Ux8: case Iop_PwMax16Ux4: case Iop_PwMax32Ux2:
2390 case Iop_PwMax8Sx8: case Iop_PwMax16Sx4: case Iop_PwMax32Sx2:
2391 case Iop_PwMin8Ux8: case Iop_PwMin16Ux4: case Iop_PwMin32Ux2:
2392 case Iop_PwMin8Sx8: case Iop_PwMin16Sx4: case Iop_PwMin32Sx2:
2393 case Iop_Mul8x8: case Iop_Mul16x4: case Iop_Mul32x2:
2394 case Iop_Mul32Fx2:
2395 case Iop_PolynomialMul8x8:
sewardjd166e282008-02-06 11:42:45 +00002396 case Iop_MulHi16Sx4: case Iop_MulHi16Ux4:
sewardj2fdd4162010-08-22 12:59:02 +00002397 case Iop_QDMulHi16Sx4: case Iop_QDMulHi32Sx2:
2398 case Iop_QRDMulHi16Sx4: case Iop_QRDMulHi32Sx2:
sewardj38a3f862005-01-13 15:06:51 +00002399 case Iop_QAdd8Sx8: case Iop_QAdd16Sx4:
sewardj2fdd4162010-08-22 12:59:02 +00002400 case Iop_QAdd32Sx2: case Iop_QAdd64Sx1:
sewardj38a3f862005-01-13 15:06:51 +00002401 case Iop_QAdd8Ux8: case Iop_QAdd16Ux4:
sewardj2fdd4162010-08-22 12:59:02 +00002402 case Iop_QAdd32Ux2: case Iop_QAdd64Ux1:
2403 case Iop_PwAdd8x8: case Iop_PwAdd16x4: case Iop_PwAdd32x2:
2404 case Iop_PwAdd32Fx2:
sewardj5f438dd2011-06-16 11:36:23 +00002405 case Iop_QNarrowBin32Sto16Sx4:
2406 case Iop_QNarrowBin16Sto8Sx8: case Iop_QNarrowBin16Sto8Ux8:
sewardjad2c9ea2011-10-22 09:32:16 +00002407 case Iop_NarrowBin16to8x8: case Iop_NarrowBin32to16x4:
sewardj38a3f862005-01-13 15:06:51 +00002408 case Iop_Sub8x8: case Iop_Sub16x4: case Iop_Sub32x2:
2409 case Iop_QSub8Sx8: case Iop_QSub16Sx4:
sewardj2fdd4162010-08-22 12:59:02 +00002410 case Iop_QSub32Sx2: case Iop_QSub64Sx1:
sewardj38a3f862005-01-13 15:06:51 +00002411 case Iop_QSub8Ux8: case Iop_QSub16Ux4:
sewardj2fdd4162010-08-22 12:59:02 +00002412 case Iop_QSub32Ux2: case Iop_QSub64Ux1:
2413 case Iop_Shl8x8: case Iop_Shl16x4: case Iop_Shl32x2:
2414 case Iop_Shr8x8: case Iop_Shr16x4: case Iop_Shr32x2:
2415 case Iop_Sar8x8: case Iop_Sar16x4: case Iop_Sar32x2:
2416 case Iop_Sal8x8: case Iop_Sal16x4: case Iop_Sal32x2: case Iop_Sal64x1:
2417 case Iop_QShl8x8: case Iop_QShl16x4: case Iop_QShl32x2: case Iop_QShl64x1:
2418 case Iop_QSal8x8: case Iop_QSal16x4: case Iop_QSal32x2: case Iop_QSal64x1:
2419 case Iop_Recps32Fx2:
2420 case Iop_Rsqrts32Fx2:
sewardjb183b852006-02-03 16:08:03 +00002421 BINARY(Ity_I64,Ity_I64, Ity_I64);
sewardj38a3f862005-01-13 15:06:51 +00002422
sewardjd166e282008-02-06 11:42:45 +00002423 case Iop_ShlN32x2: case Iop_ShlN16x4: case Iop_ShlN8x8:
sewardj2fdd4162010-08-22 12:59:02 +00002424 case Iop_ShrN32x2: case Iop_ShrN16x4: case Iop_ShrN8x8:
sewardjd71ba832006-12-27 01:15:29 +00002425 case Iop_SarN32x2: case Iop_SarN16x4: case Iop_SarN8x8:
sewardj2fdd4162010-08-22 12:59:02 +00002426 case Iop_QShlN8x8: case Iop_QShlN16x4:
2427 case Iop_QShlN32x2: case Iop_QShlN64x1:
2428 case Iop_QShlN8Sx8: case Iop_QShlN16Sx4:
2429 case Iop_QShlN32Sx2: case Iop_QShlN64Sx1:
2430 case Iop_QSalN8x8: case Iop_QSalN16x4:
2431 case Iop_QSalN32x2: case Iop_QSalN64x1:
sewardjb183b852006-02-03 16:08:03 +00002432 BINARY(Ity_I64,Ity_I8, Ity_I64);
sewardj6efd4a12004-07-15 03:54:23 +00002433
2434 case Iop_Shl8: case Iop_Shr8: case Iop_Sar8:
sewardjb183b852006-02-03 16:08:03 +00002435 BINARY(Ity_I8,Ity_I8, Ity_I8);
sewardj6efd4a12004-07-15 03:54:23 +00002436 case Iop_Shl16: case Iop_Shr16: case Iop_Sar16:
sewardjb183b852006-02-03 16:08:03 +00002437 BINARY(Ity_I16,Ity_I8, Ity_I16);
sewardj6efd4a12004-07-15 03:54:23 +00002438 case Iop_Shl32: case Iop_Shr32: case Iop_Sar32:
sewardjb183b852006-02-03 16:08:03 +00002439 BINARY(Ity_I32,Ity_I8, Ity_I32);
sewardj6efd4a12004-07-15 03:54:23 +00002440 case Iop_Shl64: case Iop_Shr64: case Iop_Sar64:
sewardjb183b852006-02-03 16:08:03 +00002441 BINARY(Ity_I64,Ity_I8, Ity_I64);
sewardj6efd4a12004-07-15 03:54:23 +00002442
sewardjeb17e492007-08-25 23:07:44 +00002443 case Iop_Not8:
sewardjb183b852006-02-03 16:08:03 +00002444 UNARY(Ity_I8, Ity_I8);
sewardjeb17e492007-08-25 23:07:44 +00002445 case Iop_Not16:
sewardjb183b852006-02-03 16:08:03 +00002446 UNARY(Ity_I16, Ity_I16);
sewardjeb17e492007-08-25 23:07:44 +00002447 case Iop_Not32:
sewardje2ea1762010-09-22 00:56:37 +00002448 case Iop_CmpNEZ16x2: case Iop_CmpNEZ8x4:
sewardjb183b852006-02-03 16:08:03 +00002449 UNARY(Ity_I32, Ity_I32);
sewardj18069182005-01-13 19:16:04 +00002450
sewardj0033ddc2005-04-26 23:34:34 +00002451 case Iop_Not64:
sewardj18069182005-01-13 19:16:04 +00002452 case Iop_CmpNEZ32x2: case Iop_CmpNEZ16x4: case Iop_CmpNEZ8x8:
sewardj2fdd4162010-08-22 12:59:02 +00002453 case Iop_Cnt8x8:
2454 case Iop_Clz8Sx8: case Iop_Clz16Sx4: case Iop_Clz32Sx2:
2455 case Iop_Cls8Sx8: case Iop_Cls16Sx4: case Iop_Cls32Sx2:
2456 case Iop_PwAddL8Ux8: case Iop_PwAddL16Ux4: case Iop_PwAddL32Ux2:
2457 case Iop_PwAddL8Sx8: case Iop_PwAddL16Sx4: case Iop_PwAddL32Sx2:
2458 case Iop_Reverse64_8x8: case Iop_Reverse64_16x4: case Iop_Reverse64_32x2:
2459 case Iop_Reverse32_8x8: case Iop_Reverse32_16x4:
2460 case Iop_Reverse16_8x8:
2461 case Iop_FtoI32Sx2_RZ: case Iop_FtoI32Ux2_RZ:
2462 case Iop_I32StoFx2: case Iop_I32UtoFx2:
2463 case Iop_Recip32x2: case Iop_Recip32Fx2:
2464 case Iop_Abs32Fx2:
2465 case Iop_Rsqrte32Fx2:
2466 case Iop_Rsqrte32x2:
2467 case Iop_Neg32Fx2:
2468 case Iop_Abs8x8: case Iop_Abs16x4: case Iop_Abs32x2:
sewardjb183b852006-02-03 16:08:03 +00002469 UNARY(Ity_I64, Ity_I64);
sewardj6efd4a12004-07-15 03:54:23 +00002470
2471 case Iop_CmpEQ8: case Iop_CmpNE8:
sewardje13074c2012-11-08 10:57:08 +00002472 case Iop_CasCmpEQ8: case Iop_CasCmpNE8: case Iop_ExpCmpNE8:
sewardj6efd4a12004-07-15 03:54:23 +00002473 COMPARISON(Ity_I8);
2474 case Iop_CmpEQ16: case Iop_CmpNE16:
sewardje13074c2012-11-08 10:57:08 +00002475 case Iop_CasCmpEQ16: case Iop_CasCmpNE16: case Iop_ExpCmpNE16:
sewardj6efd4a12004-07-15 03:54:23 +00002476 COMPARISON(Ity_I16);
2477 case Iop_CmpEQ32: case Iop_CmpNE32:
sewardje13074c2012-11-08 10:57:08 +00002478 case Iop_CasCmpEQ32: case Iop_CasCmpNE32: case Iop_ExpCmpNE32:
sewardj17442fe2004-09-20 14:54:28 +00002479 case Iop_CmpLT32S: case Iop_CmpLE32S:
2480 case Iop_CmpLT32U: case Iop_CmpLE32U:
sewardj6efd4a12004-07-15 03:54:23 +00002481 COMPARISON(Ity_I32);
2482 case Iop_CmpEQ64: case Iop_CmpNE64:
sewardje13074c2012-11-08 10:57:08 +00002483 case Iop_CasCmpEQ64: case Iop_CasCmpNE64: case Iop_ExpCmpNE64:
sewardj98540072005-04-26 01:52:01 +00002484 case Iop_CmpLT64S: case Iop_CmpLE64S:
2485 case Iop_CmpLT64U: case Iop_CmpLE64U:
sewardj6efd4a12004-07-15 03:54:23 +00002486 COMPARISON(Ity_I64);
2487
sewardj0033ddc2005-04-26 23:34:34 +00002488 case Iop_CmpNEZ8: UNARY_COMPARISON(Ity_I8);
2489 case Iop_CmpNEZ16: UNARY_COMPARISON(Ity_I16);
2490 case Iop_CmpNEZ32: UNARY_COMPARISON(Ity_I32);
2491 case Iop_CmpNEZ64: UNARY_COMPARISON(Ity_I64);
2492
sewardjeb17e492007-08-25 23:07:44 +00002493 case Iop_Left8: UNARY(Ity_I8, Ity_I8);
2494 case Iop_Left16: UNARY(Ity_I16,Ity_I16);
2495 case Iop_CmpwNEZ32: case Iop_Left32: UNARY(Ity_I32,Ity_I32);
2496 case Iop_CmpwNEZ64: case Iop_Left64: UNARY(Ity_I64,Ity_I64);
sewardj78a20592012-12-13 18:29:56 +00002497
2498 case Iop_GetMSBs8x8: UNARY(Ity_I64, Ity_I8);
2499 case Iop_GetMSBs8x16: UNARY(Ity_V128, Ity_I16);
sewardjeb17e492007-08-25 23:07:44 +00002500
sewardjb81f8b32004-07-30 10:17:50 +00002501 case Iop_MullU8: case Iop_MullS8:
sewardjb183b852006-02-03 16:08:03 +00002502 BINARY(Ity_I8,Ity_I8, Ity_I16);
sewardjb81f8b32004-07-30 10:17:50 +00002503 case Iop_MullU16: case Iop_MullS16:
sewardjb183b852006-02-03 16:08:03 +00002504 BINARY(Ity_I16,Ity_I16, Ity_I32);
sewardj6d2638e2004-07-15 09:38:27 +00002505 case Iop_MullU32: case Iop_MullS32:
sewardjb183b852006-02-03 16:08:03 +00002506 BINARY(Ity_I32,Ity_I32, Ity_I64);
sewardj9b967672005-02-08 11:13:09 +00002507 case Iop_MullU64: case Iop_MullS64:
sewardjb183b852006-02-03 16:08:03 +00002508 BINARY(Ity_I64,Ity_I64, Ity_I128);
sewardj6d2638e2004-07-15 09:38:27 +00002509
sewardj17442fe2004-09-20 14:54:28 +00002510 case Iop_Clz32: case Iop_Ctz32:
sewardjb183b852006-02-03 16:08:03 +00002511 UNARY(Ity_I32, Ity_I32);
sewardjce646f22004-08-31 23:55:54 +00002512
sewardjf53b7352005-04-06 20:01:56 +00002513 case Iop_Clz64: case Iop_Ctz64:
sewardjb183b852006-02-03 16:08:03 +00002514 UNARY(Ity_I64, Ity_I64);
sewardjf53b7352005-04-06 20:01:56 +00002515
sewardje71e56a2011-09-05 12:11:06 +00002516 case Iop_DivU32: case Iop_DivS32: case Iop_DivU32E: case Iop_DivS32E:
sewardjb183b852006-02-03 16:08:03 +00002517 BINARY(Ity_I32,Ity_I32, Ity_I32);
cerion5c8a0cb2005-02-03 13:59:46 +00002518
sewardje71e56a2011-09-05 12:11:06 +00002519 case Iop_DivU64: case Iop_DivS64: case Iop_DivS64E: case Iop_DivU64E:
sewardjb183b852006-02-03 16:08:03 +00002520 BINARY(Ity_I64,Ity_I64, Ity_I64);
cerionf0de28c2005-12-13 20:21:11 +00002521
sewardj17442fe2004-09-20 14:54:28 +00002522 case Iop_DivModU64to32: case Iop_DivModS64to32:
sewardjb183b852006-02-03 16:08:03 +00002523 BINARY(Ity_I64,Ity_I32, Ity_I64);
sewardj6d2638e2004-07-15 09:38:27 +00002524
sewardj343b9d02005-01-31 18:08:45 +00002525 case Iop_DivModU128to64: case Iop_DivModS128to64:
sewardjb183b852006-02-03 16:08:03 +00002526 BINARY(Ity_I128,Ity_I64, Ity_I128);
sewardj343b9d02005-01-31 18:08:45 +00002527
sewardj2019a972011-03-07 16:04:07 +00002528 case Iop_DivModS64to64:
2529 BINARY(Ity_I64,Ity_I64, Ity_I128);
2530
sewardjb81f8b32004-07-30 10:17:50 +00002531 case Iop_16HIto8: case Iop_16to8:
sewardjb183b852006-02-03 16:08:03 +00002532 UNARY(Ity_I16, Ity_I8);
sewardjb81f8b32004-07-30 10:17:50 +00002533 case Iop_8HLto16:
sewardjb183b852006-02-03 16:08:03 +00002534 BINARY(Ity_I8,Ity_I8, Ity_I16);
sewardjb81f8b32004-07-30 10:17:50 +00002535
sewardj8c7f1ab2004-07-29 20:31:09 +00002536 case Iop_32HIto16: case Iop_32to16:
sewardjb183b852006-02-03 16:08:03 +00002537 UNARY(Ity_I32, Ity_I16);
sewardj8c7f1ab2004-07-29 20:31:09 +00002538 case Iop_16HLto32:
sewardjb183b852006-02-03 16:08:03 +00002539 BINARY(Ity_I16,Ity_I16, Ity_I32);
sewardj8c7f1ab2004-07-29 20:31:09 +00002540
2541 case Iop_64HIto32: case Iop_64to32:
sewardjb183b852006-02-03 16:08:03 +00002542 UNARY(Ity_I64, Ity_I32);
sewardj6d2638e2004-07-15 09:38:27 +00002543 case Iop_32HLto64:
sewardjb183b852006-02-03 16:08:03 +00002544 BINARY(Ity_I32,Ity_I32, Ity_I64);
sewardj6d2638e2004-07-15 09:38:27 +00002545
sewardj9b967672005-02-08 11:13:09 +00002546 case Iop_128HIto64: case Iop_128to64:
sewardjb183b852006-02-03 16:08:03 +00002547 UNARY(Ity_I128, Ity_I64);
sewardj9b967672005-02-08 11:13:09 +00002548 case Iop_64HLto128:
sewardjb183b852006-02-03 16:08:03 +00002549 BINARY(Ity_I64,Ity_I64, Ity_I128);
sewardj9b967672005-02-08 11:13:09 +00002550
sewardjb183b852006-02-03 16:08:03 +00002551 case Iop_Not1: UNARY(Ity_I1, Ity_I1);
2552 case Iop_1Uto8: UNARY(Ity_I1, Ity_I8);
2553 case Iop_1Sto8: UNARY(Ity_I1, Ity_I8);
2554 case Iop_1Sto16: UNARY(Ity_I1, Ity_I16);
2555 case Iop_1Uto32: case Iop_1Sto32: UNARY(Ity_I1, Ity_I32);
2556 case Iop_1Sto64: case Iop_1Uto64: UNARY(Ity_I1, Ity_I64);
2557 case Iop_32to1: UNARY(Ity_I32, Ity_I1);
2558 case Iop_64to1: UNARY(Ity_I64, Ity_I1);
sewardj47341042004-09-19 11:55:46 +00002559
sewardj17442fe2004-09-20 14:54:28 +00002560 case Iop_8Uto32: case Iop_8Sto32:
sewardjb183b852006-02-03 16:08:03 +00002561 UNARY(Ity_I8, Ity_I32);
sewardj47341042004-09-19 11:55:46 +00002562
sewardj17442fe2004-09-20 14:54:28 +00002563 case Iop_8Uto16: case Iop_8Sto16:
sewardjb183b852006-02-03 16:08:03 +00002564 UNARY(Ity_I8, Ity_I16);
sewardj47341042004-09-19 11:55:46 +00002565
sewardj17442fe2004-09-20 14:54:28 +00002566 case Iop_16Uto32: case Iop_16Sto32:
sewardjb183b852006-02-03 16:08:03 +00002567 UNARY(Ity_I16, Ity_I32);
sewardj6d2638e2004-07-15 09:38:27 +00002568
sewardj17442fe2004-09-20 14:54:28 +00002569 case Iop_32Sto64: case Iop_32Uto64:
sewardjb183b852006-02-03 16:08:03 +00002570 UNARY(Ity_I32, Ity_I64);
sewardj17442fe2004-09-20 14:54:28 +00002571
sewardj291a7e82005-04-27 11:42:44 +00002572 case Iop_8Uto64: case Iop_8Sto64:
sewardjb183b852006-02-03 16:08:03 +00002573 UNARY(Ity_I8, Ity_I64);
sewardj291a7e82005-04-27 11:42:44 +00002574
2575 case Iop_16Uto64: case Iop_16Sto64:
sewardj291a7e82005-04-27 11:42:44 +00002576 UNARY(Ity_I16, Ity_I64);
sewardjb183b852006-02-03 16:08:03 +00002577 case Iop_64to16:
2578 UNARY(Ity_I64, Ity_I16);
sewardj291a7e82005-04-27 11:42:44 +00002579
sewardjb183b852006-02-03 16:08:03 +00002580 case Iop_32to8: UNARY(Ity_I32, Ity_I8);
2581 case Iop_64to8: UNARY(Ity_I64, Ity_I8);
sewardj17442fe2004-09-20 14:54:28 +00002582
sewardjb183b852006-02-03 16:08:03 +00002583 case Iop_AddF64: case Iop_SubF64:
2584 case Iop_MulF64: case Iop_DivF64:
2585 case Iop_AddF64r32: case Iop_SubF64r32:
2586 case Iop_MulF64r32: case Iop_DivF64r32:
2587 TERNARY(ity_RMode,Ity_F64,Ity_F64, Ity_F64);
2588
sewardj6c299f32009-12-31 18:00:12 +00002589 case Iop_AddF32: case Iop_SubF32:
2590 case Iop_MulF32: case Iop_DivF32:
2591 TERNARY(ity_RMode,Ity_F32,Ity_F32, Ity_F32);
2592
sewardjb183b852006-02-03 16:08:03 +00002593 case Iop_NegF64: case Iop_AbsF64:
2594 UNARY(Ity_F64, Ity_F64);
2595
sewardj6c299f32009-12-31 18:00:12 +00002596 case Iop_NegF32: case Iop_AbsF32:
2597 UNARY(Ity_F32, Ity_F32);
2598
sewardjb183b852006-02-03 16:08:03 +00002599 case Iop_SqrtF64:
sewardjb183b852006-02-03 16:08:03 +00002600 BINARY(ity_RMode,Ity_F64, Ity_F64);
2601
sewardj6c299f32009-12-31 18:00:12 +00002602 case Iop_SqrtF32:
sewardjd15b5972010-06-27 09:06:34 +00002603 case Iop_RoundF32toInt:
sewardj6c299f32009-12-31 18:00:12 +00002604 BINARY(ity_RMode,Ity_F32, Ity_F32);
2605
sewardj2019a972011-03-07 16:04:07 +00002606 case Iop_CmpF32:
2607 BINARY(Ity_F32,Ity_F32, Ity_I32);
2608
sewardjbdc7d212004-09-09 02:46:40 +00002609 case Iop_CmpF64:
sewardjb183b852006-02-03 16:08:03 +00002610 BINARY(Ity_F64,Ity_F64, Ity_I32);
sewardj8f3debf2004-09-08 23:42:23 +00002611
sewardj2019a972011-03-07 16:04:07 +00002612 case Iop_CmpF128:
2613 BINARY(Ity_F128,Ity_F128, Ity_I32);
2614
sewardj6c299f32009-12-31 18:00:12 +00002615 case Iop_F64toI16S: BINARY(ity_RMode,Ity_F64, Ity_I16);
2616 case Iop_F64toI32S: BINARY(ity_RMode,Ity_F64, Ity_I32);
sewardj4aa412a2011-07-24 14:13:21 +00002617 case Iop_F64toI64S: case Iop_F64toI64U:
2618 BINARY(ity_RMode,Ity_F64, Ity_I64);
sewardj8f3debf2004-09-08 23:42:23 +00002619
sewardj6c299f32009-12-31 18:00:12 +00002620 case Iop_F64toI32U: BINARY(ity_RMode,Ity_F64, Ity_I32);
2621
sewardj6c299f32009-12-31 18:00:12 +00002622 case Iop_I32StoF64: UNARY(Ity_I32, Ity_F64);
2623 case Iop_I64StoF64: BINARY(ity_RMode,Ity_I64, Ity_F64);
sewardj66d5ef22011-04-15 11:55:00 +00002624 case Iop_I64UtoF64: BINARY(ity_RMode,Ity_I64, Ity_F64);
sewardj95d6f3a2011-04-27 10:07:42 +00002625 case Iop_I64UtoF32: BINARY(ity_RMode,Ity_I64, Ity_F32);
sewardj6c299f32009-12-31 18:00:12 +00002626
2627 case Iop_I32UtoF64: UNARY(Ity_I32, Ity_F64);
sewardj3bca9062004-12-04 14:36:09 +00002628
sewardj2019a972011-03-07 16:04:07 +00002629 case Iop_F32toI32S: BINARY(ity_RMode,Ity_F32, Ity_I32);
2630 case Iop_F32toI64S: BINARY(ity_RMode,Ity_F32, Ity_I64);
florian1c8f7ff2012-09-01 00:12:11 +00002631 case Iop_F32toI32U: BINARY(ity_RMode,Ity_F32, Ity_I32);
2632 case Iop_F32toI64U: BINARY(ity_RMode,Ity_F32, Ity_I64);
sewardj2019a972011-03-07 16:04:07 +00002633
florian1c8f7ff2012-09-01 00:12:11 +00002634 case Iop_I32UtoF32: BINARY(ity_RMode,Ity_I32, Ity_F32);
sewardj2019a972011-03-07 16:04:07 +00002635 case Iop_I32StoF32: BINARY(ity_RMode,Ity_I32, Ity_F32);
2636 case Iop_I64StoF32: BINARY(ity_RMode,Ity_I64, Ity_F32);
2637
sewardjb183b852006-02-03 16:08:03 +00002638 case Iop_F32toF64: UNARY(Ity_F32, Ity_F64);
2639 case Iop_F64toF32: BINARY(ity_RMode,Ity_F64, Ity_F32);
sewardj4cb918d2004-12-03 19:43:31 +00002640
sewardjb183b852006-02-03 16:08:03 +00002641 case Iop_ReinterpI64asF64: UNARY(Ity_I64, Ity_F64);
2642 case Iop_ReinterpF64asI64: UNARY(Ity_F64, Ity_I64);
2643 case Iop_ReinterpI32asF32: UNARY(Ity_I32, Ity_F32);
sewardjfc1b5412007-01-09 15:20:07 +00002644 case Iop_ReinterpF32asI32: UNARY(Ity_F32, Ity_I32);
sewardj8f3debf2004-09-08 23:42:23 +00002645
sewardjb183b852006-02-03 16:08:03 +00002646 case Iop_AtanF64: case Iop_Yl2xF64: case Iop_Yl2xp1F64:
2647 case Iop_ScaleF64: case Iop_PRemF64: case Iop_PRem1F64:
2648 TERNARY(ity_RMode,Ity_F64,Ity_F64, Ity_F64);
2649
2650 case Iop_PRemC3210F64: case Iop_PRem1C3210F64:
2651 TERNARY(ity_RMode,Ity_F64,Ity_F64, Ity_I32);
2652
2653 case Iop_SinF64: case Iop_CosF64: case Iop_TanF64:
2654 case Iop_2xm1F64:
2655 case Iop_RoundF64toInt: BINARY(ity_RMode,Ity_F64, Ity_F64);
2656
sewardj40c80262006-02-08 19:30:46 +00002657 case Iop_MAddF64: case Iop_MSubF64:
2658 case Iop_MAddF64r32: case Iop_MSubF64r32:
2659 QUATERNARY(ity_RMode,Ity_F64,Ity_F64,Ity_F64, Ity_F64);
2660
sewardjb183b852006-02-03 16:08:03 +00002661 case Iop_Est5FRSqrt:
sewardj0f1ef862008-08-08 08:37:06 +00002662 case Iop_RoundF64toF64_NEAREST: case Iop_RoundF64toF64_NegINF:
2663 case Iop_RoundF64toF64_PosINF: case Iop_RoundF64toF64_ZERO:
sewardjb183b852006-02-03 16:08:03 +00002664 UNARY(Ity_F64, Ity_F64);
2665 case Iop_RoundF64toF32:
2666 BINARY(ity_RMode,Ity_F64, Ity_F64);
sewardjb183b852006-02-03 16:08:03 +00002667 case Iop_TruncF64asF32:
2668 UNARY(Ity_F64, Ity_F32);
sewardjbb53f8c2004-08-14 11:50:01 +00002669
cerionf294eb32005-11-16 17:21:10 +00002670 case Iop_I32UtoFx4:
2671 case Iop_I32StoFx4:
2672 case Iop_QFtoI32Ux4_RZ:
2673 case Iop_QFtoI32Sx4_RZ:
sewardj2fdd4162010-08-22 12:59:02 +00002674 case Iop_FtoI32Ux4_RZ:
2675 case Iop_FtoI32Sx4_RZ:
cerionf294eb32005-11-16 17:21:10 +00002676 case Iop_RoundF32x4_RM:
2677 case Iop_RoundF32x4_RP:
2678 case Iop_RoundF32x4_RN:
2679 case Iop_RoundF32x4_RZ:
sewardj2fdd4162010-08-22 12:59:02 +00002680 case Iop_Abs32Fx4:
2681 case Iop_Rsqrte32Fx4:
2682 case Iop_Rsqrte32x4:
cerionf294eb32005-11-16 17:21:10 +00002683 UNARY(Ity_V128, Ity_V128);
2684
sewardj5f438dd2011-06-16 11:36:23 +00002685 case Iop_64HLtoV128:
2686 BINARY(Ity_I64,Ity_I64, Ity_V128);
2687
sewardj2fdd4162010-08-22 12:59:02 +00002688 case Iop_V128to64: case Iop_V128HIto64:
sewardj5f438dd2011-06-16 11:36:23 +00002689 case Iop_NarrowUn16to8x8:
2690 case Iop_NarrowUn32to16x4:
2691 case Iop_NarrowUn64to32x2:
2692 case Iop_QNarrowUn16Uto8Ux8:
2693 case Iop_QNarrowUn32Uto16Ux4:
2694 case Iop_QNarrowUn64Uto32Ux2:
2695 case Iop_QNarrowUn16Sto8Sx8:
2696 case Iop_QNarrowUn32Sto16Sx4:
2697 case Iop_QNarrowUn64Sto32Sx2:
2698 case Iop_QNarrowUn16Sto8Ux8:
2699 case Iop_QNarrowUn32Sto16Ux4:
2700 case Iop_QNarrowUn64Sto32Ux2:
sewardj2fdd4162010-08-22 12:59:02 +00002701 case Iop_F32toF16x4:
sewardjb183b852006-02-03 16:08:03 +00002702 UNARY(Ity_V128, Ity_I64);
sewardjc9a43662004-11-30 18:51:59 +00002703
sewardj5f438dd2011-06-16 11:36:23 +00002704 case Iop_Widen8Uto16x8:
2705 case Iop_Widen16Uto32x4:
2706 case Iop_Widen32Uto64x2:
2707 case Iop_Widen8Sto16x8:
2708 case Iop_Widen16Sto32x4:
2709 case Iop_Widen32Sto64x2:
sewardj2fdd4162010-08-22 12:59:02 +00002710 case Iop_F16toF32x4:
2711 UNARY(Ity_I64, Ity_V128);
2712
sewardjb183b852006-02-03 16:08:03 +00002713 case Iop_V128to32: UNARY(Ity_V128, Ity_I32);
2714 case Iop_32UtoV128: UNARY(Ity_I32, Ity_V128);
2715 case Iop_64UtoV128: UNARY(Ity_I64, Ity_V128);
2716 case Iop_SetV128lo32: BINARY(Ity_V128,Ity_I32, Ity_V128);
2717 case Iop_SetV128lo64: BINARY(Ity_V128,Ity_I64, Ity_V128);
sewardj129b3d92004-12-05 15:42:05 +00002718
sewardjb183b852006-02-03 16:08:03 +00002719 case Iop_Dup8x16: UNARY(Ity_I8, Ity_V128);
2720 case Iop_Dup16x8: UNARY(Ity_I16, Ity_V128);
2721 case Iop_Dup32x4: UNARY(Ity_I32, Ity_V128);
sewardj2fdd4162010-08-22 12:59:02 +00002722 case Iop_Dup8x8: UNARY(Ity_I8, Ity_I64);
2723 case Iop_Dup16x4: UNARY(Ity_I16, Ity_I64);
2724 case Iop_Dup32x2: UNARY(Ity_I32, Ity_I64);
cerionf887b3e2005-09-13 16:34:28 +00002725
sewardj1e6ad742004-12-02 16:16:11 +00002726 case Iop_CmpEQ32Fx4: case Iop_CmpLT32Fx4:
sewardj636ad762004-12-07 11:16:04 +00002727 case Iop_CmpEQ64Fx2: case Iop_CmpLT64Fx2:
sewardj1e6ad742004-12-02 16:16:11 +00002728 case Iop_CmpLE32Fx4: case Iop_CmpUN32Fx4:
sewardj636ad762004-12-07 11:16:04 +00002729 case Iop_CmpLE64Fx2: case Iop_CmpUN64Fx2:
cerion206c3642005-11-14 00:35:59 +00002730 case Iop_CmpGT32Fx4: case Iop_CmpGE32Fx4:
sewardj1e6ad742004-12-02 16:16:11 +00002731 case Iop_CmpEQ32F0x4: case Iop_CmpLT32F0x4:
sewardj636ad762004-12-07 11:16:04 +00002732 case Iop_CmpEQ64F0x2: case Iop_CmpLT64F0x2:
sewardj1e6ad742004-12-02 16:16:11 +00002733 case Iop_CmpLE32F0x4: case Iop_CmpUN32F0x4:
sewardj636ad762004-12-07 11:16:04 +00002734 case Iop_CmpLE64F0x2: case Iop_CmpUN64F0x2:
sewardj1e6ad742004-12-02 16:16:11 +00002735 case Iop_Add32Fx4: case Iop_Add32F0x4:
sewardj636ad762004-12-07 11:16:04 +00002736 case Iop_Add64Fx2: case Iop_Add64F0x2:
sewardj176a59c2004-12-03 20:08:31 +00002737 case Iop_Div32Fx4: case Iop_Div32F0x4:
sewardj636ad762004-12-07 11:16:04 +00002738 case Iop_Div64Fx2: case Iop_Div64F0x2:
sewardj176a59c2004-12-03 20:08:31 +00002739 case Iop_Max32Fx4: case Iop_Max32F0x4:
sewardj2fdd4162010-08-22 12:59:02 +00002740 case Iop_PwMax32Fx4: case Iop_PwMin32Fx4:
sewardj636ad762004-12-07 11:16:04 +00002741 case Iop_Max64Fx2: case Iop_Max64F0x2:
sewardj176a59c2004-12-03 20:08:31 +00002742 case Iop_Min32Fx4: case Iop_Min32F0x4:
sewardj636ad762004-12-07 11:16:04 +00002743 case Iop_Min64Fx2: case Iop_Min64F0x2:
sewardj9636b442004-12-04 01:38:37 +00002744 case Iop_Mul32Fx4: case Iop_Mul32F0x4:
sewardj636ad762004-12-07 11:16:04 +00002745 case Iop_Mul64Fx2: case Iop_Mul64F0x2:
sewardjc1e7dfc2004-12-05 19:29:45 +00002746 case Iop_Sub32Fx4: case Iop_Sub32F0x4:
sewardj636ad762004-12-07 11:16:04 +00002747 case Iop_Sub64Fx2: case Iop_Sub64F0x2:
sewardjf0c1c582005-02-07 23:47:38 +00002748 case Iop_AndV128: case Iop_OrV128: case Iop_XorV128:
sewardj164f9272004-12-09 00:39:32 +00002749 case Iop_Add8x16: case Iop_Add16x8:
2750 case Iop_Add32x4: case Iop_Add64x2:
sewardj2fdd4162010-08-22 12:59:02 +00002751 case Iop_QAdd8Ux16: case Iop_QAdd16Ux8:
2752 case Iop_QAdd32Ux4: //case Iop_QAdd64Ux2:
2753 case Iop_QAdd8Sx16: case Iop_QAdd16Sx8:
2754 case Iop_QAdd32Sx4: case Iop_QAdd64Sx2:
2755 case Iop_PwAdd8x16: case Iop_PwAdd16x8: case Iop_PwAdd32x4:
sewardj164f9272004-12-09 00:39:32 +00002756 case Iop_Sub8x16: case Iop_Sub16x8:
2757 case Iop_Sub32x4: case Iop_Sub64x2:
sewardj2fdd4162010-08-22 12:59:02 +00002758 case Iop_QSub8Ux16: case Iop_QSub16Ux8:
2759 case Iop_QSub32Ux4: //case Iop_QSub64Ux2:
2760 case Iop_QSub8Sx16: case Iop_QSub16Sx8:
2761 case Iop_QSub32Sx4: case Iop_QSub64Sx2:
2762 case Iop_Mul8x16: case Iop_Mul16x8: case Iop_Mul32x4:
2763 case Iop_PolynomialMul8x16:
cerionf887b3e2005-09-13 16:34:28 +00002764 case Iop_MulHi16Ux8: case Iop_MulHi32Ux4:
2765 case Iop_MulHi16Sx8: case Iop_MulHi32Sx4:
sewardj2fdd4162010-08-22 12:59:02 +00002766 case Iop_QDMulHi16Sx8: case Iop_QDMulHi32Sx4:
2767 case Iop_QRDMulHi16Sx8: case Iop_QRDMulHi32Sx4:
cerion1ac656a2005-11-04 19:44:48 +00002768 case Iop_MullEven8Ux16: case Iop_MullEven16Ux8:
2769 case Iop_MullEven8Sx16: case Iop_MullEven16Sx8:
cerionf887b3e2005-09-13 16:34:28 +00002770 case Iop_Avg8Ux16: case Iop_Avg16Ux8: case Iop_Avg32Ux4:
2771 case Iop_Avg8Sx16: case Iop_Avg16Sx8: case Iop_Avg32Sx4:
2772 case Iop_Max8Sx16: case Iop_Max16Sx8: case Iop_Max32Sx4:
2773 case Iop_Max8Ux16: case Iop_Max16Ux8: case Iop_Max32Ux4:
2774 case Iop_Min8Sx16: case Iop_Min16Sx8: case Iop_Min32Sx4:
2775 case Iop_Min8Ux16: case Iop_Min16Ux8: case Iop_Min32Ux4:
sewardj164f9272004-12-09 00:39:32 +00002776 case Iop_CmpEQ8x16: case Iop_CmpEQ16x8: case Iop_CmpEQ32x4:
sewardjd8815622011-10-19 15:24:01 +00002777 case Iop_CmpEQ64x2:
sewardj164f9272004-12-09 00:39:32 +00002778 case Iop_CmpGT8Sx16: case Iop_CmpGT16Sx8: case Iop_CmpGT32Sx4:
sewardj69d98e32010-06-18 08:17:41 +00002779 case Iop_CmpGT64Sx2:
cerionf887b3e2005-09-13 16:34:28 +00002780 case Iop_CmpGT8Ux16: case Iop_CmpGT16Ux8: case Iop_CmpGT32Ux4:
sewardj2fdd4162010-08-22 12:59:02 +00002781 case Iop_Shl8x16: case Iop_Shl16x8: case Iop_Shl32x4: case Iop_Shl64x2:
sewardj5f438dd2011-06-16 11:36:23 +00002782 case Iop_QShl8x16: case Iop_QShl16x8:
2783 case Iop_QShl32x4: case Iop_QShl64x2:
2784 case Iop_QSal8x16: case Iop_QSal16x8:
2785 case Iop_QSal32x4: case Iop_QSal64x2:
sewardj2fdd4162010-08-22 12:59:02 +00002786 case Iop_Shr8x16: case Iop_Shr16x8: case Iop_Shr32x4: case Iop_Shr64x2:
2787 case Iop_Sar8x16: case Iop_Sar16x8: case Iop_Sar32x4: case Iop_Sar64x2:
2788 case Iop_Sal8x16: case Iop_Sal16x8: case Iop_Sal32x4: case Iop_Sal64x2:
sewardj1bee5612005-11-10 18:10:58 +00002789 case Iop_Rol8x16: case Iop_Rol16x8: case Iop_Rol32x4:
sewardj5f438dd2011-06-16 11:36:23 +00002790 case Iop_QNarrowBin16Sto8Ux16: case Iop_QNarrowBin32Sto16Ux8:
2791 case Iop_QNarrowBin16Sto8Sx16: case Iop_QNarrowBin32Sto16Sx8:
2792 case Iop_QNarrowBin16Uto8Ux16: case Iop_QNarrowBin32Uto16Ux8:
2793 case Iop_NarrowBin16to8x16: case Iop_NarrowBin32to16x8:
sewardj164f9272004-12-09 00:39:32 +00002794 case Iop_InterleaveHI8x16: case Iop_InterleaveHI16x8:
2795 case Iop_InterleaveHI32x4: case Iop_InterleaveHI64x2:
sewardj2fdd4162010-08-22 12:59:02 +00002796 case Iop_InterleaveLO8x16: case Iop_InterleaveLO16x8:
sewardj164f9272004-12-09 00:39:32 +00002797 case Iop_InterleaveLO32x4: case Iop_InterleaveLO64x2:
sewardj2fdd4162010-08-22 12:59:02 +00002798 case Iop_CatOddLanes8x16: case Iop_CatEvenLanes8x16:
2799 case Iop_CatOddLanes16x8: case Iop_CatEvenLanes16x8:
2800 case Iop_CatOddLanes32x4: case Iop_CatEvenLanes32x4:
2801 case Iop_InterleaveOddLanes8x16: case Iop_InterleaveEvenLanes8x16:
2802 case Iop_InterleaveOddLanes16x8: case Iop_InterleaveEvenLanes16x8:
2803 case Iop_InterleaveOddLanes32x4: case Iop_InterleaveEvenLanes32x4:
sewardjd8bca7e2012-06-20 11:46:19 +00002804 case Iop_Perm8x16: case Iop_Perm32x4:
sewardj2fdd4162010-08-22 12:59:02 +00002805 case Iop_Recps32Fx4:
2806 case Iop_Rsqrts32Fx4:
sewardjb183b852006-02-03 16:08:03 +00002807 BINARY(Ity_V128,Ity_V128, Ity_V128);
sewardjc9a43662004-11-30 18:51:59 +00002808
sewardj2fdd4162010-08-22 12:59:02 +00002809 case Iop_PolynomialMull8x8:
2810 case Iop_Mull8Ux8: case Iop_Mull8Sx8:
2811 case Iop_Mull16Ux4: case Iop_Mull16Sx4:
2812 case Iop_Mull32Ux2: case Iop_Mull32Sx2:
2813 BINARY(Ity_I64, Ity_I64, Ity_V128);
2814
sewardjf0c1c582005-02-07 23:47:38 +00002815 case Iop_NotV128:
sewardj0bd7ce62004-12-05 02:47:40 +00002816 case Iop_Recip32Fx4: case Iop_Recip32F0x4:
sewardj2fdd4162010-08-22 12:59:02 +00002817 case Iop_Recip32x4:
sewardj636ad762004-12-07 11:16:04 +00002818 case Iop_Recip64Fx2: case Iop_Recip64F0x2:
sewardjc1e7dfc2004-12-05 19:29:45 +00002819 case Iop_RSqrt32Fx4: case Iop_RSqrt32F0x4:
sewardj636ad762004-12-07 11:16:04 +00002820 case Iop_RSqrt64Fx2: case Iop_RSqrt64F0x2:
sewardjc1e7dfc2004-12-05 19:29:45 +00002821 case Iop_Sqrt32Fx4: case Iop_Sqrt32F0x4:
sewardj636ad762004-12-07 11:16:04 +00002822 case Iop_Sqrt64Fx2: case Iop_Sqrt64F0x2:
sewardj2e383862004-12-12 16:46:47 +00002823 case Iop_CmpNEZ8x16: case Iop_CmpNEZ16x8:
sewardj109ffdb2004-12-10 21:45:38 +00002824 case Iop_CmpNEZ32x4: case Iop_CmpNEZ64x2:
sewardj2fdd4162010-08-22 12:59:02 +00002825 case Iop_Cnt8x16:
2826 case Iop_Clz8Sx16: case Iop_Clz16Sx8: case Iop_Clz32Sx4:
2827 case Iop_Cls8Sx16: case Iop_Cls16Sx8: case Iop_Cls32Sx4:
2828 case Iop_PwAddL8Ux16: case Iop_PwAddL16Ux8: case Iop_PwAddL32Ux4:
2829 case Iop_PwAddL8Sx16: case Iop_PwAddL16Sx8: case Iop_PwAddL32Sx4:
2830 case Iop_Reverse64_8x16: case Iop_Reverse64_16x8: case Iop_Reverse64_32x4:
2831 case Iop_Reverse32_8x16: case Iop_Reverse32_16x8:
2832 case Iop_Reverse16_8x16:
2833 case Iop_Neg32Fx4:
2834 case Iop_Abs8x16: case Iop_Abs16x8: case Iop_Abs32x4:
sewardj0bd7ce62004-12-05 02:47:40 +00002835 UNARY(Ity_V128, Ity_V128);
2836
cerionf887b3e2005-09-13 16:34:28 +00002837 case Iop_ShlV128: case Iop_ShrV128:
sewardjb183b852006-02-03 16:08:03 +00002838 case Iop_ShlN8x16: case Iop_ShlN16x8:
2839 case Iop_ShlN32x4: case Iop_ShlN64x2:
2840 case Iop_ShrN8x16: case Iop_ShrN16x8:
2841 case Iop_ShrN32x4: case Iop_ShrN64x2:
sewardj2fdd4162010-08-22 12:59:02 +00002842 case Iop_SarN8x16: case Iop_SarN16x8:
2843 case Iop_SarN32x4: case Iop_SarN64x2:
2844 case Iop_QShlN8x16: case Iop_QShlN16x8:
2845 case Iop_QShlN32x4: case Iop_QShlN64x2:
2846 case Iop_QShlN8Sx16: case Iop_QShlN16Sx8:
2847 case Iop_QShlN32Sx4: case Iop_QShlN64Sx2:
2848 case Iop_QSalN8x16: case Iop_QSalN16x8:
2849 case Iop_QSalN32x4: case Iop_QSalN64x2:
sewardjb183b852006-02-03 16:08:03 +00002850 BINARY(Ity_V128,Ity_I8, Ity_V128);
sewardj164f9272004-12-09 00:39:32 +00002851
sewardj2fdd4162010-08-22 12:59:02 +00002852 case Iop_F32ToFixed32Ux4_RZ:
2853 case Iop_F32ToFixed32Sx4_RZ:
2854 case Iop_Fixed32UToF32x4_RN:
2855 case Iop_Fixed32SToF32x4_RN:
2856 BINARY(Ity_V128, Ity_I8, Ity_V128);
2857
2858 case Iop_F32ToFixed32Ux2_RZ:
2859 case Iop_F32ToFixed32Sx2_RZ:
2860 case Iop_Fixed32UToF32x2_RN:
2861 case Iop_Fixed32SToF32x2_RN:
2862 BINARY(Ity_I64, Ity_I8, Ity_I64);
2863
2864 case Iop_GetElem8x16:
2865 BINARY(Ity_V128, Ity_I8, Ity_I8);
2866 case Iop_GetElem16x8:
2867 BINARY(Ity_V128, Ity_I8, Ity_I16);
2868 case Iop_GetElem32x4:
2869 BINARY(Ity_V128, Ity_I8, Ity_I32);
2870 case Iop_GetElem64x2:
2871 BINARY(Ity_V128, Ity_I8, Ity_I64);
2872 case Iop_GetElem8x8:
2873 BINARY(Ity_I64, Ity_I8, Ity_I8);
2874 case Iop_GetElem16x4:
2875 BINARY(Ity_I64, Ity_I8, Ity_I16);
2876 case Iop_GetElem32x2:
2877 BINARY(Ity_I64, Ity_I8, Ity_I32);
2878 case Iop_SetElem8x8:
2879 TERNARY(Ity_I64, Ity_I8, Ity_I8, Ity_I64);
2880 case Iop_SetElem16x4:
2881 TERNARY(Ity_I64, Ity_I8, Ity_I16, Ity_I64);
2882 case Iop_SetElem32x2:
2883 TERNARY(Ity_I64, Ity_I8, Ity_I32, Ity_I64);
2884
2885 case Iop_Extract64:
2886 TERNARY(Ity_I64, Ity_I64, Ity_I8, Ity_I64);
2887 case Iop_ExtractV128:
2888 TERNARY(Ity_V128, Ity_V128, Ity_I8, Ity_V128);
2889
2890 case Iop_QDMulLong16Sx4: case Iop_QDMulLong32Sx2:
2891 BINARY(Ity_I64, Ity_I64, Ity_V128);
2892
sewardj2019a972011-03-07 16:04:07 +00002893 /* s390 specific */
2894 case Iop_MAddF32:
2895 case Iop_MSubF32:
2896 QUATERNARY(ity_RMode,Ity_F32,Ity_F32,Ity_F32, Ity_F32);
2897
2898 case Iop_F64HLtoF128:
2899 BINARY(Ity_F64,Ity_F64, Ity_F128);
2900
2901 case Iop_F128HItoF64:
2902 case Iop_F128LOtoF64:
2903 UNARY(Ity_F128, Ity_F64);
2904
2905 case Iop_AddF128:
2906 case Iop_SubF128:
2907 case Iop_MulF128:
2908 case Iop_DivF128:
2909 TERNARY(ity_RMode,Ity_F128,Ity_F128, Ity_F128);
2910
2911 case Iop_NegF128:
2912 case Iop_AbsF128:
2913 UNARY(Ity_F128, Ity_F128);
2914
2915 case Iop_SqrtF128:
2916 BINARY(ity_RMode,Ity_F128, Ity_F128);
2917
2918 case Iop_I32StoF128: UNARY(Ity_I32, Ity_F128);
2919 case Iop_I64StoF128: UNARY(Ity_I64, Ity_F128);
2920
florian1c8f7ff2012-09-01 00:12:11 +00002921 case Iop_I32UtoF128: UNARY(Ity_I32, Ity_F128);
2922 case Iop_I64UtoF128: UNARY(Ity_I64, Ity_F128);
2923
sewardj2019a972011-03-07 16:04:07 +00002924 case Iop_F128toI32S: BINARY(ity_RMode,Ity_F128, Ity_I32);
2925 case Iop_F128toI64S: BINARY(ity_RMode,Ity_F128, Ity_I64);
2926
florian1c8f7ff2012-09-01 00:12:11 +00002927 case Iop_F128toI32U: BINARY(ity_RMode,Ity_F128, Ity_I32);
2928 case Iop_F128toI64U: BINARY(ity_RMode,Ity_F128, Ity_I64);
2929
sewardj2019a972011-03-07 16:04:07 +00002930 case Iop_F32toF128: UNARY(Ity_F32, Ity_F128);
2931 case Iop_F64toF128: UNARY(Ity_F64, Ity_F128);
2932
2933 case Iop_F128toF32: BINARY(ity_RMode,Ity_F128, Ity_F32);
2934 case Iop_F128toF64: BINARY(ity_RMode,Ity_F128, Ity_F64);
2935
sewardj26217b02012-04-12 17:19:48 +00002936 case Iop_D32toD64:
florian6dd9f272012-12-19 04:19:54 +00002937 UNARY(Ity_D32, Ity_D64);
2938
sewardjcdc376d2012-04-23 11:21:12 +00002939 case Iop_ExtractExpD64:
carllcea07cc2013-01-22 20:25:31 +00002940 UNARY(Ity_D64, Ity_I64);
sewardj26217b02012-04-12 17:19:48 +00002941
florian4bbd3ec2012-12-27 20:01:13 +00002942 case Iop_ExtractSigD64:
2943 UNARY(Ity_D64, Ity_I64);
2944
sewardjcdc376d2012-04-23 11:21:12 +00002945 case Iop_InsertExpD64:
carllcea07cc2013-01-22 20:25:31 +00002946 BINARY(Ity_I64,Ity_D64, Ity_D64);
sewardjcdc376d2012-04-23 11:21:12 +00002947
2948 case Iop_ExtractExpD128:
carllcea07cc2013-01-22 20:25:31 +00002949 UNARY(Ity_D128, Ity_I64);
sewardjcdc376d2012-04-23 11:21:12 +00002950
carllcea07cc2013-01-22 20:25:31 +00002951 case Iop_ExtractSigD128:
florian4bbd3ec2012-12-27 20:01:13 +00002952 UNARY(Ity_D128, Ity_I64);
2953
sewardjcdc376d2012-04-23 11:21:12 +00002954 case Iop_InsertExpD128:
carllcea07cc2013-01-22 20:25:31 +00002955 BINARY(Ity_I64,Ity_D128, Ity_D128);
sewardjcdc376d2012-04-23 11:21:12 +00002956
sewardj26217b02012-04-12 17:19:48 +00002957 case Iop_D64toD128:
2958 UNARY(Ity_D64, Ity_D128);
2959
sewardj5eff1c52012-04-29 20:19:17 +00002960 case Iop_ReinterpD64asI64:
2961 UNARY(Ity_D64, Ity_I64);
2962
sewardjcdc376d2012-04-23 11:21:12 +00002963 case Iop_ReinterpI64asD64:
2964 UNARY(Ity_I64, Ity_D64);
2965
2966 case Iop_RoundD64toInt:
2967 BINARY(ity_RMode,Ity_D64, Ity_D64);
2968
2969 case Iop_RoundD128toInt:
2970 BINARY(ity_RMode,Ity_D128, Ity_D128);
2971
florianb17e16f2013-01-12 22:02:07 +00002972 case Iop_I32StoD128:
2973 case Iop_I32UtoD128:
2974 UNARY(Ity_I32, Ity_D128);
2975
carllcea07cc2013-01-22 20:25:31 +00002976 case Iop_I64StoD128:
2977 UNARY(Ity_I64, Ity_D128);
sewardj26217b02012-04-12 17:19:48 +00002978
florianb17e16f2013-01-12 22:02:07 +00002979 case Iop_I64UtoD128:
2980 UNARY(Ity_I64, Ity_D128);
2981
sewardj4c96e612012-06-02 23:47:02 +00002982 case Iop_DPBtoBCD:
2983 case Iop_BCDtoDPB:
2984 UNARY(Ity_I64, Ity_I64);
2985
sewardjc6bbd472012-04-02 10:20:48 +00002986 case Iop_D128HItoD64:
2987 case Iop_D128LOtoD64:
2988 UNARY(Ity_D128, Ity_D64);
2989
sewardj26217b02012-04-12 17:19:48 +00002990 case Iop_D128toI64S:
carllcea07cc2013-01-22 20:25:31 +00002991 BINARY(ity_RMode, Ity_D128, Ity_I64);
sewardj26217b02012-04-12 17:19:48 +00002992
florianb17e16f2013-01-12 22:02:07 +00002993 case Iop_D128toI64U:
2994 BINARY(ity_RMode, Ity_D128, Ity_I64);
2995
2996 case Iop_D128toI32S:
2997 case Iop_D128toI32U:
2998 BINARY(ity_RMode, Ity_D128, Ity_I32);
2999
sewardjc6bbd472012-04-02 10:20:48 +00003000 case Iop_D64HLtoD128:
sewardj26217b02012-04-12 17:19:48 +00003001 BINARY(Ity_D64, Ity_D64, Ity_D128);
3002
3003 case Iop_ShlD64:
3004 case Iop_ShrD64:
3005 BINARY(Ity_D64, Ity_I8, Ity_D64 );
3006
florian6dd9f272012-12-19 04:19:54 +00003007 case Iop_D64toD32:
3008 BINARY(ity_RMode, Ity_D64, Ity_D32);
3009
florianb17e16f2013-01-12 22:02:07 +00003010 case Iop_D64toI32S:
3011 case Iop_D64toI32U:
3012 BINARY(ity_RMode, Ity_D64, Ity_I32);
3013
sewardj26217b02012-04-12 17:19:48 +00003014 case Iop_D64toI64S:
carllcea07cc2013-01-22 20:25:31 +00003015 BINARY(ity_RMode, Ity_D64, Ity_I64);
sewardj26217b02012-04-12 17:19:48 +00003016
florianb17e16f2013-01-12 22:02:07 +00003017 case Iop_D64toI64U:
3018 BINARY(ity_RMode, Ity_D64, Ity_I64);
3019
3020 case Iop_I32StoD64:
3021 case Iop_I32UtoD64:
3022 UNARY(Ity_I32, Ity_D64);
3023
carllcea07cc2013-01-22 20:25:31 +00003024 case Iop_I64StoD64:
3025 BINARY(ity_RMode, Ity_I64, Ity_D64);
sewardj26217b02012-04-12 17:19:48 +00003026
florianb17e16f2013-01-12 22:02:07 +00003027 case Iop_I64UtoD64:
3028 BINARY(ity_RMode, Ity_I64, Ity_D64);
3029
florianb22838d2013-06-17 18:59:51 +00003030 case Iop_F32toD32:
3031 BINARY(ity_RMode, Ity_F32, Ity_D32);
3032
3033 case Iop_F32toD64:
3034 BINARY(ity_RMode, Ity_F32, Ity_D64);
3035
3036 case Iop_F32toD128:
3037 BINARY(ity_RMode, Ity_F32, Ity_D128);
3038
3039 case Iop_F64toD32:
3040 BINARY(ity_RMode, Ity_F64, Ity_D32);
3041
florian37c57f32013-05-05 15:04:30 +00003042 case Iop_F64toD64:
3043 BINARY(ity_RMode, Ity_F64, Ity_D64);
3044
florian37c57f32013-05-05 15:04:30 +00003045 case Iop_F64toD128:
3046 BINARY(ity_RMode, Ity_F64, Ity_D128);
3047
florianb22838d2013-06-17 18:59:51 +00003048 case Iop_F128toD32:
3049 BINARY(ity_RMode, Ity_F128, Ity_D32);
3050
3051 case Iop_F128toD64:
3052 BINARY(ity_RMode, Ity_F128, Ity_D64);
florian37c57f32013-05-05 15:04:30 +00003053
3054 case Iop_F128toD128:
3055 BINARY(ity_RMode, Ity_F128, Ity_D128);
3056
florianb22838d2013-06-17 18:59:51 +00003057 case Iop_D32toF32:
3058 BINARY(ity_RMode, Ity_D32, Ity_F32);
3059
3060 case Iop_D32toF64:
3061 BINARY(ity_RMode, Ity_D32, Ity_F64);
3062
3063 case Iop_D32toF128:
3064 BINARY(ity_RMode, Ity_D32, Ity_F128);
3065
3066 case Iop_D64toF32:
3067 BINARY(ity_RMode, Ity_D64, Ity_F32);
3068
3069 case Iop_D64toF64:
3070 BINARY(ity_RMode, Ity_D64, Ity_F64);
3071
3072 case Iop_D64toF128:
3073 BINARY(ity_RMode, Ity_D64, Ity_F128);
3074
3075 case Iop_D128toF32:
3076 BINARY(ity_RMode, Ity_D128, Ity_F32);
3077
3078 case Iop_D128toF64:
3079 BINARY(ity_RMode, Ity_D128, Ity_F64);
3080
florian37c57f32013-05-05 15:04:30 +00003081 case Iop_D128toF128:
3082 BINARY(ity_RMode, Ity_D128, Ity_F128);
3083
sewardjcdc376d2012-04-23 11:21:12 +00003084 case Iop_CmpD64:
florian20c6bca2012-12-26 17:47:19 +00003085 case Iop_CmpExpD64:
sewardjcdc376d2012-04-23 11:21:12 +00003086 BINARY(Ity_D64,Ity_D64, Ity_I32);
3087
3088 case Iop_CmpD128:
florian20c6bca2012-12-26 17:47:19 +00003089 case Iop_CmpExpD128:
sewardjcdc376d2012-04-23 11:21:12 +00003090 BINARY(Ity_D128,Ity_D128, Ity_I32);
3091
3092 case Iop_QuantizeD64:
sewardjcdc376d2012-04-23 11:21:12 +00003093 TERNARY(ity_RMode,Ity_D64,Ity_D64, Ity_D64);
3094
carllcea07cc2013-01-22 20:25:31 +00003095 case Iop_SignificanceRoundD64:
3096 TERNARY(ity_RMode, Ity_I8,Ity_D64, Ity_D64);
3097
sewardjcdc376d2012-04-23 11:21:12 +00003098 case Iop_QuantizeD128:
sewardjcdc376d2012-04-23 11:21:12 +00003099 TERNARY(ity_RMode,Ity_D128,Ity_D128, Ity_D128);
3100
carllcea07cc2013-01-22 20:25:31 +00003101 case Iop_SignificanceRoundD128:
3102 TERNARY(ity_RMode, Ity_I8,Ity_D128, Ity_D128);
3103
sewardj26217b02012-04-12 17:19:48 +00003104 case Iop_ShlD128:
3105 case Iop_ShrD128:
3106 BINARY(Ity_D128, Ity_I8, Ity_D128 );
sewardjc6bbd472012-04-02 10:20:48 +00003107
3108 case Iop_AddD64:
3109 case Iop_SubD64:
3110 case Iop_MulD64:
3111 case Iop_DivD64:
3112 TERNARY( ity_RMode, Ity_D64, Ity_D64, Ity_D64 );
3113
sewardj26217b02012-04-12 17:19:48 +00003114 case Iop_D128toD64:
3115 BINARY( ity_RMode, Ity_D128, Ity_D64 );
3116
sewardjc6bbd472012-04-02 10:20:48 +00003117 case Iop_AddD128:
3118 case Iop_SubD128:
3119 case Iop_MulD128:
3120 case Iop_DivD128:
3121 TERNARY(ity_RMode,Ity_D128,Ity_D128, Ity_D128);
3122
sewardjc4530ae2012-05-21 10:18:49 +00003123 case Iop_V256to64_0: case Iop_V256to64_1:
3124 case Iop_V256to64_2: case Iop_V256to64_3:
3125 UNARY(Ity_V256, Ity_I64);
3126
3127 case Iop_64x4toV256:
3128 QUATERNARY(Ity_I64, Ity_I64, Ity_I64, Ity_I64, Ity_V256);
3129
sewardj2a2bda92012-06-14 23:32:02 +00003130 case Iop_Add64Fx4: case Iop_Sub64Fx4:
3131 case Iop_Mul64Fx4: case Iop_Div64Fx4:
3132 case Iop_Add32Fx8: case Iop_Sub32Fx8:
3133 case Iop_Mul32Fx8: case Iop_Div32Fx8:
3134 case Iop_AndV256: case Iop_OrV256:
sewardj4b1cc832012-06-13 11:10:20 +00003135 case Iop_XorV256:
sewardj8eb7ae82012-06-24 14:00:27 +00003136 case Iop_Max32Fx8: case Iop_Min32Fx8:
3137 case Iop_Max64Fx4: case Iop_Min64Fx4:
sewardjcc3d2192013-03-27 11:37:33 +00003138 case Iop_Add8x32: case Iop_Add16x16:
3139 case Iop_Add32x8: case Iop_Add64x4:
3140 case Iop_Sub8x32: case Iop_Sub16x16:
3141 case Iop_Sub32x8: case Iop_Sub64x4:
3142 case Iop_Mul16x16: case Iop_Mul32x8:
3143 case Iop_MulHi16Ux16: case Iop_MulHi16Sx16:
3144 case Iop_Avg8Ux32: case Iop_Avg16Ux16:
3145 case Iop_Max8Sx32: case Iop_Max16Sx16: case Iop_Max32Sx8:
3146 case Iop_Max8Ux32: case Iop_Max16Ux16: case Iop_Max32Ux8:
3147 case Iop_Min8Sx32: case Iop_Min16Sx16: case Iop_Min32Sx8:
3148 case Iop_Min8Ux32: case Iop_Min16Ux16: case Iop_Min32Ux8:
3149 case Iop_CmpEQ8x32: case Iop_CmpEQ16x16:
3150 case Iop_CmpEQ32x8: case Iop_CmpEQ64x4:
3151 case Iop_CmpGT8Sx32: case Iop_CmpGT16Sx16:
3152 case Iop_CmpGT32Sx8: case Iop_CmpGT64Sx4:
3153 case Iop_QAdd8Ux32: case Iop_QAdd16Ux16:
3154 case Iop_QAdd8Sx32: case Iop_QAdd16Sx16:
3155 case Iop_QSub8Ux32: case Iop_QSub16Ux16:
3156 case Iop_QSub8Sx32: case Iop_QSub16Sx16:
3157 case Iop_Perm32x8:
sewardj56c30312012-06-12 08:45:39 +00003158 BINARY(Ity_V256,Ity_V256, Ity_V256);
3159
sewardj4b1cc832012-06-13 11:10:20 +00003160 case Iop_V256toV128_1: case Iop_V256toV128_0:
3161 UNARY(Ity_V256, Ity_V128);
3162
3163 case Iop_V128HLtoV256:
3164 BINARY(Ity_V128,Ity_V128, Ity_V256);
3165
sewardj2a2bda92012-06-14 23:32:02 +00003166 case Iop_NotV256:
sewardj66becf32012-06-18 23:15:16 +00003167 case Iop_RSqrt32Fx8:
3168 case Iop_Sqrt32Fx8:
3169 case Iop_Sqrt64Fx4:
sewardj82096922012-06-24 14:57:59 +00003170 case Iop_Recip32Fx8:
sewardjcc3d2192013-03-27 11:37:33 +00003171 case Iop_CmpNEZ8x32: case Iop_CmpNEZ16x16:
sewardj23db8a02012-06-25 07:46:18 +00003172 case Iop_CmpNEZ64x4: case Iop_CmpNEZ32x8:
sewardj2a2bda92012-06-14 23:32:02 +00003173 UNARY(Ity_V256, Ity_V256);
3174
sewardjcc3d2192013-03-27 11:37:33 +00003175 case Iop_ShlN16x16: case Iop_ShlN32x8:
3176 case Iop_ShlN64x4:
3177 case Iop_ShrN16x16: case Iop_ShrN32x8:
3178 case Iop_ShrN64x4:
3179 case Iop_SarN16x16: case Iop_SarN32x8:
3180 BINARY(Ity_V256,Ity_I8, Ity_V256);
3181
sewardj6efd4a12004-07-15 03:54:23 +00003182 default:
3183 ppIROp(op);
3184 vpanic("typeOfPrimop");
3185 }
3186# undef UNARY
3187# undef BINARY
sewardjb183b852006-02-03 16:08:03 +00003188# undef TERNARY
sewardj6efd4a12004-07-15 03:54:23 +00003189# undef COMPARISON
sewardj0033ddc2005-04-26 23:34:34 +00003190# undef UNARY_COMPARISON
sewardj6efd4a12004-07-15 03:54:23 +00003191}
3192
3193
3194/*---------------------------------------------------------------*/
sewardj695cff92004-10-13 14:50:14 +00003195/*--- Helper functions for the IR -- IR Basic Blocks ---*/
sewardjc97096c2004-06-30 09:28:04 +00003196/*---------------------------------------------------------------*/
3197
sewardjdd40fdf2006-12-24 02:20:24 +00003198void addStmtToIRSB ( IRSB* bb, IRStmt* st )
sewardjd7cb8532004-08-17 23:59:23 +00003199{
3200 Int i;
sewardj695cff92004-10-13 14:50:14 +00003201 if (bb->stmts_used == bb->stmts_size) {
3202 IRStmt** stmts2 = LibVEX_Alloc(2 * bb->stmts_size * sizeof(IRStmt*));
3203 for (i = 0; i < bb->stmts_size; i++)
3204 stmts2[i] = bb->stmts[i];
3205 bb->stmts = stmts2;
3206 bb->stmts_size *= 2;
3207 }
3208 vassert(bb->stmts_used < bb->stmts_size);
3209 bb->stmts[bb->stmts_used] = st;
3210 bb->stmts_used++;
sewardjd7cb8532004-08-17 23:59:23 +00003211}
3212
sewardj695cff92004-10-13 14:50:14 +00003213
3214/*---------------------------------------------------------------*/
3215/*--- Helper functions for the IR -- IR Type Environments ---*/
3216/*---------------------------------------------------------------*/
3217
sewardjd7cb8532004-08-17 23:59:23 +00003218/* Allocate a new IRTemp, given its type. */
sewardje3d0d2e2004-06-27 10:42:44 +00003219
sewardje539a402004-07-14 18:24:17 +00003220IRTemp newIRTemp ( IRTypeEnv* env, IRType ty )
sewardjc97096c2004-06-30 09:28:04 +00003221{
sewardj35421a32004-07-05 13:12:34 +00003222 vassert(env);
sewardje539a402004-07-14 18:24:17 +00003223 vassert(env->types_used >= 0);
3224 vassert(env->types_size >= 0);
3225 vassert(env->types_used <= env->types_size);
3226 if (env->types_used < env->types_size) {
3227 env->types[env->types_used] = ty;
3228 return env->types_used++;
sewardjc97096c2004-06-30 09:28:04 +00003229 } else {
3230 Int i;
sewardje539a402004-07-14 18:24:17 +00003231 Int new_size = env->types_size==0 ? 8 : 2*env->types_size;
3232 IRType* new_types
3233 = LibVEX_Alloc(new_size * sizeof(IRType));
3234 for (i = 0; i < env->types_used; i++)
3235 new_types[i] = env->types[i];
3236 env->types = new_types;
3237 env->types_size = new_size;
3238 return newIRTemp(env, ty);
sewardjc97096c2004-06-30 09:28:04 +00003239 }
3240}
3241
3242
sewardj17442fe2004-09-20 14:54:28 +00003243/*---------------------------------------------------------------*/
3244/*--- Helper functions for the IR -- finding types of exprs ---*/
3245/*---------------------------------------------------------------*/
3246
sewardjedeb4c42004-09-21 23:39:25 +00003247inline
sewardj17442fe2004-09-20 14:54:28 +00003248IRType typeOfIRTemp ( IRTypeEnv* env, IRTemp tmp )
sewardjc97096c2004-06-30 09:28:04 +00003249{
sewardje539a402004-07-14 18:24:17 +00003250 vassert(tmp >= 0);
3251 vassert(tmp < env->types_used);
3252 return env->types[tmp];
sewardjc97096c2004-06-30 09:28:04 +00003253}
3254
sewardj6efd4a12004-07-15 03:54:23 +00003255IRType typeOfIRConst ( IRConst* con )
3256{
3257 switch (con->tag) {
sewardjba999312004-11-15 15:21:17 +00003258 case Ico_U1: return Ity_I1;
sewardj207557a2004-08-27 12:00:18 +00003259 case Ico_U8: return Ity_I8;
3260 case Ico_U16: return Ity_I16;
3261 case Ico_U32: return Ity_I32;
3262 case Ico_U64: return Ity_I64;
sewardj2019a972011-03-07 16:04:07 +00003263 case Ico_F32: return Ity_F32;
3264 case Ico_F32i: return Ity_F32;
sewardj207557a2004-08-27 12:00:18 +00003265 case Ico_F64: return Ity_F64;
sewardj17442fe2004-09-20 14:54:28 +00003266 case Ico_F64i: return Ity_F64;
sewardj1e6ad742004-12-02 16:16:11 +00003267 case Ico_V128: return Ity_V128;
sewardj37a505b2012-06-29 15:28:24 +00003268 case Ico_V256: return Ity_V256;
sewardj6efd4a12004-07-15 03:54:23 +00003269 default: vpanic("typeOfIRConst");
3270 }
3271}
3272
sewardjcfe046e2013-01-17 14:23:53 +00003273void typeOfIRLoadGOp ( IRLoadGOp cvt,
3274 /*OUT*/IRType* t_res, /*OUT*/IRType* t_arg )
3275{
3276 switch (cvt) {
3277 case ILGop_Ident32:
3278 *t_res = Ity_I32; *t_arg = Ity_I32; break;
3279 case ILGop_16Uto32: case ILGop_16Sto32:
3280 *t_res = Ity_I32; *t_arg = Ity_I16; break;
3281 case ILGop_8Uto32: case ILGop_8Sto32:
3282 *t_res = Ity_I32; *t_arg = Ity_I8; break;
3283 default:
3284 vpanic("typeOfIRLoadGOp");
3285 }
3286}
3287
sewardjc97096c2004-06-30 09:28:04 +00003288IRType typeOfIRExpr ( IRTypeEnv* tyenv, IRExpr* e )
3289{
sewardj40c80262006-02-08 19:30:46 +00003290 IRType t_dst, t_arg1, t_arg2, t_arg3, t_arg4;
sewardjedeb4c42004-09-21 23:39:25 +00003291 start:
sewardjc97096c2004-06-30 09:28:04 +00003292 switch (e->tag) {
sewardjaf1ceca2005-06-30 23:31:27 +00003293 case Iex_Load:
3294 return e->Iex.Load.ty;
sewardjfbcaf332004-07-08 01:46:01 +00003295 case Iex_Get:
3296 return e->Iex.Get.ty;
sewardjbb53f8c2004-08-14 11:50:01 +00003297 case Iex_GetI:
sewardj2d3f77c2004-09-22 23:49:09 +00003298 return e->Iex.GetI.descr->elemTy;
sewardjdd40fdf2006-12-24 02:20:24 +00003299 case Iex_RdTmp:
3300 return typeOfIRTemp(tyenv, e->Iex.RdTmp.tmp);
sewardjc97096c2004-06-30 09:28:04 +00003301 case Iex_Const:
sewardj695cff92004-10-13 14:50:14 +00003302 return typeOfIRConst(e->Iex.Const.con);
sewardj40c80262006-02-08 19:30:46 +00003303 case Iex_Qop:
florian96d7cc32012-06-01 20:41:24 +00003304 typeOfPrimop(e->Iex.Qop.details->op,
sewardj40c80262006-02-08 19:30:46 +00003305 &t_dst, &t_arg1, &t_arg2, &t_arg3, &t_arg4);
3306 return t_dst;
sewardjb183b852006-02-03 16:08:03 +00003307 case Iex_Triop:
florian420bfa92012-06-02 20:29:22 +00003308 typeOfPrimop(e->Iex.Triop.details->op,
sewardj40c80262006-02-08 19:30:46 +00003309 &t_dst, &t_arg1, &t_arg2, &t_arg3, &t_arg4);
sewardjb183b852006-02-03 16:08:03 +00003310 return t_dst;
sewardjc97096c2004-06-30 09:28:04 +00003311 case Iex_Binop:
sewardj40c80262006-02-08 19:30:46 +00003312 typeOfPrimop(e->Iex.Binop.op,
3313 &t_dst, &t_arg1, &t_arg2, &t_arg3, &t_arg4);
sewardj6efd4a12004-07-15 03:54:23 +00003314 return t_dst;
3315 case Iex_Unop:
sewardj40c80262006-02-08 19:30:46 +00003316 typeOfPrimop(e->Iex.Unop.op,
3317 &t_dst, &t_arg1, &t_arg2, &t_arg3, &t_arg4);
sewardj6efd4a12004-07-15 03:54:23 +00003318 return t_dst;
3319 case Iex_CCall:
3320 return e->Iex.CCall.retty;
florian99dd03e2013-01-29 03:56:06 +00003321 case Iex_ITE:
3322 e = e->Iex.ITE.iffalse;
sewardjedeb4c42004-09-21 23:39:25 +00003323 goto start;
florian99dd03e2013-01-29 03:56:06 +00003324 /* return typeOfIRExpr(tyenv, e->Iex.ITE.iffalse); */
sewardj443cd9d2004-07-18 23:06:45 +00003325 case Iex_Binder:
3326 vpanic("typeOfIRExpr: Binder is not a valid expression");
sewardjc97096c2004-06-30 09:28:04 +00003327 default:
sewardj6efd4a12004-07-15 03:54:23 +00003328 ppIRExpr(e);
3329 vpanic("typeOfIRExpr");
sewardjc97096c2004-06-30 09:28:04 +00003330 }
sewardjc97096c2004-06-30 09:28:04 +00003331}
sewardj887a11a2004-07-05 17:26:47 +00003332
sewardj6d2638e2004-07-15 09:38:27 +00003333/* Is this any value actually in the enumeration 'IRType' ? */
sewardj496a58d2005-03-20 18:44:44 +00003334Bool isPlausibleIRType ( IRType ty )
sewardj6d2638e2004-07-15 09:38:27 +00003335{
3336 switch (ty) {
sewardjba999312004-11-15 15:21:17 +00003337 case Ity_INVALID: case Ity_I1:
sewardj9b967672005-02-08 11:13:09 +00003338 case Ity_I8: case Ity_I16: case Ity_I32:
3339 case Ity_I64: case Ity_I128:
sewardj2019a972011-03-07 16:04:07 +00003340 case Ity_F32: case Ity_F64: case Ity_F128:
sewardjc6bbd472012-04-02 10:20:48 +00003341 case Ity_D32: case Ity_D64: case Ity_D128:
sewardjc4530ae2012-05-21 10:18:49 +00003342 case Ity_V128: case Ity_V256:
sewardj6d2638e2004-07-15 09:38:27 +00003343 return True;
3344 default:
3345 return False;
3346 }
3347}
3348
sewardj6efd4a12004-07-15 03:54:23 +00003349
sewardj887a11a2004-07-05 17:26:47 +00003350/*---------------------------------------------------------------*/
sewardjcf787902004-11-03 09:08:33 +00003351/*--- Sanity checking -- FLATNESS ---*/
3352/*---------------------------------------------------------------*/
3353
3354/* Check that the canonical flatness constraints hold on an
3355 IRStmt. The only place where any expression is allowed to be
3356 non-atomic is the RHS of IRStmt_Tmp. */
3357
3358/* Relies on:
3359 inline static Bool isAtom ( IRExpr* e ) {
sewardjdd40fdf2006-12-24 02:20:24 +00003360 return e->tag == Iex_RdTmp || e->tag == Iex_Const;
sewardjcf787902004-11-03 09:08:33 +00003361 }
3362*/
3363
3364Bool isFlatIRStmt ( IRStmt* st )
3365{
3366 Int i;
3367 IRExpr* e;
3368 IRDirty* di;
sewardje9d8a262009-07-01 08:06:34 +00003369 IRCAS* cas;
floriand6f38b32012-05-31 15:46:18 +00003370 IRPutI* puti;
florian96d7cc32012-06-01 20:41:24 +00003371 IRQop* qop;
florian420bfa92012-06-02 20:29:22 +00003372 IRTriop* triop;
sewardjcf787902004-11-03 09:08:33 +00003373
3374 switch (st->tag) {
sewardj5a9ffab2005-05-12 17:55:01 +00003375 case Ist_AbiHint:
sewardj478646f2008-05-01 20:13:04 +00003376 return isIRAtom(st->Ist.AbiHint.base)
3377 && isIRAtom(st->Ist.AbiHint.nia);
sewardjcf787902004-11-03 09:08:33 +00003378 case Ist_Put:
sewardj496a58d2005-03-20 18:44:44 +00003379 return isIRAtom(st->Ist.Put.data);
sewardjcf787902004-11-03 09:08:33 +00003380 case Ist_PutI:
floriand6f38b32012-05-31 15:46:18 +00003381 puti = st->Ist.PutI.details;
3382 return toBool( isIRAtom(puti->ix)
3383 && isIRAtom(puti->data) );
sewardjdd40fdf2006-12-24 02:20:24 +00003384 case Ist_WrTmp:
sewardjcf787902004-11-03 09:08:33 +00003385 /* This is the only interesting case. The RHS can be any
3386 expression, *but* all its subexpressions *must* be
3387 atoms. */
sewardjdd40fdf2006-12-24 02:20:24 +00003388 e = st->Ist.WrTmp.data;
sewardjcf787902004-11-03 09:08:33 +00003389 switch (e->tag) {
3390 case Iex_Binder: return True;
3391 case Iex_Get: return True;
sewardj496a58d2005-03-20 18:44:44 +00003392 case Iex_GetI: return isIRAtom(e->Iex.GetI.ix);
sewardjdd40fdf2006-12-24 02:20:24 +00003393 case Iex_RdTmp: return True;
florian96d7cc32012-06-01 20:41:24 +00003394 case Iex_Qop: qop = e->Iex.Qop.details;
3395 return toBool(
3396 isIRAtom(qop->arg1)
3397 && isIRAtom(qop->arg2)
3398 && isIRAtom(qop->arg3)
3399 && isIRAtom(qop->arg4));
florian420bfa92012-06-02 20:29:22 +00003400 case Iex_Triop: triop = e->Iex.Triop.details;
3401 return toBool(
3402 isIRAtom(triop->arg1)
3403 && isIRAtom(triop->arg2)
3404 && isIRAtom(triop->arg3));
sewardja98bf492005-02-07 01:39:17 +00003405 case Iex_Binop: return toBool(
sewardj496a58d2005-03-20 18:44:44 +00003406 isIRAtom(e->Iex.Binop.arg1)
3407 && isIRAtom(e->Iex.Binop.arg2));
3408 case Iex_Unop: return isIRAtom(e->Iex.Unop.arg);
sewardjaf1ceca2005-06-30 23:31:27 +00003409 case Iex_Load: return isIRAtom(e->Iex.Load.addr);
sewardjcf787902004-11-03 09:08:33 +00003410 case Iex_Const: return True;
3411 case Iex_CCall: for (i = 0; e->Iex.CCall.args[i]; i++)
sewardj496a58d2005-03-20 18:44:44 +00003412 if (!isIRAtom(e->Iex.CCall.args[i]))
sewardjcf787902004-11-03 09:08:33 +00003413 return False;
3414 return True;
florian99dd03e2013-01-29 03:56:06 +00003415 case Iex_ITE: return toBool (
3416 isIRAtom(e->Iex.ITE.cond)
3417 && isIRAtom(e->Iex.ITE.iftrue)
3418 && isIRAtom(e->Iex.ITE.iffalse));
sewardjcf787902004-11-03 09:08:33 +00003419 default: vpanic("isFlatIRStmt(e)");
3420 }
3421 /*notreached*/
3422 vassert(0);
sewardjaf1ceca2005-06-30 23:31:27 +00003423 case Ist_Store:
3424 return toBool( isIRAtom(st->Ist.Store.addr)
3425 && isIRAtom(st->Ist.Store.data) );
sewardjcfe046e2013-01-17 14:23:53 +00003426 case Ist_StoreG: {
3427 IRStoreG* sg = st->Ist.StoreG.details;
3428 return toBool( isIRAtom(sg->addr)
3429 && isIRAtom(sg->data) && isIRAtom(sg->guard) );
3430 }
3431 case Ist_LoadG: {
3432 IRLoadG* lg = st->Ist.LoadG.details;
3433 return toBool( isIRAtom(lg->addr)
3434 && isIRAtom(lg->alt) && isIRAtom(lg->guard) );
3435 }
sewardje9d8a262009-07-01 08:06:34 +00003436 case Ist_CAS:
3437 cas = st->Ist.CAS.details;
3438 return toBool( isIRAtom(cas->addr)
3439 && (cas->expdHi ? isIRAtom(cas->expdHi) : True)
3440 && isIRAtom(cas->expdLo)
3441 && (cas->dataHi ? isIRAtom(cas->dataHi) : True)
3442 && isIRAtom(cas->dataLo) );
sewardje768e922009-11-26 17:17:37 +00003443 case Ist_LLSC:
3444 return toBool( isIRAtom(st->Ist.LLSC.addr)
3445 && (st->Ist.LLSC.storedata
3446 ? isIRAtom(st->Ist.LLSC.storedata) : True) );
sewardjcf787902004-11-03 09:08:33 +00003447 case Ist_Dirty:
3448 di = st->Ist.Dirty.details;
sewardj496a58d2005-03-20 18:44:44 +00003449 if (!isIRAtom(di->guard))
sewardjcf787902004-11-03 09:08:33 +00003450 return False;
3451 for (i = 0; di->args[i]; i++)
sewardj496a58d2005-03-20 18:44:44 +00003452 if (!isIRAtom(di->args[i]))
sewardjcf787902004-11-03 09:08:33 +00003453 return False;
sewardj496a58d2005-03-20 18:44:44 +00003454 if (di->mAddr && !isIRAtom(di->mAddr))
sewardjcf787902004-11-03 09:08:33 +00003455 return False;
3456 return True;
sewardjd2445f62005-03-21 00:15:53 +00003457 case Ist_NoOp:
sewardjf1689312005-03-16 18:19:10 +00003458 case Ist_IMark:
sewardjc4356f02007-11-09 21:15:04 +00003459 case Ist_MBE:
sewardj3e838932005-01-07 12:09:15 +00003460 return True;
sewardjcf787902004-11-03 09:08:33 +00003461 case Ist_Exit:
sewardj496a58d2005-03-20 18:44:44 +00003462 return isIRAtom(st->Ist.Exit.guard);
sewardjcf787902004-11-03 09:08:33 +00003463 default:
3464 vpanic("isFlatIRStmt(st)");
3465 }
3466}
3467
3468
3469/*---------------------------------------------------------------*/
sewardje539a402004-07-14 18:24:17 +00003470/*--- Sanity checking ---*/
3471/*---------------------------------------------------------------*/
3472
3473/* Checks:
3474
3475 Everything is type-consistent. No ill-typed anything.
sewardj35439212004-07-14 22:36:10 +00003476 The target address at the end of the BB is a 32- or 64-
3477 bit expression, depending on the guest's word size.
sewardje539a402004-07-14 18:24:17 +00003478
3479 Each temp is assigned only once, before its uses.
sewardjc13e2ed2004-10-31 21:44:54 +00003480*/
3481
3482static inline Int countArgs ( IRExpr** args )
3483{
3484 Int i;
3485 for (i = 0; args[i]; i++)
3486 ;
3487 return i;
3488}
sewardje539a402004-07-14 18:24:17 +00003489
sewardj35439212004-07-14 22:36:10 +00003490static
3491__attribute((noreturn))
florian1ff47562012-10-21 02:09:51 +00003492void sanityCheckFail ( IRSB* bb, IRStmt* stmt, const HChar* what )
sewardje539a402004-07-14 18:24:17 +00003493{
sewardj35439212004-07-14 22:36:10 +00003494 vex_printf("\nIR SANITY CHECK FAILURE\n\n");
sewardjdd40fdf2006-12-24 02:20:24 +00003495 ppIRSB(bb);
sewardj35439212004-07-14 22:36:10 +00003496 if (stmt) {
3497 vex_printf("\nIN STATEMENT:\n\n");
3498 ppIRStmt(stmt);
3499 }
3500 vex_printf("\n\nERROR = %s\n\n", what );
3501 vpanic("sanityCheckFail: exiting due to bad IR");
3502}
3503
sewardjdd40fdf2006-12-24 02:20:24 +00003504static Bool saneIRRegArray ( IRRegArray* arr )
sewardj2d3f77c2004-09-22 23:49:09 +00003505{
3506 if (arr->base < 0 || arr->base > 10000 /* somewhat arbitrary */)
3507 return False;
sewardjba999312004-11-15 15:21:17 +00003508 if (arr->elemTy == Ity_I1)
sewardj2d3f77c2004-09-22 23:49:09 +00003509 return False;
3510 if (arr->nElems <= 0 || arr->nElems > 500 /* somewhat arbitrary */)
3511 return False;
3512 return True;
3513}
3514
sewardj8ea867b2004-10-30 19:03:02 +00003515static Bool saneIRCallee ( IRCallee* cee )
3516{
3517 if (cee->name == NULL)
3518 return False;
3519 if (cee->addr == 0)
3520 return False;
sewardj77352542004-10-30 20:39:01 +00003521 if (cee->regparms < 0 || cee->regparms > 3)
sewardj8ea867b2004-10-30 19:03:02 +00003522 return False;
3523 return True;
3524}
3525
sewardj49bfe672004-11-15 15:46:26 +00003526static Bool saneIRConst ( IRConst* con )
3527{
3528 switch (con->tag) {
3529 case Ico_U1:
sewardja98bf492005-02-07 01:39:17 +00003530 return toBool( con->Ico.U1 == True || con->Ico.U1 == False );
sewardj49bfe672004-11-15 15:46:26 +00003531 default:
3532 /* Is there anything we can meaningfully check? I don't
3533 think so. */
3534 return True;
3535 }
3536}
sewardj35439212004-07-14 22:36:10 +00003537
3538/* Traverse a Stmt/Expr, inspecting IRTemp uses. Report any out of
3539 range ones. Report any which are read and for which the current
3540 def_count is zero. */
3541
3542static
sewardjdd40fdf2006-12-24 02:20:24 +00003543void useBeforeDef_Temp ( IRSB* bb, IRStmt* stmt, IRTemp tmp, Int* def_counts )
sewardj17442fe2004-09-20 14:54:28 +00003544{
3545 if (tmp < 0 || tmp >= bb->tyenv->types_used)
3546 sanityCheckFail(bb,stmt, "out of range Temp in IRExpr");
3547 if (def_counts[tmp] < 1)
3548 sanityCheckFail(bb,stmt, "IRTemp use before def in IRExpr");
3549}
3550
3551static
sewardjdd40fdf2006-12-24 02:20:24 +00003552void useBeforeDef_Expr ( IRSB* bb, IRStmt* stmt, IRExpr* expr, Int* def_counts )
sewardj35439212004-07-14 22:36:10 +00003553{
3554 Int i;
3555 switch (expr->tag) {
3556 case Iex_Get:
3557 break;
sewardjbb53f8c2004-08-14 11:50:01 +00003558 case Iex_GetI:
sewardjeeac8412004-11-02 00:26:55 +00003559 useBeforeDef_Expr(bb,stmt,expr->Iex.GetI.ix,def_counts);
sewardjbb53f8c2004-08-14 11:50:01 +00003560 break;
sewardjdd40fdf2006-12-24 02:20:24 +00003561 case Iex_RdTmp:
3562 useBeforeDef_Temp(bb,stmt,expr->Iex.RdTmp.tmp,def_counts);
sewardj35439212004-07-14 22:36:10 +00003563 break;
florian96d7cc32012-06-01 20:41:24 +00003564 case Iex_Qop: {
3565 IRQop* qop = expr->Iex.Qop.details;
3566 useBeforeDef_Expr(bb,stmt,qop->arg1,def_counts);
3567 useBeforeDef_Expr(bb,stmt,qop->arg2,def_counts);
3568 useBeforeDef_Expr(bb,stmt,qop->arg3,def_counts);
3569 useBeforeDef_Expr(bb,stmt,qop->arg4,def_counts);
sewardj40c80262006-02-08 19:30:46 +00003570 break;
florian96d7cc32012-06-01 20:41:24 +00003571 }
florian420bfa92012-06-02 20:29:22 +00003572 case Iex_Triop: {
3573 IRTriop* triop = expr->Iex.Triop.details;
3574 useBeforeDef_Expr(bb,stmt,triop->arg1,def_counts);
3575 useBeforeDef_Expr(bb,stmt,triop->arg2,def_counts);
3576 useBeforeDef_Expr(bb,stmt,triop->arg3,def_counts);
sewardjb183b852006-02-03 16:08:03 +00003577 break;
florian420bfa92012-06-02 20:29:22 +00003578 }
sewardj35439212004-07-14 22:36:10 +00003579 case Iex_Binop:
3580 useBeforeDef_Expr(bb,stmt,expr->Iex.Binop.arg1,def_counts);
3581 useBeforeDef_Expr(bb,stmt,expr->Iex.Binop.arg2,def_counts);
3582 break;
3583 case Iex_Unop:
3584 useBeforeDef_Expr(bb,stmt,expr->Iex.Unop.arg,def_counts);
3585 break;
sewardjaf1ceca2005-06-30 23:31:27 +00003586 case Iex_Load:
3587 useBeforeDef_Expr(bb,stmt,expr->Iex.Load.addr,def_counts);
sewardj35439212004-07-14 22:36:10 +00003588 break;
3589 case Iex_Const:
3590 break;
3591 case Iex_CCall:
3592 for (i = 0; expr->Iex.CCall.args[i]; i++)
3593 useBeforeDef_Expr(bb,stmt,expr->Iex.CCall.args[i],def_counts);
3594 break;
florian99dd03e2013-01-29 03:56:06 +00003595 case Iex_ITE:
3596 useBeforeDef_Expr(bb,stmt,expr->Iex.ITE.cond,def_counts);
3597 useBeforeDef_Expr(bb,stmt,expr->Iex.ITE.iftrue,def_counts);
3598 useBeforeDef_Expr(bb,stmt,expr->Iex.ITE.iffalse,def_counts);
sewardjeeb9ef82004-07-15 12:39:03 +00003599 break;
3600 default:
3601 vpanic("useBeforeDef_Expr");
sewardj35439212004-07-14 22:36:10 +00003602 }
3603}
3604
3605static
sewardjdd40fdf2006-12-24 02:20:24 +00003606void useBeforeDef_Stmt ( IRSB* bb, IRStmt* stmt, Int* def_counts )
sewardj35439212004-07-14 22:36:10 +00003607{
sewardjcfe046e2013-01-17 14:23:53 +00003608 Int i;
3609 IRDirty* d;
3610 IRCAS* cas;
3611 IRPutI* puti;
3612 IRLoadG* lg;
3613 IRStoreG* sg;
sewardj35439212004-07-14 22:36:10 +00003614 switch (stmt->tag) {
sewardjf1689312005-03-16 18:19:10 +00003615 case Ist_IMark:
3616 break;
sewardj5a9ffab2005-05-12 17:55:01 +00003617 case Ist_AbiHint:
3618 useBeforeDef_Expr(bb,stmt,stmt->Ist.AbiHint.base,def_counts);
sewardj478646f2008-05-01 20:13:04 +00003619 useBeforeDef_Expr(bb,stmt,stmt->Ist.AbiHint.nia,def_counts);
sewardj5a9ffab2005-05-12 17:55:01 +00003620 break;
sewardj35439212004-07-14 22:36:10 +00003621 case Ist_Put:
sewardj6d076362004-09-23 11:06:17 +00003622 useBeforeDef_Expr(bb,stmt,stmt->Ist.Put.data,def_counts);
sewardj35439212004-07-14 22:36:10 +00003623 break;
sewardjd1725d12004-08-12 20:46:53 +00003624 case Ist_PutI:
floriand6f38b32012-05-31 15:46:18 +00003625 puti = stmt->Ist.PutI.details;
3626 useBeforeDef_Expr(bb,stmt,puti->ix,def_counts);
3627 useBeforeDef_Expr(bb,stmt,puti->data,def_counts);
sewardjd1725d12004-08-12 20:46:53 +00003628 break;
sewardjdd40fdf2006-12-24 02:20:24 +00003629 case Ist_WrTmp:
3630 useBeforeDef_Expr(bb,stmt,stmt->Ist.WrTmp.data,def_counts);
sewardj35439212004-07-14 22:36:10 +00003631 break;
sewardjaf1ceca2005-06-30 23:31:27 +00003632 case Ist_Store:
3633 useBeforeDef_Expr(bb,stmt,stmt->Ist.Store.addr,def_counts);
3634 useBeforeDef_Expr(bb,stmt,stmt->Ist.Store.data,def_counts);
sewardj35439212004-07-14 22:36:10 +00003635 break;
sewardjcfe046e2013-01-17 14:23:53 +00003636 case Ist_StoreG:
3637 sg = stmt->Ist.StoreG.details;
3638 useBeforeDef_Expr(bb,stmt,sg->addr,def_counts);
3639 useBeforeDef_Expr(bb,stmt,sg->data,def_counts);
3640 useBeforeDef_Expr(bb,stmt,sg->guard,def_counts);
3641 break;
3642 case Ist_LoadG:
3643 lg = stmt->Ist.LoadG.details;
3644 useBeforeDef_Expr(bb,stmt,lg->addr,def_counts);
3645 useBeforeDef_Expr(bb,stmt,lg->alt,def_counts);
3646 useBeforeDef_Expr(bb,stmt,lg->guard,def_counts);
3647 break;
sewardje9d8a262009-07-01 08:06:34 +00003648 case Ist_CAS:
3649 cas = stmt->Ist.CAS.details;
3650 useBeforeDef_Expr(bb,stmt,cas->addr,def_counts);
3651 if (cas->expdHi)
3652 useBeforeDef_Expr(bb,stmt,cas->expdHi,def_counts);
3653 useBeforeDef_Expr(bb,stmt,cas->expdLo,def_counts);
3654 if (cas->dataHi)
3655 useBeforeDef_Expr(bb,stmt,cas->dataHi,def_counts);
3656 useBeforeDef_Expr(bb,stmt,cas->dataLo,def_counts);
3657 break;
sewardje768e922009-11-26 17:17:37 +00003658 case Ist_LLSC:
3659 useBeforeDef_Expr(bb,stmt,stmt->Ist.LLSC.addr,def_counts);
3660 if (stmt->Ist.LLSC.storedata != NULL)
3661 useBeforeDef_Expr(bb,stmt,stmt->Ist.LLSC.storedata,def_counts);
3662 break;
sewardj17442fe2004-09-20 14:54:28 +00003663 case Ist_Dirty:
3664 d = stmt->Ist.Dirty.details;
3665 for (i = 0; d->args[i] != NULL; i++)
3666 useBeforeDef_Expr(bb,stmt,d->args[i],def_counts);
3667 if (d->mFx != Ifx_None)
3668 useBeforeDef_Expr(bb,stmt,d->mAddr,def_counts);
3669 break;
sewardjd2445f62005-03-21 00:15:53 +00003670 case Ist_NoOp:
sewardjc4356f02007-11-09 21:15:04 +00003671 case Ist_MBE:
sewardj3e838932005-01-07 12:09:15 +00003672 break;
sewardj35439212004-07-14 22:36:10 +00003673 case Ist_Exit:
sewardj0276d4b2004-11-15 15:30:21 +00003674 useBeforeDef_Expr(bb,stmt,stmt->Ist.Exit.guard,def_counts);
sewardj35439212004-07-14 22:36:10 +00003675 break;
3676 default:
3677 vpanic("useBeforeDef_Stmt");
3678 }
3679}
3680
sewardj6efd4a12004-07-15 03:54:23 +00003681static
sewardjdd40fdf2006-12-24 02:20:24 +00003682void tcExpr ( IRSB* bb, IRStmt* stmt, IRExpr* expr, IRType gWordTy )
sewardj6efd4a12004-07-15 03:54:23 +00003683{
3684 Int i;
sewardj40c80262006-02-08 19:30:46 +00003685 IRType t_dst, t_arg1, t_arg2, t_arg3, t_arg4;
sewardj6efd4a12004-07-15 03:54:23 +00003686 IRTypeEnv* tyenv = bb->tyenv;
3687 switch (expr->tag) {
3688 case Iex_Get:
sewardjdd40fdf2006-12-24 02:20:24 +00003689 case Iex_RdTmp:
sewardj6efd4a12004-07-15 03:54:23 +00003690 break;
sewardjbb53f8c2004-08-14 11:50:01 +00003691 case Iex_GetI:
sewardjeeac8412004-11-02 00:26:55 +00003692 tcExpr(bb,stmt, expr->Iex.GetI.ix, gWordTy );
3693 if (typeOfIRExpr(tyenv,expr->Iex.GetI.ix) != Ity_I32)
3694 sanityCheckFail(bb,stmt,"IRExpr.GetI.ix: not :: Ity_I32");
sewardjdd40fdf2006-12-24 02:20:24 +00003695 if (!saneIRRegArray(expr->Iex.GetI.descr))
sewardj2d3f77c2004-09-22 23:49:09 +00003696 sanityCheckFail(bb,stmt,"IRExpr.GetI.descr: invalid descr");
sewardjbb53f8c2004-08-14 11:50:01 +00003697 break;
sewardj40c80262006-02-08 19:30:46 +00003698 case Iex_Qop: {
3699 IRType ttarg1, ttarg2, ttarg3, ttarg4;
florian96d7cc32012-06-01 20:41:24 +00003700 IRQop* qop = expr->Iex.Qop.details;
3701 tcExpr(bb,stmt, qop->arg1, gWordTy );
3702 tcExpr(bb,stmt, qop->arg2, gWordTy );
3703 tcExpr(bb,stmt, qop->arg3, gWordTy );
3704 tcExpr(bb,stmt, qop->arg4, gWordTy );
3705 typeOfPrimop(qop->op,
sewardj40c80262006-02-08 19:30:46 +00003706 &t_dst, &t_arg1, &t_arg2, &t_arg3, &t_arg4);
3707 if (t_arg1 == Ity_INVALID || t_arg2 == Ity_INVALID
3708 || t_arg3 == Ity_INVALID || t_arg4 == Ity_INVALID) {
3709 vex_printf(" op name: " );
florian96d7cc32012-06-01 20:41:24 +00003710 ppIROp(qop->op);
sewardj40c80262006-02-08 19:30:46 +00003711 vex_printf("\n");
3712 sanityCheckFail(bb,stmt,
3713 "Iex.Qop: wrong arity op\n"
3714 "... name of op precedes BB printout\n");
3715 }
florian96d7cc32012-06-01 20:41:24 +00003716 ttarg1 = typeOfIRExpr(tyenv, qop->arg1);
3717 ttarg2 = typeOfIRExpr(tyenv, qop->arg2);
3718 ttarg3 = typeOfIRExpr(tyenv, qop->arg3);
3719 ttarg4 = typeOfIRExpr(tyenv, qop->arg4);
sewardj40c80262006-02-08 19:30:46 +00003720 if (t_arg1 != ttarg1 || t_arg2 != ttarg2
3721 || t_arg3 != ttarg3 || t_arg4 != ttarg4) {
3722 vex_printf(" op name: ");
florian96d7cc32012-06-01 20:41:24 +00003723 ppIROp(qop->op);
sewardj40c80262006-02-08 19:30:46 +00003724 vex_printf("\n");
3725 vex_printf(" op type is (");
3726 ppIRType(t_arg1);
3727 vex_printf(",");
3728 ppIRType(t_arg2);
3729 vex_printf(",");
3730 ppIRType(t_arg3);
3731 vex_printf(",");
3732 ppIRType(t_arg4);
3733 vex_printf(") -> ");
3734 ppIRType (t_dst);
3735 vex_printf("\narg tys are (");
3736 ppIRType(ttarg1);
3737 vex_printf(",");
3738 ppIRType(ttarg2);
3739 vex_printf(",");
3740 ppIRType(ttarg3);
3741 vex_printf(",");
3742 ppIRType(ttarg4);
3743 vex_printf(")\n");
3744 sanityCheckFail(bb,stmt,
3745 "Iex.Qop: arg tys don't match op tys\n"
3746 "... additional details precede BB printout\n");
3747 }
3748 break;
3749 }
sewardjb183b852006-02-03 16:08:03 +00003750 case Iex_Triop: {
3751 IRType ttarg1, ttarg2, ttarg3;
florian420bfa92012-06-02 20:29:22 +00003752 IRTriop *triop = expr->Iex.Triop.details;
3753 tcExpr(bb,stmt, triop->arg1, gWordTy );
3754 tcExpr(bb,stmt, triop->arg2, gWordTy );
3755 tcExpr(bb,stmt, triop->arg3, gWordTy );
3756 typeOfPrimop(triop->op,
sewardj40c80262006-02-08 19:30:46 +00003757 &t_dst, &t_arg1, &t_arg2, &t_arg3, &t_arg4);
sewardjb183b852006-02-03 16:08:03 +00003758 if (t_arg1 == Ity_INVALID || t_arg2 == Ity_INVALID
sewardj40c80262006-02-08 19:30:46 +00003759 || t_arg3 == Ity_INVALID || t_arg4 != Ity_INVALID) {
sewardjb183b852006-02-03 16:08:03 +00003760 vex_printf(" op name: " );
florian420bfa92012-06-02 20:29:22 +00003761 ppIROp(triop->op);
sewardjb183b852006-02-03 16:08:03 +00003762 vex_printf("\n");
3763 sanityCheckFail(bb,stmt,
3764 "Iex.Triop: wrong arity op\n"
3765 "... name of op precedes BB printout\n");
3766 }
florian420bfa92012-06-02 20:29:22 +00003767 ttarg1 = typeOfIRExpr(tyenv, triop->arg1);
3768 ttarg2 = typeOfIRExpr(tyenv, triop->arg2);
3769 ttarg3 = typeOfIRExpr(tyenv, triop->arg3);
sewardjb183b852006-02-03 16:08:03 +00003770 if (t_arg1 != ttarg1 || t_arg2 != ttarg2 || t_arg3 != ttarg3) {
3771 vex_printf(" op name: ");
florian420bfa92012-06-02 20:29:22 +00003772 ppIROp(triop->op);
sewardjb183b852006-02-03 16:08:03 +00003773 vex_printf("\n");
3774 vex_printf(" op type is (");
3775 ppIRType(t_arg1);
3776 vex_printf(",");
3777 ppIRType(t_arg2);
3778 vex_printf(",");
3779 ppIRType(t_arg3);
3780 vex_printf(") -> ");
3781 ppIRType (t_dst);
3782 vex_printf("\narg tys are (");
3783 ppIRType(ttarg1);
3784 vex_printf(",");
3785 ppIRType(ttarg2);
3786 vex_printf(",");
3787 ppIRType(ttarg3);
3788 vex_printf(")\n");
3789 sanityCheckFail(bb,stmt,
3790 "Iex.Triop: arg tys don't match op tys\n"
3791 "... additional details precede BB printout\n");
3792 }
3793 break;
3794 }
sewardj6d2638e2004-07-15 09:38:27 +00003795 case Iex_Binop: {
3796 IRType ttarg1, ttarg2;
sewardj6efd4a12004-07-15 03:54:23 +00003797 tcExpr(bb,stmt, expr->Iex.Binop.arg1, gWordTy );
3798 tcExpr(bb,stmt, expr->Iex.Binop.arg2, gWordTy );
sewardj40c80262006-02-08 19:30:46 +00003799 typeOfPrimop(expr->Iex.Binop.op,
3800 &t_dst, &t_arg1, &t_arg2, &t_arg3, &t_arg4);
sewardjb183b852006-02-03 16:08:03 +00003801 if (t_arg1 == Ity_INVALID || t_arg2 == Ity_INVALID
sewardj40c80262006-02-08 19:30:46 +00003802 || t_arg3 != Ity_INVALID || t_arg4 != Ity_INVALID) {
sewardj8f3debf2004-09-08 23:42:23 +00003803 vex_printf(" op name: " );
3804 ppIROp(expr->Iex.Binop.op);
3805 vex_printf("\n");
3806 sanityCheckFail(bb,stmt,
3807 "Iex.Binop: wrong arity op\n"
3808 "... name of op precedes BB printout\n");
3809 }
sewardj6d2638e2004-07-15 09:38:27 +00003810 ttarg1 = typeOfIRExpr(tyenv, expr->Iex.Binop.arg1);
3811 ttarg2 = typeOfIRExpr(tyenv, expr->Iex.Binop.arg2);
3812 if (t_arg1 != ttarg1 || t_arg2 != ttarg2) {
3813 vex_printf(" op name: ");
3814 ppIROp(expr->Iex.Binop.op);
3815 vex_printf("\n");
3816 vex_printf(" op type is (");
3817 ppIRType(t_arg1);
3818 vex_printf(",");
3819 ppIRType(t_arg2);
3820 vex_printf(") -> ");
3821 ppIRType (t_dst);
3822 vex_printf("\narg tys are (");
3823 ppIRType(ttarg1);
3824 vex_printf(",");
3825 ppIRType(ttarg2);
3826 vex_printf(")\n");
3827 sanityCheckFail(bb,stmt,
3828 "Iex.Binop: arg tys don't match op tys\n"
3829 "... additional details precede BB printout\n");
sewardj695cff92004-10-13 14:50:14 +00003830 }
sewardj6efd4a12004-07-15 03:54:23 +00003831 break;
sewardj6d2638e2004-07-15 09:38:27 +00003832 }
sewardj6efd4a12004-07-15 03:54:23 +00003833 case Iex_Unop:
3834 tcExpr(bb,stmt, expr->Iex.Unop.arg, gWordTy );
floriana60e8432012-08-16 00:11:20 +00003835 typeOfPrimop(expr->Iex.Unop.op,
sewardj40c80262006-02-08 19:30:46 +00003836 &t_dst, &t_arg1, &t_arg2, &t_arg3, &t_arg4);
sewardjb183b852006-02-03 16:08:03 +00003837 if (t_arg1 == Ity_INVALID || t_arg2 != Ity_INVALID
sewardj40c80262006-02-08 19:30:46 +00003838 || t_arg3 != Ity_INVALID || t_arg4 != Ity_INVALID)
sewardj6efd4a12004-07-15 03:54:23 +00003839 sanityCheckFail(bb,stmt,"Iex.Unop: wrong arity op");
3840 if (t_arg1 != typeOfIRExpr(tyenv, expr->Iex.Unop.arg))
3841 sanityCheckFail(bb,stmt,"Iex.Unop: arg ty doesn't match op ty");
3842 break;
sewardjaf1ceca2005-06-30 23:31:27 +00003843 case Iex_Load:
3844 tcExpr(bb,stmt, expr->Iex.Load.addr, gWordTy);
3845 if (typeOfIRExpr(tyenv, expr->Iex.Load.addr) != gWordTy)
3846 sanityCheckFail(bb,stmt,"Iex.Load.addr: not :: guest word type");
3847 if (expr->Iex.Load.end != Iend_LE && expr->Iex.Load.end != Iend_BE)
3848 sanityCheckFail(bb,stmt,"Iex.Load.end: bogus endianness");
sewardj6efd4a12004-07-15 03:54:23 +00003849 break;
3850 case Iex_CCall:
sewardjc13e2ed2004-10-31 21:44:54 +00003851 if (!saneIRCallee(expr->Iex.CCall.cee))
3852 sanityCheckFail(bb,stmt,"Iex.CCall.cee: bad IRCallee");
sewardjcf787902004-11-03 09:08:33 +00003853 if (expr->Iex.CCall.cee->regparms > countArgs(expr->Iex.CCall.args))
sewardjc13e2ed2004-10-31 21:44:54 +00003854 sanityCheckFail(bb,stmt,"Iex.CCall.cee: #regparms > #args");
sewardj43c56462004-11-06 12:17:57 +00003855 for (i = 0; expr->Iex.CCall.args[i]; i++) {
3856 if (i >= 32)
3857 sanityCheckFail(bb,stmt,"Iex.CCall: > 32 args");
sewardj6efd4a12004-07-15 03:54:23 +00003858 tcExpr(bb,stmt, expr->Iex.CCall.args[i], gWordTy);
sewardj43c56462004-11-06 12:17:57 +00003859 }
sewardjba999312004-11-15 15:21:17 +00003860 if (expr->Iex.CCall.retty == Ity_I1)
3861 sanityCheckFail(bb,stmt,"Iex.CCall.retty: cannot return :: Ity_I1");
sewardj6efd4a12004-07-15 03:54:23 +00003862 for (i = 0; expr->Iex.CCall.args[i]; i++)
sewardjba999312004-11-15 15:21:17 +00003863 if (typeOfIRExpr(tyenv, expr->Iex.CCall.args[i]) == Ity_I1)
3864 sanityCheckFail(bb,stmt,"Iex.CCall.arg: arg :: Ity_I1");
sewardj6efd4a12004-07-15 03:54:23 +00003865 break;
3866 case Iex_Const:
sewardj49bfe672004-11-15 15:46:26 +00003867 if (!saneIRConst(expr->Iex.Const.con))
3868 sanityCheckFail(bb,stmt,"Iex.Const.con: invalid const");
sewardj6efd4a12004-07-15 03:54:23 +00003869 break;
florian99dd03e2013-01-29 03:56:06 +00003870 case Iex_ITE:
3871 tcExpr(bb,stmt, expr->Iex.ITE.cond, gWordTy);
3872 tcExpr(bb,stmt, expr->Iex.ITE.iftrue, gWordTy);
3873 tcExpr(bb,stmt, expr->Iex.ITE.iffalse, gWordTy);
3874 if (typeOfIRExpr(tyenv, expr->Iex.ITE.cond) != Ity_I1)
3875 sanityCheckFail(bb,stmt,"Iex.ITE.cond: cond :: Ity_I1");
3876 if (typeOfIRExpr(tyenv, expr->Iex.ITE.iftrue)
3877 != typeOfIRExpr(tyenv, expr->Iex.ITE.iffalse))
3878 sanityCheckFail(bb,stmt,"Iex.ITE: iftrue/iffalse mismatch");
sewardjeeb9ef82004-07-15 12:39:03 +00003879 break;
3880 default:
sewardj6efd4a12004-07-15 03:54:23 +00003881 vpanic("tcExpr");
3882 }
3883}
3884
3885
3886static
sewardjdd40fdf2006-12-24 02:20:24 +00003887void tcStmt ( IRSB* bb, IRStmt* stmt, IRType gWordTy )
sewardj6efd4a12004-07-15 03:54:23 +00003888{
sewardj17442fe2004-09-20 14:54:28 +00003889 Int i;
3890 IRDirty* d;
sewardje9d8a262009-07-01 08:06:34 +00003891 IRCAS* cas;
floriand6f38b32012-05-31 15:46:18 +00003892 IRPutI* puti;
sewardje9d8a262009-07-01 08:06:34 +00003893 IRType tyExpd, tyData;
sewardj6efd4a12004-07-15 03:54:23 +00003894 IRTypeEnv* tyenv = bb->tyenv;
3895 switch (stmt->tag) {
sewardjf1689312005-03-16 18:19:10 +00003896 case Ist_IMark:
3897 /* Somewhat heuristic, but rule out totally implausible
sewardj2f10aa62011-05-27 13:20:56 +00003898 instruction sizes and deltas. */
sewardjf1689312005-03-16 18:19:10 +00003899 if (stmt->Ist.IMark.len < 0 || stmt->Ist.IMark.len > 20)
3900 sanityCheckFail(bb,stmt,"IRStmt.IMark.len: implausible");
sewardj2f10aa62011-05-27 13:20:56 +00003901 if (stmt->Ist.IMark.delta > 1)
3902 sanityCheckFail(bb,stmt,"IRStmt.IMark.delta: implausible");
sewardjf1689312005-03-16 18:19:10 +00003903 break;
sewardj5a9ffab2005-05-12 17:55:01 +00003904 case Ist_AbiHint:
3905 if (typeOfIRExpr(tyenv, stmt->Ist.AbiHint.base) != gWordTy)
3906 sanityCheckFail(bb,stmt,"IRStmt.AbiHint.base: "
3907 "not :: guest word type");
sewardj478646f2008-05-01 20:13:04 +00003908 if (typeOfIRExpr(tyenv, stmt->Ist.AbiHint.nia) != gWordTy)
3909 sanityCheckFail(bb,stmt,"IRStmt.AbiHint.nia: "
3910 "not :: guest word type");
sewardj5a9ffab2005-05-12 17:55:01 +00003911 break;
sewardj6efd4a12004-07-15 03:54:23 +00003912 case Ist_Put:
sewardj6d076362004-09-23 11:06:17 +00003913 tcExpr( bb, stmt, stmt->Ist.Put.data, gWordTy );
sewardjba999312004-11-15 15:21:17 +00003914 if (typeOfIRExpr(tyenv,stmt->Ist.Put.data) == Ity_I1)
3915 sanityCheckFail(bb,stmt,"IRStmt.Put.data: cannot Put :: Ity_I1");
sewardj2d3f77c2004-09-22 23:49:09 +00003916 break;
sewardjd1725d12004-08-12 20:46:53 +00003917 case Ist_PutI:
floriand6f38b32012-05-31 15:46:18 +00003918 puti = stmt->Ist.PutI.details;
3919 tcExpr( bb, stmt, puti->data, gWordTy );
3920 tcExpr( bb, stmt, puti->ix, gWordTy );
3921 if (typeOfIRExpr(tyenv,puti->data) == Ity_I1)
sewardjba999312004-11-15 15:21:17 +00003922 sanityCheckFail(bb,stmt,"IRStmt.PutI.data: cannot PutI :: Ity_I1");
floriand6f38b32012-05-31 15:46:18 +00003923 if (typeOfIRExpr(tyenv,puti->data)
3924 != puti->descr->elemTy)
sewardj6d076362004-09-23 11:06:17 +00003925 sanityCheckFail(bb,stmt,"IRStmt.PutI.data: data ty != elem ty");
floriand6f38b32012-05-31 15:46:18 +00003926 if (typeOfIRExpr(tyenv,puti->ix) != Ity_I32)
sewardjeeac8412004-11-02 00:26:55 +00003927 sanityCheckFail(bb,stmt,"IRStmt.PutI.ix: not :: Ity_I32");
floriand6f38b32012-05-31 15:46:18 +00003928 if (!saneIRRegArray(puti->descr))
sewardj2d3f77c2004-09-22 23:49:09 +00003929 sanityCheckFail(bb,stmt,"IRStmt.PutI.descr: invalid descr");
3930 break;
sewardjdd40fdf2006-12-24 02:20:24 +00003931 case Ist_WrTmp:
3932 tcExpr( bb, stmt, stmt->Ist.WrTmp.data, gWordTy );
3933 if (typeOfIRTemp(tyenv, stmt->Ist.WrTmp.tmp)
3934 != typeOfIRExpr(tyenv, stmt->Ist.WrTmp.data))
sewardjcfe046e2013-01-17 14:23:53 +00003935 sanityCheckFail(bb,stmt,
3936 "IRStmt.Put.Tmp: tmp and expr do not match");
sewardj6efd4a12004-07-15 03:54:23 +00003937 break;
sewardjaf1ceca2005-06-30 23:31:27 +00003938 case Ist_Store:
3939 tcExpr( bb, stmt, stmt->Ist.Store.addr, gWordTy );
3940 tcExpr( bb, stmt, stmt->Ist.Store.data, gWordTy );
3941 if (typeOfIRExpr(tyenv, stmt->Ist.Store.addr) != gWordTy)
sewardjcfe046e2013-01-17 14:23:53 +00003942 sanityCheckFail(bb,stmt,
3943 "IRStmt.Store.addr: not :: guest word type");
sewardjaf1ceca2005-06-30 23:31:27 +00003944 if (typeOfIRExpr(tyenv, stmt->Ist.Store.data) == Ity_I1)
sewardjcfe046e2013-01-17 14:23:53 +00003945 sanityCheckFail(bb,stmt,
3946 "IRStmt.Store.data: cannot Store :: Ity_I1");
sewardjaf1ceca2005-06-30 23:31:27 +00003947 if (stmt->Ist.Store.end != Iend_LE && stmt->Ist.Store.end != Iend_BE)
3948 sanityCheckFail(bb,stmt,"Ist.Store.end: bogus endianness");
sewardje9d8a262009-07-01 08:06:34 +00003949 break;
sewardjcfe046e2013-01-17 14:23:53 +00003950 case Ist_StoreG: {
3951 IRStoreG* sg = stmt->Ist.StoreG.details;
3952 tcExpr( bb, stmt, sg->addr, gWordTy );
3953 tcExpr( bb, stmt, sg->data, gWordTy );
3954 tcExpr( bb, stmt, sg->guard, gWordTy );
3955 if (typeOfIRExpr(tyenv, sg->addr) != gWordTy)
3956 sanityCheckFail(bb,stmt,"IRStmtG...addr: not :: guest word type");
3957 if (typeOfIRExpr(tyenv, sg->data) == Ity_I1)
3958 sanityCheckFail(bb,stmt,"IRStmtG...data: cannot Store :: Ity_I1");
3959 if (typeOfIRExpr(tyenv, sg->guard) != Ity_I1)
3960 sanityCheckFail(bb,stmt,"IRStmtG...guard: not :: Ity_I1");
3961 if (sg->end != Iend_LE && sg->end != Iend_BE)
3962 sanityCheckFail(bb,stmt,"IRStmtG...end: bogus endianness");
3963 break;
3964 }
3965 case Ist_LoadG: {
3966 IRLoadG* lg = stmt->Ist.LoadG.details;
3967 tcExpr( bb, stmt, lg->addr, gWordTy );
3968 tcExpr( bb, stmt, lg->alt, gWordTy );
3969 tcExpr( bb, stmt, lg->guard, gWordTy );
3970 if (typeOfIRExpr(tyenv, lg->guard) != Ity_I1)
3971 sanityCheckFail(bb,stmt,"IRStmt.LoadG.guard: not :: Ity_I1");
3972 if (typeOfIRExpr(tyenv, lg->addr) != gWordTy)
3973 sanityCheckFail(bb,stmt,"IRStmt.LoadG.addr: not "
3974 ":: guest word type");
3975 if (typeOfIRExpr(tyenv, lg->alt) != typeOfIRTemp(tyenv, lg->dst))
3976 sanityCheckFail(bb,stmt,"IRStmt.LoadG: dst/alt type mismatch");
3977 IRTemp cvtRes = Ity_INVALID, cvtArg = Ity_INVALID;
3978 typeOfIRLoadGOp(lg->cvt, &cvtRes, &cvtArg);
3979 if (cvtRes != typeOfIRTemp(tyenv, lg->dst))
3980 sanityCheckFail(bb,stmt,"IRStmt.LoadG: dst/loaded type mismatch");
3981 break;
3982 }
sewardje9d8a262009-07-01 08:06:34 +00003983 case Ist_CAS:
3984 cas = stmt->Ist.CAS.details;
3985 /* make sure it's definitely either a CAS or a DCAS */
3986 if (cas->oldHi == IRTemp_INVALID
3987 && cas->expdHi == NULL && cas->dataHi == NULL) {
3988 /* fine; it's a single cas */
3989 }
3990 else
3991 if (cas->oldHi != IRTemp_INVALID
3992 && cas->expdHi != NULL && cas->dataHi != NULL) {
3993 /* fine; it's a double cas */
3994 }
3995 else {
3996 /* it's some el-mutanto hybrid */
3997 goto bad_cas;
3998 }
3999 /* check the address type */
4000 tcExpr( bb, stmt, cas->addr, gWordTy );
4001 if (typeOfIRExpr(tyenv, cas->addr) != gWordTy) goto bad_cas;
4002 /* check types on the {old,expd,data}Lo components agree */
4003 tyExpd = typeOfIRExpr(tyenv, cas->expdLo);
4004 tyData = typeOfIRExpr(tyenv, cas->dataLo);
4005 if (tyExpd != tyData) goto bad_cas;
4006 if (tyExpd != typeOfIRTemp(tyenv, cas->oldLo))
4007 goto bad_cas;
4008 /* check the base element type is sane */
4009 if (tyExpd == Ity_I8 || tyExpd == Ity_I16 || tyExpd == Ity_I32
4010 || (gWordTy == Ity_I64 && tyExpd == Ity_I64)) {
4011 /* fine */
4012 } else {
4013 goto bad_cas;
4014 }
4015 /* If it's a DCAS, check types on the {old,expd,data}Hi
4016 components too */
4017 if (cas->oldHi != IRTemp_INVALID) {
4018 tyExpd = typeOfIRExpr(tyenv, cas->expdHi);
4019 tyData = typeOfIRExpr(tyenv, cas->dataHi);
4020 if (tyExpd != tyData) goto bad_cas;
4021 if (tyExpd != typeOfIRTemp(tyenv, cas->oldHi))
4022 goto bad_cas;
4023 /* and finally check that oldLo and oldHi have the same
4024 type. This forces equivalence amongst all 6 types. */
4025 if (typeOfIRTemp(tyenv, cas->oldHi)
4026 != typeOfIRTemp(tyenv, cas->oldLo))
4027 goto bad_cas;
4028 }
4029 break;
4030 bad_cas:
4031 sanityCheckFail(bb,stmt,"IRStmt.CAS: ill-formed");
sewardj6efd4a12004-07-15 03:54:23 +00004032 break;
sewardje768e922009-11-26 17:17:37 +00004033 case Ist_LLSC: {
4034 IRType tyRes;
4035 if (typeOfIRExpr(tyenv, stmt->Ist.LLSC.addr) != gWordTy)
4036 sanityCheckFail(bb,stmt,"IRStmt.LLSC.addr: not :: guest word type");
4037 if (stmt->Ist.LLSC.end != Iend_LE && stmt->Ist.LLSC.end != Iend_BE)
4038 sanityCheckFail(bb,stmt,"Ist.LLSC.end: bogus endianness");
4039 tyRes = typeOfIRTemp(tyenv, stmt->Ist.LLSC.result);
4040 if (stmt->Ist.LLSC.storedata == NULL) {
4041 /* it's a LL */
sewardjff7f5b72011-07-11 11:43:38 +00004042 if (tyRes != Ity_I64 && tyRes != Ity_I32
4043 && tyRes != Ity_I16 && tyRes != Ity_I8)
sewardje768e922009-11-26 17:17:37 +00004044 sanityCheckFail(bb,stmt,"Ist.LLSC(LL).result :: bogus");
4045 } else {
4046 /* it's a SC */
4047 if (tyRes != Ity_I1)
4048 sanityCheckFail(bb,stmt,"Ist.LLSC(SC).result: not :: Ity_I1");
4049 tyData = typeOfIRExpr(tyenv, stmt->Ist.LLSC.storedata);
sewardjff7f5b72011-07-11 11:43:38 +00004050 if (tyData != Ity_I64 && tyData != Ity_I32
4051 && tyData != Ity_I16 && tyData != Ity_I8)
sewardj6c299f32009-12-31 18:00:12 +00004052 sanityCheckFail(bb,stmt,
4053 "Ist.LLSC(SC).result :: storedata bogus");
sewardje768e922009-11-26 17:17:37 +00004054 }
4055 break;
4056 }
sewardj17442fe2004-09-20 14:54:28 +00004057 case Ist_Dirty:
4058 /* Mostly check for various kinds of ill-formed dirty calls. */
4059 d = stmt->Ist.Dirty.details;
sewardj8ea867b2004-10-30 19:03:02 +00004060 if (d->cee == NULL) goto bad_dirty;
4061 if (!saneIRCallee(d->cee)) goto bad_dirty;
sewardjcf787902004-11-03 09:08:33 +00004062 if (d->cee->regparms > countArgs(d->args)) goto bad_dirty;
sewardj17442fe2004-09-20 14:54:28 +00004063 if (d->mFx == Ifx_None) {
4064 if (d->mAddr != NULL || d->mSize != 0)
4065 goto bad_dirty;
4066 } else {
4067 if (d->mAddr == NULL || d->mSize == 0)
4068 goto bad_dirty;
4069 }
4070 if (d->nFxState < 0 || d->nFxState > VEX_N_FXSTATE)
4071 goto bad_dirty;
sewardjc5fc7aa2004-10-27 23:00:55 +00004072 if (d->nFxState == 0 && d->needsBBP)
4073 goto bad_dirty;
sewardj17442fe2004-09-20 14:54:28 +00004074 for (i = 0; i < d->nFxState; i++) {
4075 if (d->fxState[i].fx == Ifx_None) goto bad_dirty;
4076 if (d->fxState[i].size <= 0) goto bad_dirty;
sewardjc9069f22012-06-01 16:09:50 +00004077 if (d->fxState[i].nRepeats == 0) {
4078 if (d->fxState[i].repeatLen != 0) goto bad_dirty;
4079 } else {
4080 if (d->fxState[i].repeatLen <= d->fxState[i].size)
4081 goto bad_dirty;
4082 /* the % is safe because of the .size check above */
4083 if ((d->fxState[i].repeatLen % d->fxState[i].size) != 0)
4084 goto bad_dirty;
4085 }
sewardj17442fe2004-09-20 14:54:28 +00004086 }
florian44ab8f72012-07-05 22:05:42 +00004087 /* check guard */
sewardjb8385d82004-11-02 01:34:15 +00004088 if (d->guard == NULL) goto bad_dirty;
sewardj49bfe672004-11-15 15:46:26 +00004089 tcExpr( bb, stmt, d->guard, gWordTy );
sewardjba999312004-11-15 15:21:17 +00004090 if (typeOfIRExpr(tyenv, d->guard) != Ity_I1)
4091 sanityCheckFail(bb,stmt,"IRStmt.Dirty.guard not :: Ity_I1");
florian44ab8f72012-07-05 22:05:42 +00004092 /* check types, minimally */
sewardj92d168d2004-11-15 14:22:12 +00004093 if (d->tmp != IRTemp_INVALID
sewardjba999312004-11-15 15:21:17 +00004094 && typeOfIRTemp(tyenv, d->tmp) == Ity_I1)
4095 sanityCheckFail(bb,stmt,"IRStmt.Dirty.dst :: Ity_I1");
sewardj17442fe2004-09-20 14:54:28 +00004096 for (i = 0; d->args[i] != NULL; i++) {
sewardj43c56462004-11-06 12:17:57 +00004097 if (i >= 32)
4098 sanityCheckFail(bb,stmt,"IRStmt.Dirty: > 32 args");
sewardjba999312004-11-15 15:21:17 +00004099 if (typeOfIRExpr(tyenv, d->args[i]) == Ity_I1)
4100 sanityCheckFail(bb,stmt,"IRStmt.Dirty.arg[i] :: Ity_I1");
sewardj17442fe2004-09-20 14:54:28 +00004101 }
4102 break;
4103 bad_dirty:
4104 sanityCheckFail(bb,stmt,"IRStmt.Dirty: ill-formed");
sewardje9d8a262009-07-01 08:06:34 +00004105 break;
sewardjd2445f62005-03-21 00:15:53 +00004106 case Ist_NoOp:
sewardjc4356f02007-11-09 21:15:04 +00004107 break;
4108 case Ist_MBE:
4109 switch (stmt->Ist.MBE.event) {
sewardj6d615ba2011-09-26 16:19:43 +00004110 case Imbe_Fence: case Imbe_CancelReservation:
sewardjc4356f02007-11-09 21:15:04 +00004111 break;
4112 default: sanityCheckFail(bb,stmt,"IRStmt.MBE.event: unknown");
4113 break;
4114 }
sewardj3e838932005-01-07 12:09:15 +00004115 break;
sewardj6efd4a12004-07-15 03:54:23 +00004116 case Ist_Exit:
sewardj0276d4b2004-11-15 15:30:21 +00004117 tcExpr( bb, stmt, stmt->Ist.Exit.guard, gWordTy );
4118 if (typeOfIRExpr(tyenv,stmt->Ist.Exit.guard) != Ity_I1)
4119 sanityCheckFail(bb,stmt,"IRStmt.Exit.guard: not :: Ity_I1");
sewardj49bfe672004-11-15 15:46:26 +00004120 if (!saneIRConst(stmt->Ist.Exit.dst))
4121 sanityCheckFail(bb,stmt,"IRStmt.Exit.dst: bad dst");
sewardj6efd4a12004-07-15 03:54:23 +00004122 if (typeOfIRConst(stmt->Ist.Exit.dst) != gWordTy)
4123 sanityCheckFail(bb,stmt,"IRStmt.Exit.dst: not :: guest word type");
sewardjc6f970f2012-04-02 21:54:49 +00004124 /* because it would intersect with host_EvC_* */
4125 if (stmt->Ist.Exit.offsIP < 16)
4126 sanityCheckFail(bb,stmt,"IRStmt.Exit.offsIP: too low");
sewardj6efd4a12004-07-15 03:54:23 +00004127 break;
4128 default:
4129 vpanic("tcStmt");
4130 }
4131}
4132
florian1ff47562012-10-21 02:09:51 +00004133void sanityCheckIRSB ( IRSB* bb, const HChar* caller,
sewardjb9230752004-12-29 19:25:06 +00004134 Bool require_flat, IRType guest_word_size )
sewardj35439212004-07-14 22:36:10 +00004135{
4136 Int i;
4137 IRStmt* stmt;
4138 Int n_temps = bb->tyenv->types_used;
4139 Int* def_counts = LibVEX_Alloc(n_temps * sizeof(Int));
4140
sewardjb9230752004-12-29 19:25:06 +00004141 if (0)
4142 vex_printf("sanityCheck: %s\n", caller);
4143
sewardj35439212004-07-14 22:36:10 +00004144 vassert(guest_word_size == Ity_I32
sewardj695cff92004-10-13 14:50:14 +00004145 || guest_word_size == Ity_I64);
sewardj35439212004-07-14 22:36:10 +00004146
sewardjd7cb8532004-08-17 23:59:23 +00004147 if (bb->stmts_used < 0 || bb->stmts_size < 8
4148 || bb->stmts_used > bb->stmts_size)
4149 /* this BB is so strange we can't even print it */
sewardjdd40fdf2006-12-24 02:20:24 +00004150 vpanic("sanityCheckIRSB: stmts array limits wierd");
sewardjd7cb8532004-08-17 23:59:23 +00004151
sewardj6d2638e2004-07-15 09:38:27 +00004152 /* Ensure each temp has a plausible type. */
4153 for (i = 0; i < n_temps; i++) {
sewardj17442fe2004-09-20 14:54:28 +00004154 IRType ty = typeOfIRTemp(bb->tyenv,(IRTemp)i);
sewardj496a58d2005-03-20 18:44:44 +00004155 if (!isPlausibleIRType(ty)) {
sewardj6d2638e2004-07-15 09:38:27 +00004156 vex_printf("Temp t%d declared with implausible type 0x%x\n",
4157 i, (UInt)ty);
4158 sanityCheckFail(bb,NULL,"Temp declared with implausible type");
4159 }
4160 }
sewardj35439212004-07-14 22:36:10 +00004161
sewardjb9230752004-12-29 19:25:06 +00004162 /* Check for flatness, if required. */
4163 if (require_flat) {
4164 for (i = 0; i < bb->stmts_used; i++) {
4165 stmt = bb->stmts[i];
4166 if (!stmt)
sewardjd2445f62005-03-21 00:15:53 +00004167 sanityCheckFail(bb, stmt, "IRStmt: is NULL");
sewardjb9230752004-12-29 19:25:06 +00004168 if (!isFlatIRStmt(stmt))
4169 sanityCheckFail(bb, stmt, "IRStmt: is not flat");
4170 }
sewardj496a58d2005-03-20 18:44:44 +00004171 if (!isIRAtom(bb->next))
sewardjb9230752004-12-29 19:25:06 +00004172 sanityCheckFail(bb, NULL, "bb->next is not an atom");
4173 }
4174
sewardj35439212004-07-14 22:36:10 +00004175 /* Count the defs of each temp. Only one def is allowed.
4176 Also, check that each used temp has already been defd. */
sewardj6d2638e2004-07-15 09:38:27 +00004177
4178 for (i = 0; i < n_temps; i++)
4179 def_counts[i] = 0;
4180
sewardjd7cb8532004-08-17 23:59:23 +00004181 for (i = 0; i < bb->stmts_used; i++) {
sewardje9d8a262009-07-01 08:06:34 +00004182 IRDirty* d;
4183 IRCAS* cas;
sewardjcfe046e2013-01-17 14:23:53 +00004184 IRLoadG* lg;
sewardjd7cb8532004-08-17 23:59:23 +00004185 stmt = bb->stmts[i];
sewardje9d8a262009-07-01 08:06:34 +00004186 /* Check any temps used by this statement. */
sewardj35439212004-07-14 22:36:10 +00004187 useBeforeDef_Stmt(bb,stmt,def_counts);
sewardj17442fe2004-09-20 14:54:28 +00004188
sewardje9d8a262009-07-01 08:06:34 +00004189 /* Now make note of any temps defd by this statement. */
4190 switch (stmt->tag) {
4191 case Ist_WrTmp:
sewardjdd40fdf2006-12-24 02:20:24 +00004192 if (stmt->Ist.WrTmp.tmp < 0 || stmt->Ist.WrTmp.tmp >= n_temps)
sewardj17442fe2004-09-20 14:54:28 +00004193 sanityCheckFail(bb, stmt,
4194 "IRStmt.Tmp: destination tmp is out of range");
sewardjdd40fdf2006-12-24 02:20:24 +00004195 def_counts[stmt->Ist.WrTmp.tmp]++;
4196 if (def_counts[stmt->Ist.WrTmp.tmp] > 1)
sewardj17442fe2004-09-20 14:54:28 +00004197 sanityCheckFail(bb, stmt,
sewardjcf787902004-11-03 09:08:33 +00004198 "IRStmt.Tmp: destination tmp is assigned more than once");
sewardje9d8a262009-07-01 08:06:34 +00004199 break;
sewardjcfe046e2013-01-17 14:23:53 +00004200 case Ist_LoadG:
4201 lg = stmt->Ist.LoadG.details;
4202 if (lg->dst < 0 || lg->dst >= n_temps)
4203 sanityCheckFail(bb, stmt,
4204 "IRStmt.LoadG: destination tmp is out of range");
4205 def_counts[lg->dst]++;
4206 if (def_counts[lg->dst] > 1)
4207 sanityCheckFail(bb, stmt,
4208 "IRStmt.LoadG: destination tmp is assigned more than once");
sewardje9d8a262009-07-01 08:06:34 +00004209 break;
4210 case Ist_Dirty:
sewardjcfe046e2013-01-17 14:23:53 +00004211 d = stmt->Ist.Dirty.details;
4212 if (d->tmp != IRTemp_INVALID) {
sewardje9d8a262009-07-01 08:06:34 +00004213 if (d->tmp < 0 || d->tmp >= n_temps)
4214 sanityCheckFail(bb, stmt,
4215 "IRStmt.Dirty: destination tmp is out of range");
4216 def_counts[d->tmp]++;
4217 if (def_counts[d->tmp] > 1)
4218 sanityCheckFail(bb, stmt,
4219 "IRStmt.Dirty: destination tmp is assigned more than once");
4220 }
4221 break;
4222 case Ist_CAS:
4223 cas = stmt->Ist.CAS.details;
sewardje9d8a262009-07-01 08:06:34 +00004224 if (cas->oldHi != IRTemp_INVALID) {
4225 if (cas->oldHi < 0 || cas->oldHi >= n_temps)
4226 sanityCheckFail(bb, stmt,
4227 "IRStmt.CAS: destination tmpHi is out of range");
4228 def_counts[cas->oldHi]++;
4229 if (def_counts[cas->oldHi] > 1)
4230 sanityCheckFail(bb, stmt,
4231 "IRStmt.CAS: destination tmpHi is assigned more than once");
4232 }
4233 if (cas->oldLo < 0 || cas->oldLo >= n_temps)
sewardje768e922009-11-26 17:17:37 +00004234 sanityCheckFail(bb, stmt,
4235 "IRStmt.CAS: destination tmpLo is out of range");
4236 def_counts[cas->oldLo]++;
4237 if (def_counts[cas->oldLo] > 1)
4238 sanityCheckFail(bb, stmt,
4239 "IRStmt.CAS: destination tmpLo is assigned more than once");
4240 break;
4241 case Ist_LLSC:
4242 if (stmt->Ist.LLSC.result < 0 || stmt->Ist.LLSC.result >= n_temps)
4243 sanityCheckFail(bb, stmt,
4244 "IRStmt.LLSC: destination tmp is out of range");
4245 def_counts[stmt->Ist.LLSC.result]++;
4246 if (def_counts[stmt->Ist.LLSC.result] > 1)
4247 sanityCheckFail(bb, stmt,
4248 "IRStmt.LLSC: destination tmp is assigned more than once");
4249 break;
sewardje9d8a262009-07-01 08:06:34 +00004250 default:
sewardje768e922009-11-26 17:17:37 +00004251 /* explicitly handle the rest, so as to keep gcc quiet */
4252 break;
sewardj35439212004-07-14 22:36:10 +00004253 }
4254 }
4255
sewardj6efd4a12004-07-15 03:54:23 +00004256 /* Typecheck everything. */
sewardjd7cb8532004-08-17 23:59:23 +00004257 for (i = 0; i < bb->stmts_used; i++)
sewardj39e3f242004-08-18 16:54:52 +00004258 if (bb->stmts[i])
4259 tcStmt( bb, bb->stmts[i], guest_word_size );
sewardj6efd4a12004-07-15 03:54:23 +00004260 if (typeOfIRExpr(bb->tyenv,bb->next) != guest_word_size)
4261 sanityCheckFail(bb, NULL, "bb->next field has wrong type");
sewardjc6f970f2012-04-02 21:54:49 +00004262 /* because it would intersect with host_EvC_* */
4263 if (bb->offsIP < 16)
4264 sanityCheckFail(bb, NULL, "bb->offsIP: too low");
4265
sewardje539a402004-07-14 18:24:17 +00004266}
4267
sewardj4345f7a2004-09-22 19:49:27 +00004268/*---------------------------------------------------------------*/
4269/*--- Misc helper functions ---*/
4270/*---------------------------------------------------------------*/
4271
4272Bool eqIRConst ( IRConst* c1, IRConst* c2 )
4273{
4274 if (c1->tag != c2->tag)
4275 return False;
4276
4277 switch (c1->tag) {
sewardja98bf492005-02-07 01:39:17 +00004278 case Ico_U1: return toBool( (1 & c1->Ico.U1) == (1 & c2->Ico.U1) );
4279 case Ico_U8: return toBool( c1->Ico.U8 == c2->Ico.U8 );
4280 case Ico_U16: return toBool( c1->Ico.U16 == c2->Ico.U16 );
4281 case Ico_U32: return toBool( c1->Ico.U32 == c2->Ico.U32 );
4282 case Ico_U64: return toBool( c1->Ico.U64 == c2->Ico.U64 );
sewardj2019a972011-03-07 16:04:07 +00004283 case Ico_F32: return toBool( c1->Ico.F32 == c2->Ico.F32 );
4284 case Ico_F32i: return toBool( c1->Ico.F32i == c2->Ico.F32i );
sewardja98bf492005-02-07 01:39:17 +00004285 case Ico_F64: return toBool( c1->Ico.F64 == c2->Ico.F64 );
sewardj0da5eb82007-01-27 00:46:28 +00004286 case Ico_F64i: return toBool( c1->Ico.F64i == c2->Ico.F64i );
4287 case Ico_V128: return toBool( c1->Ico.V128 == c2->Ico.V128 );
sewardj5df0b2f2012-07-18 11:48:23 +00004288 case Ico_V256: return toBool( c1->Ico.V256 == c2->Ico.V256 );
sewardj4345f7a2004-09-22 19:49:27 +00004289 default: vpanic("eqIRConst");
4290 }
4291}
4292
sewardjdd40fdf2006-12-24 02:20:24 +00004293Bool eqIRRegArray ( IRRegArray* descr1, IRRegArray* descr2 )
sewardje98dcf22004-10-04 09:15:11 +00004294{
sewardja98bf492005-02-07 01:39:17 +00004295 return toBool( descr1->base == descr2->base
4296 && descr1->elemTy == descr2->elemTy
4297 && descr1->nElems == descr2->nElems );
sewardje98dcf22004-10-04 09:15:11 +00004298}
4299
sewardj2d3f77c2004-09-22 23:49:09 +00004300Int sizeofIRType ( IRType ty )
4301{
4302 switch (ty) {
sewardjc9a43662004-11-30 18:51:59 +00004303 case Ity_I8: return 1;
4304 case Ity_I16: return 2;
4305 case Ity_I32: return 4;
4306 case Ity_I64: return 8;
sewardj7666c152010-09-28 15:20:47 +00004307 case Ity_I128: return 16;
sewardjc9a43662004-11-30 18:51:59 +00004308 case Ity_F32: return 4;
4309 case Ity_F64: return 8;
sewardj2019a972011-03-07 16:04:07 +00004310 case Ity_F128: return 16;
sewardjc6bbd472012-04-02 10:20:48 +00004311 case Ity_D32: return 4;
4312 case Ity_D64: return 8;
4313 case Ity_D128: return 16;
sewardjc4530ae2012-05-21 10:18:49 +00004314 case Ity_V128: return 16;
4315 case Ity_V256: return 32;
sewardj2d3f77c2004-09-22 23:49:09 +00004316 default: vex_printf("\n"); ppIRType(ty); vex_printf("\n");
4317 vpanic("sizeofIRType");
4318 }
4319}
4320
sewardj49651f42004-10-28 22:11:04 +00004321IRExpr* mkIRExpr_HWord ( HWord hw )
4322{
sewardjf9655262004-10-31 20:02:16 +00004323 vassert(sizeof(void*) == sizeof(HWord));
sewardj49651f42004-10-28 22:11:04 +00004324 if (sizeof(HWord) == 4)
4325 return IRExpr_Const(IRConst_U32((UInt)hw));
4326 if (sizeof(HWord) == 8)
sewardjf9655262004-10-31 20:02:16 +00004327 return IRExpr_Const(IRConst_U64((ULong)hw));
sewardj49651f42004-10-28 22:11:04 +00004328 vpanic("mkIRExpr_HWord");
4329}
sewardj6efd4a12004-07-15 03:54:23 +00004330
florian1ff47562012-10-21 02:09:51 +00004331IRDirty* unsafeIRDirty_0_N ( Int regparms, const HChar* name, void* addr,
sewardjf9655262004-10-31 20:02:16 +00004332 IRExpr** args )
4333{
4334 IRDirty* d = emptyIRDirty();
sewardjb8385d82004-11-02 01:34:15 +00004335 d->cee = mkIRCallee ( regparms, name, addr );
sewardjba999312004-11-15 15:21:17 +00004336 d->guard = IRExpr_Const(IRConst_U1(True));
sewardjb8385d82004-11-02 01:34:15 +00004337 d->args = args;
sewardjf9655262004-10-31 20:02:16 +00004338 return d;
4339}
4340
4341IRDirty* unsafeIRDirty_1_N ( IRTemp dst,
florian1ff47562012-10-21 02:09:51 +00004342 Int regparms, const HChar* name, void* addr,
sewardjf9655262004-10-31 20:02:16 +00004343 IRExpr** args )
4344{
4345 IRDirty* d = emptyIRDirty();
sewardjb8385d82004-11-02 01:34:15 +00004346 d->cee = mkIRCallee ( regparms, name, addr );
sewardjba999312004-11-15 15:21:17 +00004347 d->guard = IRExpr_Const(IRConst_U1(True));
sewardjb8385d82004-11-02 01:34:15 +00004348 d->args = args;
4349 d->tmp = dst;
sewardjf9655262004-10-31 20:02:16 +00004350 return d;
4351}
4352
4353IRExpr* mkIRExprCCall ( IRType retty,
florian1ff47562012-10-21 02:09:51 +00004354 Int regparms, const HChar* name, void* addr,
sewardjf9655262004-10-31 20:02:16 +00004355 IRExpr** args )
4356{
4357 return IRExpr_CCall ( mkIRCallee ( regparms, name, addr ),
4358 retty, args );
4359}
4360
sewardj496a58d2005-03-20 18:44:44 +00004361Bool eqIRAtom ( IRExpr* a1, IRExpr* a2 )
4362{
4363 vassert(isIRAtom(a1));
4364 vassert(isIRAtom(a2));
sewardjdd40fdf2006-12-24 02:20:24 +00004365 if (a1->tag == Iex_RdTmp && a2->tag == Iex_RdTmp)
4366 return toBool(a1->Iex.RdTmp.tmp == a2->Iex.RdTmp.tmp);
sewardj496a58d2005-03-20 18:44:44 +00004367 if (a1->tag == Iex_Const && a2->tag == Iex_Const)
4368 return eqIRConst(a1->Iex.Const.con, a2->Iex.Const.con);
4369 return False;
4370}
4371
sewardje539a402004-07-14 18:24:17 +00004372/*---------------------------------------------------------------*/
sewardjcef7d3e2009-07-02 12:21:59 +00004373/*--- end ir_defs.c ---*/
sewardj887a11a2004-07-05 17:26:47 +00004374/*---------------------------------------------------------------*/