Skip to content

Commit

Permalink
abi: Improve assembly formats.
Browse files Browse the repository at this point in the history
  • Loading branch information
lkorenc authored and xlauko committed Oct 24, 2023
1 parent 0ffaff9 commit 0b3f798
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion include/vast/Dialect/ABI/ABIOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ def DirectOp
{
let summary = "Pass value directly - usually means by register";
let description = [{ Pass value directly - usually means by register. }];

let assemblyFormat = [{ $value attr-dict `:` type($value) `->` type($result) }];
}

def RetDirectOp
Expand All @@ -25,6 +27,8 @@ def RetDirectOp
{
let summary = "Value is returned directly.";
let description = [{ Value is returned directly. }];

let assemblyFormat = [{ $value attr-dict `:` type($value) `->` type($result) }];
}

def TodoOp
Expand All @@ -34,6 +38,8 @@ def TodoOp
{
let summary = "Not implement yet.";
let description = [{ Not implemented yet }];

let assemblyFormat = [{ $value attr-dict `:` type($value) `->` type($result) }];
}


Expand All @@ -50,6 +56,8 @@ class HasBody< string mnemonic >
CArg< "BuilderCallback", "std::nullopt" >:$bodyBuilder
)>
];

let assemblyFormat = [{ $body attr-dict `:` type($results) }];
}

def PrologueOp : HasBody< "prologue" >
Expand Down Expand Up @@ -95,7 +103,11 @@ def CallExecutionOp
CArg<"mlir::ValueRange", "{}">:$operands,
CArg< "BuilderCallback", "std::nullopt" >:$bodyBuilder)
>
];
];

let assemblyFormat = [{
$callee `(` $args `)` $body attr-dict `:` functional-type($args, $result)
}];
}

def YieldOp
Expand All @@ -105,6 +117,8 @@ def YieldOp
{
let summary = "WIP";
let description = [{ WIP }];

let assemblyFormat = [{ $values attr-dict `:` type($values) `->` type($result) }];
}


Expand All @@ -128,6 +142,10 @@ def CallOp
$_state.addAttribute("callee", mlir::SymbolRefAttr::get($_builder.getContext(), callee));
$_state.addTypes(results);
}]>];

let assemblyFormat = [{
$callee `(` $args `)` attr-dict `:` functional-type( $args, $results )
}];
}

// TODO(abi): This is mostly copy & paste of hl.func. Once ABI dialect is stable,
Expand Down

0 comments on commit 0b3f798

Please sign in to comment.