Skip to content

Commit e24d044

Browse files
authored
Renamed rec_info to coercion in preparation for the coercion patch (#439)
1 parent 5fdd91c commit e24d044

27 files changed

+96
-96
lines changed

middle_end/flambda/basic/simple.ml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,21 +53,21 @@ let pattern_match' t ~var ~symbol ~const =
5353

5454
let const_from_descr descr = const (RWC.of_descr descr)
5555

56-
let without_rec_info t = pattern_match t ~name ~const
56+
let without_coercion t = pattern_match t ~name ~const
5757

58-
let merge_rec_info t ~newer_rec_info =
58+
let merge_coercion t ~newer_coercion =
5959
if is_const t then None
6060
else
61-
match newer_rec_info with
61+
match newer_coercion with
6262
| None -> Some t
63-
| Some newer_rec_info ->
64-
let rec_info =
65-
match rec_info t with
66-
| None -> newer_rec_info
67-
| Some older_rec_info ->
68-
Rec_info.merge older_rec_info ~newer:newer_rec_info
63+
| Some newer_coercion ->
64+
let coercion =
65+
match coercion t with
66+
| None -> newer_coercion
67+
| Some older_coercion ->
68+
Rec_info.merge older_coercion ~newer:newer_coercion
6969
in
70-
Some (with_rec_info (without_rec_info t) rec_info)
70+
Some (with_coercion (without_coercion t) coercion)
7171

7272
(* CR mshinwell: Make naming consistent with [Name] re. the option type *)
7373

@@ -86,7 +86,7 @@ let [@inline always] must_be_name t =
8686
let to_name t =
8787
match must_be_name t with
8888
| None -> None
89-
| Some name -> Some (rec_info t, name)
89+
| Some name -> Some (coercion t, name)
9090

9191
let map_name t ~f =
9292
match must_be_name t with

middle_end/flambda/basic/simple.mli

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ include module type of struct include Reg_width_things.Simple end
2323

2424
include Contains_names.S with type t := t
2525

26-
val has_rec_info : t -> bool
26+
val has_coercion : t -> bool
2727

28-
val merge_rec_info : t -> newer_rec_info:Rec_info.t option -> t option
28+
val merge_coercion : t -> newer_coercion:Rec_info.t option -> t option
2929

30-
val without_rec_info : t -> t
30+
val without_coercion : t -> t
3131

3232
val must_be_var : t -> Variable.t option
3333

middle_end/flambda/cmx/ids_for_export.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ let add_name t name =
7575

7676
let add_simple t simple =
7777
let simples =
78-
match Simple.rec_info simple with
78+
match Simple.coercion simple with
7979
| None -> t.simples
8080
| Some _ -> Simple.Set.add simple t.simples
8181
in
@@ -93,7 +93,7 @@ let add_continuation t continuation =
9393

9494
let from_simple simple =
9595
let simples =
96-
match Simple.rec_info simple with
96+
match Simple.coercion simple with
9797
| None ->
9898
(* This simple will not be in the grand_table_of_simples *)
9999
Simple.Set.empty

middle_end/flambda/compilenv_deps/reg_width_things.ml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -225,27 +225,27 @@ end
225225
module Simple_data = struct
226226
type t = {
227227
simple : Id.t; (* always without [Rec_info] *)
228-
rec_info : Rec_info.t;
228+
coercion : Rec_info.t;
229229
}
230230

231231
let flags = simple_flags
232232

233-
let print ppf { simple = _; rec_info; } =
233+
let print ppf { simple = _; coercion; } =
234234
Format.fprintf ppf "@[<hov 1>\
235-
@[<hov 1>(rec_info@ %a)@]\
235+
@[<hov 1>(coercion@ %a)@]\
236236
@]"
237-
Rec_info.print rec_info
237+
Rec_info.print coercion
238238

239-
let hash { simple; rec_info; } =
240-
Hashtbl.hash (Id.hash simple, Rec_info.hash rec_info)
239+
let hash { simple; coercion; } =
240+
Hashtbl.hash (Id.hash simple, Rec_info.hash coercion)
241241

