B2R2


E Type

IR Expressions. NOTE: You MUST create Expr/Stmt through the AST module. *NEVER* directly construct Expr nor Stmt.

Union cases

Union case Description

BinOp(BinOpType, RegType, Expr, Expr, ExprInfo)

Full Usage: BinOp(BinOpType, RegType, Expr, Expr, ExprInfo)

Parameters:

Binary operation such as add, sub, etc. The second argument is a result type after applying BinOp.

Item1 : BinOpType
Item2 : RegType
Item3 : Expr
Item4 : Expr
Item5 : ExprInfo

Cast(CastKind, RegType, Expr, ExprInfo)

Full Usage: Cast(CastKind, RegType, Expr, ExprInfo)

Parameters:

Type casting expression. The first argument is a casting type, and the second argument is a result type.

Item1 : CastKind
Item2 : RegType
Item3 : Expr
Item4 : ExprInfo

Extract(Expr, RegType, StartPos, ExprInfo)

Full Usage: Extract(Expr, RegType, StartPos, ExprInfo)

Parameters:

Extraction expression. The first argument is target expression, and the second argument is the number of bits for extraction, and the third is the start position.

Item1 : Expr
Item2 : RegType
Item3 : StartPos
Item4 : ExprInfo

FuncName string

Full Usage: FuncName string

Parameters:
    Item : string

Name of uninterpreted function.

Item : string

Ite(Expr, Expr, Expr, ExprInfo)

Full Usage: Ite(Expr, Expr, Expr, ExprInfo)

Parameters:

If-then-else expression. The first expression is a condition, and the second and the third are true and false expression respectively.

Item1 : Expr
Item2 : Expr
Item3 : Expr
Item4 : ExprInfo

Load(Endian, RegType, Expr, ExprInfo)

Full Usage: Load(Endian, RegType, Expr, ExprInfo)

Parameters:

Memory loading such as LE:[T_1:I32]

Item1 : Endian
Item2 : RegType
Item3 : Expr
Item4 : ExprInfo

Name Symbol

Full Usage: Name Symbol

Parameters:

Symbolic constant for labels.

Item : Symbol

Nil

Full Usage: Nil

Nil to represent cons cells. This should only be used with BinOpType.CONS.

Num BitVector

Full Usage: Num BitVector

Parameters:

A number. For example, (0x42:I32) is a 32-bit number 0x42

Item : BitVector

PCVar(RegType, string)

Full Usage: PCVar(RegType, string)

Parameters:

A variable that represents a Program Counter (PC) of a CPU.

Item1 : RegType
Item2 : string

RelOp(RelOpType, Expr, Expr, ExprInfo)

Full Usage: RelOp(RelOpType, Expr, Expr, ExprInfo)

Parameters:

Relative operation such as eq, lt, etc.

Item1 : RelOpType
Item2 : Expr
Item3 : Expr
Item4 : ExprInfo

TempVar(RegType, int)

Full Usage: TempVar(RegType, int)

Parameters:

A temporary variable represents an internal (imaginary) register. Names of temporary variables should always be affixed by an underscore (_) and a number. This is to make sure that any temporary variable is unique in a CFG. For example, a temporary variable T can be represented as (T_2:I32), where 2 is a unique number assigned to the variable.

Item1 : RegType
Item2 : int

UnOp(UnOpType, Expr, ExprInfo)

Full Usage: UnOp(UnOpType, Expr, ExprInfo)

Parameters:

Unary operation such as negation.

Item1 : UnOpType
Item2 : Expr
Item3 : ExprInfo

Undefined(RegType, string)

Full Usage: Undefined(RegType, string)

Parameters:

Undefined expression. This is rarely used, and it is a fatal error when we encounter this expression while evaluating a program. Some CPU manuals explicitly say that a register value is undefined after a certain operation. We model such cases with this expression.

Item1 : RegType
Item2 : string

Var(RegType, RegisterID, string, RegisterSet)

Full Usage: Var(RegType, RegisterID, string, RegisterSet)

Parameters:

A variable that represents a register of a CPU. Var (t, r, n) indicates a variable of type (t) that has RegisterID r and name (n). For example, (EAX:I32) represents the EAX register (of type I32). Note that name (n) is additional information that doesn't be used internally.

Item1 : RegType
Item2 : RegisterID
Item3 : string
Item4 : RegisterSet