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

fixes arm predication #1426

Merged
merged 1 commit into from
Feb 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/arm/arm_utils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ let exec
| Some f, Some (`Reg `CPSR) -> stmts @ f
| _ -> stmts in
(* generates an expression for the given McCond *)
let set_cond mccond =
let set_cond cond =
let z = Bil.var Env.zf in
let c = Bil.var Env.cf in
let v = Bil.var Env.vf in
Expand All @@ -81,8 +81,9 @@ let exec
match cond with
| `AL -> stmts
| _ when List.for_all stmts ~f:is_move ->
let cond = set_cond cond in
List.map stmts ~f:(function
let cval = set_cond cond and cvar = tmp bool_t in
let cond = Bil.var cvar in
Bil.(cvar := cval) :: List.map stmts ~f:(function
| Bil.Move (v,_) as s when Var.is_virtual v -> s
| Bil.Move (v,x) ->
Bil.(v := ite ~if_:cond ~then_:x ~else_:(var v))
Expand Down