Skip to content

Commit fe8a98b

Browse files
authored
flambda-backend: Save Mach as Cfg after Selection (#624)
1 parent 2b205d8 commit fe8a98b

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

driver/maindriver.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ let main argv ppf =
6363
are incompatible with -pack, -a, -output-obj"
6464
(String.concat "|"
6565
(P.available_pass_names ~filter:(fun _ -> true) ~native:false))
66-
| Some (P.Scheduling | P.Simplify_cfg | P.Emit) -> assert false (* native only *)
66+
| Some (P.Scheduling | P.Simplify_cfg | P.Emit | P.Selection) ->
67+
assert false (* native only *)
6768
end;
6869
if !make_archive then begin
6970
Compmisc.init_path ();

driver/optmaindriver.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ let main argv ppf =
7676
Compenv.fatal "Please specify at most one of -pack, -a, -shared, -c, \
7777
-output-obj";
7878
| Some ((P.Parsing | P.Typing | P.Scheduling
79-
| P.Simplify_cfg | P.Emit) as p) ->
79+
| P.Simplify_cfg | P.Emit | P.Selection) as p) ->
8080
assert (P.is_compilation_pass p);
8181
Printf.ksprintf Compenv.fatal
8282
"Options -i and -stop-after (%s) \
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
wrong argument 'typing'; option '-save-ir-after' expects one of: scheduling simplify_cfg.
1+
wrong argument 'typing'; option '-save-ir-after' expects one of: scheduling simplify_cfg selection.

utils/clflags.ml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,26 +546,29 @@ module Compiler_pass = struct
546546
- the manpages in man/ocaml{c,opt}.m
547547
- the manual manual/manual/cmds/unified-options.etex
548548
*)
549-
type t = Parsing | Typing | Scheduling | Emit | Simplify_cfg
549+
type t = Parsing | Typing | Scheduling | Emit | Simplify_cfg | Selection
550550

551551
let to_string = function
552552
| Parsing -> "parsing"
553553
| Typing -> "typing"
554554
| Scheduling -> "scheduling"
555555
| Emit -> "emit"
556556
| Simplify_cfg -> "simplify_cfg"
557+
| Selection -> "selection"
557558

558559
let of_string = function
559560
| "parsing" -> Some Parsing
560561
| "typing" -> Some Typing
561562
| "scheduling" -> Some Scheduling
562563
| "emit" -> Some Emit
563564
| "simplify_cfg" -> Some Simplify_cfg
565+
| "selection" -> Some Selection
564566
| _ -> None
565567

566568
let rank = function
567569
| Parsing -> 0
568570
| Typing -> 1
571+
| Selection -> 20
569572
| Simplify_cfg -> 49
570573
| Scheduling -> 50
571574
| Emit -> 60
@@ -576,19 +579,22 @@ module Compiler_pass = struct
576579
Scheduling;
577580
Emit;
578581
Simplify_cfg;
582+
Selection;
579583
]
580584
let is_compilation_pass _ = true
581585
let is_native_only = function
582586
| Scheduling -> true
583587
| Emit -> true
584588
| Simplify_cfg -> true
589+
| Selection -> true
585590
| Parsing | Typing -> false
586591

587592
let enabled is_native t = not (is_native_only t) || is_native
588593
let can_save_ir_after = function
589594
| Scheduling -> true
590595
| Simplify_cfg -> true
591-
| _ -> false
596+
| Selection -> true
597+
| Parsing | Typing | Emit -> false
592598

593599
let available_pass_names ~filter ~native =
594600
passes
@@ -603,6 +609,7 @@ module Compiler_pass = struct
603609
match t with
604610
| Scheduling -> prefix ^ Compiler_ir.(extension Linear)
605611
| Simplify_cfg -> prefix ^ Compiler_ir.(extension Cfg)
612+
| Selection -> prefix ^ Compiler_ir.(extension Cfg) ^ "-sel"
606613
| Emit | Parsing | Typing -> Misc.fatal_error "Not supported"
607614

608615
let of_input_filename name =

utils/clflags.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ module Compiler_ir : sig
254254
end
255255

256256
module Compiler_pass : sig
257-
type t = Parsing | Typing | Scheduling | Emit | Simplify_cfg
257+
type t = Parsing | Typing | Scheduling | Emit | Simplify_cfg | Selection
258258
val of_string : string -> t option
259259
val to_string : t -> string
260260
val is_compilation_pass : t -> bool

0 commit comments

Comments
 (0)