Skip to content

Commit 10146f2

Browse files
gretay-jsxclerc
authored andcommitted
flambda-backend: Add ocamlcfg (ocaml#34)
* Import the code of ocamlcfg. * Fix imported code. * Optionally go through ocamlcfg. * Merge in the latest CFG version * Fix compilation warning 18. * Add copyright header to cfg files. The head is a copy of the LICENSE file at the root of ocamlcfg library Co-authored-by: xclerc <xclerc@janestreet.com>
1 parent 819d38a commit 10146f2

File tree

5 files changed

+13
-0
lines changed

5 files changed

+13
-0
lines changed

driver/compenv.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,8 @@ let read_one_param ppf position name v =
371371
set "flambda-invariants" [ flambda_invariant_checks ] v
372372
| "linscan" ->
373373
set "linscan" [ use_linscan ] v
374+
| "ocamlcfg" ->
375+
set "ocamlcfg" [ use_ocamlcfg ] v
374376
| "insn-sched" -> set "insn-sched" [ insn_sched ] v
375377
| "no-insn-sched" -> clear "insn-sched" [ insn_sched ] v
376378

driver/main_args.ml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,10 @@ let mk_linscan f =
328328
"-linscan", Arg.Unit f, " Use the linear scan register allocator"
329329
;;
330330

331+
let mk_ocamlcfg f =
332+
"-ocamlcfg", Arg.Unit f, " Use ocamlcfg"
333+
;;
334+
331335
let mk_make_runtime f =
332336
"-make-runtime", Arg.Unit f,
333337
" Build a runtime system with given C objects and libraries"
@@ -1092,6 +1096,7 @@ module type Optcommon_options = sig
10921096
val _insn_sched : unit -> unit
10931097
val _no_insn_sched : unit -> unit
10941098
val _linscan : unit -> unit
1099+
val _ocamlcfg : unit -> unit
10951100
val _no_float_const_prop : unit -> unit
10961101

10971102
val _clambda_checks : unit -> unit
@@ -1393,6 +1398,7 @@ struct
13931398
mk_alias_deps F._alias_deps;
13941399
mk_no_alias_deps F._no_alias_deps;
13951400
mk_linscan F._linscan;
1401+
mk_ocamlcfg F._ocamlcfg;
13961402
mk_app_funct F._app_funct;
13971403
mk_no_app_funct F._no_app_funct;
13981404
mk_no_float_const_prop F._no_float_const_prop;
@@ -1522,6 +1528,7 @@ module Make_opttop_options (F : Opttop_options) = struct
15221528
mk_alias_deps F._alias_deps;
15231529
mk_no_alias_deps F._no_alias_deps;
15241530
mk_linscan F._linscan;
1531+
mk_ocamlcfg F._ocamlcfg;
15251532
mk_app_funct F._app_funct;
15261533
mk_no_app_funct F._no_app_funct;
15271534
mk_no_float_const_prop F._no_float_const_prop;
@@ -1824,6 +1831,7 @@ module Default = struct
18241831
let _insn_sched = set insn_sched
18251832
let _no_insn_sched = clear insn_sched
18261833
let _linscan = set use_linscan
1834+
let _ocamlcfg = set use_ocamlcfg
18271835
let _no_float_const_prop = clear float_const_prop
18281836
let _no_unbox_free_vars_of_closures = clear unbox_free_vars_of_closures
18291837
let _no_unbox_specialised_args = clear unbox_specialised_args

driver/main_args.mli

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ module type Optcommon_options = sig
192192
val _insn_sched : unit -> unit
193193
val _no_insn_sched : unit -> unit
194194
val _linscan : unit -> unit
195+
val _ocamlcfg : unit -> unit
195196
val _no_float_const_prop : unit -> unit
196197

197198
val _clambda_checks : unit -> unit

utils/clflags.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ and debug = ref false (* -g *)
5252
and debug_full = ref false (* For full DWARF support *)
5353
and unsafe = ref false (* -unsafe *)
5454
and use_linscan = ref false (* -linscan *)
55+
and use_ocamlcfg = ref false (* -ocamlcfg *)
5556
and link_everything = ref false (* -linkall *)
5657
and custom_runtime = ref false (* -custom *)
5758
and no_check_prims = ref false (* -no-check-prims *)

utils/clflags.mli

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ val debug : bool ref
7979
val debug_full : bool ref
8080
val unsafe : bool ref
8181
val use_linscan : bool ref
82+
val use_ocamlcfg : bool ref
8283
val link_everything : bool ref
8384
val custom_runtime : bool ref
8485
val no_check_prims : bool ref

0 commit comments

Comments
 (0)