riscv: Further fix for https://github.com/nojb/riscv-ocaml/issues/2
This commit is contained in:
parent
1b4063eb57
commit
0e2c6567fd
@ -1,13 +1,13 @@
|
||||
From a045766e1fc85d3f0c378415c58577d5156e10f4 Mon Sep 17 00:00:00 2001
|
||||
From b81417ea168c3cf9454eeb41f1f723b66b3210aa Mon Sep 17 00:00:00 2001
|
||||
From: Nicolas Ojeda Bar <n.oje.bar@gmail.com>
|
||||
Date: Tue, 22 Nov 2016 22:30:35 +0100
|
||||
Subject: [PATCH 9/9] Fix immediates' range when adjusting/indexing sp
|
||||
|
||||
---
|
||||
asmcomp/riscv/arch.ml | 3 +++
|
||||
asmcomp/riscv/emit.mlp | 51 ++++++++++++++++++++++++++++++++++------------
|
||||
asmcomp/riscv/emit.mlp | 53 ++++++++++++++++++++++++++++++++++------------
|
||||
asmcomp/riscv/selection.ml | 2 +-
|
||||
3 files changed, 42 insertions(+), 14 deletions(-)
|
||||
3 files changed, 44 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/asmcomp/riscv/arch.ml b/asmcomp/riscv/arch.ml
|
||||
index 61a38b1..22c807c 100644
|
||||
@ -24,10 +24,10 @@ index 61a38b1..22c807c 100644
|
||||
|
||||
let big_endian = false
|
||||
diff --git a/asmcomp/riscv/emit.mlp b/asmcomp/riscv/emit.mlp
|
||||
index 6d0e3ae..932a28c 100644
|
||||
index 6d0e3ae..97c49ce 100644
|
||||
--- a/asmcomp/riscv/emit.mlp
|
||||
+++ b/asmcomp/riscv/emit.mlp
|
||||
@@ -93,6 +93,32 @@ let emit_stack r =
|
||||
@@ -93,6 +93,34 @@ let emit_stack r =
|
||||
let ofs = slot_offset s (register_class r) in `{emit_int ofs}(sp)`
|
||||
| _ -> fatal_error "Emit.emit_stack"
|
||||
|
||||
@ -46,6 +46,7 @@ index 6d0e3ae..932a28c 100644
|
||||
+ ` {emit_string stg} {emit_reg src}, {emit_int ofs}(sp)\n`
|
||||
+ else begin
|
||||
+ ` li {emit_reg reg_tmp1}, {emit_int ofs}\n`;
|
||||
+ ` add {emit_reg reg_tmp1}, sp, {emit_reg reg_tmp1}\n`;
|
||||
+ ` {emit_string stg} {emit_reg src}, 0({emit_reg reg_tmp1})\n`
|
||||
+ end
|
||||
+
|
||||
@ -54,13 +55,14 @@ index 6d0e3ae..932a28c 100644
|
||||
+ ` {emit_string lg} {emit_reg dst}, {emit_int ofs}(sp)\n`
|
||||
+ else begin
|
||||
+ ` li {emit_reg reg_tmp1}, {emit_int ofs}\n`;
|
||||
+ ` add {emit_reg reg_tmp1}, sp, {emit_reg reg_tmp1}\n`;
|
||||
+ ` {emit_string lg} {emit_reg dst}, 0({emit_reg reg_tmp1})\n`
|
||||
+ end
|
||||
+
|
||||
(* Record live pointers at call points *)
|
||||
|
||||
let record_frame_label ?label live raise_ dbg =
|
||||
@@ -218,6 +244,7 @@ let name_for_specific = function
|
||||
@@ -218,6 +246,7 @@ let name_for_specific = function
|
||||
|
||||
(* Name of current function *)
|
||||
let function_name = ref ""
|
||||
@ -68,7 +70,7 @@ index 6d0e3ae..932a28c 100644
|
||||
(* Entry point for tail recursive calls *)
|
||||
let tailrec_entry_point = ref 0
|
||||
|
||||
@@ -234,12 +261,14 @@ let emit_instr i =
|
||||
@@ -234,12 +263,14 @@ let emit_instr i =
|
||||
` mv {emit_reg dst}, {emit_reg src}\n`
|
||||
| {loc = Reg _; typ = Float}, {loc = Reg _; typ = Float} ->
|
||||
` fmv.d {emit_reg dst}, {emit_reg src}\n`
|
||||
@ -87,7 +89,7 @@ index 6d0e3ae..932a28c 100644
|
||||
| {loc = Stack _; typ = Float}, {loc = Reg _} ->
|
||||
` fld {emit_reg dst}, {emit_stack src}\n`
|
||||
| _ ->
|
||||
@@ -263,8 +292,7 @@ let emit_instr i =
|
||||
@@ -263,8 +294,7 @@ let emit_instr i =
|
||||
let n = frame_size() in
|
||||
if !contains_calls then
|
||||
` {emit_string lg} ra, {emit_int(n - size_addr)}(sp)\n`;
|
||||
@ -97,7 +99,7 @@ index 6d0e3ae..932a28c 100644
|
||||
` jr {emit_reg i.arg.(0)}\n`
|
||||
| Lop(Itailcall_imm {func; label_after = _}) ->
|
||||
if func = !function_name then begin
|
||||
@@ -273,8 +301,7 @@ let emit_instr i =
|
||||
@@ -273,8 +303,7 @@ let emit_instr i =
|
||||
let n = frame_size() in
|
||||
if !contains_calls then
|
||||
` {emit_string lg} ra, {emit_int(n - size_addr)}(sp)\n`;
|
||||
@ -107,7 +109,7 @@ index 6d0e3ae..932a28c 100644
|
||||
` tail {emit_symbol func}\n`
|
||||
end
|
||||
| Lop(Iextcall{func; alloc = true; label_after = label}) ->
|
||||
@@ -285,7 +312,7 @@ let emit_instr i =
|
||||
@@ -285,7 +314,7 @@ let emit_instr i =
|
||||
` call {emit_symbol func}\n`
|
||||
| Lop(Istackoffset n) ->
|
||||
assert (n mod 16 = 0);
|
||||
@ -116,7 +118,7 @@ index 6d0e3ae..932a28c 100644
|
||||
stack_offset := !stack_offset + n
|
||||
| Lop(Iload(Single, Iindexed ofs)) ->
|
||||
` flw {emit_reg i.res.(0)}, {emit_int ofs}({emit_reg i.arg.(0)})\n`;
|
||||
@@ -398,8 +425,7 @@ let emit_instr i =
|
||||
@@ -398,8 +427,7 @@ let emit_instr i =
|
||||
` {emit_string lg} ra, {emit_int(n - size_addr)}(sp)\n`
|
||||
| Lreturn ->
|
||||
let n = frame_size() in
|
||||
@ -126,7 +128,7 @@ index 6d0e3ae..932a28c 100644
|
||||
` ret\n`
|
||||
| Llabel lbl ->
|
||||
`{emit_label lbl}:\n`
|
||||
@@ -513,8 +539,7 @@ let fundecl fundecl =
|
||||
@@ -513,8 +541,7 @@ let fundecl fundecl =
|
||||
` .align 2\n`;
|
||||
`{emit_symbol fundecl.fun_name}:\n`;
|
||||
let n = frame_size() in
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
Name: ocaml
|
||||
Version: 4.04.0
|
||||
Release: 5%{?dist}
|
||||
Release: 6%{?dist}
|
||||
|
||||
Summary: OCaml compiler and programming environment
|
||||
|
||||
@ -453,6 +453,9 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Wed Nov 23 2016 Richard W.M. Jones <rjones@redhat.com> - 4.04.0-6
|
||||
- riscv: Further fix for https://github.com/nojb/riscv-ocaml/issues/2
|
||||
|
||||
* Tue Nov 22 2016 Richard W.M. Jones <rjones@redhat.com> - 4.04.0-5
|
||||
- Update RISC-V support to fix
|
||||
https://github.com/nojb/riscv-ocaml/issues/2
|
||||
|
Loading…
Reference in New Issue
Block a user