-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CIR][CIRGen] Refactor StructType builders (#294)
Instead of using a single builder for every possible StructType, we now have three builders: identified complete, identified incomplete, and anonymous struct types. This allows us to enforce correctness and to explicitly show the intent when creating a StructType. This patch also adds support for anonymous structs type aliases. When a StructType has no name, it will generate a `ty_anon_<kind>` alias. Conflicts are automatically resolved by MLIR.
- Loading branch information
1 parent
aa0018e
commit fbe08f3
Showing
11 changed files
with
114 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
// RUN: cir-opt %s -o %t.cir | ||
// RUN: FileCheck --input-file=%t.cir %s | ||
|
||
!s32i = !cir.int<s, 32> | ||
module { | ||
// CHECK: cir.func @shouldNotUseAliasWithAnonStruct(%arg0: !cir.struct<struct {!s32i}>) | ||
cir.func @shouldNotUseAliasWithAnonStruct(%arg0 : !cir.struct<struct {!s32i}>) { | ||
// CHECK: @testAnonRecordsAlias | ||
cir.func @testAnonRecordsAlias() { | ||
// CHECK: cir.alloca !ty_anon_struct, cir.ptr <!ty_anon_struct> | ||
%0 = cir.alloca !cir.struct<struct {!cir.int<s, 32>}>, cir.ptr <!cir.struct<struct {!cir.int<s, 32>}>>, ["A"] | ||
// CHECK: cir.alloca !ty_anon_struct1, cir.ptr <!ty_anon_struct1> | ||
%1 = cir.alloca !cir.struct<struct {!cir.int<u, 8>}>, cir.ptr <!cir.struct<struct {!cir.int<u, 8>}>>, ["B"] | ||
// CHECK: cir.alloca !ty_anon_union, cir.ptr <!ty_anon_union> | ||
%2 = cir.alloca !cir.struct<union {!cir.int<s, 32>}>, cir.ptr <!cir.struct<union {!cir.int<s, 32>}>>, ["C"] | ||
cir.return | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters