diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2010-05-25 12:34:20 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2010-05-25 12:34:20 +0000 |
commit | 4c7e1b7f38ea619da6620e5d8f04ca5483a7b12f (patch) | |
tree | 7ba2911a589cd752266119df85138082c72625b5 /asmcomp/selectgen.ml | |
parent | f1c18b2dff4fbca0d6053cc544f8fb6f1abb0af9 (diff) | |
download | ocaml-annot-from-lambda.tar.gz |
Added tail call heuristic for native compilationannot-from-lambda
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/annot-from-lambda@10466 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
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 |