Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions clang/include/clang/CIR/Dialect/IR/CIRAttrs.td
Original file line number Diff line number Diff line change
Expand Up @@ -608,9 +608,9 @@ def DataMemberAttr : CIR_Attr<"DataMember", "data_member",

Example:
```
#ptr = #cir.data_member<1> : !cir.data_member<!s32i in !ty_22Point22>
#ptr = #cir.data_member<1> : !cir.data_member<!s32i in !rec_22Point22>

#null = #cir.data_member<null> : !cir.data_member<!s32i in !ty_22Point22>
#null = #cir.data_member<null> : !cir.data_member<!s32i in !rec_22Point22>
```
}];

Expand Down
22 changes: 11 additions & 11 deletions clang/include/clang/CIR/Dialect/IR/CIROps.td
Original file line number Diff line number Diff line change
Expand Up @@ -2640,7 +2640,7 @@ def VTTAddrPointOp : CIR_Op<"vtt.address_point",
```mlir
cir.global linkonce_odr @_ZTV1B = ...
...
%3 = cir.base_class_addr(%1 : !cir.ptr<!ty_D> nonnull) [0] -> !cir.ptr<!ty_B>
%3 = cir.base_class_addr(%1 : !cir.ptr<!rec_D> nonnull) [0] -> !cir.ptr<!rec_B>
%4 = cir.vtt.address_point @_ZTT1D, offset = 1 -> !cir.ptr<!cir.ptr<!void>>
cir.call @_ZN1BC2Ev(%3, %4)
```
Expand Down Expand Up @@ -3369,7 +3369,7 @@ def BaseClassAddrOp : CIR_Op<"base_class_addr"> {
```
will generate
```mlir
%3 = cir.base_class_addr (%1 : !cir.ptr<!ty_Derived> nonnull) [0] -> !cir.ptr<!ty_Base>
%3 = cir.base_class_addr (%1 : !cir.ptr<!rec_Derived> nonnull) [0] -> !cir.ptr<!rec_Base>
```
}];

Expand Down Expand Up @@ -3420,9 +3420,9 @@ def DerivedClassAddrOp : CIR_Op<"derived_class_addr"> {

leads to
```mlir
%2 = cir.load %0 : !cir.ptr<!cir.ptr<!ty_B>>, !cir.ptr<!ty_B>
%3 = cir.derived_class_addr(%2 : !cir.ptr<!ty_B> nonnull) [4] -> !cir.ptr<!ty_X>
%4 = cir.base_class_addr(%3 : !cir.ptr<!ty_X>) [0] -> !cir.ptr<!ty_A>
%2 = cir.load %0 : !cir.ptr<!cir.ptr<!rec_B>>, !cir.ptr<!rec_B>
%3 = cir.derived_class_addr(%2 : !cir.ptr<!rec_B> nonnull) [4] -> !cir.ptr<!rec_X>
%4 = cir.base_class_addr(%3 : !cir.ptr<!rec_X>) [0] -> !cir.ptr<!rec_A>
cir.return %4
```
}];
Expand Down Expand Up @@ -3519,7 +3519,7 @@ def BaseMethodOp : CIR_Op<"base_method", [Pure]> {
Example:

```mlir
%1 = cir.base_method(%0 : !cir.method<!cir.func<(!s32i)> in !ty_Derived>) [16] -> !cir.method<!cir.func<(!s32i)> in !ty_Base>
%1 = cir.base_method(%0 : !cir.method<!cir.func<(!s32i)> in !rec_Derived>) [16] -> !cir.method<!cir.func<(!s32i)> in !rec_Base>
```
}];

Expand Down Expand Up @@ -3551,7 +3551,7 @@ def DerivedMethodOp : CIR_Op<"derived_method", [Pure]> {
Example:

```mlir
%1 = cir.derived_method(%0 : !cir.method<!cir.func<(!s32i)> in !ty_Base>) [16] -> !cir.method<!cir.func<(!s32i)> in !ty_Derived>
%1 = cir.derived_method(%0 : !cir.method<!cir.func<(!s32i)> in !rec_Base>) [16] -> !cir.method<!cir.func<(!s32i)> in !rec_Derived>
```
}];

Expand Down Expand Up @@ -5190,8 +5190,8 @@ def CIR_InlineAsmOp : CIR_Op<"asm", [RecursiveMemoryEffects]> {
```

```mlir
!ty_22anon2E022 = !cir.record<struct "anon.0" {!cir.int<s, 32>, !cir.int<s, 32>}>
!ty_22anon2E122 = !cir.record<struct "anon.1" {!cir.int<s, 32>, !cir.int<s, 32>}>
!rec_22anon2E022 = !cir.record<struct "anon.0" {!cir.int<s, 32>, !cir.int<s, 32>}>
!rec_22anon2E122 = !cir.record<struct "anon.1" {!cir.int<s, 32>, !cir.int<s, 32>}>
...
%0 = cir.alloca !s32i, !cir.ptr<!s32i>, ["x", init]
%1 = cir.alloca !s32i, !cir.ptr<!s32i>, ["y", init]
Expand All @@ -5209,13 +5209,13 @@ def CIR_InlineAsmOp : CIR_Op<"asm", [RecursiveMemoryEffects]> {
out = [],
in = [],
in_out = [%2 : !s32i],
{"bar $$42 $0" "=r,=&r,1,~{dirflag},~{fpsr},~{flags}"}) -> !ty_22anon2E022
{"bar $$42 $0" "=r,=&r,1,~{dirflag},~{fpsr},~{flags}"}) -> !rec_22anon2E022

cir.asm(x86_att,
out = [],
in = [%3 : !s32i],
in_out = [%2 : !s32i],
{"baz $$42 $0" "=r,=&r,0,1,~{dirflag},~{fpsr},~{flags}"}) -> !ty_22anon2E122
{"baz $$42 $0" "=r,=&r,0,1,~{dirflag},~{fpsr},~{flags}"}) -> !rec_22anon2E122
```
}];

