Skip to content

Commit

Permalink
flambda-backend: To upstream: flambda_o3 attribute support (includes …
Browse files Browse the repository at this point in the history
…bootstrap)
  • Loading branch information
mshinwell authored and poechsel committed Jun 25, 2021
1 parent 65032b1 commit 403b82e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
Binary file modified boot/ocamlc
Binary file not shown.
Binary file modified boot/ocamllex
Binary file not shown.
22 changes: 20 additions & 2 deletions parsing/builtin_attributes.ml
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,16 @@ let clflags_attribute_without_payload attr ~name clflags_ref =
| Some () -> clflags_ref := true
| None -> ()
end


let clflags_attribute_without_payload' attr ~name ~f =
if String.equal attr.attr_name.txt name
|| String.equal attr.attr_name.txt ("ocaml." ^ name)
then begin
match parse_empty_payload attr with
| Some () -> f ()
| None -> ()
end

let clflags_attribute_with_int_payload attr ~name clflags_ref =
if String.equal attr.attr_name.txt name
|| String.equal attr.attr_name.txt ("ocaml." ^ name)
Expand All @@ -333,6 +342,14 @@ let nolabels_attribute attr =
clflags_attribute_without_payload attr
~name:"nolabels" Clflags.classic

let flambda_o3_attribute attr =
clflags_attribute_without_payload' attr
~name:"flambda_o3"
~f:(fun () ->
if Config.flambda then begin
Clflags.use_inlining_arguments_set Clflags.o3_arguments
end)

let inline_attribute attr =
if String.equal attr.attr_name.txt "inline"
|| String.equal attr.attr_name.txt "ocaml.inline"
Expand Down Expand Up @@ -363,4 +380,5 @@ let parse_standard_implementation_attributes attr =
warning_attribute attr;
nolabels_attribute attr;
inline_attribute attr;
afl_inst_ratio_attribute attr
afl_inst_ratio_attribute attr;
flambda_o3_attribute attr
1 change: 1 addition & 0 deletions parsing/builtin_attributes.mli
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
- ocaml.nolabels
- ocaml.inline
- ocaml.afl_inst_ratio
- ocaml.flambda_o3
{b Warning:} this module is unstable and part of
{{!Compiler_libs}compiler-libs}.
Expand Down

0 comments on commit 403b82e

Please sign in to comment.