Skip to content

Commit

Permalink
hl: Don't use condop base for ChooseExpr.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jezurko authored and xlauko committed Sep 4, 2024
1 parent f6d12ec commit 126561b
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions include/vast/Dialect/HighLevel/HighLevelCF.td
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,33 @@ def HighLevel_CondOp : HighLevel_CondOpBase< "cond" > {
let summary = "VAST conditional statement";
}

def HighLevel_ChooseExprOp : HighLevel_CondOpBase< "choose_expr" > {
def HighLevel_ChooseExprOp : HighLevel_ControlFlowOp< "choose_expr" >
, Arguments<(ins OptionalAttr< BoolAttr >:$condTrue)>
, Results<(outs AnyType:$result)>
{
let summary = "Representation of GNU __builtin_choose_expr";

let arguments = (ins OptionalAttr< BoolAttr >:$condTrue);
let description = [{
The operation takes builders of three regions -- condition, true branch and false branch.
Builders, given the location, build a particular region.

The generic form of the operation is as follows:

hl.cond {
... /* condition region */
hl.cond.yield %cond : !hl.bool
} ? {
... /* true region */
} : {
... /* false region */
}
}];

// ChooseExpr can have different types.
// Often used as __builtin_choose_expr(static_cond, 1, (void)0)
let hasRegionVerifier = 0;
let regions = (region
Core_CondRegion:$condRegion,
Core_ValueRegion:$thenRegion,
Core_ValueRegion:$elseRegion
);

let skipDefaultBuilders = 1;
let builders = [
Expand Down

0 comments on commit 126561b

Please sign in to comment.