[ocaml/f17] - Include svn rev 12548 to fix invalid generation of Thumb-2 branch instruction TBH (upstream PR#5
Richard W.M. Jones
rjones at fedoraproject.org
Sun Jun 3 22:06:37 UTC 2012
commit 8d2df37f2e69ab2d05adf5585acbd2e31d6f188d
Author: Richard W.M. Jones <rjones at redhat.com>
Date: Sun Jun 3 20:06:35 2012 +0100
- Include svn rev 12548 to fix invalid generation of Thumb-2 branch
instruction TBH (upstream PR#5623, RHBZ#821153).
(cherry picked from commit 1296d4b409814cdb499755b6e8ff746d2a45a9a1)
...ackend-written-by-Benedikt-Meurer-PR-5433.patch | 79 +++++++++++---------
ocaml.spec | 6 +-
2 files changed, 50 insertions(+), 35 deletions(-)
---
diff --git a/0007-New-ARM-backend-written-by-Benedikt-Meurer-PR-5433.patch b/0007-New-ARM-backend-written-by-Benedikt-Meurer-PR-5433.patch
index b826f11..378c008 100644
--- a/0007-New-ARM-backend-written-by-Benedikt-Meurer-PR-5433.patch
+++ b/0007-New-ARM-backend-written-by-Benedikt-Meurer-PR-5433.patch
@@ -1,16 +1,19 @@
-From 5017142a41b2ea9b81d41ff7d513847b9df7bae9 Mon Sep 17 00:00:00 2001
+From 22fadc3ed91cb380f7303e8a83ff5806d4576cb5 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones at redhat.com>
Date: Tue, 29 May 2012 20:50:42 +0100
-Subject: [PATCH 7/7] New ARM backend, written by Benedikt Meurer (PR#5433).
+Subject: [PATCH] New ARM backend, written by Benedikt Meurer (PR#5433).
Backported from upstream sources to 3.12.1 by RWMJ.
+
+Includes svn rev 12548 to fix invalid generation of Thumb-2 branch
+instruction TBH (upstream PR#5623, RHBZ#821153).
---
asmcomp/amd64/selection.ml | 14 +-
asmcomp/arm/arch.ml | 152 +++++++-
- asmcomp/arm/emit.mlp | 850 ++++++++++++++++++++++++++++--------------
- asmcomp/arm/proc.ml | 185 +++++++---
+ asmcomp/arm/emit.mlp | 857 ++++++++++++++++++++++++++++--------------
+ asmcomp/arm/proc.ml | 185 ++++++---
asmcomp/arm/reload.ml | 4 +-
- asmcomp/arm/scheduling.ml | 80 +++--
+ asmcomp/arm/scheduling.ml | 80 ++--
asmcomp/arm/selection.ml | 343 ++++++++++-------
asmcomp/i386/selection.ml | 14 +-
asmcomp/power/selection.ml | 2 +-
@@ -21,7 +24,7 @@ Backported from upstream sources to 3.12.1 by RWMJ.
asmrun/arm.S | 544 ++++++++++++++++-----------
asmrun/signals_osdep.h | 2 +-
configure | 11 +-
- 16 files changed, 1477 insertions(+), 743 deletions(-)
+ 16 files changed, 1485 insertions(+), 742 deletions(-)
diff --git a/asmcomp/amd64/selection.ml b/asmcomp/amd64/selection.ml
index f0546cf..5d9f6fa 100644
@@ -265,7 +268,7 @@ index 998fa4b..c4aca8d 100644
+ done;
+ !s <= m
diff --git a/asmcomp/arm/emit.mlp b/asmcomp/arm/emit.mlp
-index a4b2241..846ee4a 100644
+index a4b2241..f8db396 100644
--- a/asmcomp/arm/emit.mlp
+++ b/asmcomp/arm/emit.mlp
@@ -1,16 +1,17 @@
@@ -1146,7 +1149,7 @@ index a4b2241..846ee4a 100644
` cmp {emit_reg i.arg.(0)}, #1\n`;
begin match lbl0 with
None -> ()
-@@ -495,108 +732,135 @@ let emit_instr i =
+@@ -495,108 +732,144 @@ let emit_instr i =
| Some lbl -> ` bgt {emit_label lbl}\n`
end;
4
@@ -1156,34 +1159,42 @@ index a4b2241..846ee4a 100644
- for i = 0 to Array.length jumptbl - 1 do
- ` .word {emit_label jumptbl.(i)}\n`
- done;
-- 2 + Array.length jumptbl
+ | Lswitch jumptbl ->
+ if !arch > ARMv6 && !thumb then begin
-+ let lbl = new_label() in
-+ ` tbh [pc, {emit_reg i.arg.(0)}]\n`;
-+ `{emit_label lbl}:`;
-+ for i = 0 to Array.length jumptbl - 1 do
-+ ` .short ({emit_label jumptbl.(i)}-{emit_label lbl})/2\n`;
++ (* The Thumb-2 TBH instruction supports only forward branches,
++ so we need to generate appropriate trampolines for all labels
++ that appear before this switch instruction (PR#5623) *)
++ let tramtbl = Array.copy jumptbl in
++ ` tbh [pc, {emit_reg i.arg.(0)}, lsl #1]\n`;
++ for j = 0 to Array.length tramtbl - 1 do
++ let rec label i =
++ match i.desc with
++ Lend -> new_label()
++ | Llabel lbl when lbl = tramtbl.(j) -> lbl
++ | _ -> label i.next in
++ tramtbl.(j) <- label i.next;
++ ` .short ({emit_label tramtbl.(j)}-.)/2+{emit_int j}\n`
+ done;
-+ ` .align 1\n`;
-+ 2 + Array.length jumptbl / 2
++ (* Generate the necessary trampolines *)
++ for j = 0 to Array.length tramtbl - 1 do
++ if tramtbl.(j) <> jumptbl.(j) then
++ `{emit_label tramtbl.(j)}: b {emit_label jumptbl.(j)}\n`
++ done
++ end else if not !pic_code then begin
++ ` ldr pc, [pc, {emit_reg i.arg.(0)}, lsl #2]\n`;
++ ` nop\n`;
++ for j = 0 to Array.length jumptbl - 1 do
++ ` .word {emit_label jumptbl.(j)}\n`
++ done
+ end else begin
-+ if not !pic_code then begin
-+ ` ldr pc, [pc, {emit_reg i.arg.(0)}, lsl #2]\n`;
-+ ` nop\n`;
-+ for i = 0 to Array.length jumptbl - 1 do
-+ ` .word {emit_label jumptbl.(i)}\n`
-+ done
-+ end else begin
-+ (* Slightly slower, but position-independent *)
-+ ` add pc, pc, {emit_reg i.arg.(0)}, lsl #2\n`;
-+ ` nop\n`;
-+ for i = 0 to Array.length jumptbl - 1 do
-+ ` b {emit_label jumptbl.(i)}\n`
-+ done
-+ end;
-+ 2 + Array.length jumptbl
-+ end
++ (* Slightly slower, but position-independent *)
++ ` add pc, pc, {emit_reg i.arg.(0)}, lsl #2\n`;
++ ` nop\n`;
++ for j = 0 to Array.length jumptbl - 1 do
++ ` b {emit_label jumptbl.(j)}\n`
++ done
++ end;
+ 2 + Array.length jumptbl
| Lsetuptrap lbl ->
` bl {emit_label lbl}\n`; 1
| Lpushtrap ->
@@ -1339,7 +1350,7 @@ index a4b2241..846ee4a 100644
let data l =
` .data\n`;
-@@ -605,32 +869,62 @@ let data l =
+@@ -605,32 +878,62 @@ let data l =
(* Beginning / end of an assembly file *)
let begin_assembly() =
@@ -3092,5 +3103,5 @@ index 6ed0a9c..4e07c92 100755
esac
--
-1.7.7.6
+1.7.10
diff --git a/ocaml.spec b/ocaml.spec
index 1ab89ee..eff55d0 100644
--- a/ocaml.spec
+++ b/ocaml.spec
@@ -1,6 +1,6 @@
Name: ocaml
Version: 3.12.1
-Release: 8%{?dist}
+Release: 9%{?dist}
Summary: Objective Caml compiler and programming environment
@@ -495,6 +495,10 @@ fi
%changelog
+* Sun Jun 3 2012 Richard W.M. Jones <rjones at redhat.com> 3.12.1-9
+- Include svn rev 12548 to fix invalid generation of Thumb-2 branch
+ instruction TBH (upstream PR#5623, RHBZ#821153).
+
* Wed May 29 2012 Richard W.M. Jones <rjones at redhat.com> 3.12.1-8
- Modify the ppc64 patch to reduce the delta between power64 and
upstream power backends.
More information about the scm-commits
mailing list