Rizin
unix-like reverse engineering framework and cli tools
rz_il_opbuilder_begin.h File Reference

Syntax Macros for RzIL Lifting. More...

Go to the source code of this file.

Macros

#define ITE(c, t, f)   rz_il_op_new_ite(c, t, f)
 
#define UN(l, val)   rz_il_op_new_bitv_from_ut64(l, val)
 
#define U8(val)   UN(8, val)
 
#define U16(val)   UN(16, val)
 
#define U32(val)   UN(32, val)
 
#define U64(val)   UN(64, val)
 
#define SN(l, val)   rz_il_op_new_bitv_from_st64(l, val)
 
#define S8(val)   SN(8, val)
 
#define S16(val)   SN(16, val)
 
#define S32(val)   SN(32, val)
 
#define S64(val)   SN(64, val)
 
#define IL_FALSE   rz_il_op_new_b0()
 
#define IL_TRUE   rz_il_op_new_b1()
 
#define INV(x)   rz_il_op_new_bool_inv(x)
 
#define XOR(x, y)   rz_il_op_new_bool_xor(x, y)
 
#define AND(x, y)   rz_il_op_new_bool_and(x, y)
 
#define OR(x, y)   rz_il_op_new_bool_or(x, y)
 
#define UNSIGNED(n, x)   rz_il_op_new_unsigned(n, x)
 
#define SIGNED(n, x)   rz_il_op_new_signed(n, x)
 
#define APPEND(high, low)   rz_il_op_new_append(high, low)
 
#define DUP(op)   rz_il_op_pure_dup(op)
 
#define ADD(x, y)   rz_il_op_new_add(x, y)
 
#define SUB(x, y)   rz_il_op_new_sub(x, y)
 
#define MUL(x, y)   rz_il_op_new_mul(x, y)
 
#define DIV(x, y)   rz_il_op_new_div(x, y)
 
#define SDIV(x, y)   rz_il_op_new_sdiv(x, y)
 
#define SHIFTL(f, v, dist)   rz_il_op_new_shiftl(f, v, dist)
 
#define SHIFTR(f, v, dist)   rz_il_op_new_shiftr(f, v, dist)
 
#define SHIFTL0(v, dist)   SHIFTL(IL_FALSE, v, dist)
 
#define SHIFTR0(v, dist)   SHIFTR(IL_FALSE, v, dist)
 
#define SHIFTRA(v, dist)   rz_il_op_new_shiftr_arith(v, dist)
 
#define LOGAND(x, y)   rz_il_op_new_log_and(x, y)
 
#define LOGOR(x, y)   rz_il_op_new_log_or(x, y)
 
#define LOGXOR(x, y)   rz_il_op_new_log_xor(x, y)
 
#define LOGNOT(x)   rz_il_op_new_log_not(x)
 
#define NEG(x)   rz_il_op_new_neg(x)
 
#define NON_ZERO(x)   rz_il_op_new_non_zero(x)
 
#define IS_ZERO(x)   rz_il_op_new_is_zero(x)
 
#define MSB(x)   rz_il_op_new_msb(x)
 
#define LSB(x)   rz_il_op_new_lsb(x)
 
#define EQ(x, y)   rz_il_op_new_eq(x, y)
 
#define ULT(x, y)   rz_il_op_new_ult(x, y)
 
#define ULE(x, y)   rz_il_op_new_ule(x, y)
 
#define UGT(x, y)   rz_il_op_new_ugt(x, y)
 
#define UGE(x, y)   rz_il_op_new_uge(x, y)
 
#define SLT(x, y)   rz_il_op_new_slt(x, y)
 
#define SLE(x, y)   rz_il_op_new_sle(x, y)
 
#define SGT(x, y)   rz_il_op_new_sgt(x, y)
 
#define SGE(x, y)   rz_il_op_new_sge(x, y)
 
#define LOAD(addr)   rz_il_op_new_load(0, addr)
 
#define LOADW(n, addr)   rz_il_op_new_loadw(0, addr, n)
 
#define STORE(addr, val)   rz_il_op_new_store(0, addr, val)
 
