Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frontend fixes to support CAS #284

Closed
wants to merge 2 commits into from
Closed

frontend fixes to support CAS #284

wants to merge 2 commits into from

Conversation

ailrst
Copy link
Contributor

@ailrst ailrst commented Dec 10, 2024

  • fix bug: requiring all symbol table entries to have an address
  • frontend: allow loads in binary expressions and branch conditions to support CAS instruction
  • frontend (gtirb): wip; support AtomicStart and AtomicEnd intrinsics, split blocks into multiple across call boundaries

addresses #281

@ailrst ailrst changed the title frontend fixes to support CAS #281 frontend fixes to support CAS Dec 10, 2024
- fix bug: requiring all symbol table entries to have an address
- frontend: allow loads in binary expressions and branch conditions to support CAS instruction
- frontend (gtirb): support AtomicStart and AtomicEnd intrinsics: split blocks containing calls
                    into multiple that each may end in a call
@ailrst ailrst marked this pull request as draft December 10, 2024 07:27
@ailrst
Copy link
Contributor Author

ailrst commented Dec 10, 2024

Gtirb frontend needs more effort since it assumes Stmt_If statements are genuine control flow jumps with corresponding edges in the gtirb, but CAS produces purely semantic ifs in the middle of the statement list;

          "semantics": [
            "Stmt_TCall(\"AtomicStart.0\",[],[])",
            "Stmt_ConstDecl(Type_Bits(32),\"Exp16__6\",Expr_TApply(\"Mem.read.0\",[4],[Expr_Array(Expr_Var(\"_R\"),3);4;9]))",
            "Stmt_If(Expr_TApply(\"eq_bits.0\",[32],[Expr_TApply(\"Mem.read.0\",[4],[Expr_Array(Expr_Var(\"_R\"),3);4;9]);Expr_Slices(Expr_Array(Expr_Var(\"_R\"),0),[Slice_LoWd(0,32
)])]),[\nStmt_TCall(\"Mem.set.0\",[4],[Expr_Array(Expr_Var(\"_R\"),3);4;9;Expr_Slices(Expr_Array(Expr_Var(\"_R\"),4),[Slice_LoWd(0,32)])])\n],[],[])",
            "Stmt_TCall(\"AtomicEnd.0\",[],[])",
            "Stmt_Assign(LExpr_Array(LExpr_Var(\"_R\"),0),Expr_TApply(\"ZeroExtend.0\",[32;64],[Expr_Var(\"Exp16__6\");64]))"
          ]

@l-kent
Copy link
Contributor

l-kent commented Dec 11, 2024

since it assumes Stmt_If statements are genuine control flow jumps with corresponding edges in the gtirb, but CAS produces purely semantic ifs

There is no difference, BASIL does not assume that a Stmt_If is a 'genuine' control flow jump, it's just that splitting it into blocks is necessary to represent it accurately. See the cset instruction for another case where this happens.

@ailrst
Copy link
Contributor Author

ailrst commented Dec 11, 2024

You are right, but in this case the TempIf is not cleaned up and converted to a jump

@l-kent
Copy link
Contributor

l-kent commented Dec 11, 2024

The TempIf being converted into a jump is what is supposed to happen in this sort of case?

@ailrst
Copy link
Contributor Author

ailrst commented Dec 11, 2024

it is not converted to a jump

@ailrst ailrst closed this Dec 11, 2024
@ailrst ailrst deleted the cas-fixes-281 branch December 11, 2024 03:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants