-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CIR][IR] Refactor ScopeOp assembly format
This simplifies and modularizes the assembly format for ScopeOp by using the Tablegen assembly description and a new custom printer/parser that handles regions with omitted terminators. It also fixes an issue where the parser would not correctly handle `cir.scopes` with a return value. ghstack-source-id: c5b9be705113c21117363cb3bd78e19d133c3fc5 Pull Request resolved: #311
- Loading branch information
1 parent
1c2433c
commit 5537ef8
Showing
3 changed files
with
54 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// RUN: cir-opt %s -o %t.cir | ||
// RUN: FileCheck --input-file=%t.cir %s | ||
!u32i = !cir.int<u, 32> | ||
|
||
module { | ||
// Should properly print/parse scope with implicit empty yield. | ||
cir.func @implicit_yield() { | ||
cir.scope { | ||
} | ||
// CHECK: cir.scope { | ||
// CHECK: } | ||
cir.return | ||
} | ||
|
||
// Should properly print/parse scope with explicit yield. | ||
cir.func @explicit_yield() { | ||
%0 = cir.scope { | ||
%1 = cir.alloca !u32i, cir.ptr <!u32i>, ["a", init] {alignment = 4 : i64} | ||
cir.yield %1 : !cir.ptr<!u32i> | ||
} : !cir.ptr<!u32i> | ||
// CHECK: %0 = cir.scope { | ||
// [...] | ||
// CHECK: cir.yield %1 : !cir.ptr<!u32i> | ||
// CHECK: } : !cir.ptr<!u32i> | ||
cir.return | ||
} | ||
} |