#define STOREW(addr, val)   rz_il_op_new_storew(0, addr, val)
 
#define VARG(name)   rz_il_op_new_var(name, RZ_IL_VAR_KIND_GLOBAL)
 
#define VARL(name)   rz_il_op_new_var(name, RZ_IL_VAR_KIND_LOCAL)
 
#define VARLP(name)   rz_il_op_new_var(name, RZ_IL_VAR_KIND_LOCAL_PURE)
 
#define SETG(name, v)   rz_il_op_new_set(name, false, v)
 
#define SETL(name, v)   rz_il_op_new_set(name, true, v)
 
#define LET(name, v, body)   rz_il_op_new_let(name, v, body)
 
#define SEQ2(e0, e1)   rz_il_op_new_seq(e0, e1)
 
#define SEQ3(e0, e1, e2)   rz_il_op_new_seqn(3, e0, e1, e2)
 
#define SEQ4(e0, e1, e2, e3)   rz_il_op_new_seqn(4, e0, e1, e2, e3)
 
#define SEQ5(e0, e1, e2, e3, e4)   rz_il_op_new_seqn(5, e0, e1, e2, e3, e4)
 
#define SEQ6(e0, e1, e2, e3, e4, e5)   rz_il_op_new_seqn(6, e0, e1, e2, e3, e4, e5)
 
#define SEQ7(e0, e1, e2, e3, e4, e5, e6)   rz_il_op_new_seqn(7, e0, e1, e2, e3, e4, e5, e6)
 
#define SEQ8(e0, e1, e2, e3, e4, e5, e6, e7)   rz_il_op_new_seqn(8, e0, e1, e2, e3, e4, e5, e6, e7)
 
#define SEQ9(e0, e1, e2, e3, e4, e5, e6, e7, e8)   rz_il_op_new_seqn(9, e0, e1, e2, e3, e4, e5, e6, e7, e8)
 
#define EMPTY()   rz_il_op_new_empty()
 
#define NOP()   rz_il_op_new_nop()
 
#define BRANCH(c, t, f)   rz_il_op_new_branch(c, t, f)
 
#define REPEAT(c, b)   rz_il_op_new_repeat(c, b)
 
#define JMP(tgt)   rz_il_op_new_jmp(tgt)
 
#define GOTO(lbl)   rz_il_op_new_goto(lbl)
 

Detailed Description

Syntax Macros for RzIL Lifting.

This header introduces a number of short macros for conveniently building RzIL expressions without having to type out rz_il_op_new_....

It is intended to be used like this, for example when lifting IL from an architecture:

#include <rz_il/rz_il_opbuilder_begin.h>

RzILOpEffect *lift_my_op() {
    return SEQ3(
        SETG("a", U8(42)),
        SETG("x", U8(123)),
        STORE(0xcafe, VARG("a")));
}

#include <rz_il/rz_il_opbuilder_end.h>

Because of their short nature, these macros may conflict with other code. As such, it should never be included in any public headers, and should be closed by an #include <rz_il/rz_il_opbuilder_end.h> when not needed anymore, which #undefs everything again.

Consequently, when editing this file, always make sure to keep rz_il_opbuilder_end.h in sync!

Definition in file rz_il_opbuilder_begin.h.

Macro Definition Documentation

◆ ADD

#define ADD (   x,
 
)    rz_il_op_new_add(x, y)

Definition at line 64 of file rz_il_opbuilder_begin.h.

◆ AND

#define AND (   x,
 
)    rz_il_op_new_bool_and(x, y)

Definition at line 56 of file rz_il_opbuilder_begin.h.

◆ APPEND

#define APPEND (   high,
  low 
)    rz_il_op_new_append(high, low)

Definition at line 61 of file rz_il_opbuilder_begin.h.

◆ BRANCH

#define BRANCH (   c,
  t,
  f 
)    rz_il_op_new_branch(c, t, f)

Definition at line 117 of file rz_il_opbuilder_begin.h.

◆ DIV

#define DIV (   x,
 
)    rz_il_op_new_div(x, y)

