forked from ocaml-flambda/flambda-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dune
executable file
·527 lines (490 loc) · 15.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
;**************************************************************************
;* *
;* 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# 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
branch_relaxation_intf
cmx_format
cmxs_format
x86_ast)
(modules
;; To match the Makefiles, ocamloptcomp needs to include ocamlmiddleend.
;; file_formats/
cmx_format
cmxs_format
;; middle_end/
backend_var
compilenv
;; asmcomp/
afl_instrument
arch
asmgen
asmlibrarian
asmlink
asmpackager
branch_relaxation
branch_relaxation_intf
cfgize
checks
cmm_helpers
cmm_builtins
cmm_invariants
cmm
cmmgen_state
coloring
comballoc
CSE
CSE_utils
CSEgen
dataflow
deadcode
emit
emitaux
generic_fns
interf
interval
linear
internal_assembler
linscan
liveness
mach
peephole_optimize
peephole_rules
peephole_utils
polling
printcmm
printlinear
printmach
checkmach
proc
simd
simd_selection
simd_reload
simd_proc
stack_check
reg
reload
reloadgen
relocation_entry
relocation_table
schedgen
scheduling
section_table
selectgen
selection
spill
split
string_table
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_comballoc
cfg_dataflow
cfg_deadcode
cfg_liveness
cfg_dominators
cfg_loop_infos
cfg_to_linear_desc
cfg_cse
cfg_stack_checks
eliminate_dead_code
disconnect_block
eliminate_dead_blocks
eliminate_fallthrough_blocks
merge_straightline_blocks
extra_debug
label
linear_utils
simplify_terminator
cfg_equivalence
;; backend/regalloc
regalloc_gi
regalloc_gi_state
regalloc_gi_utils
regalloc_invariants
regalloc_irc
regalloc_irc_state
regalloc_irc_utils
regalloc_ls
regalloc_ls_state
regalloc_ls_utils
regalloc_rewrite
regalloc_split
regalloc_split_state
regalloc_split_utils
regalloc_stack_operands
regalloc_stack_slots
regalloc_utils
regalloc_validate
;; file_formats/
linear_format
cfg_format
;; asmcomp/debug/
available_ranges_vars
available_regs
compute_ranges
compute_ranges_intf
inlined_frame_ranges
is_parameter
reg_availability_set
reg_with_debug_info
stack_reg_offset
;; 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_abstract_instances
dwarf_compilation_unit
dwarf_concrete_instances
dwarf_inlined_frames
dwarf_name_laundry
dwarf_reg_locations
dwarf_state
dwarf_variables_and_parameters
;; 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/floats/flambda2_floats.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/floats/flambda2_floats.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/floats/flambda2_floats.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
(ocaml/compilerlibs/META as compiler-libs/META)
(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)
(middle_end/flambda2/numbers/floats/libflambda2_floats_stubs.a
as
compiler-libs/libflambda2_floats_stubs.a)
(middle_end/flambda2/numbers/floats/libflambda2_floats_stubs.a
as
compiler-libs/libflambda2_floats_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)))