Skip to content

Commit

Permalink
More progress on cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
euisuny committed Apr 10, 2024
1 parent d71214f commit 75f2e92
Show file tree
Hide file tree
Showing 7 changed files with 986 additions and 1,109 deletions.
6 changes: 6 additions & 0 deletions middle_end/flambda2/identifiers/int_ids.ml
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,8 @@ module Symbol = struct

let create_wrapped data = Table.add !grand_table_of_symbols data

let var t = t

let unsafe_create compilation_unit linkage_name =
Symbol_data.unsafe_create compilation_unit linkage_name |> create_wrapped

Expand Down Expand Up @@ -564,6 +566,8 @@ module Simple = struct

let vars vars = vars

let code_id v = v

let symbol s = s

let const cst = cst
Expand Down Expand Up @@ -683,6 +687,8 @@ module Code_id = struct

let linkage_name t = (find_data t).linkage_name

let var v = v

let name t = (find_data t).name

let previous_name_stamp = ref (-1)
Expand Down
88 changes: 47 additions & 41 deletions middle_end/flambda2/identifiers/int_ids.mli
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ module Symbol : sig

val create_wrapped : Flambda2_import.Symbol.t -> t

val var : t -> Variable.t

val unsafe_create : Compilation_unit.t -> Linkage_name.t -> t

val compilation_unit : t -> Compilation_unit.t
Expand Down Expand Up @@ -150,47 +152,6 @@ module Coercion :
with type variable = Variable.t
and type rec_info_expr = Rec_info_expr.t

module Simple : sig
type t = private Table_by_int_id.Id.t

type exported

include Container_types.S with type t := t

val name : Name.t -> t

val var : Variable.t -> t

val vars : Variable.t list -> t list

val symbol : Symbol.t -> t

val const : Const.t -> t

val coercion : t -> Coercion.t

val with_coercion : t -> Coercion.t -> t

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

(* CR lmaurer: Should make [name] and [const] take a [coercion] argument to be
sure we're not dropping coercions by accident. *)
val pattern_match :
t ->
name:(Name.t -> coercion:Coercion.t -> 'a) ->
const:(Const.t -> 'a) ->
'a

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

val export : t -> exported

val import : exported -> t
end

module Code_id : sig
type t = private Table_by_int_id.Id.t

Expand All @@ -212,6 +173,8 @@ module Code_id : sig

val linkage_name : t -> Linkage_name.t

val var : t -> Variable.t

val name : t -> string

(* The [rename] function, in addition to changing the stamp of the code ID,
Expand Down Expand Up @@ -246,6 +209,49 @@ module Code_id_or_symbol : sig
t -> code_id:(Code_id.t -> 'a) -> symbol:(Symbol.t -> 'a) -> 'a
end

module Simple : sig
type t = private Table_by_int_id.Id.t

type exported

include Container_types.S with type t := t

val name : Name.t -> t

val var : Variable.t -> t

val vars : Variable.t list -> t list

val code_id : Code_id.t -> t

val symbol : Symbol.t -> t

val const : Const.t -> t

val coercion : t -> Coercion.t

val with_coercion : t -> Coercion.t -> t

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

(* CR lmaurer: Should make [name] and [const] take a [coercion] argument to be
sure we're not dropping coercions by accident. *)
val pattern_match :
t ->
name:(Name.t -> coercion:Coercion.t -> 'a) ->
const:(Const.t -> 'a) ->
'a

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

val export : t -> exported

val import : exported -> t
end

val initialise : unit -> unit

val reset : unit -> unit
Loading

0 comments on commit 75f2e92

Please sign in to comment.