Definition at line 67 of file rz_il_opbuilder_begin.h.

◆ DUP

#define DUP (   op)    rz_il_op_pure_dup(op)

Definition at line 62 of file rz_il_opbuilder_begin.h.

◆ EMPTY

#define EMPTY ( )    rz_il_op_new_empty()

Definition at line 115 of file rz_il_opbuilder_begin.h.

◆ EQ

#define EQ (   x,
 
)    rz_il_op_new_eq(x, y)

Definition at line 84 of file rz_il_opbuilder_begin.h.

◆ GOTO

#define GOTO (   lbl)    rz_il_op_new_goto(lbl)

Definition at line 120 of file rz_il_opbuilder_begin.h.

◆ IL_FALSE

#define IL_FALSE   rz_il_op_new_b0()

Definition at line 52 of file rz_il_opbuilder_begin.h.

◆ IL_TRUE

#define IL_TRUE   rz_il_op_new_b1()

Definition at line 53 of file rz_il_opbuilder_begin.h.

◆ INV

#define INV (   x)    rz_il_op_new_bool_inv(x)

Definition at line 54 of file rz_il_opbuilder_begin.h.

◆ IS_ZERO

#define IS_ZERO (   x)    rz_il_op_new_is_zero(x)

Definition at line 81 of file rz_il_opbuilder_begin.h.

◆ ITE

#define ITE (   c,
  t,
  f 
)    rz_il_op_new_ite(c, t, f)

Definition at line 38 of file rz_il_opbuilder_begin.h.

◆ JMP

#define JMP (   tgt)    rz_il_op_new_jmp(tgt)

Definition at line 119 of file rz_il_opbuilder_begin.h.

◆ LET

#define LET (   name,
  v,
  body 
)    rz_il_op_new_let(name, v, body)

Definition at line 104 of file rz_il_opbuilder_begin.h.

◆ LOAD

#define LOAD (   addr)    rz_il_op_new_load(0, addr)

Definition at line 94 of file rz_il_opbuilder_begin.h.

◆ LOADW

#define LOADW (   n,
  addr 
)    rz_il_op_new_loadw(0, addr, n)

Definition at line 95 of file rz_il_opbuilder_begin.h.

◆ LOGAND

#define LOGAND (   x,
 
)    rz_il_op_new_log_and(x, y)

Definition at line 74 of file rz_il_opbuilder_begin.h.

◆ LOGNOT

#define LOGNOT (   x)    rz_il_op_new_log_not(x)

Definition at line 77 of file rz_il_opbuilder_begin.h.

◆ LOGOR

#define LOGOR (   x,
 
)    rz_il_op_new_log_or(x, y)

Definition at line 75 of file rz_il_opbuilder_begin.h.

◆ LOGXOR

#define LOGXOR (   x,
 
)    rz_il_op_new_log_xor(x, y)

Definition at line 76 of file rz_il_opbuilder_begin.h.

◆ LSB

#define LSB (   x)    rz_il_op_new_lsb(x)

Definition at line 83 of file rz_il_opbuilder_begin.h.

◆ MSB

#define MSB (   x)    rz_il_op_new_msb(x)

Definition at line 82 of file rz_il_opbuilder_begin.h.

◆ MUL

#define MUL (   x,
 
)    rz_il_op_new_mul(x, y)

Definition at line 66 of file rz_il_opbuilder_begin.h.

◆ NEG

#define NEG (   x)    rz_il_op_new_neg(x)

Definition at line 78 of file rz_il_opbuilder_begin.h.

◆ NON_ZERO

#define NON_ZERO (   x)    rz_il_op_new_non_zero(x)

Definition at line 80 of file rz_il_opbuilder_begin.h.

◆ NOP

#define NOP ( )    rz_il_op_new_nop()

Definition at line 116 of file rz_il_opbuilder_begin.h.

◆ OR

#define OR (   x,
 
)    rz_il_op_new_bool_or(x, y)

Definition at line 57 of file rz_il_opbuilder_begin.h.

◆ REPEAT

#define REPEAT (   c,
  b 
)    rz_il_op_new_repeat(c, b)

