diff options
Diffstat (limited to 'asmcomp/selectgen.ml')
-rw-r--r-- | asmcomp/selectgen.ml | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/asmcomp/selectgen.ml b/asmcomp/selectgen.ml index 0b75c64bdc..15c66843a9 100644 --- a/asmcomp/selectgen.ml +++ b/asmcomp/selectgen.ml @@ -824,3 +824,17 @@ method emit_fundecl f = fun_fast = f.Cmm.fun_fast } end + +(* Tail call criterion (estimated). Assumes: +- all arguments are of type "int" (always the case for Caml function calls) +- one extra argument representing the closure environment (conservative). +*) + +let is_tail_call nargs = + assert (Reg.dummy.typ = Int); + let args = Array.make (nargs + 1) Reg.dummy in + let (loc_arg, stack_ofs) = Proc.loc_arguments args in + stack_ofs = 0 + +let _ = + Simplif.is_tail_native_heuristic := is_tail_call |