@@ -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.
@@ -2752,7 +2740,7 @@ def TryCallOp : CIR_CallOp<"try_call"> {
2752
2740
2753
2741
```mlir
2754
2742
cir.try {
2755
- %0 = cir.alloca !cir.ptr<!cir.eh.info>, cir.ptr <!cir.ptr<!cir.eh.info>>
2743
+ %0 = cir.alloca !cir.ptr<!cir.eh.info>, ! cir.ptr<!cir.ptr<!cir.eh.info>>
2756
2744
...
2757
2745
%r = cir.try_call %exception(%0) @division(%1, %2)
2758
2746
} ...
@@ -3384,10 +3372,10 @@ def StackRestoreOp : CIR_Op<"stack_restore"> {
3384
3372
Useful for implementing language features like variable length arrays.
3385
3373
3386
3374
```mlir
3387
- %0 = cir.alloca !cir.ptr<!u8i>, cir.ptr <!cir.ptr<!u8i>>, ["saved_stack"] {alignment = 8 : i64}
3375
+ %0 = cir.alloca !cir.ptr<!u8i>, ! cir.ptr<!cir.ptr<!u8i>>, ["saved_stack"] {alignment = 8 : i64}
3388
3376
%1 = cir.stack_save : <!u8i>
3389
- cir.store %1, %0 : !cir.ptr<!u8i>, cir.ptr <!cir.ptr<!u8i>>
3390
- %2 = cir.load %0 : cir.ptr <!cir.ptr<!u8i>>, !cir.ptr<!u8i>
3377
+ cir.store %1, %0 : !cir.ptr<!u8i>, ! cir.ptr<!cir.ptr<!u8i>>
3378
+ %2 = cir.load %0 : ! cir.ptr<!cir.ptr<!u8i>>, !cir.ptr<!u8i>
3391
3379
cir.stack_restore %2 : !cir.ptr<!u8i>
3392
3380
```
3393
3381
}];
@@ -3410,16 +3398,16 @@ def CIR_InlineAsmOp : CIR_Op<"asm", [RecursiveMemoryEffects]> {
3410
3398
let description = [{
3411
3399
The `cir.asm` operation represents C/C++ asm inline.
3412
3400
3413
- CIR constraints strings follow barelly the same rules that are established
3414
- for the C level assembler constraints with several differences caused by
3415
- clang::AsmStmt processing.
3401
+ CIR constraints strings follow barelly the same rules that are established
3402
+ for the C level assembler constraints with several differences caused by
3403
+ clang::AsmStmt processing.
3416
3404
3417
3405
Thus, numbers that appears in the constraint string may also refer to:
3418
3406
- the output variable index referenced by the input operands.
3419
3407
- the index of early-clobber operand
3420
3408
3421
3409
Operand attributes is a storage, where each element corresponds to the operand with
3422
- the same index. The first index relates to the operation result (if any).
3410
+ the same index. The first index relates to the operation result (if any).
3423
3411
Note, the operands themselves are stored as VariadicOfVariadic in the next order:
3424
3412
output, input and then in/out operands.
3425
3413
@@ -3432,16 +3420,16 @@ def CIR_InlineAsmOp : CIR_Op<"asm", [RecursiveMemoryEffects]> {
3432
3420
__asm__("bar $42 %[val]" : [val] "=r" (x), "+&r"(x));
3433
3421
__asm__("baz $42 %[val]" : [val] "=r" (x), "+&r"(x) : "[val]"(y));
3434
3422
```
3435
-
3423
+
3436
3424
```mlir
3437
3425
!ty_22anon2E022 = !cir.struct<struct "anon.0" {!cir.int<s, 32>, !cir.int<s, 32>}>
3438
3426
!ty_22anon2E122 = !cir.struct<struct "anon.1" {!cir.int<s, 32>, !cir.int<s, 32>}>
3439
3427
...
3440
- %0 = cir.alloca !s32i, cir.ptr <!s32i>, ["x", init]
3441
- %1 = cir.alloca !s32i, cir.ptr <!s32i>, ["y", init]
3442
- ...
3443
- %2 = cir.load %0 : cir.ptr <!s32i>, !s32i
3444
- %3 = cir.load %1 : cir.ptr <!s32i>, !s32i
3428
+ %0 = cir.alloca !s32i, ! cir.ptr<!s32i>, ["x", init]
3429
+ %1 = cir.alloca !s32i, ! cir.ptr<!s32i>, ["y", init]
3430
+ ...
3431
+ %2 = cir.load %0 : ! cir.ptr<!s32i>, !s32i
3432
+ %3 = cir.load %1 : ! cir.ptr<!s32i>, !s32i
3445
3433
3446
3434
cir.asm(x86_att,
3447
3435
out = [],
@@ -3484,7 +3472,7 @@ def CIR_InlineAsmOp : CIR_Op<"asm", [RecursiveMemoryEffects]> {
3484
3472
"ArrayRef<Attribute>":$operand_attrs
3485
3473
)>
3486
3474
];
3487
-
3475
+
3488
3476
let hasCustomAssemblyFormat = 1;
3489
3477
}
3490
3478
0 commit comments