-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathcompiler_hooks.mli
66 lines (56 loc) · 2.72 KB
/
compiler_hooks.mli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
(**************************************************************************)
(* *)
(* OCaml *)
(* *)
(* Copyright 2021 Jane Street Group LLC *)
(* *)
(* All rights reserved. This file is distributed under the terms of *)
(* the GNU Lesser General Public License version 2.1, with the *)
(* special exception on linking described in the file LICENSE. *)
(* *)
(**************************************************************************)
open Misc
open Compile_common
(* Hooks allow to inspect the IR produced by a pass without altering
the compilation pipeline.
Hooks are allowed to inspect the data but are prohibited from
altering it. If one hook were to mutate the data there's no guarantee
of how the compiler would behave.
Several hooks can be registered for the same pass. There's no guarantees
on the order of execution of hooks.
When one IR is the output of several passes, the hooks are usually called
on the latest version of the IR (the exception being passes marked as "raw",
where corresponding hooks are called on the earliest version of the IR).
*)
type _ pass =
| Parse_tree_intf : Parsetree.signature pass
| Parse_tree_impl : Parsetree.structure pass
| Typed_tree_intf : Typedtree.signature pass
| Typed_tree_impl : Typedtree.implementation pass
| Raw_lambda : Lambda.program pass
| Lambda : Lambda.program pass
| Raw_flambda2 : Flambda2_terms.Flambda_unit.t pass
| Flambda2 : Flambda2_terms.Flambda_unit.t pass
| Raw_flambda1 : Flambda.program pass
| Flambda1 : Flambda.program pass
| Raw_clambda : Clambda.ulambda pass
| Clambda : Clambda.ulambda pass
| Mach_polling : Mach.fundecl pass
| Mach_combine : Mach.fundecl pass
| Mach_cse : Mach.fundecl pass
| Mach_spill : Mach.fundecl pass
| Mach_live : Mach.fundecl pass
| Mach_reload : Mach.fundecl pass
| Mach_sel : Mach.fundecl pass
| Mach_split : Mach.fundecl pass
| Linear : Linear.fundecl pass
| Cfg : Cfg_with_layout.t pass
| Cmm : Cmm.phrase list pass
| Inlining_tree : Flambda2_simplify_shared.Inlining_report.Inlining_tree.t pass
(* Register a new hook for [pass]. *)
val register : 'a pass -> ('a -> unit) -> unit
(* Execute the hooks registered for [pass]. *)
val execute : 'a pass -> 'a -> unit
val execute_and_pipe : 'a pass -> 'a -> 'a
(* Remove all hooks registered for [pass] *)
val clear : 'a pass -> unit