diff options
author | Greta Yorsh <45005955+gretay-js@users.noreply.github.com> | 2020-10-13 14:07:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-13 15:07:13 +0200 |
commit | 855c13cd6e42abdc778767adf358cb8a4e4ac0a3 (patch) | |
tree | 26ba1ceb4ce5ea985cbe66f1e6f03fc50cded31f /driver/optcompile.ml | |
parent | 246564e8db0e86f10339bc4a4045835590c3e8b9 (diff) | |
download | ocaml-855c13cd6e42abdc778767adf358cb8a4e4ac0a3.tar.gz |
ability to restart compilation from .cmir-linear IR files
Diffstat (limited to 'driver/optcompile.ml')
-rw-r--r-- | driver/optcompile.ml | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/driver/optcompile.ml b/driver/optcompile.ml index 9ca93c33b0..693a35f489 100644 --- a/driver/optcompile.ml +++ b/driver/optcompile.ml @@ -85,7 +85,12 @@ let clambda i backend typed = ~ppf_dump:i.ppf_dump; Compilenv.save_unit_info (cmx i)) -let implementation ~backend ~source_file ~output_prefix = +(* Emit assembly directly from Linear IR *) +let emit i = + Compilenv.reset ?packname:!Clflags.for_package i.module_name; + Asmgen.compile_implementation_linear i.output_prefix ~progname:i.source_file + +let implementation ~backend ~start_from ~source_file ~output_prefix = let backend info typed = Compilenv.reset ?packname:!Clflags.for_package info.module_name; if Config.flambda @@ -93,4 +98,8 @@ let implementation ~backend ~source_file ~output_prefix = else clambda info backend typed in with_info ~source_file ~output_prefix ~dump_ext:"cmx" @@ fun info -> - Compile_common.implementation info ~backend + match (start_from:Clflags.Compiler_pass.t) with + | Parsing -> Compile_common.implementation info ~backend + | Emit -> emit info + | _ -> Misc.fatal_errorf "Cannot start from %s" + (Clflags.Compiler_pass.to_string start_from) |