summaryrefslogtreecommitdiff
path: root/powerpc
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2014-01-01 17:36:48 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2014-01-01 17:36:48 +0000
commit25c616a17851ae5c61fa15ccbeba0e3efb8f3365 (patch)
treeff6c0c133dedfaba11b741d865e216c2383acb2c /powerpc
parentc5ca995063b270c0e0b0f4df04c68ae431c869fd (diff)
powerpc: bad use of GPR0 in va_start.
arm: typo. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2396 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'powerpc')
-rw-r--r--powerpc/PrintAsm.ml15
1 files changed, 9 insertions, 6 deletions
diff --git a/powerpc/PrintAsm.ml b/powerpc/PrintAsm.ml
index 4aa88e8..310a733 100644
--- a/powerpc/PrintAsm.ml
+++ b/powerpc/PrintAsm.ml
@@ -503,6 +503,7 @@ let print_builtin_vstore_global oc chunk id ofs args =
(* Handling of varargs *)
+let current_function_stacksize = ref 0l
let current_function_sig =
ref { sig_args = []; sig_res = None; sig_cc = cc_default }
@@ -533,11 +534,12 @@ let print_builtin_va_start oc r =
fprintf oc " stb %a, 0(%a)\n" ireg GPR0 ireg r;
fprintf oc " li %a, %d\n" ireg GPR0 fr;
fprintf oc " stb %a, 1(%a)\n" ireg GPR0 ireg r;
- fprintf oc " lwz %a, 0(%a)\n" ireg GPR0 ireg GPR1;
- fprintf oc " addi %a, %a, -96\n" ireg GPR0 ireg GPR0;
- fprintf oc " stw %a, 8(%a)\n" ireg GPR0 ireg r;
- fprintf oc " addi %a, %a, %d\n" ireg GPR0 ireg GPR0 (96 + 8 + ofs);
- fprintf oc " stw %a, 4(%a)\n" ireg GPR0 ireg r
+ fprintf oc " addi %a, %a, %ld\n" ireg GPR0 ireg GPR1
+ Int32.(add !current_function_stacksize 8l);
+ fprintf oc " stw %a, 4(%a)\n" ireg GPR0 ireg r;
+ fprintf oc " addi %a, %a, %ld\n" ireg GPR0 ireg GPR1
+ Int32.(sub !current_function_stacksize 96l);
+ fprintf oc " stw %a, 8(%a)\n" ireg GPR0 ireg r
(* Handling of compiler-inlined builtins *)
@@ -709,7 +711,8 @@ let print_instruction oc tbl pc fallthrough = function
fprintf oc " mflr %a\n" ireg GPR0;
fprintf oc " blr __compcert_va_saveregs\n";
fprintf oc " mtlr %a\n" ireg GPR0
- end
+ end;
+ current_function_stacksize := sz
| Pand_(r1, r2, r3) ->
fprintf oc " and. %a, %a, %a\n" ireg r1 ireg r2 ireg r3
| Pandc(r1, r2, r3) ->