|
|
@ -1,26 +1,28 @@
|
|
|
|
From 1469caf50519c50979aeb27518f53d5976aed4ce Mon Sep 17 00:00:00 2001
|
|
|
|
From 2a2f55156c3d53f22095968f1785e79cca7676e7 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Mark Shinwell <mark@three-tuns.net>
|
|
|
|
From: Mark Shinwell <mshinwell@janestreet.com>
|
|
|
|
Date: Tue, 9 Jun 2015 11:52:59 +0100
|
|
|
|
Date: Wed, 10 Jun 2015 09:27:36 +0000
|
|
|
|
Subject: [PATCH 18/18] aarch64: AArch64 backend generates invalid asm:
|
|
|
|
Subject: [PATCH 18/18] Fix PR#6878: AArch64 conditional branches out of range.
|
|
|
|
conditional branch out of range (RHBZ#1224815).
|
|
|
|
(Introduces new, generic branch relaxation module.)
|
|
|
|
|
|
|
|
|
|
|
|
Upstream bug: http://caml.inria.fr/mantis/view.php?id=6878
|
|
|
|
git-svn-id: http://caml.inria.fr/svn/ocaml/version/4.02@16168 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
|
|
|
|
|
|
|
|
(cherry picked from commit d2a9da66eca1cb769e555b79a23b1ac64c01d1b5)
|
|
|
|
---
|
|
|
|
---
|
|
|
|
.depend | 148 ++++++++++---------
|
|
|
|
.depend | 130 +++++++++--------
|
|
|
|
Makefile | 2 +
|
|
|
|
Makefile | 2 +
|
|
|
|
|
|
|
|
asmcomp/amd64/emit.mlp | 6 +
|
|
|
|
asmcomp/arm64/arch.ml | 13 ++
|
|
|
|
asmcomp/arm64/arch.ml | 13 ++
|
|
|
|
asmcomp/arm64/emit.mlp | 294 +++++++++++++++++++++++++++++++++++---
|
|
|
|
asmcomp/arm64/emit.mlp | 294 +++++++++++++++++++++++++++++++++++---
|
|
|
|
asmcomp/branch_relaxation.ml | 135 +++++++++++++++++
|
|
|
|
asmcomp/branch_relaxation.ml | 138 ++++++++++++++++++
|
|
|
|
asmcomp/branch_relaxation.mli | 26 ++++
|
|
|
|
asmcomp/branch_relaxation.mli | 26 ++++
|
|
|
|
asmcomp/branch_relaxation_intf.ml | 53 +++++++
|
|
|
|
asmcomp/branch_relaxation_intf.ml | 63 ++++++++
|
|
|
|
asmcomp/power/emit.mlp | 190 ++++++++++--------------
|
|
|
|
asmcomp/power/emit.mlp | 190 ++++++++++--------------
|
|
|
|
8 files changed, 655 insertions(+), 206 deletions(-)
|
|
|
|
9 files changed, 666 insertions(+), 196 deletions(-)
|
|
|
|
create mode 100644 asmcomp/branch_relaxation.ml
|
|
|
|
create mode 100644 asmcomp/branch_relaxation.ml
|
|
|
|
create mode 100644 asmcomp/branch_relaxation.mli
|
|
|
|
create mode 100644 asmcomp/branch_relaxation.mli
|
|
|
|
create mode 100644 asmcomp/branch_relaxation_intf.ml
|
|
|
|
create mode 100644 asmcomp/branch_relaxation_intf.ml
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/.depend b/.depend
|
|
|
|
diff --git a/.depend b/.depend
|
|
|
|
index 5d95a9b..d18b769 100644
|
|
|
|
index 5d95a9b..813fbd7 100644
|
|
|
|
--- a/.depend
|
|
|
|
--- a/.depend
|
|
|
|
+++ b/.depend
|
|
|
|
+++ b/.depend
|
|
|
|
@@ -94,10 +94,10 @@ typing/ctype.cmi : typing/types.cmi typing/path.cmi parsing/longident.cmi \
|
|
|
|
@@ -94,10 +94,10 @@ typing/ctype.cmi : typing/types.cmi typing/path.cmi parsing/longident.cmi \
|
|
|
@ -265,78 +267,51 @@ index 5d95a9b..d18b769 100644
|
|
|
|
asmcomp/debuginfo.cmi
|
|
|
|
asmcomp/debuginfo.cmi
|
|
|
|
asmcomp/debuginfo.cmx : parsing/location.cmx bytecomp/lambda.cmx \
|
|
|
|
asmcomp/debuginfo.cmx : parsing/location.cmx bytecomp/lambda.cmx \
|
|
|
|
asmcomp/debuginfo.cmi
|
|
|
|
asmcomp/debuginfo.cmi
|
|
|
|
-asmcomp/emit.cmo : asmcomp/reg.cmi asmcomp/proc.cmi utils/misc.cmi \
|
|
|
|
+asmcomp/emitaux.cmo : asmcomp/linearize.cmi asmcomp/debuginfo.cmi \
|
|
|
|
- asmcomp/mach.cmi asmcomp/linearize.cmi bytecomp/lambda.cmi \
|
|
|
|
+ utils/config.cmi utils/clflags.cmi asmcomp/arch.cmo asmcomp/emitaux.cmi
|
|
|
|
- asmcomp/emitaux.cmi asmcomp/debuginfo.cmi utils/config.cmi \
|
|
|
|
+asmcomp/emitaux.cmx : asmcomp/linearize.cmx asmcomp/debuginfo.cmx \
|
|
|
|
|
|
|
|
+ utils/config.cmx utils/clflags.cmx asmcomp/arch.cmx asmcomp/emitaux.cmi
|
|
|
|
|
|
|
|
asmcomp/emit.cmo : asmcomp/reg.cmi asmcomp/proc.cmi utils/misc.cmi \
|
|
|
|
|
|
|
|
asmcomp/mach.cmi asmcomp/linearize.cmi bytecomp/lambda.cmi \
|
|
|
|
|
|
|
|
asmcomp/emitaux.cmi asmcomp/debuginfo.cmi utils/config.cmi \
|
|
|
|
- asmcomp/compilenv.cmi asmcomp/cmm.cmi utils/clflags.cmi asmcomp/arch.cmo \
|
|
|
|
- asmcomp/compilenv.cmi asmcomp/cmm.cmi utils/clflags.cmi asmcomp/arch.cmo \
|
|
|
|
- asmcomp/emit.cmi
|
|
|
|
- asmcomp/emit.cmi
|
|
|
|
-asmcomp/emit.cmx : asmcomp/reg.cmx asmcomp/proc.cmx utils/misc.cmx \
|
|
|
|
+ asmcomp/compilenv.cmi asmcomp/cmm.cmi utils/clflags.cmi \
|
|
|
|
- asmcomp/mach.cmx asmcomp/linearize.cmx bytecomp/lambda.cmx \
|
|
|
|
+ asmcomp/branch_relaxation.cmi asmcomp/arch.cmo asmcomp/emit.cmi
|
|
|
|
- asmcomp/emitaux.cmx asmcomp/debuginfo.cmx utils/config.cmx \
|
|
|
|
asmcomp/emit.cmx : asmcomp/reg.cmx asmcomp/proc.cmx utils/misc.cmx \
|
|
|
|
|
|
|
|
asmcomp/mach.cmx asmcomp/linearize.cmx bytecomp/lambda.cmx \
|
|
|
|
|
|
|
|
asmcomp/emitaux.cmx asmcomp/debuginfo.cmx utils/config.cmx \
|
|
|
|
- asmcomp/compilenv.cmx asmcomp/cmm.cmx utils/clflags.cmx asmcomp/arch.cmx \
|
|
|
|
- asmcomp/compilenv.cmx asmcomp/cmm.cmx utils/clflags.cmx asmcomp/arch.cmx \
|
|
|
|
- asmcomp/emit.cmi
|
|
|
|
- asmcomp/emit.cmi
|
|
|
|
asmcomp/emitaux.cmo : asmcomp/linearize.cmi asmcomp/debuginfo.cmi \
|
|
|
|
-asmcomp/emitaux.cmo : asmcomp/linearize.cmi asmcomp/debuginfo.cmi \
|
|
|
|
utils/config.cmi utils/clflags.cmi asmcomp/arch.cmo asmcomp/emitaux.cmi
|
|
|
|
- utils/config.cmi utils/clflags.cmi asmcomp/arch.cmo asmcomp/emitaux.cmi
|
|
|
|
asmcomp/emitaux.cmx : asmcomp/linearize.cmx asmcomp/debuginfo.cmx \
|
|
|
|
-asmcomp/emitaux.cmx : asmcomp/linearize.cmx asmcomp/debuginfo.cmx \
|
|
|
|
utils/config.cmx utils/clflags.cmx asmcomp/arch.cmx asmcomp/emitaux.cmi
|
|
|
|
- utils/config.cmx utils/clflags.cmx asmcomp/arch.cmx asmcomp/emitaux.cmi
|
|
|
|
+asmcomp/emit.cmo : asmcomp/reg.cmi asmcomp/proc.cmi utils/misc.cmi \
|
|
|
|
+ asmcomp/compilenv.cmx asmcomp/cmm.cmx utils/clflags.cmx \
|
|
|
|
+ asmcomp/mach.cmi asmcomp/linearize.cmi bytecomp/lambda.cmi \
|
|
|
|
+ asmcomp/branch_relaxation.cmx asmcomp/arch.cmx asmcomp/emit.cmi
|
|
|
|
+ asmcomp/emitaux.cmi utils/config.cmi asmcomp/compilenv.cmi \
|
|
|
|
|
|
|
|
+ asmcomp/cmm.cmi utils/clflags.cmi asmcomp/branch_relaxation.cmi \
|
|
|
|
|
|
|
|
+ asmcomp/arch.cmo asmcomp/emit.cmi
|
|
|
|
|
|
|
|
+asmcomp/emit.cmx : asmcomp/reg.cmx asmcomp/proc.cmx utils/misc.cmx \
|
|
|
|
|
|
|
|
+ asmcomp/mach.cmx asmcomp/linearize.cmx bytecomp/lambda.cmx \
|
|
|
|
|
|
|
|
+ asmcomp/emitaux.cmx utils/config.cmx asmcomp/compilenv.cmx \
|
|
|
|
|
|
|
|
+ asmcomp/cmm.cmx utils/clflags.cmx asmcomp/branch_relaxation.cmx \
|
|
|
|
|
|
|
|
+ asmcomp/arch.cmx asmcomp/emit.cmi
|
|
|
|
|
|
|
|
asmcomp/interf.cmo : asmcomp/reg.cmi asmcomp/proc.cmi asmcomp/mach.cmi \
|
|
|
|
asmcomp/interf.cmo : asmcomp/reg.cmi asmcomp/proc.cmi asmcomp/mach.cmi \
|
|
|
|
asmcomp/interf.cmi
|
|
|
|
asmcomp/interf.cmi
|
|
|
|
asmcomp/interf.cmx : asmcomp/reg.cmx asmcomp/proc.cmx asmcomp/mach.cmx \
|
|
|
|
asmcomp/interf.cmx : asmcomp/reg.cmx asmcomp/proc.cmx asmcomp/mach.cmx \
|
|
|
|
@@ -796,21 +806,19 @@ asmcomp/printmach.cmx : asmcomp/reg.cmx asmcomp/proc.cmx \
|
|
|
|
@@ -803,14 +813,14 @@ asmcomp/proc.cmx : asmcomp/reg.cmx utils/misc.cmx asmcomp/mach.cmx \
|
|
|
|
asmcomp/debuginfo.cmx asmcomp/cmm.cmx asmcomp/arch.cmx \
|
|
|
|
asmcomp/arch.cmx asmcomp/proc.cmi
|
|
|
|
asmcomp/printmach.cmi
|
|
|
|
|
|
|
|
asmcomp/proc.cmo : asmcomp/reg.cmi utils/misc.cmi asmcomp/mach.cmi \
|
|
|
|
|
|
|
|
- utils/config.cmi asmcomp/cmm.cmi utils/clflags.cmi utils/ccomp.cmi \
|
|
|
|
|
|
|
|
- asmcomp/arch.cmo asmcomp/proc.cmi
|
|
|
|
|
|
|
|
+ utils/config.cmi asmcomp/cmm.cmi utils/ccomp.cmi asmcomp/arch.cmo \
|
|
|
|
|
|
|
|
+ asmcomp/proc.cmi
|
|
|
|
|
|
|
|
asmcomp/proc.cmx : asmcomp/reg.cmx utils/misc.cmx asmcomp/mach.cmx \
|
|
|
|
|
|
|
|
- utils/config.cmx asmcomp/cmm.cmx utils/clflags.cmx utils/ccomp.cmx \
|
|
|
|
|
|
|
|
- asmcomp/arch.cmx asmcomp/proc.cmi
|
|
|
|
|
|
|
|
+ utils/config.cmx asmcomp/cmm.cmx utils/ccomp.cmx asmcomp/arch.cmx \
|
|
|
|
|
|
|
|
+ asmcomp/proc.cmi
|
|
|
|
|
|
|
|
asmcomp/reg.cmo : typing/ident.cmi asmcomp/cmm.cmi asmcomp/reg.cmi
|
|
|
|
asmcomp/reg.cmo : typing/ident.cmi asmcomp/cmm.cmi asmcomp/reg.cmi
|
|
|
|
asmcomp/reg.cmx : typing/ident.cmx asmcomp/cmm.cmx asmcomp/reg.cmi
|
|
|
|
asmcomp/reg.cmx : typing/ident.cmx asmcomp/cmm.cmx asmcomp/reg.cmi
|
|
|
|
-asmcomp/reload.cmo : asmcomp/reloadgen.cmi asmcomp/reg.cmi asmcomp/mach.cmi \
|
|
|
|
+asmcomp/reloadgen.cmo : asmcomp/reg.cmi utils/misc.cmi asmcomp/mach.cmi \
|
|
|
|
- asmcomp/cmm.cmi utils/clflags.cmi asmcomp/arch.cmo asmcomp/reload.cmi
|
|
|
|
+ asmcomp/reloadgen.cmi
|
|
|
|
-asmcomp/reload.cmx : asmcomp/reloadgen.cmx asmcomp/reg.cmx asmcomp/mach.cmx \
|
|
|
|
+asmcomp/reloadgen.cmx : asmcomp/reg.cmx utils/misc.cmx asmcomp/mach.cmx \
|
|
|
|
- asmcomp/cmm.cmx utils/clflags.cmx asmcomp/arch.cmx asmcomp/reload.cmi
|
|
|
|
+ asmcomp/reloadgen.cmi
|
|
|
|
asmcomp/reloadgen.cmo : asmcomp/reg.cmi utils/misc.cmi asmcomp/mach.cmi \
|
|
|
|
asmcomp/reload.cmo : asmcomp/reloadgen.cmi asmcomp/reg.cmi asmcomp/mach.cmi \
|
|
|
|
asmcomp/reloadgen.cmi
|
|
|
|
asmcomp/cmm.cmi utils/clflags.cmi asmcomp/arch.cmo asmcomp/reload.cmi
|
|
|
|
asmcomp/reloadgen.cmx : asmcomp/reg.cmx utils/misc.cmx asmcomp/mach.cmx \
|
|
|
|
asmcomp/reload.cmx : asmcomp/reloadgen.cmx asmcomp/reg.cmx asmcomp/mach.cmx \
|
|
|
|
asmcomp/reloadgen.cmi
|
|
|
|
asmcomp/cmm.cmx utils/clflags.cmx asmcomp/arch.cmx asmcomp/reload.cmi
|
|
|
|
+asmcomp/reload.cmo : asmcomp/reloadgen.cmi asmcomp/reload.cmi
|
|
|
|
-asmcomp/reloadgen.cmo : asmcomp/reg.cmi utils/misc.cmi asmcomp/mach.cmi \
|
|
|
|
+asmcomp/reload.cmx : asmcomp/reloadgen.cmx asmcomp/reload.cmi
|
|
|
|
- asmcomp/reloadgen.cmi
|
|
|
|
|
|
|
|
-asmcomp/reloadgen.cmx : asmcomp/reg.cmx utils/misc.cmx asmcomp/mach.cmx \
|
|
|
|
|
|
|
|
- asmcomp/reloadgen.cmi
|
|
|
|
asmcomp/schedgen.cmo : asmcomp/reg.cmi asmcomp/proc.cmi asmcomp/mach.cmi \
|
|
|
|
asmcomp/schedgen.cmo : asmcomp/reg.cmi asmcomp/proc.cmi asmcomp/mach.cmi \
|
|
|
|
asmcomp/linearize.cmi asmcomp/cmm.cmi asmcomp/arch.cmo \
|
|
|
|
asmcomp/linearize.cmi asmcomp/cmm.cmi asmcomp/arch.cmo \
|
|
|
|
asmcomp/schedgen.cmi
|
|
|
|
asmcomp/schedgen.cmi
|
|
|
|
@@ -827,11 +835,11 @@ asmcomp/selectgen.cmx : utils/tbl.cmx bytecomp/simplif.cmx asmcomp/reg.cmx \
|
|
|
|
@@ -849,8 +859,8 @@ driver/compenv.cmi :
|
|
|
|
asmcomp/proc.cmx utils/misc.cmx asmcomp/mach.cmx bytecomp/lambda.cmx \
|
|
|
|
|
|
|
|
typing/ident.cmx asmcomp/debuginfo.cmx asmcomp/cmm.cmx utils/clflags.cmx \
|
|
|
|
|
|
|
|
asmcomp/arch.cmx asmcomp/selectgen.cmi
|
|
|
|
|
|
|
|
-asmcomp/selection.cmo : asmcomp/selectgen.cmi asmcomp/proc.cmi \
|
|
|
|
|
|
|
|
- asmcomp/mach.cmi asmcomp/cmm.cmi utils/clflags.cmi asmcomp/arch.cmo \
|
|
|
|
|
|
|
|
+asmcomp/selection.cmo : asmcomp/selectgen.cmi asmcomp/mach.cmi \
|
|
|
|
|
|
|
|
+ asmcomp/compilenv.cmi asmcomp/cmm.cmi utils/clflags.cmi asmcomp/arch.cmo \
|
|
|
|
|
|
|
|
asmcomp/selection.cmi
|
|
|
|
|
|
|
|
-asmcomp/selection.cmx : asmcomp/selectgen.cmx asmcomp/proc.cmx \
|
|
|
|
|
|
|
|
- asmcomp/mach.cmx asmcomp/cmm.cmx utils/clflags.cmx asmcomp/arch.cmx \
|
|
|
|
|
|
|
|
+asmcomp/selection.cmx : asmcomp/selectgen.cmx asmcomp/mach.cmx \
|
|
|
|
|
|
|
|
+ asmcomp/compilenv.cmx asmcomp/cmm.cmx utils/clflags.cmx asmcomp/arch.cmx \
|
|
|
|
|
|
|
|
asmcomp/selection.cmi
|
|
|
|
|
|
|
|
asmcomp/spill.cmo : asmcomp/reg.cmi asmcomp/proc.cmi utils/misc.cmi \
|
|
|
|
|
|
|
|
asmcomp/mach.cmi asmcomp/spill.cmi
|
|
|
|
|
|
|
|
@@ -849,8 +857,8 @@ driver/compenv.cmi :
|
|
|
|
|
|
|
|
driver/compile.cmi :
|
|
|
|
driver/compile.cmi :
|
|
|
|
driver/compmisc.cmi : typing/env.cmi
|
|
|
|
driver/compmisc.cmi : typing/env.cmi
|
|
|
|
driver/errors.cmi :
|
|
|
|
driver/errors.cmi :
|
|
|
@ -346,7 +321,7 @@ index 5d95a9b..d18b769 100644
|
|
|
|
driver/optcompile.cmi :
|
|
|
|
driver/optcompile.cmi :
|
|
|
|
driver/opterrors.cmi :
|
|
|
|
driver/opterrors.cmi :
|
|
|
|
driver/optmain.cmi :
|
|
|
|
driver/optmain.cmi :
|
|
|
|
@@ -885,6 +893,8 @@ driver/compmisc.cmx : typing/typemod.cmx utils/misc.cmx \
|
|
|
|
@@ -885,6 +895,8 @@ driver/compmisc.cmx : typing/typemod.cmx utils/misc.cmx \
|
|
|
|
parsing/asttypes.cmi driver/compmisc.cmi
|
|
|
|
parsing/asttypes.cmi driver/compmisc.cmi
|
|
|
|
driver/errors.cmo : parsing/location.cmi driver/errors.cmi
|
|
|
|
driver/errors.cmo : parsing/location.cmi driver/errors.cmi
|
|
|
|
driver/errors.cmx : parsing/location.cmx driver/errors.cmi
|
|
|
|
driver/errors.cmx : parsing/location.cmx driver/errors.cmi
|
|
|
@ -355,7 +330,7 @@ index 5d95a9b..d18b769 100644
|
|
|
|
driver/main.cmo : utils/warnings.cmi utils/misc.cmi driver/main_args.cmi \
|
|
|
|
driver/main.cmo : utils/warnings.cmi utils/misc.cmi driver/main_args.cmi \
|
|
|
|
parsing/location.cmi utils/config.cmi driver/compmisc.cmi \
|
|
|
|
parsing/location.cmi utils/config.cmi driver/compmisc.cmi \
|
|
|
|
driver/compile.cmi driver/compenv.cmi utils/clflags.cmi \
|
|
|
|
driver/compile.cmi driver/compenv.cmi utils/clflags.cmi \
|
|
|
|
@@ -895,8 +905,6 @@ driver/main.cmx : utils/warnings.cmx utils/misc.cmx driver/main_args.cmx \
|
|
|
|
@@ -895,8 +907,6 @@ driver/main.cmx : utils/warnings.cmx utils/misc.cmx driver/main_args.cmx \
|
|
|
|
driver/compile.cmx driver/compenv.cmx utils/clflags.cmx \
|
|
|
|
driver/compile.cmx driver/compenv.cmx utils/clflags.cmx \
|
|
|
|
bytecomp/bytepackager.cmx bytecomp/bytelink.cmx \
|
|
|
|
bytecomp/bytepackager.cmx bytecomp/bytelink.cmx \
|
|
|
|
bytecomp/bytelibrarian.cmx driver/main.cmi
|
|
|
|
bytecomp/bytelibrarian.cmx driver/main.cmi
|
|
|
@ -377,6 +352,23 @@ index 6c0e7e6..7a20e2c 100644
|
|
|
|
asmcomp/emitaux.cmo asmcomp/emit.cmo asmcomp/asmgen.cmo \
|
|
|
|
asmcomp/emitaux.cmo asmcomp/emit.cmo asmcomp/asmgen.cmo \
|
|
|
|
asmcomp/asmlink.cmo asmcomp/asmlibrarian.cmo asmcomp/asmpackager.cmo \
|
|
|
|
asmcomp/asmlink.cmo asmcomp/asmlibrarian.cmo asmcomp/asmpackager.cmo \
|
|
|
|
driver/opterrors.cmo driver/optcompile.cmo
|
|
|
|
driver/opterrors.cmo driver/optcompile.cmo
|
|
|
|
|
|
|
|
diff --git a/asmcomp/amd64/emit.mlp b/asmcomp/amd64/emit.mlp
|
|
|
|
|
|
|
|
index b576ece..d56d0f5 100644
|
|
|
|
|
|
|
|
--- a/asmcomp/amd64/emit.mlp
|
|
|
|
|
|
|
|
+++ b/asmcomp/amd64/emit.mlp
|
|
|
|
|
|
|
|
@@ -20,6 +20,12 @@ open Mach
|
|
|
|
|
|
|
|
open Linearize
|
|
|
|
|
|
|
|
open Emitaux
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+(* [Branch_relaxation] is not used in this file, but is required by
|
|
|
|
|
|
|
|
+ emit.mlp files for certain other targets; the reference here ensures
|
|
|
|
|
|
|
|
+ that when releases are being prepared the .depend files are correct
|
|
|
|
|
|
|
|
+ for all targets. *)
|
|
|
|
|
|
|
|
+open! Branch_relaxation
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
let macosx = (Config.system = "macosx")
|
|
|
|
|
|
|
|
let mingw64 = (Config.system = "mingw64")
|
|
|
|
|
|
|
|
let cygwin = (Config.system = "cygwin")
|
|
|
|
diff --git a/asmcomp/arm64/arch.ml b/asmcomp/arm64/arch.ml
|
|
|
|
diff --git a/asmcomp/arm64/arch.ml b/asmcomp/arm64/arch.ml
|
|
|
|
index bfbe183..3e62da8 100644
|
|
|
|
index bfbe183..3e62da8 100644
|
|
|
|
--- a/asmcomp/arm64/arch.ml
|
|
|
|
--- a/asmcomp/arm64/arch.ml
|
|
|
@ -418,7 +410,7 @@ index bfbe183..3e62da8 100644
|
|
|
|
fprintf ppf "(%a * %a) + %a"
|
|
|
|
fprintf ppf "(%a * %a) + %a"
|
|
|
|
printreg arg.(0)
|
|
|
|
printreg arg.(0)
|
|
|
|
diff --git a/asmcomp/arm64/emit.mlp b/asmcomp/arm64/emit.mlp
|
|
|
|
diff --git a/asmcomp/arm64/emit.mlp b/asmcomp/arm64/emit.mlp
|
|
|
|
index c5c30d4..3d7a297 100644
|
|
|
|
index c5c30d4..8576eeb 100644
|
|
|
|
--- a/asmcomp/arm64/emit.mlp
|
|
|
|
--- a/asmcomp/arm64/emit.mlp
|
|
|
|
+++ b/asmcomp/arm64/emit.mlp
|
|
|
|
+++ b/asmcomp/arm64/emit.mlp
|
|
|
|
@@ -231,6 +231,32 @@ let emit_intconst dst n =
|
|
|
|
@@ -231,6 +231,32 @@ let emit_intconst dst n =
|
|
|
@ -473,7 +465,7 @@ index c5c30d4..3d7a297 100644
|
|
|
|
+ | Lop (Ispecific (Ishiftcheckbound _)) ->
|
|
|
|
+ | Lop (Ispecific (Ishiftcheckbound _)) ->
|
|
|
|
+ let check_bound =
|
|
|
|
+ let check_bound =
|
|
|
|
+ (* When not in debug mode, there is at most one check-bound point. *)
|
|
|
|
+ (* When not in debug mode, there is at most one check-bound point. *)
|
|
|
|
+ if not !Clflags.debug then min (check_bound + 1) 1
|
|
|
|
+ if not !Clflags.debug then 1
|
|
|
|
+ else check_bound + 1
|
|
|
|
+ else check_bound + 1
|
|
|
|
+ in
|
|
|
|
+ in
|
|
|
|
+ loop instr.next (call_gc, check_bound)
|
|
|
|
+ loop instr.next (call_gc, check_bound)
|
|
|
@ -713,7 +705,7 @@ index c5c30d4..3d7a297 100644
|
|
|
|
+ let lbl = bound_error_label i.dbg in
|
|
|
|
+ let lbl = bound_error_label i.dbg in
|
|
|
|
+ let lbl2 = new_label () in
|
|
|
|
+ let lbl2 = new_label () in
|
|
|
|
+ ` cmp {emit_reg i.arg.(0)}, {emit_reg i.arg.(1)}\n`;
|
|
|
|
+ ` cmp {emit_reg i.arg.(0)}, {emit_reg i.arg.(1)}\n`;
|
|
|
|
+ ` b.ge {emit_label lbl2}\n`;
|
|
|
|
+ ` b.hi {emit_label lbl2}\n`;
|
|
|
|
+ ` b {emit_label lbl}\n`;
|
|
|
|
+ ` b {emit_label lbl}\n`;
|
|
|
|
+ `{emit_label lbl2}:\n`;
|
|
|
|
+ `{emit_label lbl2}:\n`;
|
|
|
|
| Lop(Iintop_imm(Icheckbound, n)) ->
|
|
|
|
| Lop(Iintop_imm(Icheckbound, n)) ->
|
|
|
@ -724,7 +716,7 @@ index c5c30d4..3d7a297 100644
|
|
|
|
+ let lbl = bound_error_label i.dbg in
|
|
|
|
+ let lbl = bound_error_label i.dbg in
|
|
|
|
+ let lbl2 = new_label () in
|
|
|
|
+ let lbl2 = new_label () in
|
|
|
|
+ ` cmp {emit_reg i.arg.(0)}, #{emit_int bound}\n`;
|
|
|
|
+ ` cmp {emit_reg i.arg.(0)}, #{emit_int bound}\n`;
|
|
|
|
+ ` b.ge {emit_label lbl2}\n`;
|
|
|
|
+ ` b.hi {emit_label lbl2}\n`;
|
|
|
|
+ ` b {emit_label lbl}\n`;
|
|
|
|
+ ` b {emit_label lbl}\n`;
|
|
|
|
+ `{emit_label lbl2}:\n`;
|
|
|
|
+ `{emit_label lbl2}:\n`;
|
|
|
|
| Lop(Ispecific(Ishiftcheckbound shift)) ->
|
|
|
|
| Lop(Ispecific(Ishiftcheckbound shift)) ->
|
|
|
@ -735,7 +727,7 @@ index c5c30d4..3d7a297 100644
|
|
|
|
+ let lbl = bound_error_label i.dbg in
|
|
|
|
+ let lbl = bound_error_label i.dbg in
|
|
|
|
+ let lbl2 = new_label () in
|
|
|
|
+ let lbl2 = new_label () in
|
|
|
|
+ ` cmp {emit_reg i.arg.(1)}, {emit_reg i.arg.(0)}, lsr #{emit_int shift}\n`;
|
|
|
|
+ ` cmp {emit_reg i.arg.(1)}, {emit_reg i.arg.(0)}, lsr #{emit_int shift}\n`;
|
|
|
|
+ ` b.ge {emit_label lbl2}\n`;
|
|
|
|
+ ` b.lo {emit_label lbl2}\n`;
|
|
|
|
+ ` b {emit_label lbl}\n`;
|
|
|
|
+ ` b {emit_label lbl}\n`;
|
|
|
|
+ `{emit_label lbl2}:\n`;
|
|
|
|
+ `{emit_label lbl2}:\n`;
|
|
|
|
| Lop(Iintop Imod) ->
|
|
|
|
| Lop(Iintop Imod) ->
|
|
|
@ -763,10 +755,10 @@ index c5c30d4..3d7a297 100644
|
|
|
|
` .size {emit_symbol fundecl.fun_name}, .-{emit_symbol fundecl.fun_name}\n`;
|
|
|
|
` .size {emit_symbol fundecl.fun_name}, .-{emit_symbol fundecl.fun_name}\n`;
|
|
|
|
diff --git a/asmcomp/branch_relaxation.ml b/asmcomp/branch_relaxation.ml
|
|
|
|
diff --git a/asmcomp/branch_relaxation.ml b/asmcomp/branch_relaxation.ml
|
|
|
|
new file mode 100644
|
|
|
|
new file mode 100644
|
|
|
|
index 0000000..8fd3891
|
|
|
|
index 0000000..d4609e4
|
|
|
|
--- /dev/null
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/asmcomp/branch_relaxation.ml
|
|
|
|
+++ b/asmcomp/branch_relaxation.ml
|
|
|
|
@@ -0,0 +1,135 @@
|
|
|
|
@@ -0,0 +1,138 @@
|
|
|
|
+(***********************************************************************)
|
|
|
|
+(***********************************************************************)
|
|
|
|
+(* *)
|
|
|
|
+(* *)
|
|
|
|
+(* OCaml *)
|
|
|
|
+(* OCaml *)
|
|
|
@ -883,7 +875,10 @@ index 0000000..8fd3891
|
|
|
|
+ instr.next <- cont.next;
|
|
|
|
+ instr.next <- cont.next;
|
|
|
|
+ fixup true pc instr
|
|
|
|
+ fixup true pc instr
|
|
|
|
+ | _ ->
|
|
|
|
+ | _ ->
|
|
|
|
+ Misc.fatal_error "Unsupported instruction for branch relaxation"
|
|
|
|
+ (* Any other instruction has already been rejected in
|
|
|
|
|
|
|
|
+ [instr_overflows] above.
|
|
|
|
|
|
|
|
+ We can *never* get here. *)
|
|
|
|
|
|
|
|
+ assert false
|
|
|
|
+ in
|
|
|
|
+ in
|
|
|
|
+ fixup false 0 code
|
|
|
|
+ fixup false 0 code
|
|
|
|
+
|
|
|
|
+
|
|
|
@ -936,10 +931,10 @@ index 0000000..9d517b1
|
|
|
|
+end
|
|
|
|
+end
|
|
|
|
diff --git a/asmcomp/branch_relaxation_intf.ml b/asmcomp/branch_relaxation_intf.ml
|
|
|
|
diff --git a/asmcomp/branch_relaxation_intf.ml b/asmcomp/branch_relaxation_intf.ml
|
|
|
|
new file mode 100644
|
|
|
|
new file mode 100644
|
|
|
|
index 0000000..fb721b2
|
|
|
|
index 0000000..610d0d0
|
|
|
|
--- /dev/null
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/asmcomp/branch_relaxation_intf.ml
|
|
|
|
+++ b/asmcomp/branch_relaxation_intf.ml
|
|
|
|
@@ -0,0 +1,53 @@
|
|
|
|
@@ -0,0 +1,63 @@
|
|
|
|
+(***********************************************************************)
|
|
|
|
+(***********************************************************************)
|
|
|
|
+(* *)
|
|
|
|
+(* *)
|
|
|
|
+(* OCaml *)
|
|
|
|
+(* OCaml *)
|
|
|
@ -973,7 +968,17 @@ index 0000000..fb721b2
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ (* Which variety of conditional branch may be produced by the emitter for a
|
|
|
|
+ (* Which variety of conditional branch may be produced by the emitter for a
|
|
|
|
+ given instruction description. For the moment we assume that only one
|
|
|
|
+ given instruction description. For the moment we assume that only one
|
|
|
|
+ such variety per instruction description is needed. *)
|
|
|
|
+ such variety per instruction description is needed.
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+ N.B. The only instructions supported are the following:
|
|
|
|
|
|
|
|
+ - Lop (Ialloc _)
|
|
|
|
|
|
|
|
+ - Lop (Iintop Icheckbound)
|
|
|
|
|
|
|
|
+ - Lop (Iintop_imm (Icheckbound, _))
|
|
|
|
|
|
|
|
+ - Lop (Ispecific _)
|
|
|
|
|
|
|
|
+ - Lcondbranch (_, _)
|
|
|
|
|
|
|
|
+ - Lcondbranch3 (_, _, _)
|
|
|
|
|
|
|
|
+ [classify_instr] is expected to return [None] when called on any
|
|
|
|
|
|
|
|
+ instruction not in this list. *)
|
|
|
|
+ val classify_instr : Linearize.instruction_desc -> t option
|
|
|
|
+ val classify_instr : Linearize.instruction_desc -> t option
|
|
|
|
+ end
|
|
|
|
+ end
|
|
|
|
+
|
|
|
|
+
|
|
|
@ -1210,5 +1215,5 @@ index 8e31b58..717ab12 100644
|
|
|
|
(* Emit the glue code to call the GC *)
|
|
|
|
(* Emit the glue code to call the GC *)
|
|
|
|
if !call_gc_label > 0 then begin
|
|
|
|
if !call_gc_label > 0 then begin
|
|
|
|
--
|
|
|
|
--
|
|
|
|
2.4.1
|
|
|
|
2.3.1
|
|
|
|
|
|
|
|
|