diff options
author | Cyril SIX <cyril.six@kalray.eu> | 2019-03-12 10:52:04 +0100 |
---|---|---|
committer | Cyril SIX <cyril.six@kalray.eu> | 2019-03-12 10:52:04 +0100 |
commit | e61f9334e0a964e358e93b94d5b24cf8d88e877a (patch) | |
tree | 7998867fb02a115a0071d10ab1b4cab9be067e83 /mppa_k1c | |
parent | a64e80432cf2222a84503f4202c04cfdbf705d27 (diff) | |
download | compcert-kvx-e61f9334e0a964e358e93b94d5b24cf8d88e877a.tar.gz compcert-kvx-e61f9334e0a964e358e93b94d5b24cf8d88e877a.zip |
Fix for frame pointer being destroyed
Diffstat (limited to 'mppa_k1c')
-rw-r--r-- | mppa_k1c/Asmexpand.ml | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/mppa_k1c/Asmexpand.ml b/mppa_k1c/Asmexpand.ml index 9afe61b8..cd6cf1ec 100644 --- a/mppa_k1c/Asmexpand.ml +++ b/mppa_k1c/Asmexpand.ml @@ -52,6 +52,8 @@ let expand_addptrofs dst src n = List.iter emit (basic_to_instruction (Asmblock.PArith (Asmblockgen.addptrofs dst src n)) :: []) let expand_storeind_ptr src base ofs = List.iter emit (basic_to_instruction (Asmblockgen.storeind_ptr src base ofs) :: []) +let expand_loadind_ptr dst base ofs = + List.iter emit (basic_to_instruction (Asmblockgen.loadind_ptr base ofs dst) :: []) (* Built-ins. They come in two flavors: - annotation statements: take their arguments in registers or stack @@ -399,14 +401,15 @@ let expand_instruction instr = match instr with | Pallocframe (sz, ofs) -> let sg = get_current_function_sig() in - emit (Pmv (Asmblock.GPR14, stack_pointer)); if sg.sig_cc.cc_vararg then begin let n = arguments_size sg in let extra_sz = if n >= _nbregargs_ then 0 else (* align _alignment_ *) ((_nbregargs_ - n) * wordsize) in - let full_sz = Z.add sz (Z.of_uint extra_sz) in - expand_addptrofs stack_pointer stack_pointer (Ptrofs.repr (Z.neg full_sz)); - emit Psemi; - expand_storeind_ptr Asmblock.GPR14 stack_pointer ofs; + let full_sz = Z.add sz (Z.of_uint extra_sz) in begin + expand_addptrofs stack_pointer stack_pointer (Ptrofs.repr (Z.neg full_sz)); + emit Psemi; + expand_storeind_ptr Asmblock.GPR14 stack_pointer ofs; + expand_addptrofs Asmblock.GPR14 stack_pointer (Ptrofs.repr full_sz) + end; emit Psemi; let va_ofs = sz in @@ -417,6 +420,7 @@ let expand_instruction instr = expand_addptrofs stack_pointer stack_pointer (Ptrofs.repr (Z.neg sz)); emit Psemi; expand_storeind_ptr Asmblock.GPR14 stack_pointer ofs; + expand_addptrofs Asmblock.GPR14 stack_pointer (Ptrofs.repr sz); emit Psemi; vararg_start_ofs := None end @@ -427,6 +431,7 @@ let expand_instruction instr = let n = arguments_size sg in if n >= _nbregargs_ then 0 else (* align _alignment_ *) ((_nbregargs_ - n) * wordsize) end else 0 in + expand_loadind_ptr Asmblock.GPR14 stack_pointer ofs; expand_addptrofs stack_pointer stack_pointer (Ptrofs.repr (Z.add sz (Z.of_uint extra_sz))) (*| Pseqw(rd, rs1, rs2) -> |