diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2001-04-02 08:14:51 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2001-04-02 08:14:51 +0000 |
commit | c16439d28666234ad1067732d3db9491efc7dc5e (patch) | |
tree | 8b6e5ba4d9a5e5434a1caceb38ad8f8f3cc698ae /asmcomp/arm | |
parent | e7d2a4ed93405ebfa619997264e2110b55fe7374 (diff) | |
download | ocaml-c16439d28666234ad1067732d3db9491efc7dc5e.tar.gz |
Suite revision immediats entiers (PR#327,#328)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3482 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'asmcomp/arm')
-rw-r--r-- | asmcomp/arm/emit.mlp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/asmcomp/arm/emit.mlp b/asmcomp/arm/emit.mlp index f490941d1d..88be03ce72 100644 --- a/asmcomp/arm/emit.mlp +++ b/asmcomp/arm/emit.mlp @@ -216,16 +216,17 @@ let emit_complex_intconst r n = (* Adjust sp (up or down) by the given byte amount *) let emit_stack_adjustment instr n = - decompose_intconst (Nativeint.of_int n) - (fun bits -> - ` {emit_string instr} sp, sp, #{emit_nativeint !bits}\n`) + if n <= 0 then 0 else + decompose_intconst (Nativeint.of_int n) + (fun bits -> + ` {emit_string instr} sp, sp, #{emit_nativeint bits}\n`) (* Adjust alloc_ptr down by the given byte amount *) let emit_alloc_decrement n = decompose_intconst (Nativeint.of_int n) (fun bits -> - ` sub alloc_ptr, alloc_ptr, #{emit_nativeint !bits}\n`) + ` sub alloc_ptr, alloc_ptr, #{emit_nativeint bits}\n`) (* Name of current function *) let function_name = ref "" @@ -323,8 +324,7 @@ let emit_instr i = let n = frame_size() in if !contains_calls then ` ldr lr, [sp, #{emit_int (n-4)}]\n`; - if n > 0 then - ` add sp, sp, #{emit_int n}\n`; + ignore (emit_stack_adjustment "add" n); ` mov pc, {emit_reg i.arg.(0)}\n`; 3 | Lop(Itailcall_imm s) -> if s = !function_name then begin @@ -333,8 +333,7 @@ let emit_instr i = let n = frame_size() in if !contains_calls then ` ldr lr, [sp, #{emit_int (n-4)}]\n`; - if n > 0 then - ` add sp, sp, #{emit_int n}\n`; + ignore (emit_stack_adjustment "add" n); ` b {emit_symbol s}\n`; 3 end | Lop(Iextcall(s, alloc)) -> @@ -480,8 +479,7 @@ let emit_instr i = ` ldr lr, [sp, #{emit_int(n-4)}]\n`; 1 | Lreturn -> let n = frame_size() in - if n > 0 then - ` add sp, sp, #{emit_int n}\n`; + ignore(emit_stack_adjustment "add" n); ` mov pc, lr\n`; 2 | Llabel lbl -> `{emit_label lbl}:\n`; 0 @@ -598,8 +596,7 @@ let fundecl fundecl = ` .global {emit_symbol fundecl.fun_name}\n`; `{emit_symbol fundecl.fun_name}:\n`; let n = frame_size() in - if n > 0 then - ` sub sp, sp, #{emit_int n}\n`; + ignore(emit_stack_adjustment "sub" n); if !contains_calls then ` str lr, [sp, #{emit_int(n - 4)}]\n`; `{emit_label !tailrec_entry_point}:\n`; |