aboutsummaryrefslogtreecommitdiffstats
path: root/aarch64/SelectOp.vp
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@college-de-france.fr>2020-12-23 15:54:51 +0100
committerXavier Leroy <xavier.leroy@college-de-france.fr>2020-12-26 18:44:28 +0100
commitc50680bb86564fe61db61e6140a418ccc7d36677 (patch)
tree58f8731421325939c93546df3c9046fbf96a051e /aarch64/SelectOp.vp
parent73551e058a850297bc72924a69b39affcfa49dfa (diff)
downloadcompcert-kvx-c50680bb86564fe61db61e6140a418ccc7d36677.tar.gz
compcert-kvx-c50680bb86564fe61db61e6140a418ccc7d36677.zip
AArch64: macOS port
This commit adds support for macOS (and probably iOS) running on AArch64 / ARM 64-bit / "Apple silicon" processors.
Diffstat (limited to 'aarch64/SelectOp.vp')
-rw-r--r--aarch64/SelectOp.vp10
1 files changed, 9 insertions, 1 deletions
diff --git a/aarch64/SelectOp.vp b/aarch64/SelectOp.vp
index 5bd96987..b5a03989 100644
--- a/aarch64/SelectOp.vp
+++ b/aarch64/SelectOp.vp
@@ -536,10 +536,18 @@ Definition select (ty: typ) (cond: condition) (args: exprlist) (e1 e2: expr) :=
(** ** Recognition of addressing modes for load and store operations *)
+(** Some symbols are relocatable (e.g. external symbols in macOS)
+ and cannot be used with [Aglobal] addressing mode. *)
+
+Parameter symbol_is_relocatable: ident -> bool.
+
Nondetfunction addressing (chunk: memory_chunk) (e: expr) :=
match e with
| Eop (Oaddrstack n) Enil => (Ainstack n, Enil)
- | Eop (Oaddrsymbol id ofs) Enil => (Aglobal id ofs, Enil)
+ | Eop (Oaddrsymbol id ofs) Enil =>
+ if symbol_is_relocatable id
+ then (Aindexed (Ptrofs.to_int64 ofs), Eop (Oaddrsymbol id Ptrofs.zero) Enil ::: Enil)
+ else (Aglobal id ofs, Enil)
| Eop (Oaddlimm n) (e1:::Enil) => (Aindexed n, e1:::Enil)
| Eop (Oaddlshift Slsl a) (e1:::e2:::Enil) => (Aindexed2shift a, e1:::e2:::Enil)
| Eop (Oaddlext x a) (e1:::e2:::Enil) => (Aindexed2ext x a, e1:::e2:::Enil)