From 0f32d582a5094b3dbabaa3b91e7c89404bdab23e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Surovi=C4=8D?= Date: Mon, 10 Jun 2024 19:36:38 +0200 Subject: [PATCH] pc: Add (conditonal) branches, call and return. --- include/patchestry/Dialect/Pcode/PcodeOps.td | 36 ++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/include/patchestry/Dialect/Pcode/PcodeOps.td b/include/patchestry/Dialect/Pcode/PcodeOps.td index 6ae8596..92f983e 100644 --- a/include/patchestry/Dialect/Pcode/PcodeOps.td +++ b/include/patchestry/Dialect/Pcode/PcodeOps.td @@ -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