jon.recoil.org

Module Cfg_with_layout

type t
type layout = Label.t Oxcaml_utils.Doubly_linked_list.t
val create : Cfg.t -> layout:layout -> t
val cfg : t -> Cfg.t
val layout : t -> layout
val set_layout : t -> layout -> unit
val add_block : t -> Cfg.basic_block -> after:Label.t -> unit

Add to cfg, layout, and other data-structures that track labels.

val assign_blocks_to_section : t -> Label.t list -> string -> unit
val get_section : t -> Label.t -> string option
val remove_blocks : t -> Label.Set.t -> unit

Remove from cfg, layout, and other data-structures that track labels.

val is_trap_handler : t -> Label.t -> bool
val save_as_dot : ?show_instr:bool -> ?show_exn:bool -> ?annotate_instr: (Format.formatter -> [ `Basic of Cfg.basic Cfg.instruction | `Terminator of Cfg.terminator Cfg.instruction ] -> unit) list -> ?annotate_block:(Label.t -> string) -> ?annotate_block_end:(Format.formatter -> Cfg.basic_block -> unit) -> ?annotate_succ:(Label.t -> Label.t -> string) -> ?filename:string -> t -> string -> unit
val print_dot : ?show_instr:bool -> ?show_exn:bool -> ?annotate_instr: (Format.formatter -> [ `Basic of Cfg.basic Cfg.instruction | `Terminator of Cfg.terminator Cfg.instruction ] -> unit) list -> ?annotate_block:(Label.t -> string) -> ?annotate_block_end:(Format.formatter -> Cfg.basic_block -> unit) -> ?annotate_succ:(Label.t -> Label.t -> string) -> Format.formatter -> t -> unit
val reorder_blocks_random : ?random_state:Random.State.t -> t -> unit

Change layout: randomly reorder the blocks, keeping the entry block first. This function is intended for testing and enabled by compiler flag "-reorder-blocks-random".

Side-effects random_state by repeated calls to Random.State.int and Random.State.bool.

val reorder_blocks : comparator:(Label.t -> Label.t -> int) -> t -> unit
val iter_blocks : t -> f:(Cfg.basic_block -> unit) -> unit
val iter_instructions : t -> instruction:(Cfg.basic Cfg.instruction -> unit) -> terminator:(Cfg.terminator Cfg.instruction -> unit) -> unit
val fold_instructions : t -> instruction:('a -> Cfg.basic Cfg.instruction -> 'a) -> terminator:('a -> Cfg.terminator Cfg.instruction -> 'a) -> init:'a -> 'a
val insert_block : t -> Cfg.basic_instruction_list -> after:Cfg.basic_block -> before:Cfg.basic_block option -> Cfg.basic_block list