summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>1999-05-15 17:48:10 +0000
committerXavier Leroy <xavier.leroy@inria.fr>1999-05-15 17:48:10 +0000
commit52bdeb2bdff552dc70657e04df4e1a9f8b4c3985 (patch)
treef8101f5f1cf14a9d7acbc7586f607dc1ca3e27ce
parent57acfa7dec1f89d213d22dfc4544445bbeceb4cd (diff)
Prise en compte du traitement addimm 2 addresses -> lea
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2375 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--asmcomp/i386/emit_nt.mlp2
-rw-r--r--asmcomp/i386/reload.ml4
2 files changed, 6 insertions, 0 deletions
diff --git a/asmcomp/i386/emit_nt.mlp b/asmcomp/i386/emit_nt.mlp
index a1c7dfa06..5ee1b8e0e 100644
--- a/asmcomp/i386/emit_nt.mlp
+++ b/asmcomp/i386/emit_nt.mlp
@@ -429,6 +429,8 @@ let emit_instr i =
` inc {emit_reg i.res.(0)}\n`
| Lop(Iintop_imm(Iadd, -1) | Iintop_imm(Isub, 1)) ->
` dec {emit_reg i.res.(0)}\n`
+ | Lop(Iintop_imm(Iadd, n)) when i.arg.(0).loc <> i.res.(0).loc ->
+ ` lea {emit_reg i.res.(0)}, [{emit_reg i.arg.(0)}+{emit_int n}]\n`
| Lop(Iintop_imm(Idiv, n)) ->
let l = Misc.log2 n in
let lbl = new_label() in
diff --git a/asmcomp/i386/reload.ml b/asmcomp/i386/reload.ml
index d648e48e3..a29156398 100644
--- a/asmcomp/i386/reload.ml
+++ b/asmcomp/i386/reload.ml
@@ -43,6 +43,10 @@ method reload_operation op arg res =
if stackp arg.(0) && stackp arg.(1)
then ([|arg.(0); self#makereg arg.(1)|], res)
else (arg, res)
+ | Iintop_imm(Iadd, _) when arg.(0).loc <> res.(0).loc ->
+ (* This add will be turned into a lea; args and results must be
+ in registers *)
+ super#reload_operation op arg res
| Iintop(Ilsl|Ilsr|Iasr) | Iintop_imm(_, _) | Ifloatofint | Iintoffloat |
Ispecific(Ipush) ->
(* The argument(s) can be either in register or on stack *)