package bap-std

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Builder interface.

type t

This interface provides an efficient way to build new blocks. It is also useful, when rebuilding existing block. It is the user responsibility to preserve the uniqueness of identifiers throughout the program instance.

val create : ?tid:tid -> ?phis:int -> ?defs:int -> ?jmps:int -> unit -> t

create ~tid ~phis ~defs ~jmp () creates a block builder. If tid parameter is specified, then the new block will have this tid. If any of phis, defs or jmps parameters are specified, the provtided number would be used as a hint of the expected amount of the corresponding entries. Since it is the hint, it can mismatch with the actual size. The hint must be a positive number.

val init : ?same_tid:bool -> ?copy_phis:bool -> ?copy_defs:bool -> ?copy_jmps:bool -> blk term -> t

init blk creates a builder based on an existing block. If copy_phis, copy_defs or copy_jmps is true (defaults to false), then prepopulate builder with corresponding terms from block blk. If same_tid is true (default), then a resulting block will have the same tid as block blk. Otherwise, a fresh new tid will be created.

val add_def : t -> def term -> unit

appends a definition

val add_jmp : t -> jmp term -> unit

appends a jump

val add_phi : t -> phi term -> unit

appends a phi node

val add_elt : t -> elt -> unit

appends generic element

val result : t -> blk term

returns current result