Skip to content

Commit

Permalink
pc: Add (conditonal) branches, call and return.
Browse files Browse the repository at this point in the history
  • Loading branch information
surovic committed Jun 10, 2024
1 parent ef9db4a commit 0f32d58
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions include/patchestry/Dialect/Pcode/PcodeOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,40 @@ def IntSBorrowOp : BinOp< "int_sborrow" >;
def IntSLessOp : BinOp< "int_sless" >;
def IntAndOp : BinOp< "int_and" >;

def BranchOp
: Pcode_Op< "branch" >
, Arguments<( ins Builtin_Integer:$addr )>
{
let summary = "Pcode BRANCH operation";
let description = "TODO(surovic)";
let assemblyFormat = [{ $addr attr-dict `:` type(operands) }];
}

def CBranchOp
: Pcode_Op< "cbranch" >
, Arguments<( ins Builtin_Integer:$addr, Builtin_Integer:$cond )>
{
let summary = "Pcode CBRANCH operation";
let description = "TODO(surovic)";
let assemblyFormat = [{ $addr `,` $cond attr-dict `:` type(operands) }];
}

def CallOp
: Pcode_Op< "call" >
, Arguments<( ins Builtin_Integer:$addr )>
{
let summary = "Pcode CALL operation";
let description = "TODO(surovic)";
let assemblyFormat = [{ $addr attr-dict `:` type(operands) }];
}

def ReturnOp
: Pcode_Op< "return" >
, Arguments<( ins Builtin_Integer:$varnode )>
{
let summary = "Pcode RETURN operation";
let description = "TODO(surovic)";
let assemblyFormat = [{ $varnode attr-dict `:` type(operands) }];
}

#endif // PCODE_DIALECT_OPS

0 comments on commit 0f32d58

Please sign in to comment.