Skip to content

Commit 403b82e

Browse files
mshinwellpoechsel
authored andcommitted
flambda-backend: To upstream: flambda_o3 attribute support (includes bootstrap)
1 parent 65032b1 commit 403b82e

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

boot/ocamlc

346 Bytes
Binary file not shown.

boot/ocamllex

0 Bytes
Binary file not shown.

parsing/builtin_attributes.ml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,16 @@ let clflags_attribute_without_payload attr ~name clflags_ref =
319319
| Some () -> clflags_ref := true
320320
| None -> ()
321321
end
322-
322+
323+
let clflags_attribute_without_payload' attr ~name ~f =
324+
if String.equal attr.attr_name.txt name
325+
|| String.equal attr.attr_name.txt ("ocaml." ^ name)
326+
then begin
327+
match parse_empty_payload attr with
328+
| Some () -> f ()
329+
| None -> ()
330+
end
331+
323332
let clflags_attribute_with_int_payload attr ~name clflags_ref =
324333
if String.equal attr.attr_name.txt name
325334
|| String.equal attr.attr_name.txt ("ocaml." ^ name)
@@ -333,6 +342,14 @@ let nolabels_attribute attr =
333342
clflags_attribute_without_payload attr
334343
~name:"nolabels" Clflags.classic
335344

345+
let flambda_o3_attribute attr =
346+
clflags_attribute_without_payload' attr
347+
~name:"flambda_o3"
348+
~f:(fun () ->
349+
if Config.flambda then begin
350+
Clflags.use_inlining_arguments_set Clflags.o3_arguments
351+
end)
352+
336353
let inline_attribute attr =
337354
if String.equal attr.attr_name.txt "inline"
338355
|| String.equal attr.attr_name.txt "ocaml.inline"
@@ -363,4 +380,5 @@ let parse_standard_implementation_attributes attr =
363380
warning_attribute attr;
364381
nolabels_attribute attr;
365382
inline_attribute attr;
366-
afl_inst_ratio_attribute attr
383+
afl_inst_ratio_attribute attr;
384+
flambda_o3_attribute attr

parsing/builtin_attributes.mli

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
- ocaml.nolabels
3131
- ocaml.inline
3232
- ocaml.afl_inst_ratio
33+
- ocaml.flambda_o3
3334
3435
{b Warning:} this module is unstable and part of
3536
{{!Compiler_libs}compiler-libs}.

0 commit comments

Comments
 (0)