242242
let equal t1 t2 =
243243
if t1 == t2 then true
244244
else
245-
let { simple = simple1; rec_info = rec_info1; } = t1 in
246-
let { simple = simple2; rec_info = rec_info2; } = t2 in
245+
let { simple = simple1; coercion = coercion1; } = t1 in
246+
let { simple = simple2; coercion = coercion2; } = t2 in
247247
Id.equal simple1 simple2
248-
&& Rec_info.equal rec_info1 rec_info2
248+
&& Rec_info.equal coercion1 coercion2
249249
end
250250

251251
module Const = struct
@@ -519,7 +519,7 @@ module Simple = struct
519519

520520
let find_data t = Table.find !grand_table_of_simples t
521521

522-
let has_rec_info t =
522+
let has_coercion t =
523523
Id.flags t = simple_flags
524524

525525
let name n = n
@@ -553,9 +553,9 @@ module Simple = struct
553553
in
554554
pattern_match t1 ~name ~const
555555

556-
let [@inline always] rec_info t =
556+
let [@inline always] coercion t =
557557
let flags = Id.flags t in
558-
if flags = simple_flags then Some ((find_data t).rec_info)
558+
if flags = simple_flags then Some ((find_data t).coercion)
559559
else None
560560

561561
module T0 = struct
@@ -569,15 +569,15 @@ module Simple = struct
569569
~name:(fun name -> Name.print ppf name)
570570
~const:(fun cst -> Const.print ppf cst)
571571
in
572-
match rec_info t with
572+
match coercion t with
573573
| None -> print ppf t
574-
| Some rec_info ->
574+
| Some coercion ->
575575
Format.fprintf ppf "@[<hov 1>\
576576
@[<hov 1>(simple@ %a)@] \
577-
@[<hov 1>(rec_info@ %a)@]\
577+
@[<hov 1>(coercion@ %a)@]\
578578
@]"
579579
print t
580-
Rec_info.print rec_info
580+
Rec_info.print coercion
581581

582582
let output chan t =
583583
print (Format.formatter_of_out_channel chan) t
@@ -589,12 +589,12 @@ module Simple = struct
589589
include T0
590590
end
591591

592-
let with_rec_info t new_rec_info =
593-
if Rec_info.is_initial new_rec_info then t
592+
let with_coercion t new_coercion =
593+
if Rec_info.is_initial new_coercion then t
594594
else
595-
match rec_info t with
595+
match coercion t with
596596
| None ->
597-
let data : Simple_data.t = { simple = t; rec_info = new_rec_info; } in
597+
let data : Simple_data.t = { simple = t; coercion = new_coercion; } in
598598
Table.add !grand_table_of_simples data
599599
| Some _ ->
600600
Misc.fatal_errorf "Cannot add [Rec_info] to [Simple] %a that already \

middle_end/flambda/compilenv_deps/reg_width_things.mli

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,12 @@ module Simple : sig
154154

155155
val const : Const.t -> t
156156

157-
val rec_info : t -> Rec_info.t option
157+
val coercion : t -> Rec_info.t option
158158

159-
val with_rec_info : t -> Rec_info.t -> t
159+
val with_coercion : t -> Rec_info.t -> t
160160

161161
(* This does not consult the grand table of [Simple]s. *)
162-
val has_rec_info : t -> bool
162+
val has_coercion : t -> bool
163163

164164
val pattern_match
165165
: t
@@ -168,7 +168,7 @@ module Simple : sig
168168
-> 'a
169169

170170
(* [same s1 s2] returns true iff they represent the same name or const
171-
i.e. [same s (with_rec_info s rec_info)] returns true *)
171+
i.e. [same s (with_coercion s coercion)] returns true *)
172172
val same : t -> t -> bool
173173

174174
val export : t -> exported

middle_end/flambda/inlining/inlining_state.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type t = {
2121
depth: int
2222
}
2323

24-
let increment_depth t = { t with depth = t.depth + 1 }
24+
let increment_depth t = { t with depth = t.depth + 1 }
2525