Definition at line 118 of file rz_il_opbuilder_begin.h.

◆ S16

#define S16 (   val)    SN(16, val)

Definition at line 48 of file rz_il_opbuilder_begin.h.

◆ S32

#define S32 (   val)    SN(32, val)

Definition at line 49 of file rz_il_opbuilder_begin.h.

◆ S64

#define S64 (   val)    SN(64, val)

Definition at line 50 of file rz_il_opbuilder_begin.h.

◆ S8

#define S8 (   val)    SN(8, val)

Definition at line 47 of file rz_il_opbuilder_begin.h.

◆ SDIV

#define SDIV (   x,
 
)    rz_il_op_new_sdiv(x, y)

Definition at line 68 of file rz_il_opbuilder_begin.h.

◆ SEQ2

#define SEQ2 (   e0,
  e1 
)    rz_il_op_new_seq(e0, e1)

Definition at line 106 of file rz_il_opbuilder_begin.h.

◆ SEQ3

#define SEQ3 (   e0,
  e1,
  e2 
)    rz_il_op_new_seqn(3, e0, e1, e2)

Definition at line 107 of file rz_il_opbuilder_begin.h.

◆ SEQ4

#define SEQ4 (   e0,
  e1,
  e2,
  e3 
)    rz_il_op_new_seqn(4, e0, e1, e2, e3)

Definition at line 108 of file rz_il_opbuilder_begin.h.

◆ SEQ5

#define SEQ5 (   e0,
  e1,
  e2,
  e3,
  e4 
)    rz_il_op_new_seqn(5, e0, e1, e2, e3, e4)

Definition at line 109 of file rz_il_opbuilder_begin.h.

◆ SEQ6

#define SEQ6 (   e0,
  e1,
  e2,
  e3,
  e4,
  e5 
)    rz_il_op_new_seqn(6, e0, e1, e2, e3, e4, e5)

Definition at line 110 of file rz_il_opbuilder_begin.h.

◆ SEQ7

#define SEQ7 (   e0,
  e1,
  e2,
  e3,
  e4,
  e5,
  e6 
)    rz_il_op_new_seqn(7, e0, e1, e2, e3, e4, e5, e6)

Definition at line 111 of file rz_il_opbuilder_begin.h.

◆ SEQ8

#define SEQ8 (   e0,
  e1,
  e2,
  e3,
  e4,
  e5,
  e6,
  e7 
)    rz_il_op_new_seqn(8, e0, e1, e2, e3, e4, e5, e6, e7)

Definition at line 112 of file rz_il_opbuilder_begin.h.

◆ SEQ9

#define SEQ9 (   e0,
  e1,
  e2,
  e3,
  e4,
  e5,
  e6,
  e7,
  e8 
)    rz_il_op_new_seqn(9, e0, e1, e2, e3, e4, e5, e6, e7, e8)

Definition at line 113 of file rz_il_opbuilder_begin.h.

◆ SETG

#define SETG (   name,
  v 
)    rz_il_op_new_set(name, false, v)

Definition at line 102 of file rz_il_opbuilder_begin.h.

◆ SETL

#define SETL (   name,
  v 
)    rz_il_op_new_set(name, true, v)

Definition at line 103 of file rz_il_opbuilder_begin.h.

◆ SGE

#define SGE (   x,
 
)    rz_il_op_new_sge(x, y)

Definition at line 92 of file rz_il_opbuilder_begin.h.

◆ SGT

#define SGT (   x,
 
)    rz_il_op_new_sgt(x, y)

Definition at line 91 of file rz_il_opbuilder_begin.h.

◆ SHIFTL

#define SHIFTL (   f,
  v,
  dist 
)    rz_il_op_new_shiftl(f, v, dist)

Definition at line 69 of file rz_il_opbuilder_begin.h.

◆ SHIFTL0

#define SHIFTL0 (   v,
  dist 
)    SHIFTL(IL_FALSE, v, dist)

Definition at line 71 of file rz_il_opbuilder_begin.h.

◆ SHIFTR

