@@ -1058,6 +1058,21 @@ let mk_flambda2_expert_max_unboxing_depth f =
1058
1058
Flambda2.Expert.Default. max_unboxing_depth
1059
1059
;;
1060
1060
1061
+ let mk_flambda2_expert_can_inline_recursive_functions f =
1062
+ " -flambda2-expert-can-inline-recursive-functions" , Arg. Unit f,
1063
+ Printf. sprintf " Consider inlining\n \
1064
+ \ recursive functions (default %s) (Flambda 2 only)"
1065
+ (format_default Flambda2.Expert.Default. can_inline_recursive_functions)
1066
+ ;;
1067
+
1068
+ let mk_no_flambda2_expert_can_inline_recursive_functions f =
1069
+ " -no-flambda2-expert-can-inline-recursive-functions" , Arg. Unit f,
1070
+ Printf. sprintf " Only inline recursive\n \
1071
+ \ functions if forced to so do by an attribute\n \
1072
+ \ (default %s) (Flambda 2 only)"
1073
+ (format_not_default Flambda2.Expert.Default. can_inline_recursive_functions)
1074
+ ;;
1075
+
1061
1076
let mk_flambda2_debug_permute_every_name f =
1062
1077
" -flambda2-debug-permute-every-name" , Arg. Unit f,
1063
1078
Printf. sprintf " Permute every name to test name\n \
@@ -1097,6 +1112,14 @@ let mk_flambda2_inline_max_depth f =
1097
1112
Clflags.Flambda2.Inlining.Default. max_depth
1098
1113
;;
1099
1114
1115
+ let mk_flambda2_inline_max_rec_depth f =
1116
+ " -flambda2-inline-max-rec-depth" , Arg. String f,
1117
+ Printf. sprintf " <int>|<round>=<int>[,...]\n \
1118
+ \ Maximum depth of search for inlining opportunities inside\n \
1119
+ \ inlined recursive functions (default %d) (Flambda 2 only)"
1120
+ Clflags.Flambda2.Inlining.Default. max_rec_depth
1121
+ ;;
1122
+
1100
1123
let mk_flambda2_inline_cost arg descr ~default f =
1101
1124
Printf. sprintf " -flambda2-inline-%s-cost" arg,
1102
1125
Arg. String f,
@@ -1455,12 +1478,15 @@ module type Optcommon_options = sig
1455
1478
val _no_flambda2_expert_phantom_lets : unit -> unit
1456
1479
val _flambda2_expert_max_block_size_for_projections : int -> unit
1457
1480
val _flambda2_expert_max_unboxing_depth : int -> unit
1481
+ val _flambda2_expert_can_inline_recursive_functions : unit -> unit
1482
+ val _no_flambda2_expert_can_inline_recursive_functions : unit -> unit
1458
1483
val _flambda2_debug_permute_every_name : unit -> unit
1459
1484
val _no_flambda2_debug_permute_every_name : unit -> unit
1460
1485
val _flambda2_debug_concrete_types_only_on_canonicals : unit -> unit
1461
1486
val _no_flambda2_debug_concrete_types_only_on_canonicals : unit -> unit
1462
1487
1463
1488
val _flambda2_inline_max_depth : string -> unit
1489
+ val _flambda2_inline_max_rec_depth : string -> unit
1464
1490
val _flambda2_inline_call_cost : string -> unit
1465
1491
val _flambda2_inline_alloc_cost : string -> unit
1466
1492
val _flambda2_inline_prim_cost : string -> unit
@@ -1849,6 +1875,10 @@ struct
1849
1875
F. _flambda2_expert_max_block_size_for_projections;
1850
1876
mk_flambda2_expert_max_unboxing_depth
1851
1877
F. _flambda2_expert_max_unboxing_depth;
1878
+ mk_flambda2_expert_can_inline_recursive_functions
1879
+ F. _flambda2_expert_can_inline_recursive_functions;
1880
+ mk_no_flambda2_expert_can_inline_recursive_functions
1881
+ F. _no_flambda2_expert_can_inline_recursive_functions;
1852
1882
mk_flambda2_debug_permute_every_name
1853
1883
F. _flambda2_debug_permute_every_name;
1854
1884
mk_no_flambda2_debug_permute_every_name
@@ -1859,6 +1889,7 @@ struct
1859
1889
F. _no_flambda2_debug_concrete_types_only_on_canonicals;
1860
1890
1861
1891
mk_flambda2_inline_max_depth F. _flambda2_inline_max_depth;
1892
+ mk_flambda2_inline_max_rec_depth F. _flambda2_inline_max_rec_depth;
1862
1893
mk_flambda2_inline_alloc_cost F. _flambda2_inline_alloc_cost;
1863
1894
mk_flambda2_inline_branch_cost F. _flambda2_inline_branch_cost;
1864
1895
mk_flambda2_inline_call_cost F. _flambda2_inline_call_cost;
@@ -2038,6 +2069,10 @@ module Make_opttop_options (F : Opttop_options) = struct
2038
2069
F. _flambda2_expert_max_block_size_for_projections;
2039
2070
mk_flambda2_expert_max_unboxing_depth
2040
2071
F. _flambda2_expert_max_unboxing_depth;
2072
+ mk_flambda2_expert_can_inline_recursive_functions
2073
+ F. _flambda2_expert_can_inline_recursive_functions;
2074
+ mk_no_flambda2_expert_can_inline_recursive_functions
2075
+ F. _no_flambda2_expert_can_inline_recursive_functions;
2041
2076
mk_flambda2_debug_permute_every_name
2042
2077
F. _flambda2_debug_permute_every_name;
2043
2078
mk_no_flambda2_debug_permute_every_name
@@ -2048,6 +2083,7 @@ module Make_opttop_options (F : Opttop_options) = struct
2048
2083
F. _no_flambda2_debug_concrete_types_only_on_canonicals;
2049
2084
2050
2085
mk_flambda2_inline_max_depth F. _flambda2_inline_max_depth;
2086
+ mk_flambda2_inline_max_rec_depth F. _flambda2_inline_max_rec_depth;
2051
2087
mk_flambda2_inline_alloc_cost F. _flambda2_inline_alloc_cost;
2052
2088
mk_flambda2_inline_branch_cost F. _flambda2_inline_branch_cost;
2053
2089
mk_flambda2_inline_call_cost F. _flambda2_inline_call_cost;
@@ -2390,6 +2426,10 @@ module Default = struct
2390
2426
Flambda2.Expert. max_block_size_for_projections := Some size
2391
2427
let _flambda2_expert_max_unboxing_depth depth =
2392
2428
Flambda2.Expert. max_unboxing_depth := depth
2429
+ let _flambda2_expert_can_inline_recursive_functions () =
2430
+ Flambda2.Expert. can_inline_recursive_functions := true
2431
+ let _no_flambda2_expert_can_inline_recursive_functions () =
2432
+ Flambda2.Expert. can_inline_recursive_functions := false
2393
2433
let _flambda2_debug_permute_every_name =
2394
2434
set Flambda2.Debug. permute_every_name
2395
2435
let _no_flambda2_debug_permute_every_name =
@@ -2404,6 +2444,10 @@ module Default = struct
2404
2444
" Syntax: -flambda2-inline-max-depth <int> | <round>=<int>[,...]"
2405
2445
Flambda2.Inlining. max_depth
2406
2446
2447
+ let _flambda2_inline_max_rec_depth spec =
2448
+ Int_arg_helper. parse spec
2449
+ " Syntax: -flambda2-inline-max-rec-depth <int> | <round>=<int>[,...]"
2450
+ Flambda2.Inlining. max_rec_depth
2407
2451
let _flambda2_inline_alloc_cost spec =
2408
2452
Float_arg_helper. parse spec
2409
2453
" Syntax: -flambda2-inline-alloc-cost <float> | <round>=<float>[,...]"
0 commit comments