Eviter d'emettre des addi 1, 1, 0 en cas de fonction qui n'utilise pas la pile
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1988 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
a859063f3b
commit
5ac8854085
|
@ -448,6 +448,7 @@ let rec emit_instr i dslot =
|
|||
` addi {emit_gpr 1}, {emit_gpr 1}, {emit_int n}\n`;
|
||||
` mtlr {emit_gpr 11}\n`
|
||||
end else begin
|
||||
if n > 0 then
|
||||
` addi {emit_gpr 1}, {emit_gpr 1}, {emit_int n}\n`
|
||||
end;
|
||||
` bctr\n`
|
||||
|
@ -461,6 +462,7 @@ let rec emit_instr i dslot =
|
|||
` addi {emit_gpr 1}, {emit_gpr 1}, {emit_int n}\n`;
|
||||
` mtlr {emit_gpr 11}\n`
|
||||
end else begin
|
||||
if n > 0 then
|
||||
` addi {emit_gpr 1}, {emit_gpr 1}, {emit_int n}\n`
|
||||
end;
|
||||
` b {emit_codesymbol s}\n`
|
||||
|
@ -484,6 +486,7 @@ let rec emit_instr i dslot =
|
|||
` lwz 0, 0(12)\n`;
|
||||
` lwz 2, 4(12)\n`;
|
||||
` mtctr 0\n`;
|
||||
if n > 0 then
|
||||
` addi 1, 1, {emit_int n}\n`
|
||||
end;
|
||||
` bctr\n`
|
||||
|
@ -634,6 +637,7 @@ let rec emit_instr i dslot =
|
|||
` mtlr {emit_gpr 11}\n`
|
||||
| Lreturn ->
|
||||
let n = frame_size() in
|
||||
if n > 0 then
|
||||
` addi {emit_gpr 1}, {emit_gpr 1}, {emit_int n}\n`;
|
||||
` blr\n`
|
||||
| Llabel lbl ->
|
||||
|
@ -817,8 +821,10 @@ let fundecl fundecl =
|
|||
` mflr {emit_gpr 0}\n`;
|
||||
` addi {emit_gpr 1}, {emit_gpr 1}, {emit_int(-n)}\n`;
|
||||
` stw {emit_gpr 0}, {emit_int(n - 4)}({emit_gpr 1})\n`
|
||||
end else
|
||||
` addi {emit_gpr 1}, {emit_gpr 1}, {emit_int(-n)}\n`;
|
||||
end else begin
|
||||
if n > 0 then
|
||||
` addi {emit_gpr 1}, {emit_gpr 1}, {emit_int(-n)}\n`
|
||||
end;
|
||||
`{emit_label !tailrec_entry_point}:\n`;
|
||||
emit_all fundecl.fun_body;
|
||||
(* Emit the glue code to call the GC *)
|
||||
|
|
Loading…
Reference in New Issue