aboutsummaryrefslogtreecommitdiffstats
path: root/aarch64/Asmgen.v
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@college-de-france.fr>2022-05-25 15:32:17 +0200
committerXavier Leroy <xavier.leroy@college-de-france.fr>2022-05-30 17:38:07 +0200
commitd357b5c52fb9ac70679fa8abd47094e89a6c3fa1 (patch)
treeafc9759833de393a36b6156a1ff0a7cc1db65bec /aarch64/Asmgen.v
parent318fc06823eb577e9b386aeea57133e8c3938ecf (diff)
downloadcompcert-d357b5c52fb9ac70679fa8abd47094e89a6c3fa1.tar.gz
compcert-d357b5c52fb9ac70679fa8abd47094e89a6c3fa1.zip
AArch64: make register X29 callee-save
CompCert doesn't maintain a frame pointer in X29. However, it must treat X29 as callee-save, so that CompCert-generated code can be called from code that uses X29 as frame pointer. This commit makes X29 callee-save. In places where X29 was used as a temporary, X15 or X14 is used instead.
Diffstat (limited to 'aarch64/Asmgen.v')
-rw-r--r--aarch64/Asmgen.v10
1 files changed, 5 insertions, 5 deletions
diff --git a/aarch64/Asmgen.v b/aarch64/Asmgen.v
index baaab6c4..2237c66a 100644
--- a/aarch64/Asmgen.v
+++ b/aarch64/Asmgen.v
@@ -1057,7 +1057,7 @@ Definition make_epilogue (f: Mach.function) (k: code) :=
(** Translation of a Mach instruction. *)
Definition transl_instr (f: Mach.function) (i: Mach.instruction)
- (r29_is_parent: bool) (k: code) : res code :=
+ (r15_is_parent: bool) (k: code) : res code :=
match i with
| Mgetstack ofs ty dst =>
loadind XSP ofs ty dst k
@@ -1065,8 +1065,8 @@ Definition transl_instr (f: Mach.function) (i: Mach.instruction)
storeind src XSP ofs ty k
| Mgetparam ofs ty dst =>
(* load via the frame pointer if it is valid *)
- do c <- loadind X29 ofs ty dst k;
- OK (if r29_is_parent then c else loadptr XSP f.(fn_link_ofs) X29 c)
+ do c <- loadind X15 ofs ty dst k;
+ OK (if r15_is_parent then c else loadptr XSP f.(fn_link_ofs) X15 c)
| Mop op args res =>
transl_op op args res k
| Mload chunk addr args dst =>
@@ -1102,8 +1102,8 @@ Definition transl_instr (f: Mach.function) (i: Mach.instruction)
Definition it1_is_parent (before: bool) (i: Mach.instruction) : bool :=
match i with
| Msetstack src ofs ty => before
- | Mgetparam ofs ty dst => negb (mreg_eq dst R29)
- | Mop op args res => before && negb (mreg_eq res R29)
+ | Mgetparam ofs ty dst => negb (mreg_eq dst R15)
+ | Mop op args res => before && negb (mreg_eq res R15)
| _ => false
end.