2626
let default = {
2727
arguments = Inlining_arguments.unknown;

middle_end/flambda/inlining/inlining_transforms.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ let make_inlined_body ~callee ~unroll_to ~params ~args ~my_closure ~body
4040
apply_exn_continuation
4141
in
4242
let callee =
43-
Simple.merge_rec_info callee
44-
~newer_rec_info:(Some (Rec_info.create ~depth:1 ~unroll_to))
43+
Simple.merge_coercion callee
44+
~newer_coercion:(Some (Rec_info.create ~depth:1 ~unroll_to))
4545
|> Option.get (* CR mshinwell: improve *)
4646
in
4747
Expr.apply_renaming

middle_end/flambda/naming/renaming.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,15 +330,15 @@ let apply_simple t simple =
330330
let new_name = apply_name t old_name in
331331
if old_name == new_name then simple
332332
else
333-
match Simple.rec_info simple with
333+
match Simple.coercion simple with
334334
| None -> Simple.name new_name
335-
| Some rec_info -> Simple.with_rec_info (Simple.name new_name) rec_info
335+
| Some coercion -> Simple.with_coercion (Simple.name new_name) coercion
336336
in
337337
(* Constants are never permuted, only freshened upon import. *)
338338
Simple.pattern_match simple
339339
~name
340340
~const:(fun cst ->
341-
assert (not (Simple.has_rec_info simple));
341+
assert (not (Simple.has_coercion simple));
342342
Simple.const (apply_const t cst))
343343

344344
let closure_var_is_used t closure_var =

middle_end/flambda/simplify/simplify_apply_expr.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -643,11 +643,11 @@ let simplify_function_call ~simplify_expr dacc apply ~callee_ty
643643
in
644644
(* CR mshinwell: This should go in Typing_env (ditto logic for Rec_info
645645
in Simplify_simple *)
646-
let function_decl_rec_info =
647-
let rec_info = I.rec_info inlinable in
648-
match Simple.rec_info (Apply.callee apply) with
649-
| None -> rec_info
650-
| Some newer -> Rec_info.merge rec_info ~newer
646+
let function_decl_coercion =
647+
let coercion = I.rec_info inlinable in
648+
match Simple.coercion (Apply.callee apply) with
649+
| None -> coercion
650+
| Some newer -> Rec_info.merge coercion ~newer
651651
in
652652
let callee's_code_id_from_type = I.code_id inlinable in
653653
let callee's_code = DE.find_code denv callee's_code_id_from_type in
@@ -658,7 +658,7 @@ let simplify_function_call ~simplify_expr dacc apply ~callee_ty
658658
~result_arity:(Code.result_arity callee's_code)
659659
~recursive:(Code.recursive callee's_code)
660660
~must_be_detupled
661-
(Some (inlinable, function_decl_rec_info))
661+
(Some (inlinable, function_decl_coercion))
662662
~down_to_up
663663
| Ok (Non_inlinable non_inlinable) ->
664664
let module N = T.Function_declaration_type.Non_inlinable in

middle_end/flambda/simplify/simplify_unary_primitive.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ module Int64 = Numbers.Int64
3838
{(thd3/0
3939
(Ok (Inlinable (code_id thd3_0_tuple_stub/2) (param_arity 𝕍)
4040
(result_arity 𝕍) (stub true) (dbg ) (inline Default_inline)
41-
(is_a_functor false) (recursive Non_recursive) (rec_info ((depth 1) (unroll_to None))))))
41+
(is_a_functor false) (recursive Non_recursive) (coercion ((depth 1) (unroll_to None))))))
4242
(thd3/1
4343
(Ok (Inlinable (code_id thd3_0/3) (param_arity 𝕍 ⨯ 𝕍 ⨯ 𝕍)
4444
(result_arity 𝕍) (stub false) (dbg tuple_stub.ml:1,9--20)
4545
(inline Default_inline) (is_a_functor false) (recursive Non_recursive)
46-
(rec_info ((depth 1) (unroll_to None))))))})
46+
(coercion ((depth 1) (unroll_to None))))))})
4747
(closure_types ((components_by_index {(thd3/0 (Val (= Tuple_stub.camlTuple_stub__thd3_2))) (thd3/1 (Val (= Tuple_stub.camlTuple_stub__thd3_3)))})))
4848
(closure_var_types ((components_by_index {})))))}) (other_tags Bottom)))
4949
unboxed_version/48 : (Val (= Tuple_stub.camlTuple_stub__thd3_3)))))

0 commit comments

Comments
 (0)