Expand Down
4 changes: 2 additions & 2 deletions clang/include/clang/CIR/Dialect/IR/CIRTBAAAttrs.td
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def CIR_TBAAMemberAttr : CIR_Attr<"TBAAMember", "tbaa_member", []> {

Example:
```mlir
!ty_StructS = !cir.record<struct "StructS" {!u16i, !u32i} #cir.record.decl.ast>
!rec_StructS = !cir.record<struct "StructS" {!u16i, !u32i} #cir.record.decl.ast>
#tbaa_scalar = #cir.tbaa_scalar<id = "int", type = !s32i>
#tbaa_scalar1 = #cir.tbaa_scalar<id = "short", type = !s16i>
#tbaa_struct = #cir.tbaa_struct<id = "_ZTS7StructS", members = {<#tbaa_scalar1, 0>, <#tbaa_scalar, 4>}>
Expand Down Expand Up @@ -135,7 +135,7 @@ def CIR_TBAAStructAttr : CIR_Attr<"TBAAStruct",

Example:
```mlir
!ty_StructS = !cir.record<struct "StructS" {!u16i, !u32i} #cir.record.decl.ast>
!rec_StructS = !cir.record<struct "StructS" {!u16i, !u32i} #cir.record.decl.ast>
#tbaa_scalar = #cir.tbaa_scalar<id = "int", type = !s32i>
#tbaa_scalar1 = #cir.tbaa_scalar<id = "short", type = !s16i>
// CIR_TBAAStructAttr
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/CIR/Dialect/IR/CIRDialect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ struct CIROpAsmDialectInterface : public OpAsmDialectInterface {
if (auto recordType = dyn_cast<cir::RecordType>(type)) {
StringAttr nameAttr = recordType.getName();
if (!nameAttr)
os << "ty_anon_" << recordType.getKindAsStr();
os << "rec_anon_" << recordType.getKindAsStr();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not to do in this patch, but we discussed making this an 'assert' at one point, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. I was going to do that separately.

else
os << "ty_" << nameAttr.getValue();
os << "rec_" << nameAttr.getValue();
return AliasResult::OverridableAlias;
}
if (auto intType = dyn_cast<cir::IntType>(type)) {
Expand Down
Loading
Loading