summaryrefslogtreecommitdiff
path: root/asmcomp
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>1999-05-15 15:04:08 +0000
committerXavier Leroy <xavier.leroy@inria.fr>1999-05-15 15:04:08 +0000
commit94b8cdbb749016ee94e753088a30016f03e5cd2f (patch)
treea6d4fdbdcfa92d83e0051a1a0b7461d209ebaa75 /asmcomp
parent75d7f7d0aa303653a7c1ef6b36e7fa168c807b2c (diff)
downloadocaml-94b8cdbb749016ee94e753088a30016f03e5cd2f.tar.gz
Emettre un lea pour x <- y + cst quand x et y sont dans des registres differents (utile pour la nouvelle passe Comballoc)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2360 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'asmcomp')
-rw-r--r--asmcomp/i386/emit.mlp2
-rw-r--r--asmcomp/m68k/emit.mlp7
2 files changed, 7 insertions, 2 deletions
diff --git a/asmcomp/i386/emit.mlp b/asmcomp/i386/emit.mlp
index eb16e3f39d..fe4eac8db2 100644
--- a/asmcomp/i386/emit.mlp
+++ b/asmcomp/i386/emit.mlp
@@ -434,6 +434,8 @@ let emit_instr i =
` incl {emit_reg i.res.(0)}\n`
| Lop(Iintop_imm(Iadd, -1) | Iintop_imm(Isub, 1)) ->
` decl {emit_reg i.res.(0)}\n`
+ | Lop(Iintop_imm(Iadd, n)) when i.arg.(0).loc <> i.res.(0).loc ->
+ ` leal {emit_int n}({emit_reg i.arg.(0)}), {emit_reg i.res.(0)}\n`
| Lop(Iintop_imm(Idiv, n)) ->
let l = Misc.log2 n in
let lbl = new_label() in
diff --git a/asmcomp/m68k/emit.mlp b/asmcomp/m68k/emit.mlp
index e92fa6a11a..aaa7fb5eb6 100644
--- a/asmcomp/m68k/emit.mlp
+++ b/asmcomp/m68k/emit.mlp
@@ -439,8 +439,11 @@ let emit_instr i =
` subql #{emit_int(-n)}, {emit_reg dest}\n`;
set_cc i.res.(0)
| _ ->
- ` addl #{emit_int n}, {emit_reg dest}\n`;
- set_cc i.res.(0)
+ if i.arg.(0).loc = i.res.(0).loc then begin
+ ` addl #{emit_int n}, {emit_reg dest}\n`;
+ set_cc i.res.(0)
+ end else
+ ` lea {emit_reg i.arg.(0)}@({emit_int n}), {emit_reg i.res.(0)}\n`
end
| Lop(Iintop_imm(Isub, n)) ->
let dest = i.res.(0) in