Class Biri.t

base class for BIR interpreters

constraint 'a = context
inherit 'a Expi.t
method enter_term : 't 'p. ('p, 't) cls -> 't term -> 'a u

called for each term, just after the position is updated, but before any side effect of term evaluation had occurred.

method eval : 't 'p. ('p, 't) cls -> 't term -> 'a u

eval cls t evaluates a term t of the cls class. The method implementation will call the enter_term method, and then will dispatch to the eval_XXX method, where XXX is a name of a term corresponding to cls. Finally, the leave_term method is called.

method leave_term : 't 'p. ('p, 't) cls -> 't term -> 'a u

called after all side effects of the term has occurred

method eval_sub : sub term -> 'a u

Evaluates a subroutine with the following algorithm:

0. next <- first block of subroutine and goto 1 1. eval all in and in/out arguments and goto 2 2. if next is some blk then eval it and goto 2 else goto 3 3. if next is some sub then eval it and goto 2 else goto 4 4. eval all out and in/out arguments.

method eval_arg : arg term -> 'a u

evaluate argument by first evaluating its right hand side, and then assigning the result to the left hand side.

method eval_blk : blk term -> 'a u

evaluate all terms in a given block, starting with phi nodes, then proceeding to def nodes and finally evaluating all jmp terms until either jump is taken or jump condition is undefined. After the evaluation the context#next will point next destination.

method eval_def : def term -> 'a u

evaluate definition by assigning the result of the right hand side to the definition variable

method eval_phi : phi term -> 'a u

based on trace select an expression and assign its value to the left hand side of phi node.

method eval_jmp : jmp term -> 'a u

evaluate condition, and if it is false, then do nothing, otherwise evaluate jump target (see below)

method eval_goto : label -> 'a u

evaluate label, using eval_direct or eval_indirect, based on the label variant

method eval_call : call -> 'a u

evaluate target label, using eval_direct or eval_indirect, based on the label variant. Ignores return label.

method eval_ret : label -> 'a u

evaluate label, using eval_direct or eval_indirect, based on the label variant

method eval_exn : int -> tid -> 'a u

ignore arguments and set context#next to None

method eval_direct : tid -> 'a u

set context#next to the a given tid

method eval_indirect : exp -> 'a u

ignore argument and set context#next to None