forked from ocaml-flambda/flambda-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdune
executable file
·588 lines (548 loc) · 16.1 KB
/
dune
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
;**************************************************************************
;* *
;* The Flambda backend project for OCaml *
;* *
;* Mark Shinwell, Jane Street Europe *
;* *
;* Copyright 2020 Jane Street Group LLC *
;* *
;**************************************************************************
; Since upstream has the middle end code inside ocamloptcomp, we do the
; same for the moment.
(copy_files# backend/*.ml{,i})
(copy_files# backend/cfg/*.ml{,i})
(copy_files# backend/debug/*.ml{,i})
(copy_files# backend/debug/dwarf/dwarf_ocaml/*.ml{,i})
(copy_files# backend/internal_assembler/*.ml{,i})
(copy_files# backend/peephole/*.ml{,i})
(copy_files# backend/regalloc/*.ml{,i})
(copy_files# driver/optcompile.ml{,i})
(copy_files# driver/flambda_backend_main.ml{,i})
(copy_files# driver/compiler_hooks.ml{,i})
(copy_files# driver/optmaindriver.ml{,i})
(copy_files# driver/flambda_backend_args.ml{,i})
(copy_files# driver/flambda_backend_flags.ml{,i})
(copy_files# file_formats/cmx_format.mli)
(copy_files# file_formats/linear_format.ml{,i})
(copy_files# file_formats/cfg_format.ml{,i})
(copy_files# middle_end/*.ml{,i})
(copy_files# middle_end/closure/*.ml{,i})
(copy_files# middle_end/flambda/*.ml{,i})
(copy_files# middle_end/flambda/base_types/*.ml{,i})
(copy_files# ocaml/driver/opterrors.ml{,i})
(copy_files# ocaml/file_formats/cmxs_format.mli)
(copy_files# printer/*.ml{,i})
(library
(name ocamloptcomp)
(wrapped false) ; for compatibility with existing code
(modes byte native)
; We should change the code so this "-open" can be removed.
; Likewise fix occurrences of warning 9.
(flags
(:standard -principal -w -9-69-70))
(ocamlopt_flags
(:include %{project_root}/ocamlopt_flags.sexp))
(instrumentation
(backend bisect_ppx))
(modules_without_implementation
backend_intf
cmx_format
cmxs_format
inlining_decision_intf
simplify_boxed_integer_ops_intf
x86_ast)
(modules
;; To match the Makefiles, ocamloptcomp needs to include ocamlmiddleend.
;; file_formats/
cmx_format
cmxs_format
;; middle_end/
backend_intf
backend_var
backend_var
clambda
clambda_primitives
compilenv
mangling
convert_primitives
internal_variable_names
printclambda
printclambda_primitives
semantics_of_primitives
symbol_utils
variable
;; middle_end/closure/
closure
closure_middle_end
;; middle_end/flambda/base_types/
closure_element
closure_id
closure_origin
export_id
id_types
mutable_variable
set_of_closures_id
set_of_closures_origin
static_exception
tag
var_within_closure
;; middle_end/flambda/
alias_analysis
allocated_const
augment_specialised_args
build_export_info
closure_conversion
closure_conversion_aux
closure_offsets
effect_analysis
export_info
extract_projections
find_recursive_functions
flambda
flambda_invariants
flambda_iterators
flambda_middle_end
flambda_to_clambda
flambda_utils
freshening
import_approx
inconstant_idents
initialize_symbol_to_let_symbol
inline_and_simplify
inline_and_simplify_aux
inlining_cost
inlining_decision
inlining_decision_intf
inlining_stats
inlining_stats_types
inlining_transforms
invariant_params
lift_code
lift_constants
lift_let_to_initialize_symbol
parameter
pass_wrapper
projection
ref_to_variables
remove_free_vars_equal_to_args
remove_unused_arguments
remove_unused_closure_vars
remove_unused_program_constructs
share_constants
simple_value_approx
simplify_boxed_integer_ops
simplify_boxed_integer_ops_intf
simplify_common
simplify_primitives
traverse_for_exported_symbols
un_anf
unbox_closures
unbox_free_vars_of_closures
unbox_specialised_args
;; asmcomp/
afl_instrument
arch
asmgen
asmlibrarian
asmlink
asmpackager
branch_relaxation
branch_relaxation_intf
cfgize
checks
cmm_helpers
cmm_builtins
cmm_invariants
cmm
cmmgen
cmmgen_state
coloring
comballoc
CSE
CSEgen
dataflow
deadcode
emit
emitaux
interf
interval
linear
internal_assembler
linearize
linscan
liveness
mach
peephole_optimize
peephole_rules
peephole_utils
polling
printcmm
printlinear
printmach
checkmach
proc
reg
reload
reloadgen
relocation_entry
relocation_table
schedgen
scheduling
section_table
selectgen
selection
spill
split
string_table
strmatch
symbol_entry
symbol_table
x86_ast
x86_binary_emitter
x86_dsl
x86_gas
x86_masm
x86_proc
fdo_info
;; asmcomp/cfg
cfg
cfg_intf
cfg_to_linear
cfg_with_layout
cfg_with_infos
cfg_dataflow
cfg_deadcode
cfg_liveness
cfg_dominators
cfg_loop_infos
cfg_to_linear_desc
eliminate_dead_code
disconnect_block
eliminate_dead_blocks
eliminate_fallthrough_blocks
merge_straightline_blocks
extra_debug
label
linear_to_cfg
linear_utils
simplify_terminator
trap_stack
cfg_equivalence
;; backend/regalloc
regalloc_invariants
regalloc_irc
regalloc_irc_state
regalloc_irc_utils
regalloc_ls
regalloc_ls_state
regalloc_ls_utils
regalloc_rewrite
regalloc_stack_slots
regalloc_split
regalloc_split_state
regalloc_split_utils
regalloc_stack_operands
regalloc_utils
regalloc_validate
;; file_formats/
linear_format
cfg_format
;; asmcomp/debug/
reg_availability_set
compute_ranges_intf
available_regs
reg_with_debug_info
compute_ranges
;; asmcomp/debug/dwarf/dwarf_ocaml
;; This code has a lot of dependencies into ocamloptcomp, so we just
;; build it as part of that library.
dwarf
dwarf_compilation_unit
dwarf_concrete_instances
dwarf_state
;; driver/
opterrors
optcompile
optmaindriver
compiler_hooks
;; printer/
printast_with_mappings
location_tracker_formatter
; The driver should be in here too, but is not at present. This might
; be tricky because it has a different name...
)
(libraries
ocamlcommon
flambda_backend_common
flambda_backend_utils
flambda2_identifiers
flambda2_cmx
compiler_owee
gc_timings
dwarf_low
dwarf_high))
(library
(name flambda_backend_common)
(wrapped false)
(modes byte native)
; same flags as for ocamlcommon library
(flags
(-strict-sequence
-principal
-w
+a-4-9-40-41-42-44-45-48-66
-warn-error
A
-bin-annot
-safe-string
-strict-formats
-w
-67
; remove -w -67 by adding the camlinternalMenhirLib hack like the Makefile
))
(ocamlopt_flags
(:include %{project_root}/ocamlopt_flags.sexp))
(instrumentation
(backend bisect_ppx))
(libraries ocamlcommon dwarf_flags asm_targets)
(modules flambda_backend_args flambda_backend_flags))
(executable
(name flambda_backend_main)
(modes byte)
(instrumentation
(backend bisect_ppx))
(flags
(:standard -principal))
(libraries
flambda_backend_driver
memtrace
flambda2
flambda2_ui
flambda2_to_cmm
ocamloptcomp
ocamlcommon
unix)
(modules flambda_backend_main))
(rule
(targets flambda_backend_main_native.ml)
(action
(copy driver/flambda_backend_main.ml %{targets})))
(executable
(name flambda_backend_main_native)
(modes native)
(instrumentation
(backend bisect_ppx))
(flags
(:standard -principal))
(ocamlopt_flags
(:standard -runtime-variant nnp))
(libraries
flambda_backend_driver
memtrace
flambda2
flambda2_ui
flambda2_to_cmm
ocamloptcomp
ocamlcommon
unix)
(modules flambda_backend_main_native))
(rule
(targets boot_ocamlopt.ml)
(action
(copy driver/boot_ocamlopt.ml %{targets})))
; CR sdolan: Could be faster if it was closure-only?
(executable
(name boot_ocamlopt)
(modes native)
(instrumentation
(backend bisect_ppx))
(flags
(:standard -principal))
(libraries
flambda_backend_driver
flambda2
flambda2_ui
flambda2_to_cmm
ocamloptcomp
ocamlcommon
unix)
(modules boot_ocamlopt))
; The input archives (.a, .cma and .cmxa) to the following three rules
; must be kept in sync with each other and in a topological order.
(rule
(targets ocamloptcomp_with_flambda2.a)
(action
(run
%{dep:tools/merge_dot_a_files.sh}
%{targets}
%{dep:backend/debug/dwarf/dwarf_flags/dwarf_flags.a}
%{dep:backend/asm_targets/asm_targets.a}
%{dep:backend/debug/dwarf/dwarf_low/dwarf_low.a}
%{dep:backend/debug/dwarf/dwarf_high/dwarf_high.a}
%{dep:flambda_backend_common.a}
%{dep:utils/flambda_backend_utils.a}
%{dep:middle_end/flambda2/import/flambda2_import.a}
%{dep:middle_end/flambda2/ui/flambda2_ui.a}
%{dep:middle_end/flambda2/algorithms/flambda2_algorithms.a}
%{dep:middle_end/flambda2/numbers/flambda2_numbers.a}
%{dep:middle_end/flambda2/kinds/flambda2_kinds.a}
%{dep:middle_end/flambda2/identifiers/flambda2_identifiers.a}
%{dep:middle_end/flambda2/nominal/flambda2_nominal.a}
%{dep:middle_end/flambda2/lattices/flambda2_lattices.a}
%{dep:middle_end/flambda2/bound_identifiers/flambda2_bound_identifiers.a}
%{dep:middle_end/flambda2/term_basics/flambda2_term_basics.a}
%{dep:middle_end/flambda2/classic_mode_types/flambda2_classic_mode_types.a}
%{dep:middle_end/flambda2/types/flambda2_types.a}
%{dep:middle_end/flambda2/terms/flambda2_terms.a}
%{dep:middle_end/flambda2/simplify_shared/flambda2_simplify_shared.a}
%{dep:middle_end/flambda2/cmx/flambda2_cmx.a}
%{dep:middle_end/flambda2/from_lambda/flambda2_from_lambda.a}
%{dep:middle_end/flambda2/simplify/flambda2_simplify.a}
%{dep:middle_end/flambda2/parser/flambda2_parser.a}
%{dep:external/owee/compiler_owee.a}
%{dep:external/gc-timings/gc_timings.a}
%{dep:ocamloptcomp.a}
%{dep:middle_end/flambda2/to_cmm/flambda2_to_cmm.a}
%{dep:middle_end/flambda2/flambda2.a})))
(rule
(targets ocamloptcomp_with_flambda2.cma)
(action
(run
%{dep:tools/merge_archives.exe}
%{targets}
%{dep:backend/debug/dwarf/dwarf_flags/dwarf_flags.cma}
%{dep:backend/asm_targets/asm_targets.cma}
%{dep:backend/debug/dwarf/dwarf_low/dwarf_low.cma}
%{dep:backend/debug/dwarf/dwarf_high/dwarf_high.cma}
%{dep:flambda_backend_common.cma}
%{dep:utils/flambda_backend_utils.cma}
%{dep:middle_end/flambda2/import/flambda2_import.cma}
%{dep:middle_end/flambda2/ui/flambda2_ui.cma}
%{dep:middle_end/flambda2/algorithms/flambda2_algorithms.cma}
%{dep:middle_end/flambda2/numbers/flambda2_numbers.cma}
%{dep:middle_end/flambda2/kinds/flambda2_kinds.cma}
%{dep:middle_end/flambda2/identifiers/flambda2_identifiers.cma}
%{dep:middle_end/flambda2/nominal/flambda2_nominal.cma}
%{dep:middle_end/flambda2/lattices/flambda2_lattices.cma}
%{dep:middle_end/flambda2/bound_identifiers/flambda2_bound_identifiers.cma}
%{dep:middle_end/flambda2/term_basics/flambda2_term_basics.cma}
%{dep:middle_end/flambda2/classic_mode_types/flambda2_classic_mode_types.cma}
%{dep:middle_end/flambda2/types/flambda2_types.cma}
%{dep:middle_end/flambda2/terms/flambda2_terms.cma}
%{dep:middle_end/flambda2/simplify_shared/flambda2_simplify_shared.cma}
%{dep:middle_end/flambda2/cmx/flambda2_cmx.cma}
%{dep:middle_end/flambda2/from_lambda/flambda2_from_lambda.cma}
%{dep:middle_end/flambda2/simplify/flambda2_simplify.cma}
%{dep:middle_end/flambda2/parser/flambda2_parser.cma}
%{dep:external/owee/compiler_owee.cma}
%{dep:external/gc-timings/gc_timings.cma}
%{dep:ocamloptcomp.cma}
%{dep:middle_end/flambda2/to_cmm/flambda2_to_cmm.cma}
%{dep:middle_end/flambda2/flambda2.cma})))
(rule
(targets ocamloptcomp_with_flambda2.cmxa)
(action
(run
%{dep:tools/merge_archives.exe}
%{targets}
%{dep:backend/debug/dwarf/dwarf_flags/dwarf_flags.cmxa}
%{dep:backend/asm_targets/asm_targets.cmxa}
%{dep:backend/debug/dwarf/dwarf_low/dwarf_low.cmxa}
%{dep:backend/debug/dwarf/dwarf_high/dwarf_high.cmxa}
%{dep:flambda_backend_common.cmxa}
%{dep:utils/flambda_backend_utils.cmxa}
%{dep:middle_end/flambda2/import/flambda2_import.cmxa}
%{dep:middle_end/flambda2/ui/flambda2_ui.cmxa}
%{dep:middle_end/flambda2/algorithms/flambda2_algorithms.cmxa}
%{dep:middle_end/flambda2/numbers/flambda2_numbers.cmxa}
%{dep:middle_end/flambda2/kinds/flambda2_kinds.cmxa}
%{dep:middle_end/flambda2/identifiers/flambda2_identifiers.cmxa}
%{dep:middle_end/flambda2/nominal/flambda2_nominal.cmxa}
%{dep:middle_end/flambda2/lattices/flambda2_lattices.cmxa}
%{dep:middle_end/flambda2/bound_identifiers/flambda2_bound_identifiers.cmxa}
%{dep:middle_end/flambda2/term_basics/flambda2_term_basics.cmxa}
%{dep:middle_end/flambda2/classic_mode_types/flambda2_classic_mode_types.cmxa}
%{dep:middle_end/flambda2/types/flambda2_types.cmxa}
%{dep:middle_end/flambda2/terms/flambda2_terms.cmxa}
%{dep:middle_end/flambda2/simplify_shared/flambda2_simplify_shared.cmxa}
%{dep:middle_end/flambda2/cmx/flambda2_cmx.cmxa}
%{dep:middle_end/flambda2/from_lambda/flambda2_from_lambda.cmxa}
%{dep:middle_end/flambda2/simplify/flambda2_simplify.cmxa}
%{dep:middle_end/flambda2/parser/flambda2_parser.cmxa}
%{dep:external/owee/compiler_owee.cmxa}
%{dep:external/gc-timings/gc_timings.cmxa}
%{dep:ocamloptcomp.cmxa}
%{dep:middle_end/flambda2/to_cmm/flambda2_to_cmm.cmxa}
%{dep:middle_end/flambda2/flambda2.cmxa})))
(install
(files
(flambda_backend_main.bc as ocamlopt.byte)
(flambda_backend_main_native.exe as ocamlopt.opt))
(section bin)
(package ocaml))
(install
(files
(external/owee/libcompiler_owee_stubs.a
as
compiler-libs/libcompiler_owee_stubs.a)
(external/owee/libcompiler_owee_stubs.a
as
compiler-libs/libcompiler_owee_stubs_native.a)
(external/gc-timings/libgc_timings_stubs.a
as
compiler-libs/libgc_timings_stubs.a)
(external/gc-timings/libgc_timings_stubs.a
as
compiler-libs/libgc_timings_stubs_native.a)
; for special_dune compat
(ocamloptcomp_with_flambda2.cma as compiler-libs/ocamloptcomp.cma)
(ocamloptcomp_with_flambda2.cmxa as compiler-libs/ocamloptcomp.cmxa)
(ocamloptcomp_with_flambda2.a as compiler-libs/ocamloptcomp.a))
(section lib)
(package ocaml))
(rule
(targets compiler-libs-installation.sexp)
(deps
; Note that Dune doesn't allow globbing in the path part of the filename,
; so this is a bit more repetitive than it could be. Also, as far as I can
; tell, (glob_files_rec) simply doesn't work.
ocaml/jane_syntax.mli
(glob_files *.mli)
(glob_files .ocamloptcomp.objs/byte/*.{cmi,cmo,cmt,cmti})
(glob_files .ocamloptcomp.objs/native/*.cmx)
(glob_files
backend/asm_targets/.asm_targets.objs/byte/asm_targets.{cmi,cmo,cmt})
(glob_files_rec
backend/asm_targets/.asm_targets.objs/native/asm_targets.cmx)
(glob_files middle_end/flambda2/.flambda2objs/byte/flambda2.{cmi,cmt})
(glob_files
middle_end/flambda2/to_cmm/.flambda2_to_cmm.objs/byte/flambda2_to_cmm{,__To_cmm}.{cmi,cmt})
(glob_files
.flambda_backend_common.objs/byte/flambda_backend_{args,flags}.{cmi,cmo,cmt,cmti})
(glob_files
.flambda_backend_common.objs/native/flambda_backend_{args,flags}.cmx)
backend/debug/dwarf/dwarf_flags/dwarf_flags.mli
(glob_files
backend/debug/dwarf/dwarf_flags/.dwarf_flags.objs/byte/dwarf_flags.{cmi,cmo,cmt,cmti})
backend/debug/dwarf/dwarf_flags/.dwarf_flags.objs/native/dwarf_flags.cmx
(glob_files
backend/debug/dwarf/dwarf_low/.dwarf_low.objs/byte/*.{cmi,cmo,cmt})
(glob_files backend/debug/dwarf/dwarf_low/.dwarf_low.objs/native/*.cmx)
(glob_files
backend/debug/dwarf/dwarf_high/.dwarf_high.objs/byte/*.{cmi,cmo,cmt})
(glob_files backend/debug/dwarf/dwarf_high/.dwarf_high.objs/native/*.cmx)
(glob_files backend/debug/dwarf/dwarf_ocaml/.dwarf_ocaml.objs/native/*.cmx)
(glob_files external/owee/.compiler_owee.objs/byte/*.{cmi,cmo,cmt,cmti})
(glob_files external/owee/.compiler_owee.objs/native/*.cmx)
(glob_files
external/gc-timings/.gc_timings.objs/byte/gc_timings.{cmi,cmti})
external/gc-timings/.gc_timings.objs/native/gc_timings.cmx)
(action
(with-stdout-to
compiler-libs-installation.sexp
(run tools/gen_compiler_libs_installation.exe %{deps}))))
(install
(section lib)
(package ocaml)
(files
(include compiler-libs-installation.sexp)))