Argus.Cfg.Block (Panoptes v0.13.0)

Copy Markdown View Source

One basic block: a maximal straight-line run of instructions with a single entry (the leader) and a single exit (the terminator).

range is the inclusive instruction-index span within the function's raw beam_disasm stream (the same indexing as Argus.InstrId.idx, including label/line pseudo-instructions).

Summary

Types

The kind of a control-flow edge between blocks.

t()

Why control leaves this block

Types

edge_kind()

@type edge_kind() ::
  :fallthrough
  | :jump
  | :branch_pass
  | :branch_fail
  | {:select_arm, String.t()}
  | :select_fail
  | :exception

The kind of a control-flow edge between blocks.

:branch_fail is the branch's label edge (a test's fail edge); :branch_pass is its fallthrough. {:select_arm, value} carries the matched value as the emitter stringified it; :select_fail is the select's default. :exception is a try/catch handler edge.

id()

@type id() :: non_neg_integer()

t()

@type t() :: %Argus.Cfg.Block{
  id: id(),
  label: non_neg_integer() | nil,
  preds: [{id(), edge_kind()}],
  range: {non_neg_integer(), non_neg_integer()},
  succs: [{id(), edge_kind()}],
  terminator: terminator()
}

terminator()

@type terminator() ::
  :return
  | :tail_call
  | :raise
  | :jump
  | :branch
  | :select
  | :exception
  | :fallthrough

Why control leaves this block:

  • :return / :tail_call — leaves the function entirely.
  • :raise — raises (badmatch/case_end/if_end/try_case_end/raw_raise).
  • :jump — unconditional transfer (includes loop_rec_end/wait loop-backs).
  • :branch — two-way conditional (a test, a fail-labelled op, or receive-loop control).
  • :select — multi-way select_val/select_tuple_arity dispatch.
  • :exception — installs a handler (try/catch) and falls through.
  • :fallthrough — the block ends only because the next instruction is a leader (a jump target).