@@ -392,7 +392,7 @@ def AllocaOp : CIR_Op<"alloca", [
392
392
%0 = cir.alloca i32, !cir.ptr<i32>, ["count", init] {alignment = 4 : i64}
393
393
394
394
// int *ptr;
395
- %1 = cir.alloca !cir.ptr<i32>, cir.ptr <!cir.ptr<i32>>, ["ptr"] {alignment = 8 : i64}
395
+ %1 = cir.alloca !cir.ptr<i32>, ! cir.ptr<!cir.ptr<i32>>, ["ptr"] {alignment = 8 : i64}
396
396
...
397
397
```
398
398
}];
@@ -434,10 +434,8 @@ def AllocaOp : CIR_Op<"alloca", [
434
434
bool isDynamic() { return (bool)getDynAllocSize(); }
435
435
}];
436
436
437
- // FIXME: we should not be printing `cir.ptr` below, that should come
438
- // from the pointer type directly.
439
437
let assemblyFormat = [{
440
- $allocaType `,` `cir.ptr` type($addr) `,`
438
+ $allocaType `,` qualified( type($addr) ) `,`
441
439
($dynAllocSize^ `:` type($dynAllocSize) `,`)?
442
440
`[` $name
443
441
(`,` `init` $init^)?
@@ -474,7 +472,7 @@ def LoadOp : CIR_Op<"load", [
474
472
475
473
// Load address from memory at address %0. %3 is used by at least one
476
474
// operation that dereferences a pointer.
477
- %3 = cir.load deref %0 : cir.ptr <!cir.ptr<i32>>
475
+ %3 = cir.load deref %0 : ! cir.ptr<!cir.ptr<i32>>
478
476
479
477
// Perform a volatile load from address in %0.
480
478
%4 = cir.load volatile %0 : !cir.ptr<i32>, i32
@@ -487,13 +485,11 @@ def LoadOp : CIR_Op<"load", [
487
485
OptionalAttr<MemOrder>:$mem_order);
488
486
let results = (outs CIR_AnyType:$result);
489
487
490
- // FIXME: we should not be printing `cir.ptr` below, that should come
491
- // from the pointer type directly.
492
488
let assemblyFormat = [{
493
489
(`deref` $isDeref^)?
494
490
(`volatile` $is_volatile^)?
495
491
(`atomic` `(` $mem_order^ `)`)?
496
- $addr `:` `cir.ptr` type($addr) `,` type($result) attr-dict
492
+ $addr `:` qualified( type($addr) ) `,` type($result) attr-dict
497
493
}];
498
494
499
495
// FIXME: add verifier.
@@ -532,12 +528,10 @@ def StoreOp : CIR_Op<"store", [
532
528
UnitAttr:$is_volatile,
533
529
OptionalAttr<MemOrder>:$mem_order);
534
530
535
- // FIXME: we should not be printing `cir.ptr` below, that should come
536
- // from the pointer type directly.
537
531
let assemblyFormat = [{
538
532
(`volatile` $is_volatile^)?
539
533
(`atomic` `(` $mem_order^ `)`)?
540
- $value `,` $addr attr-dict `:` type($value) `,` `cir.ptr` type($addr)
534
+ $value `,` $addr attr-dict `:` type($value) `,` qualified( type($addr) )
541
535
}];
542
536
543
537
// FIXME: add verifier.
@@ -999,7 +993,7 @@ def BinOp : CIR_Op<"binop", [Pure,
999
993
UnitAttr:$no_signed_wrap);
1000
994
1001
995
let assemblyFormat = [{
1002
- `(` $kind `,` $lhs `,` $rhs `)`
996
+ `(` $kind `,` $lhs `,` $rhs `)`
1003
997
(`nsw` $no_signed_wrap^)?
1004
998
(`nuw` $no_unsigned_wrap^)?
1005
999
`:` type($lhs) attr-dict
@@ -1871,11 +1865,9 @@ def GetGlobalOp : CIR_Op<"get_global",
1871
1865
let arguments = (ins FlatSymbolRefAttr:$name, UnitAttr:$tls);
1872
1866
let results = (outs Res<CIR_PointerType, "", []>:$addr);
1873
1867
1874
- // FIXME: we should not be printing `cir.ptr` below, that should come
1875
- // from the pointer type directly.
1876
1868
let assemblyFormat = [{
1877
1869
(`thread_local` $tls^)?
1878
- $name `:` `cir.ptr` type($addr) attr-dict
1870
+ $name `:` qualified( type($addr) ) attr-dict
1879
1871
}];
1880
1872
1881
1873
// `GetGlobalOp` is fully verified by its traits.
@@ -1904,7 +1896,7 @@ def VTableAddrPointOp : CIR_Op<"vtable.address_point",
1904
1896
```mlir
1905
1897
cir.global linkonce_odr @_ZTV1B = ...
1906
1898
...
1907
- %3 = cir.vtable.address_point(@_ZTV1B, vtable_index = 0, address_point_index = 2) : cir.ptr <!cir.ptr<() -> i32>>
1899
+ %3 = cir.vtable.address_point(@_ZTV1B, vtable_index = 0, address_point_index = 2) : ! cir.ptr<!cir.ptr<() -> i32>>
1908
1900
```
1909
1901
}];
1910
1902
@@ -1914,8 +1906,6 @@ def VTableAddrPointOp : CIR_Op<"vtable.address_point",
1914
1906
I32Attr:$address_point_index);
1915
1907
let results = (outs Res<CIR_PointerType, "", []>:$addr);
1916
1908
1917
- // FIXME: we should not be printing `cir.ptr` below, that should come
1918
- // from the pointer type directly.
1919
1909
let assemblyFormat = [{
1920
1910
`(`
1921
1911
($name^)?
@@ -1924,7 +1914,7 @@ def VTableAddrPointOp : CIR_Op<"vtable.address_point",
1924
1914
`vtable_index` `=` $vtable_index `,`
1925
1915
`address_point_index` `=` $address_point_index
1926
1916
`)`
1927
- `:` `cir.ptr` type($addr) attr-dict
1917
+ `:` qualified( type($addr) ) attr-dict
1928
1918
}];
1929
1919
1930
1920
let hasVerifier = 1;
@@ -1972,7 +1962,7 @@ def SetBitfieldOp : CIR_Op<"set_bitfield"> {
1972
1962
#bfi_d = #cir.bitfield_info<name = "d", storage_type = !u32i, size = 2, offset = 17, is_signed = true>
1973
1963
1974
1964
%1 = cir.const(#cir.int<3> : !s32i) : !s32i
1975
- %2 = cir.load %0 : cir.ptr <!cir.ptr<!struct_type>>, !cir.ptr<!struct_type>
1965
+ %2 = cir.load %0 : ! cir.ptr<!cir.ptr<!struct_type>>, !cir.ptr<!struct_type>
1976
1966
%3 = cir.get_member %2[1] {name = "d"} : !cir.ptr<!struct_type> -> !cir.ptr<!u32i>
1977
1967
%4 = cir.set_bitfield(#bfi_d, %3 : !cir.ptr<!u32i>, %1 : !s32i) -> !s32i
1978
1968
```
@@ -2051,7 +2041,7 @@ def GetBitfieldOp : CIR_Op<"get_bitfield"> {
2051
2041
!struct_type = !cir.struct<struct "S" {!cir.int<u, 32>, !cir.int<u, 32>, !cir.int<u, 16>} #cir.record.decl.ast>
2052
2042
#bfi_d = #cir.bitfield_info<name = "d", storage_type = !u32i, size = 2, offset = 17, is_signed = true>
2053
2043
2054
- %2 = cir.load %0 : cir.ptr <!cir.ptr<!struct_type>>, !cir.ptr<!struct_type>
2044
+ %2 = cir.load %0 : ! cir.ptr<!cir.ptr<!struct_type>>, !cir.ptr<!struct_type>
2055
2045
%3 = cir.get_member %2[1] {name = "d"} : !cir.ptr<!struct_type> -> !cir.ptr<!u32i>
2056
2046
%4 = cir.get_bitfield(#bfi_d, %3 : !cir.ptr<!u32i>) -> !s32i
2057
2047
```
@@ -2453,12 +2443,10 @@ def BaseClassAddrOp : CIR_Op<"base_class_addr"> {
2453
2443
2454
2444
let results = (outs Res<CIR_PointerType, "">:$base_addr);
2455
2445
2456
- // FIXME: we should not be printing `cir.ptr` below, that should come
2457
- // from the pointer type directly.
2458
2446
let assemblyFormat = [{
2459
2447
`(`
2460
- $derived_addr `:` `cir.ptr` type($derived_addr)
2461
- `)` `->` `cir.ptr` type($base_addr) attr-dict
2448
+ $derived_addr `:` qualified( type($derived_addr) )
2449
+ `)` `->` qualified( type($base_addr) ) attr-dict
2462
2450
}];
2463
2451
2464
2452
// FIXME: add verifier.
@@ -2761,7 +2749,7 @@ def TryCallOp : CIR_CallOp<"try_call"> {
2761
2749
2762
2750
```mlir
2763
2751
cir.try {
2764
- %0 = cir.alloca !cir.ptr<!cir.eh.info>, cir.ptr <!cir.ptr<!cir.eh.info>>
2752
+ %0 = cir.alloca !cir.ptr<!cir.eh.info>, ! cir.ptr<!cir.ptr<!cir.eh.info>>
2765
2753
...
2766
2754
%r = cir.try_call %exception(%0) @division(%1, %2)
2767
2755
} ...
@@ -3393,10 +3381,10 @@ def StackRestoreOp : CIR_Op<"stack_restore"> {
3393
3381
Useful for implementing language features like variable length arrays.
3394
3382
3395
3383
```mlir
3396
- %0 = cir.alloca !cir.ptr<!u8i>, cir.ptr <!cir.ptr<!u8i>>, ["saved_stack"] {alignment = 8 : i64}
3384
+ %0 = cir.alloca !cir.ptr<!u8i>, ! cir.ptr<!cir.ptr<!u8i>>, ["saved_stack"] {alignment = 8 : i64}
3397
3385
%1 = cir.stack_save : <!u8i>
3398
- cir.store %1, %0 : !cir.ptr<!u8i>, cir.ptr <!cir.ptr<!u8i>>
3399
- %2 = cir.load %0 : cir.ptr <!cir.ptr<!u8i>>, !cir.ptr<!u8i>
3386
+ cir.store %1, %0 : !cir.ptr<!u8i>, ! cir.ptr<!cir.ptr<!u8i>>
3387
+ %2 = cir.load %0 : ! cir.ptr<!cir.ptr<!u8i>>, !cir.ptr<!u8i>
3400
3388
cir.stack_restore %2 : !cir.ptr<!u8i>
3401
3389
```
3402
3390
}];
@@ -3419,16 +3407,16 @@ def CIR_InlineAsmOp : CIR_Op<"asm", [RecursiveMemoryEffects]> {
3419
3407
let description = [{
3420
3408
The `cir.asm` operation represents C/C++ asm inline.
3421
3409
3422
- CIR constraints strings follow barelly the same rules that are established
3423
- for the C level assembler constraints with several differences caused by
3424
- clang::AsmStmt processing.
3410
+ CIR constraints strings follow barelly the same rules that are established
3411
+ for the C level assembler constraints with several differences caused by
3412
+ clang::AsmStmt processing.
3425
3413
3426
3414
Thus, numbers that appears in the constraint string may also refer to:
3427
3415
- the output variable index referenced by the input operands.
3428
3416
- the index of early-clobber operand
3429
3417
3430
3418
Operand attributes is a storage, where each element corresponds to the operand with
3431
- the same index. The first index relates to the operation result (if any).
3419
+ the same index. The first index relates to the operation result (if any).
3432
3420
Note, the operands themselves are stored as VariadicOfVariadic in the next order:
3433
3421
output, input and then in/out operands.
3434
3422
@@ -3441,16 +3429,16 @@ def CIR_InlineAsmOp : CIR_Op<"asm", [RecursiveMemoryEffects]> {
3441
3429
__asm__("bar $42 %[val]" : [val] "=r" (x), "+&r"(x));
3442
3430
__asm__("baz $42 %[val]" : [val] "=r" (x), "+&r"(x) : "[val]"(y));
3443
3431
```
3444
-
3432
+
3445
3433
```mlir
3446
3434
!ty_22anon2E022 = !cir.struct<struct "anon.0" {!cir.int<s, 32>, !cir.int<s, 32>}>
3447
3435
!ty_22anon2E122 = !cir.struct<struct "anon.1" {!cir.int<s, 32>, !cir.int<s, 32>}>
3448
3436
...
3449
- %0 = cir.alloca !s32i, cir.ptr <!s32i>, ["x", init]
3450
- %1 = cir.alloca !s32i, cir.ptr <!s32i>, ["y", init]
3451
- ...
3452
- %2 = cir.load %0 : cir.ptr <!s32i>, !s32i
3453
- %3 = cir.load %1 : cir.ptr <!s32i>, !s32i
3437
+ %0 = cir.alloca !s32i, ! cir.ptr<!s32i>, ["x", init]
3438
+ %1 = cir.alloca !s32i, ! cir.ptr<!s32i>, ["y", init]
3439
+ ...
3440
+ %2 = cir.load %0 : ! cir.ptr<!s32i>, !s32i
3441
+ %3 = cir.load %1 : ! cir.ptr<!s32i>, !s32i
3454
3442
3455
3443
cir.asm(x86_att,
3456
3444
out = [],
@@ -3493,7 +3481,7 @@ def CIR_InlineAsmOp : CIR_Op<"asm", [RecursiveMemoryEffects]> {
3493
3481
"ArrayRef<Attribute>":$operand_attrs
3494
3482
)>
3495
3483
];
3496
-
3484
+
3497
3485
let hasCustomAssemblyFormat = 1;
3498
3486
}
3499
3487
0 commit comments