Fix rbp to rsp switch

Use rsp+16, because we'll pop the saved rbp from the stack just after
This commit is contained in:
Théophile Bastian 2019-04-02 18:36:34 +02:00
parent 180e32a4b3
commit 30fe23b541
1 changed files with 7 additions and 4 deletions

View File

@ -255,10 +255,13 @@ let process_def (local_state: block_local_state) def (cur_reg: reg_pos)
(* Assume we are overwriting %rbp with something — we must revert to (* Assume we are overwriting %rbp with something — we must revert to
some rsp-based indexing *) some rsp-based indexing *)
(* FIXME don't assume the rsp offset will always be 8, find a smart way (* FIXME don't assume the rsp offset will always be 8, find a smart way
to figure this out *) to figure this out.
Some (RspOffset(Int64.of_int 8)) We actually use offset 16 because the `pop` will occur after the
| _ -> None) value is read from the stack.
in *)
Some (RspOffset(Int64.of_int 16))
| _ -> None
) in
let is_rbp_save_expr expr local_state = let is_rbp_save_expr expr local_state =
let free_vars = BStd.Exp.free_vars expr in let free_vars = BStd.Exp.free_vars expr in