#define SHIFTR (   f,
  v,
  dist 
)    rz_il_op_new_shiftr(f, v, dist)

Definition at line 70 of file rz_il_opbuilder_begin.h.

◆ SHIFTR0

#define SHIFTR0 (   v,
  dist 
)    SHIFTR(IL_FALSE, v, dist)

Definition at line 72 of file rz_il_opbuilder_begin.h.

◆ SHIFTRA

#define SHIFTRA (   v,
  dist 
)    rz_il_op_new_shiftr_arith(v, dist)

Definition at line 73 of file rz_il_opbuilder_begin.h.

◆ SIGNED

#define SIGNED (   n,
  x 
)    rz_il_op_new_signed(n, x)

Definition at line 60 of file rz_il_opbuilder_begin.h.

◆ SLE

#define SLE (   x,
 
)    rz_il_op_new_sle(x, y)

Definition at line 90 of file rz_il_opbuilder_begin.h.

◆ SLT

#define SLT (   x,
 
)    rz_il_op_new_slt(x, y)

Definition at line 89 of file rz_il_opbuilder_begin.h.

◆ SN

#define SN (   l,
  val 
)    rz_il_op_new_bitv_from_st64(l, val)

Definition at line 46 of file rz_il_opbuilder_begin.h.

◆ STORE

#define STORE (   addr,
  val 
)    rz_il_op_new_store(0, addr, val)

Definition at line 96 of file rz_il_opbuilder_begin.h.

◆ STOREW

#define STOREW (   addr,
  val 
)    rz_il_op_new_storew(0, addr, val)

Definition at line 97 of file rz_il_opbuilder_begin.h.

◆ SUB

#define SUB (   x,
 
)    rz_il_op_new_sub(x, y)

Definition at line 65 of file rz_il_opbuilder_begin.h.

◆ U16

#define U16 (   val)    UN(16, val)

Definition at line 42 of file rz_il_opbuilder_begin.h.

◆ U32

#define U32 (   val)    UN(32, val)

Definition at line 43 of file rz_il_opbuilder_begin.h.

◆ U64

#define U64 (   val)    UN(64, val)

Definition at line 44 of file rz_il_opbuilder_begin.h.

◆ U8

#define U8 (   val)    UN(8, val)

Definition at line 41 of file rz_il_opbuilder_begin.h.

◆ UGE

#define UGE (   x,
 
)    rz_il_op_new_uge(x, y)

Definition at line 88 of file rz_il_opbuilder_begin.h.

◆ UGT

#define UGT (   x,
 
)    rz_il_op_new_ugt(x, y)

Definition at line 87 of file rz_il_opbuilder_begin.h.

◆ ULE

#define ULE (   x,
 
)    rz_il_op_new_ule(x, y)

Definition at line 86 of file rz_il_opbuilder_begin.h.

◆ ULT

#define ULT (   x,
 
)    rz_il_op_new_ult(x, y)

Definition at line 85 of file rz_il_opbuilder_begin.h.

◆ UN

#define UN (   l,
  val 
)    rz_il_op_new_bitv_from_ut64(l, val)

Definition at line 40 of file rz_il_opbuilder_begin.h.

◆ UNSIGNED

#define UNSIGNED (   n,
  x 
)    rz_il_op_new_unsigned(n, x)

Definition at line 59 of file rz_il_opbuilder_begin.h.

◆ VARG

#define VARG (   name)    rz_il_op_new_var(name, RZ_IL_VAR_KIND_GLOBAL)

Definition at line 99 of file rz_il_opbuilder_begin.h.

◆ VARL

#define VARL (   name)    rz_il_op_new_var(name, RZ_IL_VAR_KIND_LOCAL)

Definition at line 100 of file rz_il_opbuilder_begin.h.

◆ VARLP

#define VARLP (   name)    rz_il_op_new_var(name, RZ_IL_VAR_KIND_LOCAL_PURE)

Definition at line 101 of file rz_il_opbuilder_begin.h.

◆ XOR

#define XOR (   x,
 
)    rz_il_op_new_bool_xor(x, y)

Definition at line 55 of file rz_il_opbuilder_begin.h.