aboutsummaryrefslogtreecommitdiffstats
path: root/arm/TargetPrinter.ml
diff options
context:
space:
mode:
authorMichael Schmidt <github@mschmidt.me>2017-08-02 14:26:16 +0200
committerMichael Schmidt <github@mschmidt.me>2017-08-02 14:26:16 +0200
commit9f6e2aac73ca1f863d236f86f446b0894c8ebcef (patch)
treed87b9b562eb83f7ea36b7deb97289839f59b2331 /arm/TargetPrinter.ml
parent0aa08f5d521401644b5c839239de97f587e0a217 (diff)
downloadcompcert-kvx-9f6e2aac73ca1f863d236f86f446b0894c8ebcef.tar.gz
compcert-kvx-9f6e2aac73ca1f863d236f86f446b0894c8ebcef.zip
Improve stack offset addressing
Functions which require large amounts of stack for spilling and/or arguments for function calls lead to stackframe offsets that exceed the 12bit limit of immediate constants in ARM instructions. This patch fixes the stack-offsets in the function prolog/epilog.
Diffstat (limited to 'arm/TargetPrinter.ml')
-rw-r--r--arm/TargetPrinter.ml17
1 files changed, 5 insertions, 12 deletions
diff --git a/arm/TargetPrinter.ml b/arm/TargetPrinter.ml
index 60f52efd..02c348a8 100644
--- a/arm/TargetPrinter.ml
+++ b/arm/TargetPrinter.ml
@@ -539,23 +539,13 @@ struct
| Psbc (r1,r2,sa) ->
fprintf oc " sbc %a, %a, %a\n" ireg r1 ireg r2 shift_op sa; 1
| Pstr(r1, r2, sa) | Pstr_a(r1, r2, sa) ->
- fprintf oc " str %a, [%a, %a]\n" ireg r1 ireg r2 shift_op sa;
- begin match r1, r2, sa with
- | IR14, IR13, SOimm n -> cfi_rel_offset oc "lr" (camlint_of_coqint n)
- | _ -> ()
- end;
- 1
+ fprintf oc " str %a, [%a, %a]\n" ireg r1 ireg r2 shift_op sa; 1
| Pstrb(r1, r2, sa) ->
fprintf oc " strb %a, [%a, %a]\n" ireg r1 ireg r2 shift_op sa; 1
| Pstrh(r1, r2, sa) ->
fprintf oc " strh %a, [%a, %a]\n" ireg r1 ireg r2 shift_op sa; 1
| Pstr_p(r1, r2, sa) ->
- fprintf oc " str %a, [%a], %a\n" ireg r1 ireg r2 shift_op sa;
- begin match r1, r2, sa with
- | IR14, IR13, SOimm n -> cfi_rel_offset oc "lr" (camlint_of_coqint n)
- | _ -> ()
- end;
- 1
+ fprintf oc " str %a, [%a], %a\n" ireg r1 ireg r2 shift_op sa; 1
| Pstrb_p(r1, r2, sa) ->
fprintf oc " strb %a, [%a], %a\n" ireg r1 ireg r2 shift_op sa; 1
| Pstrh_p(r1, r2, sa) ->
@@ -703,6 +693,8 @@ struct
assert false
| Pfreeframe(sz, ofs) ->
assert false
+ | Psavelr(ofs) ->
+ assert false
| Plabel lbl ->
fprintf oc "%a:\n" print_label lbl; 0
| Ploadsymbol(r1, id, ofs) ->
@@ -751,6 +743,7 @@ struct
assert false
end
| Pcfi_adjust sz -> cfi_adjust oc (camlint_of_coqint sz); 0
+ | Pcfi_rel_offset ofs -> cfi_rel_offset oc "lr" (camlint_of_coqint ofs); 0
let no_fallthrough = function
| Pb _ -> true