forked from llvm/circt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Handshake] Persist handshake.FuncOp argument names (llvm#2048)
This commit modifies the parsing of `handshake.func` operations to store the SSA argument names as a new attribute `argNames`. This attribute is then later used in `handshakeToFIRRTL` to guide argument naming. This, unfortunately, does not solve how to persist names from `standard`->`handshake` - a `builtin.func` does not persist parsed SSA names. For reference, these are discarded at this point: https://github.com/llvm/llvm-project/blob/main/mlir/lib/IR/BuiltinDialect.cpp#L116-L119 If provided, an `argNames` attribute set for a `builtin.func` will be copied to the `handshake.func` during `StandardToHandshake`.
- Loading branch information
Showing
8 changed files
with
101 additions
and
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// RUN: circt-opt -lower-handshake-to-firrtl %s | FileCheck %s | ||
|
||
// CHECK-LABEL: firrtl.module @main( | ||
// CHECK: in %a: !firrtl.bundle<valid: uint<1>, ready flip: uint<1>, data: uint<64>>, | ||
// CHECK: in %b: !firrtl.bundle<valid: uint<1>, ready flip: uint<1>, data: uint<64>>, | ||
// CHECK: in %ctrl: !firrtl.bundle<valid: uint<1>, ready flip: uint<1>>, | ||
// CHECK: out %arg3: !firrtl.bundle<valid: uint<1>, ready flip: uint<1>, data: uint<64>>, | ||
// CHECK: out %arg4: !firrtl.bundle<valid: uint<1>, ready flip: uint<1>>, | ||
// CHECK: in %clock: !firrtl.clock, | ||
// CHECK: in %reset: !firrtl.uint<1>) { | ||
handshake.func @main(%a: index, %b: index, %ctrl: none, ...) -> (index, none) { | ||
%0 = arith.addi %a, %b : index | ||
handshake.return %0, %ctrl : index, none | ||
} |
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,6 @@ | ||
// RUN: circt-opt -lower-std-to-handshake %s | FileCheck %s | ||
|
||
// CHECK-LABEL: handshake.func @main(%arg0: i32, %arg1: i32, %arg2: i32, %arg3: none, ...) -> none attributes {argNames = ["a", "b", "c"]} { | ||
func @main(%arg0 : i32, %b : i32, %c: i32) attributes {argNames = ["a", "b", "c"]} { | ||
return | ||
} |