summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--asmcomp/selectgen.ml9
1 files changed, 8 insertions, 1 deletions
diff --git a/asmcomp/selectgen.ml b/asmcomp/selectgen.ml
index 7c063087e..5da131c88 100644
--- a/asmcomp/selectgen.ml
+++ b/asmcomp/selectgen.ml
@@ -500,7 +500,14 @@ method emit_expr env exp =
alloc_state <- None;
rd
| Some(ralloc, ofs) ->
- ignore(self#insert_op (Iintop_imm(Iadd, ofs)) ralloc rd);
+ if self#is_immediate ofs then
+ ignore(self#insert_op (Iintop_imm(Iadd, ofs)) ralloc rd)
+ else begin
+ let r = Reg.createv typ_int in
+ ignore(self#insert_op (Iconst_int(Nativeint.from ofs)) [||] r);
+ ignore(self#insert_op (Iintop Iadd)
+ (Array.append ralloc r) rd)
+ end;
alloc_state <- Some(ralloc, ofs + size);
self#emit_stores env new_args ralloc
(Arch.offset_addressing header_addressing ofs);