Newer
Older
case STARS_NN_pclmulqdq: // Carry-Less Multiplication Quadword
SMP_fprintf(OutFile, "ERROR");
break;
// Returns modifies by operand size prefixes
case STARS_NN_retnw: // Return Near from Procedure (use16)
case STARS_NN_retnd: // Return Near from Procedure (use32)
case STARS_NN_retnq: // Return Near from Procedure (use64)
case STARS_NN_retfw: // Return Far from Procedure (use16)
case STARS_NN_retfd: // Return Far from Procedure (use32)
case STARS_NN_retfq: // Return Far from Procedure (use64)
SMP_fprintf(OutFile, "return");
break;
// RDRAND support
case STARS_NN_rdrand: // Read Random Number
SMP_fprintf(OutFile, "ERROR");
break;
// new GPR instructions
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
case STARS_NN_adcx: // Unsigned Integer Addition of Two Operands with Carry Flag
case STARS_NN_adox: // Unsigned Integer Addition of Two Operands with Overflow Flag
case STARS_NN_andn: // Logical AND NOT
case STARS_NN_bextr: // Bit Field Extract
case STARS_NN_blsi: // Extract Lowest Set Isolated Bit
case STARS_NN_blsmsk: // Get Mask Up to Lowest Set Bit
case STARS_NN_blsr: // Reset Lowest Set Bit
case STARS_NN_bzhi: // Zero High Bits Starting with Specified Bit Position
case STARS_NN_clac: // Clear AC Flag in EFLAGS Register
case STARS_NN_mulx: // Unsigned Multiply Without Affecting Flags
case STARS_NN_pdep: // Parallel Bits Deposit
case STARS_NN_pext: // Parallel Bits Extract
case STARS_NN_rorx: // Rotate Right Logical Without Affecting Flags
case STARS_NN_sarx: // Shift Arithmetically Right Without Affecting Flags
case STARS_NN_shlx: // Shift Logically Left Without Affecting Flags
case STARS_NN_shrx: // Shift Logically Right Without Affecting Flags
case STARS_NN_stac: // Set AC Flag in EFLAGS Register
case STARS_NN_tzcnt: // Count the Number of Trailing Zero Bits
case STARS_NN_xsaveopt: // Save Processor Extended States Optimized
case STARS_NN_invpcid: // Invalidate Processor Context ID
case STARS_NN_rdseed: // Read Random Seed
case STARS_NN_rdfsbase: // Read FS Segment Base
case STARS_NN_rdgsbase: // Read GS Segment Base
case STARS_NN_wrfsbase: // Write FS Segment Base
case STARS_NN_wrgsbase: // Write GS Segment Base
SMP_fprintf(OutFile, "ERROR");
break;
// new AVX instructions
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
case STARS_NN_vaddpd: // Add Packed Double-Precision Floating-Point Values
case STARS_NN_vaddps: // Packed Single-FP Add
case STARS_NN_vaddsd: // Add Scalar Double-Precision Floating-Point Values
case STARS_NN_vaddss: // Scalar Single-FP Add
case STARS_NN_vaddsubpd: // Add /Sub packed DP FP numbers
case STARS_NN_vaddsubps: // Add /Sub packed SP FP numbers
case STARS_NN_vaesdec: // Perform One Round of an AES Decryption Flow
case STARS_NN_vaesdeclast: // Perform the Last Round of an AES Decryption Flow
case STARS_NN_vaesenc: // Perform One Round of an AES Encryption Flow
case STARS_NN_vaesenclast: // Perform the Last Round of an AES Encryption Flow
case STARS_NN_vaesimc: // Perform the AES InvMixColumn Transformation
case STARS_NN_vaeskeygenassist: // AES Round Key Generation Assist
case STARS_NN_vandnpd: // Bitwise Logical AND NOT of Packed Double-Precision Floating-Point Values
case STARS_NN_vandnps: // Bitwise Logical And Not for Single-FP
case STARS_NN_vandpd: // Bitwise Logical AND of Packed Double-Precision Floating-Point Values
case STARS_NN_vandps: // Bitwise Logical And for Single-FP
case STARS_NN_vblendpd: // Blend Packed Double Precision Floating-Point Values
case STARS_NN_vblendps: // Blend Packed Single Precision Floating-Point Values
case STARS_NN_vblendvpd: // Variable Blend Packed Double Precision Floating-Point Values
case STARS_NN_vblendvps: // Variable Blend Packed Single Precision Floating-Point Values
case STARS_NN_vbroadcastf128: // Broadcast 128 Bits of Floating-Point Data
case STARS_NN_vbroadcasti128: // Broadcast 128 Bits of Integer Data
case STARS_NN_vbroadcastsd: // Broadcast Double-Precision Floating-Point Element
case STARS_NN_vbroadcastss: // Broadcast Single-Precision Floating-Point Element
case STARS_NN_vcmppd: // Compare Packed Double-Precision Floating-Point Values
case STARS_NN_vcmpps: // Packed Single-FP Compare
case STARS_NN_vcmpsd: // Compare Scalar Double-Precision Floating-Point Values
case STARS_NN_vcmpss: // Scalar Single-FP Compare
case STARS_NN_vcomisd: // Compare Scalar Ordered Double-Precision Floating-Point Values and Set EFLAGS
case STARS_NN_vcomiss: // Scalar Ordered Single-FP Compare and Set EFLAGS
case STARS_NN_vcvtdq2pd: // Convert Packed Doubleword Integers to Packed Single-Precision Floating-Point Values
case STARS_NN_vcvtdq2ps: // Convert Packed Doubleword Integers to Packed Double-Precision Floating-Point Values
case STARS_NN_vcvtpd2dq: // Convert Packed Double-Precision Floating-Point Values to Packed Doubleword Integers
case STARS_NN_vcvtpd2ps: // Convert Packed Double-Precision Floating-Point Values to Packed Single-Precision Floating-Point Values
case STARS_NN_vcvtph2ps: // Convert 16-bit FP Values to Single-Precision FP Values
case STARS_NN_vcvtps2dq: // Convert Packed Single-Precision Floating-Point Values to Packed Doubleword Integers
case STARS_NN_vcvtps2pd: // Convert Packed Single-Precision Floating-Point Values to Packed Double-Precision Floating-Point Values
case STARS_NN_vcvtps2ph: // Convert Single-Precision FP value to 16-bit FP value
case STARS_NN_vcvtsd2si: // Convert Scalar Double-Precision Floating-Point Value to Doubleword Integer
case STARS_NN_vcvtsd2ss: // Convert Scalar Double-Precision Floating-Point Value to Scalar Single-Precision Floating-Point Value
case STARS_NN_vcvtsi2sd: // Convert Doubleword Integer to Scalar Double-Precision Floating-Point Value
case STARS_NN_vcvtsi2ss: // Scalar signed INT32 to Single-FP conversion
case STARS_NN_vcvtss2sd: // Convert Scalar Single-Precision Floating-Point Value to Scalar Double-Precision Floating-Point Value
case STARS_NN_vcvtss2si: // Scalar Single-FP to signed INT32 conversion
case STARS_NN_vcvttpd2dq: // Convert With Truncation Packed Double-Precision Floating-Point Values to Packed Doubleword Integers
case STARS_NN_vcvttps2dq: // Convert With Truncation Packed Single-Precision Floating-Point Values to Packed Doubleword Integers
case STARS_NN_vcvttsd2si: // Convert with Truncation Scalar Double-Precision Floating-Point Value to Doubleword Integer
case STARS_NN_vcvttss2si: // Scalar Single-FP to signed INT32 conversion (truncate)
case STARS_NN_vdivpd: // Divide Packed Double-Precision Floating-Point Values
case STARS_NN_vdivps: // Packed Single-FP Divide
case STARS_NN_vdivsd: // Divide Scalar Double-Precision Floating-Point Values
case STARS_NN_vdivss: // Scalar Single-FP Divide
case STARS_NN_vdppd: // Dot Product of Packed Double Precision Floating-Point Values
case STARS_NN_vdpps: // Dot Product of Packed Single Precision Floating-Point Values
case STARS_NN_vextractf128: // Extract Packed Floating-Point Values
case STARS_NN_vextracti128: // Extract Packed Integer Values
case STARS_NN_vextractps: // Extract Packed Floating-Point Values
case STARS_NN_vfmadd132pd: // Fused Multiply-Add of Packed Double-Precision Floating-Point Values
case STARS_NN_vfmadd132ps: // Fused Multiply-Add of Packed Single-Precision Floating-Point Values
case STARS_NN_vfmadd132sd: // Fused Multiply-Add of Scalar Double-Precision Floating-Point Values
case STARS_NN_vfmadd132ss: // Fused Multiply-Add of Scalar Single-Precision Floating-Point Values
case STARS_NN_vfmadd213pd: // Fused Multiply-Add of Packed Double-Precision Floating-Point Values
case STARS_NN_vfmadd213ps: // Fused Multiply-Add of Packed Single-Precision Floating-Point Values
case STARS_NN_vfmadd213sd: // Fused Multiply-Add of Scalar Double-Precision Floating-Point Values
case STARS_NN_vfmadd213ss: // Fused Multiply-Add of Scalar Single-Precision Floating-Point Values
case STARS_NN_vfmadd231pd: // Fused Multiply-Add of Packed Double-Precision Floating-Point Values
case STARS_NN_vfmadd231ps: // Fused Multiply-Add of Packed Single-Precision Floating-Point Values
case STARS_NN_vfmadd231sd: // Fused Multiply-Add of Scalar Double-Precision Floating-Point Values
case STARS_NN_vfmadd231ss: // Fused Multiply-Add of Scalar Single-Precision Floating-Point Values
case STARS_NN_vfmaddsub132pd: // Fused Multiply-Alternating Add/Subtract of Packed Double-Precision Floating-Point Values
case STARS_NN_vfmaddsub132ps: // Fused Multiply-Alternating Add/Subtract of Packed Single-Precision Floating-Point Values
case STARS_NN_vfmaddsub213pd: // Fused Multiply-Alternating Add/Subtract of Packed Double-Precision Floating-Point Values
case STARS_NN_vfmaddsub213ps: // Fused Multiply-Alternating Add/Subtract of Packed Single-Precision Floating-Point Values
case STARS_NN_vfmaddsub231pd: // Fused Multiply-Alternating Add/Subtract of Packed Double-Precision Floating-Point Values
case STARS_NN_vfmaddsub231ps: // Fused Multiply-Alternating Add/Subtract of Packed Single-Precision Floating-Point Values
case STARS_NN_vfmsub132pd: // Fused Multiply-Subtract of Packed Double-Precision Floating-Point Values
case STARS_NN_vfmsub132ps: // Fused Multiply-Subtract of Packed Single-Precision Floating-Point Values
case STARS_NN_vfmsub132sd: // Fused Multiply-Subtract of Scalar Double-Precision Floating-Point Values
case STARS_NN_vfmsub132ss: // Fused Multiply-Subtract of Scalar Single-Precision Floating-Point Values
case STARS_NN_vfmsub213pd: // Fused Multiply-Subtract of Packed Double-Precision Floating-Point Values
case STARS_NN_vfmsub213ps: // Fused Multiply-Subtract of Packed Single-Precision Floating-Point Values
case STARS_NN_vfmsub213sd: // Fused Multiply-Subtract of Scalar Double-Precision Floating-Point Values
case STARS_NN_vfmsub213ss: // Fused Multiply-Subtract of Scalar Single-Precision Floating-Point Values
case STARS_NN_vfmsub231pd: // Fused Multiply-Subtract of Packed Double-Precision Floating-Point Values
case STARS_NN_vfmsub231ps: // Fused Multiply-Subtract of Packed Single-Precision Floating-Point Values
case STARS_NN_vfmsub231sd: // Fused Multiply-Subtract of Scalar Double-Precision Floating-Point Values
case STARS_NN_vfmsub231ss: // Fused Multiply-Subtract of Scalar Single-Precision Floating-Point Values
case STARS_NN_vfmsubadd132pd: // Fused Multiply-Alternating Subtract/Add of Packed Double-Precision Floating-Point Values
case STARS_NN_vfmsubadd132ps: // Fused Multiply-Alternating Subtract/Add of Packed Single-Precision Floating-Point Values
case STARS_NN_vfmsubadd213pd: // Fused Multiply-Alternating Subtract/Add of Packed Double-Precision Floating-Point Values
case STARS_NN_vfmsubadd213ps: // Fused Multiply-Alternating Subtract/Add of Packed Single-Precision Floating-Point Values
case STARS_NN_vfmsubadd231pd: // Fused Multiply-Alternating Subtract/Add of Packed Double-Precision Floating-Point Values
case STARS_NN_vfmsubadd231ps: // Fused Multiply-Alternating Subtract/Add of Packed Single-Precision Floating-Point Values
case STARS_NN_vfnmadd132pd: // Fused Negative Multiply-Add of Packed Double-Precision Floating-Point Values
case STARS_NN_vfnmadd132ps: // Fused Negative Multiply-Add of Packed Single-Precision Floating-Point Values
case STARS_NN_vfnmadd132sd: // Fused Negative Multiply-Add of Scalar Double-Precision Floating-Point Values
case STARS_NN_vfnmadd132ss: // Fused Negative Multiply-Add of Scalar Single-Precision Floating-Point Values
case STARS_NN_vfnmadd213pd: // Fused Negative Multiply-Add of Packed Double-Precision Floating-Point Values
case STARS_NN_vfnmadd213ps: // Fused Negative Multiply-Add of Packed Single-Precision Floating-Point Values
case STARS_NN_vfnmadd213sd: // Fused Negative Multiply-Add of Scalar Double-Precision Floating-Point Values
case STARS_NN_vfnmadd213ss: // Fused Negative Multiply-Add of Scalar Single-Precision Floating-Point Values
case STARS_NN_vfnmadd231pd: // Fused Negative Multiply-Add of Packed Double-Precision Floating-Point Values
case STARS_NN_vfnmadd231ps: // Fused Negative Multiply-Add of Packed Single-Precision Floating-Point Values
case STARS_NN_vfnmadd231sd: // Fused Negative Multiply-Add of Scalar Double-Precision Floating-Point Values
case STARS_NN_vfnmadd231ss: // Fused Negative Multiply-Add of Scalar Single-Precision Floating-Point Values
case STARS_NN_vfnmsub132pd: // Fused Negative Multiply-Subtract of Packed Double-Precision Floating-Point Values
case STARS_NN_vfnmsub132ps: // Fused Negative Multiply-Subtract of Packed Single-Precision Floating-Point Values
case STARS_NN_vfnmsub132sd: // Fused Negative Multiply-Subtract of Scalar Double-Precision Floating-Point Values
case STARS_NN_vfnmsub132ss: // Fused Negative Multiply-Subtract of Scalar Single-Precision Floating-Point Values
case STARS_NN_vfnmsub213pd: // Fused Negative Multiply-Subtract of Packed Double-Precision Floating-Point Values
case STARS_NN_vfnmsub213ps: // Fused Negative Multiply-Subtract of Packed Single-Precision Floating-Point Values
case STARS_NN_vfnmsub213sd: // Fused Negative Multiply-Subtract of Scalar Double-Precision Floating-Point Values
case STARS_NN_vfnmsub213ss: // Fused Negative Multiply-Subtract of Scalar Single-Precision Floating-Point Values
case STARS_NN_vfnmsub231pd: // Fused Negative Multiply-Subtract of Packed Double-Precision Floating-Point Values
case STARS_NN_vfnmsub231ps: // Fused Negative Multiply-Subtract of Packed Single-Precision Floating-Point Values
case STARS_NN_vfnmsub231sd: // Fused Negative Multiply-Subtract of Scalar Double-Precision Floating-Point Values
case STARS_NN_vfnmsub231ss: // Fused Negative Multiply-Subtract of Scalar Single-Precision Floating-Point Values
case STARS_NN_vgatherdps: // Gather Packed SP FP Values Using Signed Dword Indices
case STARS_NN_vgatherdpd: // Gather Packed DP FP Values Using Signed Dword Indices
case STARS_NN_vgatherqps: // Gather Packed SP FP Values Using Signed Qword Indices
case STARS_NN_vgatherqpd: // Gather Packed DP FP Values Using Signed Qword Indices
case STARS_NN_vhaddpd: // Add horizontally packed DP FP numbers
case STARS_NN_vhaddps: // Add horizontally packed SP FP numbers
case STARS_NN_vhsubpd: // Sub horizontally packed DP FP numbers
case STARS_NN_vhsubps: // Sub horizontally packed SP FP numbers
case STARS_NN_vinsertf128: // Insert Packed Floating-Point Values
case STARS_NN_vinserti128: // Insert Packed Integer Values
case STARS_NN_vinsertps: // Insert Packed Single Precision Floating-Point Value
case STARS_NN_vlddqu: // Load Unaligned Packed Integer Values
case STARS_NN_vldmxcsr: // Load Streaming SIMD Extensions Technology Control/Status Register
case STARS_NN_vmaskmovdqu: // Store Selected Bytes of Double Quadword with NT Hint
case STARS_NN_vmaskmovpd: // Conditionally Load Packed Double-Precision Floating-Point Values
case STARS_NN_vmaskmovps: // Conditionally Load Packed Single-Precision Floating-Point Values
case STARS_NN_vmaxpd: // Return Maximum Packed Double-Precision Floating-Point Values
case STARS_NN_vmaxps: // Packed Single-FP Maximum
case STARS_NN_vmaxsd: // Return Maximum Scalar Double-Precision Floating-Point Value
case STARS_NN_vmaxss: // Scalar Single-FP Maximum
case STARS_NN_vminpd: // Return Minimum Packed Double-Precision Floating-Point Values
case STARS_NN_vminps: // Packed Single-FP Minimum
case STARS_NN_vminsd: // Return Minimum Scalar Double-Precision Floating-Point Value
case STARS_NN_vminss: // Scalar Single-FP Minimum
case STARS_NN_vmovapd: // Move Aligned Packed Double-Precision Floating-Point Values
case STARS_NN_vmovaps: // Move Aligned Four Packed Single-FP
case STARS_NN_vmovd: // Move 32 bits
case STARS_NN_vmovddup: // Move One Double-FP and Duplicate
case STARS_NN_vmovdqa: // Move Aligned Double Quadword
case STARS_NN_vmovdqu: // Move Unaligned Double Quadword
case STARS_NN_vmovhlps: // Move High to Low Packed Single-FP
case STARS_NN_vmovhpd: // Move High Packed Double-Precision Floating-Point Values
case STARS_NN_vmovhps: // Move High Packed Single-FP
case STARS_NN_vmovlhps: // Move Low to High Packed Single-FP
case STARS_NN_vmovlpd: // Move Low Packed Double-Precision Floating-Point Values
case STARS_NN_vmovlps: // Move Low Packed Single-FP
case STARS_NN_vmovmskpd: // Extract Packed Double-Precision Floating-Point Sign Mask
case STARS_NN_vmovmskps: // Move Mask to Register
case STARS_NN_vmovntdq: // Store Double Quadword Using Non-Temporal Hint
case STARS_NN_vmovntdqa: // Load Double Quadword Non-Temporal Aligned Hint
case STARS_NN_vmovntpd: // Store Packed Double-Precision Floating-Point Values Using Non-Temporal Hint
case STARS_NN_vmovntps: // Move Aligned Four Packed Single-FP Non Temporal
case STARS_NN_vmovntsd: // Move Non-Temporal Scalar Double-Precision Floating-Point
case STARS_NN_vmovntss: // Move Non-Temporal Scalar Single-Precision Floating-Point
case STARS_NN_vmovq: // Move 64 bits
case STARS_NN_vmovsd: // Move Scalar Double-Precision Floating-Point Values
case STARS_NN_vmovshdup: // Move Packed Single-FP High and Duplicate
case STARS_NN_vmovsldup: // Move Packed Single-FP Low and Duplicate
case STARS_NN_vmovss: // Move Scalar Single-FP
case STARS_NN_vmovupd: // Move Unaligned Packed Double-Precision Floating-Point Values
case STARS_NN_vmovups: // Move Unaligned Four Packed Single-FP
case STARS_NN_vmpsadbw: // Compute Multiple Packed Sums of Absolute Difference
case STARS_NN_vmulpd: // Multiply Packed Double-Precision Floating-Point Values
case STARS_NN_vmulps: // Packed Single-FP Multiply
case STARS_NN_vmulsd: // Multiply Scalar Double-Precision Floating-Point Values
case STARS_NN_vmulss: // Scalar Single-FP Multiply
case STARS_NN_vorpd: // Bitwise Logical OR of Double-Precision Floating-Point Values
case STARS_NN_vorps: // Bitwise Logical OR for Single-FP Data
case STARS_NN_vpabsb: // Packed Absolute Value Byte
case STARS_NN_vpabsd: // Packed Absolute Value Doubleword
case STARS_NN_vpabsw: // Packed Absolute Value Word
case STARS_NN_vpackssdw: // Pack with Signed Saturation (Dword->Word)
case STARS_NN_vpacksswb: // Pack with Signed Saturation (Word->Byte)
case STARS_NN_vpackusdw: // Pack with Unsigned Saturation
case STARS_NN_vpackuswb: // Pack with Unsigned Saturation (Word->Byte)
case STARS_NN_vpaddb: // Packed Add Byte
case STARS_NN_vpaddd: // Packed Add Dword
case STARS_NN_vpaddq: // Add Packed Quadword Integers
case STARS_NN_vpaddsb: // Packed Add with Saturation (Byte)
case STARS_NN_vpaddsw: // Packed Add with Saturation (Word)
case STARS_NN_vpaddusb: // Packed Add Unsigned with Saturation (Byte)
case STARS_NN_vpaddusw: // Packed Add Unsigned with Saturation (Word)
case STARS_NN_vpaddw: // Packed Add Word
case STARS_NN_vpalignr: // Packed Align Right
case STARS_NN_vpand: // Bitwise Logical And
case STARS_NN_vpandn: // Bitwise Logical And Not
case STARS_NN_vpavgb: // Packed Average (Byte)
case STARS_NN_vpavgw: // Packed Average (Word)
case STARS_NN_vpblendd: // Blend Packed Dwords
case STARS_NN_vpblendvb: // Variable Blend Packed Bytes
case STARS_NN_vpblendw: // Blend Packed Words
case STARS_NN_vpbroadcastb: // Broadcast a Byte Integer
case STARS_NN_vpbroadcastd: // Broadcast a Dword Integer
case STARS_NN_vpbroadcastq: // Broadcast a Qword Integer
case STARS_NN_vpbroadcastw: // Broadcast a Word Integer
case STARS_NN_vpclmulqdq: // Carry-Less Multiplication Quadword
case STARS_NN_vpcmpeqb: // Packed Compare for Equal (Byte)
case STARS_NN_vpcmpeqd: // Packed Compare for Equal (Dword)
case STARS_NN_vpcmpeqq: // Compare Packed Qword Data for Equal
case STARS_NN_vpcmpeqw: // Packed Compare for Equal (Word)
case STARS_NN_vpcmpestri: // Packed Compare Explicit Length Strings: Return Index
case STARS_NN_vpcmpestrm: // Packed Compare Explicit Length Strings: Return Mask
case STARS_NN_vpcmpgtb: // Packed Compare for Greater Than (Byte)
case STARS_NN_vpcmpgtd: // Packed Compare for Greater Than (Dword)
case STARS_NN_vpcmpgtq: // Compare Packed Data for Greater Than
case STARS_NN_vpcmpgtw: // Packed Compare for Greater Than (Word)
case STARS_NN_vpcmpistri: // Packed Compare Implicit Length Strings: Return Index
case STARS_NN_vpcmpistrm: // Packed Compare Implicit Length Strings: Return Mask
case STARS_NN_vperm2f128: // Permute Floating-Point Values
case STARS_NN_vperm2i128: // Permute Integer Values
case STARS_NN_vpermd: // Full Doublewords Element Permutation
case STARS_NN_vpermilpd: // Permute Double-Precision Floating-Point Values
case STARS_NN_vpermilps: // Permute Single-Precision Floating-Point Values
case STARS_NN_vpermpd: // Permute Double-Precision Floating-Point Elements
case STARS_NN_vpermps: // Permute Single-Precision Floating-Point Elements
case STARS_NN_vpermq: // Qwords Element Permutation
case STARS_NN_vpextrb: // Extract Byte
case STARS_NN_vpextrd: // Extract Dword
case STARS_NN_vpextrq: // Extract Qword
case STARS_NN_vpextrw: // Extract Word
case STARS_NN_vpgatherdd: // Gather Packed Dword Values Using Signed Dword Indices
case STARS_NN_vpgatherdq: // Gather Packed Qword Values Using Signed Dword Indices
case STARS_NN_vpgatherqd: // Gather Packed Dword Values Using Signed Qword Indices
case STARS_NN_vpgatherqq: // Gather Packed Qword Values Using Signed Qword Indices
case STARS_NN_vphaddd: // Packed Horizontal Add Doubleword
case STARS_NN_vphaddsw: // Packed Horizontal Add and Saturate
case STARS_NN_vphaddw: // Packed Horizontal Add Word
case STARS_NN_vphminposuw: // Packed Horizontal Word Minimum
case STARS_NN_vphsubd: // Packed Horizontal Subtract Doubleword
case STARS_NN_vphsubsw: // Packed Horizontal Subtract and Saturate
case STARS_NN_vphsubw: // Packed Horizontal Subtract Word
case STARS_NN_vpinsrb: // Insert Byte
case STARS_NN_vpinsrd: // Insert Dword
case STARS_NN_vpinsrq: // Insert Qword
case STARS_NN_vpinsrw: // Insert Word
case STARS_NN_vpmaddubsw: // Multiply and Add Packed Signed and Unsigned Bytes
case STARS_NN_vpmaddwd: // Packed Multiply and Add
case STARS_NN_vpmaskmovd: // Conditionally Store Dword Values Using Mask
case STARS_NN_vpmaskmovq: // Conditionally Store Qword Values Using Mask
case STARS_NN_vpmaxsb: // Maximum of Packed Signed Byte Integers
case STARS_NN_vpmaxsd: // Maximum of Packed Signed Dword Integers
case STARS_NN_vpmaxsw: // Packed Signed Integer Word Maximum
case STARS_NN_vpmaxub: // Packed Unsigned Integer Byte Maximum
case STARS_NN_vpmaxud: // Maximum of Packed Unsigned Dword Integers
case STARS_NN_vpmaxuw: // Maximum of Packed Word Integers
case STARS_NN_vpminsb: // Minimum of Packed Signed Byte Integers
case STARS_NN_vpminsd: // Minimum of Packed Signed Dword Integers
case STARS_NN_vpminsw: // Packed Signed Integer Word Minimum
case STARS_NN_vpminub: // Packed Unsigned Integer Byte Minimum
case STARS_NN_vpminud: // Minimum of Packed Unsigned Dword Integers
case STARS_NN_vpminuw: // Minimum of Packed Word Integers
case STARS_NN_vpmovmskb: // Move Byte Mask to Integer
case STARS_NN_vpmovsxbd: // Packed Move with Sign Extend
case STARS_NN_vpmovsxbq: // Packed Move with Sign Extend
case STARS_NN_vpmovsxbw: // Packed Move with Sign Extend
case STARS_NN_vpmovsxdq: // Packed Move with Sign Extend
case STARS_NN_vpmovsxwd: // Packed Move with Sign Extend
case STARS_NN_vpmovsxwq: // Packed Move with Sign Extend
case STARS_NN_vpmovzxbd: // Packed Move with Zero Extend
case STARS_NN_vpmovzxbq: // Packed Move with Zero Extend
case STARS_NN_vpmovzxbw: // Packed Move with Zero Extend
case STARS_NN_vpmovzxdq: // Packed Move with Zero Extend
case STARS_NN_vpmovzxwd: // Packed Move with Zero Extend
case STARS_NN_vpmovzxwq: // Packed Move with Zero Extend
case STARS_NN_vpmuldq: // Multiply Packed Signed Dword Integers
case STARS_NN_vpmulhrsw: // Packed Multiply High with Round and Scale
case STARS_NN_vpmulhuw: // Packed Multiply High Unsigned
case STARS_NN_vpmulhw: // Packed Multiply High
case STARS_NN_vpmulld: // Multiply Packed Signed Dword Integers and Store Low Result
case STARS_NN_vpmullw: // Packed Multiply Low
case STARS_NN_vpmuludq: // Multiply Packed Unsigned Doubleword Integers
case STARS_NN_vpor: // Bitwise Logical Or
case STARS_NN_vpsadbw: // Packed Sum of Absolute Differences
case STARS_NN_vpshufb: // Packed Shuffle Bytes
case STARS_NN_vpshufd: // Shuffle Packed Doublewords
case STARS_NN_vpshufhw: // Shuffle Packed High Words
case STARS_NN_vpshuflw: // Shuffle Packed Low Words
case STARS_NN_vpsignb: // Packed SIGN Byte
case STARS_NN_vpsignd: // Packed SIGN Doubleword
case STARS_NN_vpsignw: // Packed SIGN Word
case STARS_NN_vpslld: // Packed Shift Left Logical (Dword)
case STARS_NN_vpslldq: // Shift Double Quadword Left Logical
case STARS_NN_vpsllq: // Packed Shift Left Logical (Qword)
case STARS_NN_vpsllvd: // Variable Bit Shift Left Logical (Dword)
case STARS_NN_vpsllvq: // Variable Bit Shift Left Logical (Qword)
case STARS_NN_vpsllw: // Packed Shift Left Logical (Word)
case STARS_NN_vpsrad: // Packed Shift Right Arithmetic (Dword)
case STARS_NN_vpsravd: // Variable Bit Shift Right Arithmetic
case STARS_NN_vpsraw: // Packed Shift Right Arithmetic (Word)
case STARS_NN_vpsrld: // Packed Shift Right Logical (Dword)
case STARS_NN_vpsrldq: // Shift Double Quadword Right Logical (Qword)
case STARS_NN_vpsrlq: // Packed Shift Right Logical (Qword)
case STARS_NN_vpsrlvd: // Variable Bit Shift Right Logical (Dword)
case STARS_NN_vpsrlvq: // Variable Bit Shift Right Logical (Qword)
case STARS_NN_vpsrlw: // Packed Shift Right Logical (Word)
case STARS_NN_vpsubb: // Packed Subtract Byte
case STARS_NN_vpsubd: // Packed Subtract Dword
case STARS_NN_vpsubq: // Subtract Packed Quadword Integers
case STARS_NN_vpsubsb: // Packed Subtract with Saturation (Byte)
case STARS_NN_vpsubsw: // Packed Subtract with Saturation (Word)
case STARS_NN_vpsubusb: // Packed Subtract Unsigned with Saturation (Byte)
case STARS_NN_vpsubusw: // Packed Subtract Unsigned with Saturation (Word)
case STARS_NN_vpsubw: // Packed Subtract Word
case STARS_NN_vptest: // Logical Compare
case STARS_NN_vpunpckhbw: // Unpack High Packed Data (Byte->Word)
case STARS_NN_vpunpckhdq: // Unpack High Packed Data (Dword->Qword)
case STARS_NN_vpunpckhqdq: // Unpack High Packed Data (Qword->Xmmword)
case STARS_NN_vpunpckhwd: // Unpack High Packed Data (Word->Dword)
case STARS_NN_vpunpcklbw: // Unpack Low Packed Data (Byte->Word)
case STARS_NN_vpunpckldq: // Unpack Low Packed Data (Dword->Qword)
case STARS_NN_vpunpcklqdq: // Unpack Low Packed Data (Qword->Xmmword)
case STARS_NN_vpunpcklwd: // Unpack Low Packed Data (Word->Dword)
case STARS_NN_vpxor: // Bitwise Logical Exclusive Or
case STARS_NN_vrcpps: // Packed Single-FP Reciprocal
case STARS_NN_vrcpss: // Scalar Single-FP Reciprocal
case STARS_NN_vroundpd: // Round Packed Double Precision Floating-Point Values
case STARS_NN_vroundps: // Round Packed Single Precision Floating-Point Values
case STARS_NN_vroundsd: // Round Scalar Double Precision Floating-Point Values
case STARS_NN_vroundss: // Round Scalar Single Precision Floating-Point Values
case STARS_NN_vrsqrtps: // Packed Single-FP Square Root Reciprocal
case STARS_NN_vrsqrtss: // Scalar Single-FP Square Root Reciprocal
case STARS_NN_vshufpd: // Shuffle Packed Double-Precision Floating-Point Values
case STARS_NN_vshufps: // Shuffle Single-FP
case STARS_NN_vsqrtpd: // Compute Square Roots of Packed Double-Precision Floating-Point Values
case STARS_NN_vsqrtps: // Packed Single-FP Square Root
case STARS_NN_vsqrtsd: // Compute Square Rootof Scalar Double-Precision Floating-Point Value
case STARS_NN_vsqrtss: // Scalar Single-FP Square Root
case STARS_NN_vstmxcsr: // Store Streaming SIMD Extensions Technology Control/Status Register
case STARS_NN_vsubpd: // Subtract Packed Double-Precision Floating-Point Values
case STARS_NN_vsubps: // Packed Single-FP Subtract
case STARS_NN_vsubsd: // Subtract Scalar Double-Precision Floating-Point Values
case STARS_NN_vsubss: // Scalar Single-FP Subtract
case STARS_NN_vtestpd: // Packed Double-Precision Floating-Point Bit Test
case STARS_NN_vtestps: // Packed Single-Precision Floating-Point Bit Test
case STARS_NN_vucomisd: // Unordered Compare Scalar Ordered Double-Precision Floating-Point Values and Set EFLAGS
case STARS_NN_vucomiss: // Scalar Unordered Single-FP Compare and Set EFLAGS
case STARS_NN_vunpckhpd: // Unpack and Interleave High Packed Double-Precision Floating-Point Values
case STARS_NN_vunpckhps: // Unpack High Packed Single-FP Data
case STARS_NN_vunpcklpd: // Unpack and Interleave Low Packed Double-Precision Floating-Point Values
case STARS_NN_vunpcklps: // Unpack Low Packed Single-FP Data
case STARS_NN_vxorpd: // Bitwise Logical OR of Double-Precision Floating-Point Values
case STARS_NN_vxorps: // Bitwise Logical XOR for Single-FP Data
case STARS_NN_vzeroall: // Zero All YMM Registers
case STARS_NN_vzeroupper: // Zero Upper Bits of YMM Registers
SMP_fprintf(OutFile, "ERROR");
break;
// Transactional Synchronization Extensions
case STARS_NN_xabort: // Transaction Abort
case STARS_NN_xbegin: // Transaction Begin
case STARS_NN_xend: // Transaction End
case STARS_NN_xtest: // Test If In Transactional Execution
SMP_fprintf(OutFile, "ERROR");
break;
// Virtual PC synthetic instructions
case STARS_NN_vmgetinfo: // Virtual PC - Get VM Information
case STARS_NN_vmsetinfo: // Virtual PC - Set VM Information
case STARS_NN_vmdxdsbl: // Virtual PC - Disable Direct Execution
case STARS_NN_vmdxenbl: // Virtual PC - Enable Direct Execution
case STARS_NN_vmcpuid: // Virtual PC - Virtualized CPU Information
case STARS_NN_vmhlt: // Virtual PC - Halt
case STARS_NN_vmsplaf: // Virtual PC - Spin Lock Acquisition Failed
case STARS_NN_vmpushfd: // Virtual PC - Push virtualized flags register
case STARS_NN_vmpopfd: // Virtual PC - Pop virtualized flags register
case STARS_NN_vmcli: // Virtual PC - Clear Interrupt Flag
case STARS_NN_vmsti: // Virtual PC - Set Interrupt Flag
case STARS_NN_vmiretd: // Virtual PC - Return From Interrupt
case STARS_NN_vmsgdt: // Virtual PC - Store Global Descriptor Table
case STARS_NN_vmsidt: // Virtual PC - Store Interrupt Descriptor Table
case STARS_NN_vmsldt: // Virtual PC - Store Local Descriptor Table
case STARS_NN_vmstr: // Virtual PC - Store Task Register
case STARS_NN_vmsdte: // Virtual PC - Store to Descriptor Table Entry
case STARS_NN_vpcext: // Virtual PC - ISA extension
SMP_fprintf(OutFile, "ERROR");
break;
case STARS_NN_last:
SMP_fprintf(OutFile, "ERROR");
break;
default:
SMP_fprintf(OutFile, "ERROR");
break;
}
return;
} // end of PrintOpcode()
// MACHINE DEPENDENT: Is operand type a known type that we want to analyze?
bool MDKnownOperandType(const STARSOpndTypePtr &TempOp) {
bool GoodOpType = (nullptr != TempOp) && TempOp->MDIsKnownOpType();
#if SMP_DEBUG_OPERAND_TYPES
if (!GoodOpType && (! TempOp->IsVoidOp())) {
SMP_msg("WARNING: Operand type %d \n", TempOp->GetOpType());
}
#endif
return GoodOpType;
// Meet function over any two types in the type lattice.
SMPOperandType SMPTypeMeet(SMPOperandType Type1, SMPOperandType Type2) {
SMPOperandType MeetType = UNKNOWN;
bool ProfDerived = IsProfDerived(Type1) || IsProfDerived(Type2);
if (IsEqType(UNINIT, Type1))
MeetType = Type2;
else if (IsEqType(UNINIT, Type2) || IsEqType(Type1, Type2)
|| IsUnknown(Type1))
MeetType = Type1;
else if (IsNumeric(Type1)) {
if (IsNumeric(Type2)) // one is NUMERIC, one is CODEPTR
MeetType = NUMERIC;
else if (IsDataPtr(Type2) || IsUnknown(Type2))
MeetType = UNKNOWN;
else
clc5q
committed
SMP_msg("ERROR #1 in SMPTypeMeet.\n");
}
else if (IsDataPtr(Type1)) {
if (IsDataPtr(Type2)) // two different POINTER subtypes
MeetType = POINTER;
else if (IsNumeric(Type2) || IsUnknown(Type2))
MeetType = UNKNOWN;
else
clc5q
committed
SMP_msg("ERROR #2 in SMPTypeMeet.\n");
if (ProfDerived && IsNotEqType(UNINIT, MeetType))
MeetType = MakeProfDerived(MeetType);
// Meet function for SCCP constant propagation; updates NewConstStruct
void STARSConstantTypeMeet(struct STARS_SCCP_Const_Struct OldConstStruct, struct STARS_SCCP_Const_Struct &NewConstStruct) {
if ((OldConstStruct.ConstType != STARS_CONST_BOTTOM) && (NewConstStruct.ConstType != STARS_CONST_TOP)) {
// We have four possibilities. Three of them have NewConstStruct lower in the type lattice, which means the final
// result is simply the NewConstStruct (i.e. if Old == TOP, New == CONST or BOTTOM; or Old == CONST, New == BOTTOM).
// The fourth possibility is that Old == CONST, New == CONST, and we have to check the const values for consistency,
// lowering NewConstStruct to BOTTOM if they are inconsistent.
if ((OldConstStruct.ConstType == STARS_CONST_HAS_VALUE) && (NewConstStruct.ConstType == STARS_CONST_HAS_VALUE)) {
if (OldConstStruct.ConstValue != NewConstStruct.ConstValue) { // inconsistent const values
NewConstStruct.ConstType = STARS_CONST_BOTTOM;
}
}
}
else {
NewConstStruct = OldConstStruct;
}
return;
} // end of STARSConstantTypeMeet()
// *****************************************************************
// Class DisAsmString
// *****************************************************************
DisAsmString::DisAsmString(void) {
this->CurrAddr = STARS_BADADDR;
this->StringLen = 0;
this->CachedDisAsm[0] = '\0';
return;
}
char *DisAsmString::GetDisAsm(STARS_ea_t InstAddr, bool MarkerInst) {
if (InstAddr != this->CurrAddr) {
this->CurrAddr = InstAddr;
if (MarkerInst) {
this->SetMarkerInstText(InstAddr);
}
else {
bool IDAsuccess = SMP_generate_disasm_line(InstAddr, this->CachedDisAsm, sizeof(this->CachedDisAsm) - 1);
if (IDAsuccess) {
// Remove interactive color-coding tags.
this->StringLen = SMP_tag_remove(this->CachedDisAsm, this->CachedDisAsm, sizeof(this->CachedDisAsm) - 1);
if (-1 >= StringLen) {
SMP_msg("ERROR: tag_remove failed at addr %lx \n", (unsigned long) InstAddr);
this->CachedDisAsm[0] = '\0';
}
}
else {
SMP_msg("ERROR: generate_disasm_line failed at addr %lx \n", (unsigned long) InstAddr);
this->CachedDisAsm[0] = '\0';
}
}
}
return (char *) this->CachedDisAsm;
} // end of DisAsmString::GetDisasm()
// Set the disasm text for the SSA marker instructions, which have no IDA Pro disasm because
// they are pseudo-instructions that we add at the top of each function to hold LiveIn name info.
void DisAsmString::SetMarkerInstText(STARS_ea_t InstAddr) {
if (InstAddr != this->CurrAddr) {
this->CurrAddr = InstAddr;
clc5q
committed
SMP_strncpy(this->CachedDisAsm, "\tfnop\t; Top of function SSA marker for SMP",
sizeof(this->CachedDisAsm) - 1);
this->StringLen = (STARS_ssize_t) strlen(this->CachedDisAsm);
}
return;
} // end of DisAsmString::SetMarkerInstText()
DisAsmString DisAsmText;
// *****************************************************************
// Class DefOrUse
// *****************************************************************
// Default constructor to make the compilers happy.
DefOrUse::DefOrUse(void) {
this->Operand = nullptr;
this->OpType = UNINIT;
this->NonSpeculativeOpType = UNINIT;
this->MetadataStatus = DEF_METADATA_UNANALYZED;
return;
}
DefOrUse::DefOrUse(STARSOpndTypePtr Ref, SMPOperandType Type, int SSASub) {
if (Ref->IsRegOp()) {
// We want to map AH, AL, and AX to EAX, etc. throughout our data flow analysis
// and type inference systems.
STARSOpndTypePtr Ref2 = CloneIfSubwordReg(Ref);
CanonicalizeOpnd(Ref2);
assert(!IsProfDerived(Type));
this->NonSpeculativeOpType = Type;
this->MetadataStatus = DEF_METADATA_UNANALYZED;
// Copy constructor.
DefOrUse::DefOrUse(const DefOrUse &CopyIn) {
*this = CopyIn;
return;
}
// Assignment operator for copy constructor use.
DefOrUse &DefOrUse::operator=(const DefOrUse &rhs) {
this->Operand = rhs.Operand;
this->OpType = rhs.OpType;
this->NonSpeculativeOpType = rhs.NonSpeculativeOpType;
this->SSANumber = rhs.SSANumber;
this->MetadataStatus = rhs.MetadataStatus;
return *this;
}
// Set the operand type for this DEF or USE - don't forget to take
// into account the speculative (profiler) status.
void DefOrUse::SetType(SMPOperandType Type, const SMPInstr *Instr) {
SMPOperandType OldType = this->OpType;
SMPOperandType NewType = Type;
if (Instr->GetBlock()->GetFunc()->GetIsSpeculative()) {
NewType = (SMPOperandType)(((int)NewType) | PROF_BASE);
if (!IsProfDerived(OldType))
this->NonSpeculativeOpType = OldType;
}
}
void DefOrUse::SetMetadataStatus(SMPMetadataType NewStatus) {
// See if we are just updating explanation codes.
bool OldUsed = ((this->MetadataStatus >= DEF_METADATA_USED) && (this->MetadataStatus < DEF_METADATA_REDUNDANT));
if (OldUsed) {
bool NewUsed = ((NewStatus >= DEF_METADATA_USED) && (NewStatus < DEF_METADATA_REDUNDANT));
if (NewUsed) {
// Union the explanation codes.
int TempInt = (int) this->GetMetadataStatus();
TempInt |= (int) NewStatus;
this->MetadataStatus = (SMPMetadataType) TempInt;
return;
}
}
this->MetadataStatus = NewStatus;
return;
}
// Debug printing.
void DefOrUse::Dump(void) const {
PrintListOperand(this->Operand, this->SSANumber);
if (IsEqType(this->OpType , NUMERIC))
clc5q
committed
SMP_msg("N ");
else if (IsEqType(this->OpType , CODEPTR))
clc5q
committed
SMP_msg("C ");
else if (IsEqType(this->OpType , POINTER))
clc5q
committed
SMP_msg("P ");
else if (IsEqType(this->OpType , STACKPTR))
clc5q
committed
SMP_msg("S ");
else if (IsEqType(this->OpType , GLOBALPTR))
clc5q
committed
SMP_msg("G ");
else if (IsEqType(this->OpType , HEAPPTR))
clc5q
committed
SMP_msg("H ");
else if (IsEqType(this->OpType , PTROFFSET))
clc5q
committed
SMP_msg("O ");
clc5q
committed
else if (IsEqType(this->OpType , NEGATEDPTR))
clc5q
committed
SMP_msg("NegP ");
else if (IsEqType(this->OpType , UNKNOWN))
clc5q
committed
SMP_msg("U ");
/* emit the profile bit */
clc5q
committed
SMP_msg("Pr ");
// Don't write anything for UNINIT OpType
// Emit the metadata status.
if (DEF_METADATA_UNUSED == this->MetadataStatus)
clc5q
committed
SMP_msg("Mn ");
else if (DEF_METADATA_USED == this->MetadataStatus)
clc5q
committed
SMP_msg("Mu ");
else if (DEF_METADATA_REDUNDANT == this->MetadataStatus)
clc5q
committed
SMP_msg("Mr ");
// Is the DEF possibly aliased because of an indirect write in
// the DEF-USE chain?
clc5q
committed
SMP_msg("Al* ");
return;
} // end of DefOrUse::Dump()
// *****************************************************************
// Class DefOrUseSet
// *****************************************************************
// Default constructor.
DefOrUseSet::DefOrUseSet(void) {
this->Refs.clear();
clc5q
committed
// Destructor.
DefOrUseSet::~DefOrUseSet() {
this->Refs.clear();
return;
clc5q
committed
}
// Find the reference for a given operand type.
set<DefOrUse, LessDefUse>::iterator DefOrUseSet::FindRef(const STARSOpndTypePtr &SearchOp) {
set<DefOrUse, LessDefUse>::iterator CurrRef;
DefOrUse DummyRef(SearchOp);
CurrRef = this->Refs.find(DummyRef);
return CurrRef;
}
// Insert a new DEF or USE; must be new, insert must succeed else we assert.
set<DefOrUse, LessDefUse>::iterator DefOrUseSet::InsertRef(DefOrUse Ref) {
pair<set<DefOrUse, LessDefUse>::iterator, bool> InsertResult;
InsertResult = this->Refs.insert(Ref);
assert(InsertResult.second);
return InsertResult.first;
}
// Set a Def or Use into the list, along with its type.
void DefOrUseSet::SetRef(STARSOpndTypePtr Ref, SMPOperandType Type, int SSASub) {
pair<set<DefOrUse, LessDefUse>::iterator, bool> InsertResult;
DefOrUse CurrRef(Ref, Type, SSASub);
InsertResult = this->Refs.insert(CurrRef);
if ((!(InsertResult.second)) && (! Ref->IsRegOp())) {
SMP_msg("ERROR: Inserted duplicate DEF or USE: ");
CurrRef.Dump(); SMP_msg("\n");
// Change the indirect write status for a reference.
set<DefOrUse, LessDefUse>::iterator DefOrUseSet::SetOp(set<DefOrUse, LessDefUse>::iterator CurrRef, STARSOpndTypePtr NewOp) {
// To change a field within a set, we must grab a copy, change the copy,
// delete the old set member, and insert the updated copy as a new member.
assert(CurrRef != this->Refs.end());
DefOrUse NewCopy = (*CurrRef);
NewCopy.SetOp(NewOp);
this->Refs.erase(CurrRef);
pair<set<DefOrUse, LessDefUse>::iterator, bool> InsertResult;
InsertResult = this->Refs.insert(NewCopy);
assert(InsertResult.second);
return InsertResult.first;
} // end of DefOrUseSet::SetOp()
// Change the SSA subscript for a reference.
set<DefOrUse, LessDefUse>::iterator DefOrUseSet::SetSSANum(const STARSOpndTypePtr &CurrOp, int NewSSASub) {
// To change a field within a set, we must grab a copy, change the copy,
// delete the old set member, and insert the updated copy as a new member.
set<DefOrUse, LessDefUse>::iterator CurrRef = this->FindRef(CurrOp);
assert(CurrRef != this->Refs.end());
set<DefOrUse, LessDefUse>::iterator NextRef = CurrRef;
++NextRef;
DefOrUse NewCopy = (*CurrRef);
NewCopy.SetSSANum(NewSSASub);
this->Refs.erase(CurrRef);
CurrRef = this->Refs.insert(NextRef, NewCopy);
return CurrRef;
} // end of DefOrUseSet::SetSSANum()
// Change the operand type for a reference.
set<DefOrUse, LessDefUse>::iterator DefOrUseSet::SetType(const STARSOpndTypePtr &CurrOp, SMPOperandType Type, const SMPInstr* Instr) {
// To change a field within a set, we must grab a copy, change the copy,
// delete the old set member, and insert the updated copy as a new member.
set<DefOrUse, LessDefUse>::iterator CurrRef = this->FindRef(CurrOp);
assert(CurrRef != this->Refs.end());
if (CurrOp->IsImmedOp()) {
if (UNINIT != CurrRef->GetType() && Type != CurrRef->GetType()) {
SMP_msg("ERROR: Changing type of immediate from %d to %d at %lx: ", CurrRef->GetType(), Type, (unsigned long) Instr->GetAddr());
clc5q
committed
SMP_msg("\n");
SMPInstr InstCopy = (*Instr);
InstCopy.Dump();
DefOrUse NewCopy = (*CurrRef);
NewCopy.SetType(Type,Instr);
this->Refs.erase(CurrRef);
pair<set<DefOrUse, LessDefUse>::iterator, bool> InsertResult;
InsertResult = this->Refs.insert(NewCopy);
assert(InsertResult.second);
CurrRef = InsertResult.first;
} // end of DefOrUseSet::SetType()
// Change the Metadata type for a reference.
set<DefOrUse, LessDefUse>::iterator DefOrUseSet::SetMetadata(const STARSOpndTypePtr &CurrOp, SMPMetadataType Status) {
// To change a field within a set, we must grab a copy, change the copy,
// delete the old set member, and insert the updated copy as a new member.
set<DefOrUse, LessDefUse>::iterator CurrRef = this->FindRef(CurrOp);
assert(CurrRef != this->Refs.end());
DefOrUse NewCopy = (*CurrRef);
NewCopy.SetMetadataStatus(Status);
this->Refs.erase(CurrRef);
pair<set<DefOrUse, LessDefUse>::iterator, bool> InsertResult;
InsertResult = this->Refs.insert(NewCopy);
assert(InsertResult.second);
CurrRef = InsertResult.first;
return CurrRef;
} // end of DefOrUseSet::SetMetadata()
// Change the indirect write status for a reference.
set<DefOrUse, LessDefUse>::iterator DefOrUseSet::SetIndWrite(const STARSOpndTypePtr &CurrOp, bool IndWriteFlag) {
// To change a field within a set, we must grab a copy, change the copy,
// delete the old set member, and insert the updated copy as a new member.
set<DefOrUse, LessDefUse>::iterator CurrRef = this->FindRef(CurrOp);
assert(CurrRef != this->Refs.end());
DefOrUse NewCopy = (*CurrRef);
NewCopy.SetIndWrite(IndWriteFlag);
this->Refs.erase(CurrRef);
pair<set<DefOrUse, LessDefUse>::iterator, bool> InsertResult;
InsertResult = this->Refs.insert(NewCopy);
assert(InsertResult.second);
CurrRef = InsertResult.first;
return CurrRef;
} // end of DefOrUseSet::SetIndWrite()
// Change the ignore apparent truncation flag for a reference.
set<DefOrUse, LessDefUse>::iterator DefOrUseSet::SetNoTruncation(const STARSOpndTypePtr &CurrOp, bool NoTruncFlag) {
// To change a field within a set, we must grab a copy, change the copy,
// delete the old set member, and insert the updated copy as a new member.
set<DefOrUse, LessDefUse>::iterator CurrRef = this->FindRef(CurrOp);
assert(CurrRef != this->Refs.end());
DefOrUse NewCopy = (*CurrRef);
NewCopy.SetNoTruncation(NoTruncFlag);
this->Refs.erase(CurrRef);
pair<set<DefOrUse, LessDefUse>::iterator, bool> InsertResult;
InsertResult = this->Refs.insert(NewCopy);
assert(InsertResult.second);
CurrRef = InsertResult.first;
return CurrRef;
} // end of DefOrUseSet::SetNoTruncation()
clc5q
committed
// Change the ignore apparent overflow flag for a reference.
set<DefOrUse, LessDefUse>::iterator DefOrUseSet::SetNoOverflow(const STARSOpndTypePtr &CurrOp, bool NoOverflowFlag) {
clc5q
committed
// To change a field within a set, we must grab a copy, change the copy,
// delete the old set member, and insert the updated copy as a new member.
set<DefOrUse, LessDefUse>::iterator CurrRef = this->FindRef(CurrOp);
assert(CurrRef != this->Refs.end());
DefOrUse NewCopy = (*CurrRef);
NewCopy.SetNoOverflow(NoOverflowFlag);
this->Refs.erase(CurrRef);
pair<set<DefOrUse, LessDefUse>::iterator, bool> InsertResult;
InsertResult = this->Refs.insert(NewCopy);
assert(InsertResult.second);
CurrRef = InsertResult.first;
return CurrRef;
} // end of DefOrUseSet::SetNoOverflow()
// Set a DEF as being invariant for all loops in the func.
set<DefOrUse, LessDefUse>::iterator DefOrUseSet::SetLoopInvariant(const STARSOpndTypePtr &CurrOp) {
// To change a field within a set, we must grab a copy, change the copy,
// delete the old set member, and insert the updated copy as a new member.
set<DefOrUse, LessDefUse>::iterator CurrRef = this->FindRef(CurrOp);
assert(CurrRef != this->Refs.end());
DefOrUse NewCopy = (*CurrRef);
NewCopy.SetInvariantForAllLoops();
this->Refs.erase(CurrRef);
pair<set<DefOrUse, LessDefUse>::iterator, bool> InsertResult;
InsertResult = this->Refs.insert(NewCopy);
assert(InsertResult.second);
CurrRef = InsertResult.first;
return CurrRef;
} // end of DefOrUseSet::SetLoopInvariant()
clc5q
committed
void DefOrUseSet::Dump(void) const {
set<DefOrUse, LessDefUse>::iterator CurrRef;
for (CurrRef = this->Refs.begin(); CurrRef != this->Refs.end(); ++CurrRef) {
CurrRef->Dump();
}
clc5q
committed
SMP_msg("\n");
// Do all types agree, ignoring any flags registers in the set? This is used
// for conditional move instructions; if all types agree, it does not matter
// whether the move happens or not.
clc5q
committed
bool DefOrUseSet::TypesAgreeNoFlags(void) {
bool FoundFirstUse = false;
set<DefOrUse, LessDefUse>::iterator CurrUse;
SMPOperandType UseType = UNINIT;
for (CurrUse = this->Refs.begin(); CurrUse != this->Refs.end(); ++CurrUse) {
if (!(CurrUse->GetOp()->MatchesReg(X86_FLAGS_REG))) { // ignore flags
clc5q
committed
if (!FoundFirstUse) {
FoundFirstUse = true;
UseType = CurrUse->GetType();
}
else {
clc5q
committed
if (IsNotEqType(CurrUse->GetType(), UseType)) {
clc5q
committed
return false; // inconsistent types
}
}
}
}
return true;
} // end of DefOrUseSet::TypesAgreeNoFlags()
// *****************************************************************
// Class DefOrUseList
// *****************************************************************
// Default constructor.
DefOrUseList::DefOrUseList(void) {
this->Refs.clear();
return;
}
// Set a Def or Use into the list, along with its type.
void DefOrUseList::SetRef(STARSOpndTypePtr Ref, SMPOperandType Type, int SSASub) {
DefOrUse CurrRef(Ref, Type, SSASub);
this->Refs.push_back(CurrRef);
DefOrUse DefOrUseList::GetRef(size_t index) const {
// Change the SSA subscript for a reference.
void DefOrUseList::SetSSANum(size_t index, int NewSSASub) {
this->Refs[index].SetSSANum(NewSSASub);
return;
}
// Change the operand type for a reference.
void DefOrUseList::SetType(size_t index, SMPOperandType Type, const SMPInstr* Instr) {
this->Refs[index].SetType(Type,Instr);
return;
}
// Debug printing.
void DefOrUseList::Dump(void) const {
for (size_t index = 0; index < this->Refs.size(); ++index) {
Refs[index].Dump();
}
clc5q
committed
SMP_msg("\n");
return;
}
// Erase duplicate entries, in case SMPInstr::MDFixupDefUseLists() adds one.
void DefOrUseList::EraseDuplicates(void) {
set<STARSOpndTypePtr, LessOp> TempRefs; // Use STL set to find duplicates
set<STARSOpndTypePtr, LessOp>::iterator TempIter;
vector<DefOrUse>::iterator RefIter;
RefIter = this->Refs.begin();
while (RefIter != this->Refs.end()) {
TempIter = TempRefs.find(RefIter->GetOp());
if (TempIter == TempRefs.end()) { // not already in set
TempRefs.insert(RefIter->GetOp());
++RefIter;
}
else { // found it in set already
RefIter = this->Refs.erase(RefIter);
}
}
return;
} // end of DefOrUseList::EraseDuplicates()
// *****************************************************************
// Class SMPPhiFunction
// *****************************************************************
// Constructor
SMPPhiFunction::SMPPhiFunction(int GlobIndex, const DefOrUse &Def) {
this->DefName = Def;
clc5q
committed
this->SubscriptedOps.clear();
DefOrUse SMPPhiFunction::GetDefCopy(void) const {
DefOrUse DefCopy(this->DefName);
return DefCopy;
}
// Add a phi item to the list
void SMPPhiFunction::PushBack(DefOrUse Ref) {
this->SubscriptedOps.SetRef(Ref.GetOp(), Ref.GetType(), Ref.GetSSANum());
return;
}
// Set the SSA number of the defined variable.
void SMPPhiFunction::SetSSADef(int NewSSASub) {
this->DefName.SetSSANum(NewSSASub);
return;
}
// Set the SSA number of the input variable.
void SMPPhiFunction::SetSSARef(size_t index, int NewSSASub) {
this->SubscriptedOps.SetSSANum(index, NewSSASub);
return;
}