From: Stephane Glondu Date: Fri, 8 Nov 2013 15:42:19 +0000 (+0100) Subject: Fix ocamlopt on sparc X-Git-Tag: archive/raspbian/4.02.3-10+rpi1~2^2^2^2^2~5 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=aeae8d2262c5c2f8c156fd5001e7cbb4b95417d5;p=ocaml.git Fix ocamlopt on sparc Bug: http://caml.inria.fr/mantis/view.php?id=6227 Gbp-Pq: Name 0012-Fix-ocamlopt-on-sparc.patch --- diff --git a/asmcomp/interf.ml b/asmcomp/interf.ml index 77acb78a..eab8a961 100644 --- a/asmcomp/interf.ml +++ b/asmcomp/interf.ml @@ -115,13 +115,17 @@ let build_graph fundecl = (* Add a preference from one reg to another. Do not add anything if the two registers conflict, - or if the source register already has a location. *) + or if the source register already has a location, + or if the two registers belong to different classes. + (The last case can occur e.g. on Sparc when passing + float arguments in integer registers, PR#6227.) *) let add_pref weight r1 r2 = if weight > 0 then begin let i = r1.stamp and j = r2.stamp in if i <> j && r1.loc = Unknown + && Proc.register_class r1 = Proc.register_class r2 && (let p = if i < j then (i, j) else (j, i) in not (IntPairSet.mem p !mat)) then r1.prefer <- (r2, weight) :: r1.prefer diff --git a/asmcomp/sparc/emit.mlp b/asmcomp/sparc/emit.mlp index b8387cd7..258b2ca1 100644 --- a/asmcomp/sparc/emit.mlp +++ b/asmcomp/sparc/emit.mlp @@ -64,7 +64,7 @@ let symbol_prefix = if Config.system = "sunos" then "_" else "" let emit_symbol s = - if String.length s >= 1 & s.[0] = '.' + if String.length s >= 1 && s.[0] = '.' then emit_string s else begin emit_string symbol_prefix; Emitaux.emit_symbol '$' s end @@ -629,8 +629,8 @@ let is_one_instr i = i.arg.(0).typ <> Float && i.res.(0).typ <> Float | Iconst_int n -> is_native_immediate n | Istackoffset _ -> true - | Iload(_, Iindexed n) -> i.res.(0).typ <> Float & is_immediate n - | Istore(_, Iindexed n) -> i.arg.(0).typ <> Float & is_immediate n + | Iload(_, Iindexed n) -> i.res.(0).typ <> Float && is_immediate n + | Istore(_, Iindexed n) -> i.arg.(0).typ <> Float && is_immediate n | Iintop(op) -> is_one_instr_op op | Iintop_imm(op, _) -> is_one_instr_op op | Iaddf | Isubf | Imulf | Idivf -> true @@ -660,15 +660,15 @@ let rec emit_all i = emit_instr i.next (Some i); emit_all i.next.next | {next = {desc = Lop(Itailcall_imm s)}} - when s = !function_name & is_one_instr i -> + when s = !function_name && is_one_instr i -> emit_instr i.next (Some i); emit_all i.next.next | {next = {desc = Lop(Icall_ind)}} - when is_one_instr i & no_interference i.res i.next.arg -> + when is_one_instr i && no_interference i.res i.next.arg -> emit_instr i.next (Some i); emit_all i.next.next | {next = {desc = Lcondbranch(_, _)}} - when is_one_instr i & no_interference i.res i.next.arg -> + when is_one_instr i && no_interference i.res i.next.arg -> emit_instr i.next (Some i); emit_all i.next.next | _ ->