Skip to content

Commit 2dca25a

Browse files
committed
Move "how to add a new flag" to HACKING
1 parent 2dc06e4 commit 2dca25a

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

HACKING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ want to modify the Flambda backend. Jump to:
1616
- [Pulling changes onto a release branch](#pulling-changes-onto-a-release-branch)
1717
- [Rebasing to a new major version of the upstream compiler](#rebasing-to-a-new-major-version-of-the-upstream-compiler)
1818
- [How to add a new intrinsic to the compiler](#how-to-add-a-new-intrinsic-to-the-compiler)
19+
- [How to add a new command line option](#how-to-add-a-new-command-line-option)
1920
- [Installation tree comparison script](#installation-tree-comparison-script)
2021

2122
## Branches, pull requests, etc.
@@ -293,6 +294,17 @@ library, and then the compiler.
293294
relies on the library tests to avoid duplication. Library tests use
294295
`Core`, but the library itself does not.
295296

297+
## How to add a new command line option
298+
299+
1) Add a ref to `flambda_backend_flags.ml{i}`
300+
2) Add the flag's constructor `mk_<flag>` in `flambda_backend_args.ml`
301+
3) Add the callback for the new flag to `Flambda_backend_options` module type
302+
in `flambda_backend_args.ml{i}`
303+
4) List the flag in the body of `Make_flambda_backend_options` functor
304+
5) Implement the flag in `Flambda_backend_options_impl`
305+
by setting the corresponding ref in Flambda_backend_flags
306+
6) Add the flag to `Extra_params` if it can be set via `OCAMLPARAM`
307+
296308
## Installation tree comparison script
297309

298310
A target `make compare` exists to run a comparison script that finds differences

driver/flambda_backend_args.mli

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,6 @@
1818
different installable tools and (b) override default implementations
1919
of arguments. *)
2020

21-
(** Steps for adding a new flag:
22-
1) add a ref to flambda_backend_flags.ml{i}
23-
2) add the flag's constructor "mk_<flag>" in flambda_backend_args.ml
24-
3) add the callback for the new flag to Flambda_backend_options module type
25-
in flambda_backend_args.ml{i}
26-
4) list the flag in the body of Make_flambda_backend_options functor
27-
5) implement the flag in Flambda_backend_options_impl
28-
by setting the corresponding ref in Flambda_backend_flags
29-
6) add the flag to Extra_params if it can be set via OCAMLPARAM
30-
*)
31-
3221
(** Command line arguments required for flambda backend. *)
3322
module type Flambda_backend_options = sig
3423
val ocamlcfg : unit -> unit

0 commit comments

Comments
 (0)