@@ -1357,6 +1357,40 @@ One important use case of `UbChecks` is to determine overflows in unchecked arit
1357
1357
` nullOpAlignOf `
1358
1358
` nullOpOffsetOf(VariantAndFieldIndices) `
1359
1359
1360
+ ``` k
1361
+
1362
+ // FIXME: Alignment is platform specific
1363
+ syntax Int ::= #alignOf( TypeInfo ) [function]
1364
+
1365
+ rule #alignOf( typeInfoPrimitiveType(primTypeBool) ) => 1
1366
+ rule #alignOf( typeInfoPrimitiveType(primTypeChar) ) => 4
1367
+
1368
+ rule #alignOf( typeInfoPrimitiveType(primTypeInt(intTyIsize)) ) => 8 // FIXME: Hard coded since usize not implemented
1369
+ rule #alignOf( typeInfoPrimitiveType(primTypeInt(intTyI8)) ) => 1
1370
+ rule #alignOf( typeInfoPrimitiveType(primTypeInt(intTyI16)) ) => 2
1371
+ rule #alignOf( typeInfoPrimitiveType(primTypeInt(intTyI32)) ) => 4
1372
+ rule #alignOf( typeInfoPrimitiveType(primTypeInt(intTyI64)) ) => 8
1373
+ rule #alignOf( typeInfoPrimitiveType(primTypeInt(intTyI128)) ) => 16
1374
+
1375
+ rule #alignOf( typeInfoPrimitiveType(primTypeUint(uintTyUsize)) ) => 8 // FIXME: Hard coded since usize not implemented
1376
+ rule #alignOf( typeInfoPrimitiveType(primTypeUint(uintTyU8)) ) => 1
1377
+ rule #alignOf( typeInfoPrimitiveType(primTypeUint(uintTyU16)) ) => 2
1378
+ rule #alignOf( typeInfoPrimitiveType(primTypeUint(uintTyU32)) ) => 4
1379
+ rule #alignOf( typeInfoPrimitiveType(primTypeUint(uintTyU64)) ) => 8
1380
+ rule #alignOf( typeInfoPrimitiveType(primTypeUint(uintTyU128)) ) => 16
1381
+
1382
+ rule #alignOf( typeInfoPrimitiveType(primTypeFloat(floatTyF16)) ) => 2
1383
+ rule #alignOf( typeInfoPrimitiveType(primTypeFloat(floatTyF32)) ) => 4
1384
+ rule #alignOf( typeInfoPrimitiveType(primTypeFloat(floatTyF64)) ) => 8
1385
+ rule #alignOf( typeInfoPrimitiveType(primTypeFloat(floatTyF128)) ) => 16
1386
+
1387
+ rule <k> rvalueNullaryOp(nullOpAlignOf, TY) => typedValue( Integer(#alignOf({TYPEMAP[TY]}:>TypeInfo), 64, false), TyUnknown, mutabilityNot ) ... </k> // FIXME: 64 is hardcoded since usize not supported
1388
+ <types> TYPEMAP </types>
1389
+ requires TY in_keys(TYPEMAP)
1390
+ andBool isTypeInfo(TYPEMAP[TY])
1391
+
1392
+ ```
1393
+
1360
1394
#### Other operations
1361
1395
1362
1396
` binOpOffset `
0 commit comments