Rizin
unix-like reverse engineering framework and cli tools
il_opcodes.c File Reference

Go to the source code of this file.

Macros

#define rz_il_op_new_0(sort, id)
 
#define rz_il_op_new_1(sort, id, t, s, v0)
 
#define rz_il_op_new_2(sort, id, t, s, v0, v1)
 
#define rz_il_op_new_3(sort, id, t, s, v0, v1, v2)
 
#define DUP_OP1(arg, m0)
 
#define DUP_OP2(arg, m0, m1)
 
#define DUP_OP3(arg, m0, m1, m2)
 
#define rz_il_op_free_1(sort, s, v0)    rz_il_op_##sort##_free(op->op.s.v0);
 
#define rz_il_op_free_2(sort, s, v0, v1)
 
#define rz_il_op_free_3(sort, s, v0, v1, v2)
 

Functions

RZ_API RZ_OWN RzILOpPurerz_il_op_new_ite (RZ_NONNULL RzILOpPure *condition, RZ_NULLABLE RzILOpPure *x, RZ_NULLABLE RzILOpPure *y)
 op structure for ite (bool -> 'a pure -> 'a pure -> 'a pure) More...
 
RZ_API RZ_OWN RzILOpPurerz_il_op_new_var (RZ_NONNULL const char *v, RzILVarKind kind)
 op structure for var ('a var -> 'a pure) More...
 
RZ_API RZ_OWN RzILOpPurerz_il_op_new_let (RZ_NONNULL const char *name, RZ_NONNULL RzILOpPure *exp, RZ_NONNULL RzILOpPure *body)
 
RZ_API RZ_OWN RzILOpBoolrz_il_op_new_b0 ()
 op structure for bool false More...
 
RZ_API RZ_OWN RzILOpBoolrz_il_op_new_b1 ()
 op structure for bool true More...
 
RZ_API RZ_OWN RzILOpBoolrz_il_op_new_bool_and (RZ_NONNULL RzILOpBool *x, RZ_NONNULL RzILOpBool *y)
 op structure for and (bool -> bool -> bool) More...
 
RZ_API RZ_OWN RzILOpBoolrz_il_op_new_bool_or (RZ_NONNULL RzILOpBool *x, RZ_NONNULL RzILOpBool *y)
 op structure for or (bool -> bool -> bool) More...
 
RZ_API RZ_OWN RzILOpBoolrz_il_op_new_bool_xor (RZ_NONNULL RzILOpBool *x, RZ_NONNULL RzILOpBool *y)
 op structure for xor (bool -> bool -> bool) More...
 
RZ_API RZ_OWN RzILOpBoolrz_il_op_new_bool_inv (RZ_NONNULL RzILOpBool *x)
 op structure for inv (!bool -> bool) More...
 
RZ_API RZ_OWN RzILOpBitVectorrz_il_op_new_bitv (RZ_NONNULL RzBitVector *value)
 op structure for bitvector More...
 
RZ_API RZ_OWN RzILOpBoolrz_il_op_new_bitv_from_ut64 (ut32 length, ut64 number)
 op structure for bitvector converted from ut64 More...
 
RZ_API RZ_OWN RzILOpBoolrz_il_op_new_bitv_from_st64 (ut32 length, st64 number)
 op structure for bitvector converted from st64 More...
 
RZ_API RZ_OWN RzILOpBoolrz_il_op_new_msb (RZ_NONNULL RzILOpBitVector *bv)
 op structure for msb ('s bitv -> bool) [MSB] msb x is the most significant bit of x. More...
 
RZ_API RZ_OWN RzILOpBoolrz_il_op_new_lsb (RZ_NONNULL RzILOpBitVector *bv)
 op structure for lsb ('s bitv -> bool) [LSB] lsb x is the least significant bit of x. More...
 
RZ_API RZ_OWN RzILOpBoolrz_il_op_new_is_zero (RZ_NONNULL RzILOpPure *bv)
 
RZ_API RZ_OWN RzILOpBoolrz_il_op_new_non_zero (RZ_NONNULL RzILOpPure *bv)
 
RZ_API RZ_OWN RzILOpBoolrz_il_op_new_eq (RZ_NONNULL RzILOpBitVector *x, RZ_NONNULL RzILOpBitVector *y)
 
RZ_API RZ_OWN RzILOpBoolrz_il_op_new_ule (RZ_NONNULL RzILOpBitVector *x, RZ_NONNULL RzILOpBitVector *y)
 op structure for sle/ule ('a bitv -> 'a bitv -> bool) More...
 
RZ_API RZ_OWN RzILOpBoolrz_il_op_new_sle (RZ_NONNULL RzILOpBitVector *x, RZ_NONNULL RzILOpBitVector *y)
 op structure for sle/ule ('a bitv -> 'a bitv -> bool) More...
 
RZ_API RZ_OWN RzILOpBoolrz_il_op_new_ult (RZ_NONNULL RzILOpPure *x, RZ_NONNULL RzILOpPure *y)
 
RZ_API RZ_OWN RzILOpBoolrz_il_op_new_slt (RZ_NONNULL RzILOpPure *x, RZ_NONNULL RzILOpPure *y)
 
RZ_API RZ_OWN RzILOpBoolrz_il_op_new_uge (RZ_NONNULL RzILOpPure *x, RZ_NONNULL RzILOpPure *y)
 
RZ_API RZ_OWN RzILOpBoolrz_il_op_new_sge (RZ_NONNULL RzILOpPure *x, RZ_NONNULL RzILOpPure *y)
 
RZ_API RZ_OWN RzILOpBoolrz_il_op_new_ugt (RZ_NONNULL RzILOpPure *x, RZ_NONNULL RzILOpPure *y)
 
RZ_API RZ_OWN RzILOpBoolrz_il_op_new_sgt (RZ_NONNULL RzILOpPure *x, RZ_NONNULL RzILOpPure *y)
 
RZ_API RZ_OWN RzILOpBitVectorrz_il_op_new_cast (ut32 length, RZ_NONNULL RzILOpBool *fill, RZ_NONNULL RzILOpBitVector *val)
 op structure for casting bitv More...
 
RZ_API RZ_OWN RzILOpBitVectorrz_il_op_new_unsigned (ut32 length, RZ_NONNULL RzILOpBitVector *val)
 Extend val to length bits, filling up with zeroes. More...
 
RZ_API RZ_OWN RzILOpBitVectorrz_il_op_new_signed (ut32 length, RZ_NONNULL RzILOpBitVector *val)
 Extend val to length bits, filling up with val's most significant bit. More...
 
RZ_API RZ_OWN RzILOpBitVectorrz_il_op_new_neg (RZ_NONNULL RzILOpBitVector *bv)
 op structure for neg ('s bitv -> 's bitv) More...
 
RZ_API RZ_OWN RzILOpBitVectorrz_il_op_new_log_not (RZ_NONNULL RzILOpBitVector *bv)
 op structure for not ('s bitv -> 's bitv) More...
 
RZ_API RZ_OWN RzILOpBitVectorrz_il_op_new_add (RZ_NONNULL RzILOpBitVector *x, RZ_NONNULL RzILOpBitVector *y)
 op structure for two-operand algorithm and logical operations ('s bitv -> 's bitv -> 's bitv) More...
 
RZ_API RZ_OWN RzILOpBitVectorrz_il_op_new_sub (RZ_NONNULL RzILOpBitVector *x, RZ_NONNULL RzILOpBitVector *y)
 op structure for two-operand algorithm and logical operations ('s bitv -> 's bitv -> 's bitv) More...
 
RZ_API RZ_OWN RzILOpBitVectorrz_il_op_new_mul (RZ_NONNULL RzILOpBitVector *x, RZ_NONNULL RzILOpBitVector *y)
 op structure for two-operand algorithm and logical operations ('s bitv -> 's bitv -> 's bitv) More...
 
RZ_API RZ_OWN RzILOpBitVectorrz_il_op_new_div (RZ_NONNULL RzILOpBitVector *x, RZ_NONNULL RzILOpBitVector *y)
 op structure for two-operand algorithm and logical operations ('s bitv -> 's bitv -> 's bitv) More...
 
RZ_API RZ_OWN RzILOpBitVectorrz_il_op_new_sdiv (RZ_NONNULL RzILOpBitVector *x, RZ_NONNULL RzILOpBitVector *y)
 op structure for two-operand algorithm and logical operations ('s bitv -> 's bitv -> 's bitv) More...
 
RZ_API RZ_OWN RzILOpBitVectorrz_il_op_new_smod (RZ_NONNULL RzILOpBitVector *x, RZ_NONNULL RzILOpBitVector *y)
 op structure for two-operand algorithm and logical operations ('s bitv -> 's bitv -> 's bitv) More...
 
RZ_API RZ_OWN RzILOpBitVectorrz_il_op_new_mod (RZ_NONNULL RzILOpBitVector *x, RZ_NONNULL RzILOpBitVector *y)
 op structure for two-operand algorithm and logical operations ('s bitv -> 's bitv -> 's bitv) More...
 
RZ_API RZ_OWN RzILOpBitVectorrz_il_op_new_log_and (RZ_NONNULL RzILOpBitVector *x, RZ_NONNULL RzILOpBitVector *y)
 op structure for two-operand algorithm and logical operations ('s bitv -> 's bitv -> 's bitv) More...
 
RZ_API RZ_OWN RzILOpBitVectorrz_il_op_new_log_or (RZ_NONNULL RzILOpBitVector *x, RZ_NONNULL RzILOpBitVector *y)
 op structure for two-operand algorithm and logical operations ('s bitv -> 's bitv -> 's bitv) More...
 
RZ_API RZ_OWN RzILOpBitVectorrz_il_op_new_log_xor (RZ_NONNULL RzILOpBitVector *x, RZ_NONNULL RzILOpBitVector *y)
 op structure for two-operand algorithm and logical operations ('s bitv -> 's bitv -> 's bitv) More...
 
RZ_API RZ_OWN RzILOpBitVectorrz_il_op_new_shiftl (RZ_NONNULL RzILOpBool *fill_bit, RZ_NONNULL RzILOpBitVector *x, RZ_NONNULL RzILOpBitVector *y)
 op structure for left shift (bool -> 's bitv -> 'b bitv -> 's bitv) More...
 
RZ_API RZ_OWN RzILOpBitVectorrz_il_op_new_shiftr (RZ_NONNULL RzILOpBool *fill_bit, RZ_NONNULL RzILOpBitVector *x, RZ_NONNULL RzILOpBitVector *y)
 op structure for right shift (bool -> 's bitv -> 'b bitv -> 's bitv) More...
 
RZ_API RZ_OWN RzILOpBitVectorrz_il_op_new_shiftr_arith (RZ_NONNULL RzILOpBitVector *x, RZ_NONNULL RzILOpBitVector *y)
 alias for shiftr (msb x) x d, right-shift filling up with the left operand's msb More...
 
RZ_API RZ_OWN RzILOpBitVectorrz_il_op_new_append (RZ_NONNULL RzILOpBitVector *high, RZ_NONNULL RzILOpBitVector *low)
 op structure for appending 2 bitv: MSB:LSB high:low More...
 
RZ_API RZ_OWN RzILOpEffectrz_il_op_new_empty ()
 oop structure for an empty effect (val empty : 'a sort -> 'a t) More...
 
RZ_API RZ_OWN RzILOpEffectrz_il_op_new_nop ()
 
RZ_API RZ_OWN RzILOpEffectrz_il_op_new_set (RZ_NONNULL const char *v, bool is_local, RZ_NONNULL RzILOpPure *x)
 op structure for set ('a var -> 'a pure -> data eff) More...
 
RZ_API RZ_OWN RzILOpEffectrz_il_op_new_jmp (RZ_NONNULL RzILOpBitVector *dst)
 op structure for jmp (_ bitv -> ctrl eff) More...
 
RZ_API RZ_OWN RzILOpEffectrz_il_op_new_goto (RZ_NONNULL const char *lbl)
 op structure for goto (label -> ctrl eff) More...
 
RZ_API RZ_OWN RzILOpEffectrz_il_op_new_seq (RZ_NONNULL RzILOpEffect *x, RZ_NONNULL RzILOpEffect *y)
 op structure for Seq ('a eff -> 'a eff -> 'a eff) More...
 
RZ_API RZ_OWN RzILOpEffectrz_il_op_new_seqn (ut32 n,...)
 
RZ_API RZ_OWN RzILOpEffectrz_il_op_new_blk (RZ_NONNULL const char *label, RZ_NONNULL RzILOpEffect *data_eff, RZ_NONNULL RzILOpEffect *ctrl_eff)
 op structure for blk (label -> data eff -> ctrl eff -> unit eff) More...
 
RZ_API RZ_OWN RzILOpEffectrz_il_op_new_repeat (RZ_NONNULL RzILOpBool *condition, RZ_NONNULL RzILOpEffect *data_eff)
 op structure for repeat (bool -> data eff -> data eff) More...
 
RZ_API RZ_OWN RzILOpEffectrz_il_op_new_branch (RZ_NONNULL RzILOpBool *condition, RZ_NULLABLE RzILOpEffect *true_eff, RZ_NULLABLE RzILOpEffect *false_eff)
 op structure for branch (bool -> 'a eff -> 'a eff -> 'a eff) More...
 
RZ_API RZ_OWN RzILOpPurerz_il_op_new_load (RzILMemIndex mem, RZ_NONNULL RzILOpPure *key)
 Helper to create RzILOpArgsLoad. More...
 
RZ_API RZ_OWN RzILOpEffectrz_il_op_new_store (RzILMemIndex mem, RZ_NONNULL RzILOpBitVector *key, RZ_NONNULL RzILOpBitVector *value)
 Helper to create RzILOpArgsStoreW. More...
 
RZ_API RZ_OWN RzILOpPurerz_il_op_new_loadw (RzILMemIndex mem, RZ_NONNULL RzILOpBitVector *key, ut32 n_bits)
 Helper to create RzILOpArgsLoadW. More...
 
RZ_API RZ_OWN RzILOpEffectrz_il_op_new_storew (RzILMemIndex mem, RZ_NONNULL RzILOpBitVector *key, RZ_NONNULL RzILOpBitVector *value)
 Helper to create RzILOpArgsStoreW. More...
 
RZ_API RzILOpPurerz_il_op_pure_dup (RZ_NONNULL RzILOpPure *op)
 
RZ_API void rz_il_op_pure_free (RZ_NULLABLE RzILOpPure *op)
 
RZ_API void rz_il_op_effect_free (RZ_NULLABLE RzILOpEffect *op)
 

Macro Definition Documentation

◆ DUP_OP1

#define DUP_OP1 (   arg,
  m0 
)
Value:
do { \
r->op.arg.m0 = rz_il_op_pure_dup(op->op.arg.m0); \
if (!r->op.arg.m0) { \
return NULL; \
} \
} while (0);
#define NULL
Definition: cris-opc.c:27
#define r
Definition: crypto_rc6.c:12
RZ_API RzILOpPure * rz_il_op_pure_dup(RZ_NONNULL RzILOpPure *op)
Definition: il_opcodes.c:763
Definition: dis.c:32

◆ DUP_OP2

#define DUP_OP2 (   arg,
  m0,
  m1 
)
Value:
do { \
r->op.arg.m0 = rz_il_op_pure_dup(op->op.arg.m0); \
r->op.arg.m1 = rz_il_op_pure_dup(op->op.arg.m1); \
if (!r->op.arg.m0 || !r->op.arg.m1) { \
rz_il_op_pure_free(r->op.arg.m0); \
rz_il_op_pure_free(r->op.arg.m1); \
return NULL; \
} \
} while (0);

◆ DUP_OP3

#define DUP_OP3 (   arg,
  m0,
  m1,
  m2 
)
Value:
do { \
r->op.arg.m0 = rz_il_op_pure_dup(op->op.arg.m0); \
r->op.arg.m1 = rz_il_op_pure_dup(op->op.arg.m1); \
r->op.arg.m2 = rz_il_op_pure_dup(op->op.arg.m2); \
if (!r->op.arg.m0 || !r->op.arg.m1 || !r->op.arg.m2) { \
rz_il_op_pure_free(r->op.arg.m0); \
rz_il_op_pure_free(r->op.arg.m1); \
rz_il_op_pure_free(r->op.arg.m2); \
return NULL; \
} \
} while (0);

◆ rz_il_op_free_1

#define rz_il_op_free_1 (   sort,
  s,
  v0 
)     rz_il_op_##sort##_free(op->op.s.v0);

Definition at line 916 of file il_opcodes.c.

◆ rz_il_op_free_2

#define rz_il_op_free_2 (   sort,
  s,
  v0,
  v1 
)
Value:
rz_il_op_##sort##_free(op->op.s.v0); \
rz_il_op_##sort##_free(op->op.s.v1);

Definition at line 919 of file il_opcodes.c.

◆ rz_il_op_free_3

#define rz_il_op_free_3 (   sort,
  s,
  v0,
  v1,
  v2 
)
Value:
rz_il_op_##sort##_free(op->op.s.v0); \
rz_il_op_##sort##_free(op->op.s.v1); \
rz_il_op_##sort##_free(op->op.s.v2);

Definition at line 923 of file il_opcodes.c.

◆ rz_il_op_new_0

#define rz_il_op_new_0 (   sort,
  id 
)
Value:
do { \
ret = RZ_NEW0(RzILOp##sort); \
if (!ret) { \
return NULL; \
} \
ret->code = id; \
} while (0)
int id
Definition: op.c:540
#define RZ_NEW0(x)
Definition: rz_types.h:284

Definition at line 6 of file il_opcodes.c.

◆ rz_il_op_new_1

#define rz_il_op_new_1 (   sort,
  id,
  t,
  s,
  v0 
)
Value:
do { \
ret = RZ_NEW0(RzILOp##sort); \
if (!ret) { \
return NULL; \
} \
ret->code = id; \
ret->op.s.v0 = v0; \
} while (0)
@ v0
Definition: lanai.h:84

Definition at line 15 of file il_opcodes.c.

◆ rz_il_op_new_2

#define rz_il_op_new_2 (   sort,
  id,
  t,
  s,
  v0,
  v1 
)
Value:
do { \
ret = RZ_NEW0(RzILOp##sort); \
if (!ret) { \
return NULL; \
} \
ret->code = id; \
ret->op.s.v0 = v0; \
ret->op.s.v1 = v1; \
} while (0)
@ v1
Definition: lanai.h:85

Definition at line 25 of file il_opcodes.c.

◆ rz_il_op_new_3

#define rz_il_op_new_3 (   sort,
  id,
  t,
  s,
  v0,
  v1,
  v2 
)
Value:
do { \
ret = RZ_NEW0(RzILOp##sort); \
if (!ret) { \
return NULL; \
} \
ret->code = id; \
ret->op.s.v0 = v0; \
ret->op.s.v1 = v1; \
ret->op.s.v2 = v2; \
} while (0)

Definition at line 36 of file il_opcodes.c.

Function Documentation

◆ rz_il_op_effect_free()

RZ_API void rz_il_op_effect_free ( RZ_NULLABLE RzILOpEffect op)

Definition at line 1036 of file il_opcodes.c.

1036  {
1037  if (!op) {
1038  return;
1039  }
1040  switch (op->code) {
1041  case RZ_IL_OP_EMPTY:
1042  break;
1043  case RZ_IL_OP_STORE:
1044  rz_il_op_free_2(pure, store, key, value);
1045  break;
1046  case RZ_IL_OP_STOREW:
1047  rz_il_op_free_2(pure, storew, key, value);
1048  break;
1049  case RZ_IL_OP_NOP:
1050  break;
1051  case RZ_IL_OP_SET:
1052  rz_il_op_free_1(pure, set, x);
1053  break;
1054  case RZ_IL_OP_JMP:
1055  rz_il_op_free_1(pure, jmp, dst);
1056  break;
1057  case RZ_IL_OP_GOTO:
1058  break;
1059  case RZ_IL_OP_SEQ:
1060  rz_il_op_free_2(effect, seq, x, y);
1061  break;
1062  case RZ_IL_OP_BLK:
1063  rz_il_op_free_2(effect, blk, data_eff, ctrl_eff);
1064  break;
1065  case RZ_IL_OP_REPEAT:
1066  rz_il_op_pure_free(op->op.repeat.condition);
1067  rz_il_op_free_1(effect, repeat, data_eff);
1068  break;
1069  case RZ_IL_OP_BRANCH:
1070  rz_il_op_pure_free(op->op.repeat.condition);
1071  rz_il_op_free_2(effect, branch, true_eff, false_eff);
1072  break;
1073  default:
1075  RZ_LOG_ERROR("RzIL: unknown opcode %u\n", op->code);
1076  break;
1077  }
1078  free(op);
1079 }
#define jmp
static int value
Definition: cmd_api.c:93
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len key
Definition: sflib.h:118
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
#define rz_il_op_free_1(sort, s, v0)
Definition: il_opcodes.c:916
RZ_API void rz_il_op_pure_free(RZ_NULLABLE RzILOpPure *op)
Definition: il_opcodes.c:928
#define rz_il_op_free_2(sort, s, v0, v1)
Definition: il_opcodes.c:919
char * dst
Definition: lz4.h:724
int x
Definition: mipsasm.c:20
static void repeat(struct parse *, sopno, int, int)
Definition: regcomp.c:1155
#define rz_warn_if_reached()
Definition: rz_assert.h:29
@ RZ_IL_OP_BLK
@ RZ_IL_OP_GOTO
@ RZ_IL_OP_SEQ
@ RZ_IL_OP_NOP
@ RZ_IL_OP_JMP
@ RZ_IL_OP_EMPTY
@ RZ_IL_OP_STORE
@ RZ_IL_OP_STOREW
@ RZ_IL_OP_REPEAT
@ RZ_IL_OP_BRANCH
@ RZ_IL_OP_SET
#define RZ_LOG_ERROR(fmtstr,...)
Definition: rz_log.h:58
struct op_code code
Definition: dis.c:33

References test-lz4-speed::branch, op::code, dst, free(), jmp, key, repeat(), RZ_IL_OP_BLK, RZ_IL_OP_BRANCH, RZ_IL_OP_EMPTY, rz_il_op_free_1, rz_il_op_free_2, RZ_IL_OP_GOTO, RZ_IL_OP_JMP, RZ_IL_OP_NOP, rz_il_op_pure_free(), RZ_IL_OP_REPEAT, RZ_IL_OP_SEQ, RZ_IL_OP_SET, RZ_IL_OP_STORE, RZ_IL_OP_STOREW, RZ_LOG_ERROR, rz_warn_if_reached, value, and x.

Referenced by ldm(), ldr(), rz_analysis_op_fini(), smlal(), smlaw(), smuad(), ssat(), ssat16(), stm(), str(), strex(), umaal(), and umull().

◆ rz_il_op_new_add()

op structure for two-operand algorithm and logical operations ('s bitv -> 's bitv -> 's bitv)

[ADD] add x y addition modulo 2^'s

Definition at line 397 of file il_opcodes.c.

397  {
399  RzILOpBitVector *ret;
400  rz_il_op_new_2(BitVector, RZ_IL_OP_ADD, RzILOpArgsAdd, add, x, y);
401  return ret;
402 }
#define rz_il_op_new_2(sort, id, t, s, v0, v1)
Definition: il_opcodes.c:25
#define rz_return_val_if_fail(expr, val)
Definition: rz_assert.h:108
@ RZ_IL_OP_ADD
op structure for two-operand algorithm and logical operations ('s bitv -> 's bitv -> 's bitv)
Definition: rz_il_opcodes.h:97
An IL op performing a pure computation, 'a pure.
static int add(char *argv[])
Definition: ziptool.c:84

References add(), NULL, RZ_IL_OP_ADD, rz_il_op_new_2, rz_return_val_if_fail, and x.

Referenced by bf_inc(), and bf_right_arrow().

◆ rz_il_op_new_append()

RZ_API RZ_OWN RzILOpBitVector* rz_il_op_new_append ( RZ_NONNULL RzILOpBitVector high,
RZ_NONNULL RzILOpBitVector low 
)

op structure for appending 2 bitv: MSB:LSB high:low

Definition at line 547 of file il_opcodes.c.

547  {
548  rz_return_val_if_fail(high && low, NULL);
549  RzILOpBitVector *ret;
550  rz_il_op_new_2(BitVector, RZ_IL_OP_APPEND, RzILOpArgsAppend, append, high, low);
551  return ret;
552 }
#define append(x, y)
Definition: cmd_print.c:1740
@ RZ_IL_OP_APPEND
op structure for appending 2 bitv: MSB:LSB high:low

References append, NULL, RZ_IL_OP_APPEND, rz_il_op_new_2, and rz_return_val_if_fail.

Referenced by avr_il_get_indirect_address_reg().

◆ rz_il_op_new_b0()

RZ_API RZ_OWN RzILOpBool* rz_il_op_new_b0 ( )

op structure for bool false

Definition at line 85 of file il_opcodes.c.

85  {
86  RzILOpPure *ret;
88  return ret;
89 }
#define rz_il_op_new_0(sort, id)
Definition: il_opcodes.c:6
@ RZ_IL_OP_B0

References RZ_IL_OP_B0, and rz_il_op_new_0.

Referenced by rz_il_op_new_unsigned().

◆ rz_il_op_new_b1()

RZ_API RZ_OWN RzILOpBool* rz_il_op_new_b1 ( )

op structure for bool true

Definition at line 94 of file il_opcodes.c.

94  {
95  RzILOpPure *ret;
97  return ret;
98 }
@ RZ_IL_OP_B1

References RZ_IL_OP_B1, and rz_il_op_new_0.

◆ rz_il_op_new_bitv()

RZ_API RZ_OWN RzILOpBitVector* rz_il_op_new_bitv ( RZ_NONNULL RzBitVector value)

op structure for bitvector

value is a bitvector constant.

Definition at line 161 of file il_opcodes.c.

161  {
163  RzILOpBitVector *ret;
164  rz_il_op_new_1(BitVector, RZ_IL_OP_BITV, RzILOpArgsBv, bitv, value);
165  return ret;
166 }
#define rz_il_op_new_1(sort, id, t, s, v0)
Definition: il_opcodes.c:15
@ RZ_IL_OP_BITV
value is a bitvector constant.
Definition: rz_il_opcodes.h:51

References NULL, RZ_IL_OP_BITV, rz_il_op_new_1, rz_return_val_if_fail, and value.

◆ rz_il_op_new_bitv_from_st64()

RZ_API RZ_OWN RzILOpBool* rz_il_op_new_bitv_from_st64 ( ut32  length,
st64  number 
)

op structure for bitvector converted from st64

value is a bitvector constant.

Definition at line 193 of file il_opcodes.c.

193  {
195  if (!value) {
196  return NULL;
197  }
198  RzILOpBool *ret = RZ_NEW0(RzILOpBool);
199  if (!ret) {
200  rz_bv_free(value);
201  return NULL;
202  }
203  ret->code = RZ_IL_OP_BITV;
204  ret->op.bitv.value = value;
205  return ret;
206 }
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void length
Definition: sflib.h:133
RZ_API void rz_bv_free(RZ_NULLABLE RzBitVector *bv)
Definition: bitvector.c:85
RZ_API RZ_OWN RzBitVector * rz_bv_new_from_st64(ut32 length, st64 value)
Definition: bitvector.c:1179
structure for bitvector
Definition: rz_bitvector.h:19
RzBitVector * value
value of bitvector
Definition: rz_il_opcodes.h:52
union rz_il_op_pure_t::@286 op
RzILOpPureCode code
RzILOpArgsBv bitv

References rz_il_op_pure_t::bitv, rz_il_op_pure_t::code, length, NULL, rz_il_op_pure_t::op, rz_bv_free(), rz_bv_new_from_st64(), RZ_IL_OP_BITV, RZ_NEW0, value, and rz_il_op_args_bv_t::value.

◆ rz_il_op_new_bitv_from_ut64()

RZ_API RZ_OWN RzILOpBool* rz_il_op_new_bitv_from_ut64 ( ut32  length,
ut64  number 
)

op structure for bitvector converted from ut64

value is a bitvector constant.

Definition at line 173 of file il_opcodes.c.

173  {
175  if (!value) {
176  return NULL;
177  }
178  RzILOpBool *ret = RZ_NEW0(RzILOpBool);
179  if (!ret) {
180  rz_bv_free(value);
181  return NULL;
182  }
183  ret->code = RZ_IL_OP_BITV;
184  ret->op.bitv.value = value;
185  return ret;
186 }
RZ_API RZ_OWN RzBitVector * rz_bv_new_from_ut64(ut32 length, ut64 value)
Definition: bitvector.c:1161

References rz_il_op_pure_t::bitv, rz_il_op_pure_t::code, length, NULL, rz_il_op_pure_t::op, rz_bv_free(), rz_bv_new_from_ut64(), RZ_IL_OP_BITV, RZ_NEW0, value, and rz_il_op_args_bv_t::value.

Referenced by bf_llimit(), and bf_rlimit().

◆ rz_il_op_new_blk()

RZ_API RZ_OWN RzILOpEffect* rz_il_op_new_blk ( RZ_NONNULL const char *  label,
RZ_NONNULL RzILOpEffect data_eff,
RZ_NONNULL RzILOpEffect ctrl_eff 
)

op structure for blk (label -> data eff -> ctrl eff -> unit eff)

blk lbl data ctrl a labeled sequence of effects.

Definition at line 678 of file il_opcodes.c.

678  {
679  rz_return_val_if_fail(data_eff && ctrl_eff, NULL);
680  RzILOpEffect *ret;
681  rz_il_op_new_3(Effect, RZ_IL_OP_BLK, RzILOpArgsBlk, blk, label, data_eff, ctrl_eff);
682  return ret;
683 }
#define rz_il_op_new_3(sort, id, t, s, v0, v1, v2)
Definition: il_opcodes.c:36
Definition: dis.h:35
op structure for blk (label -> data eff -> ctrl eff -> unit eff)

References NULL, RZ_IL_OP_BLK, rz_il_op_new_3, and rz_return_val_if_fail.

◆ rz_il_op_new_bool_and()

RZ_API RZ_OWN RzILOpBool* rz_il_op_new_bool_and ( RZ_NONNULL RzILOpBool x,
RZ_NONNULL RzILOpBool y 
)

op structure for and (bool -> bool -> bool)

BAP equivalent: val and_ : bool -> bool -> bool and(x, y) is a conjunction of x and y.

Definition at line 107 of file il_opcodes.c.

107  {
109  RzILOpBool *ret;
110  rz_il_op_new_2(Bool, RZ_IL_OP_AND, RzILOpArgsBoolAnd, booland, x, y);
111  return ret;
112 }
@ RZ_IL_OP_AND
op structure for and, or and xor (bool -> bool -> bool)

References NULL, RZ_IL_OP_AND, rz_il_op_new_2, rz_return_val_if_fail, and x.

Referenced by rz_il_op_new_slt(), and rz_il_op_new_ult().

◆ rz_il_op_new_bool_inv()

RZ_API RZ_OWN RzILOpBool* rz_il_op_new_bool_inv ( RZ_NONNULL RzILOpBool x)

op structure for inv (!bool -> bool)

BAP equivalent: val inv : bool -> bool inv(x) inverts x (also known as not operation).

Definition at line 149 of file il_opcodes.c.

149  {
151  RzILOpBool *ret;
153  return ret;
154 }
@ RZ_IL_OP_INV
op structure for inv (!bool -> bool)

References NULL, RZ_IL_OP_INV, rz_il_op_new_1, rz_return_val_if_fail, and x.

Referenced by rz_il_op_new_non_zero(), rz_il_op_new_sge(), rz_il_op_new_sgt(), rz_il_op_new_slt(), rz_il_op_new_uge(), rz_il_op_new_ugt(), and rz_il_op_new_ult().

◆ rz_il_op_new_bool_or()

RZ_API RZ_OWN RzILOpBool* rz_il_op_new_bool_or ( RZ_NONNULL RzILOpBool x,
RZ_NONNULL RzILOpBool y 
)

op structure for or (bool -> bool -> bool)

BAP equivalent: val or_ : bool -> bool -> bool or(x, y) is a conjunction of x or y.

Definition at line 121 of file il_opcodes.c.

121  {
123  RzILOpBool *ret;
124  rz_il_op_new_2(Bool, RZ_IL_OP_OR, RzILOpArgsBoolOr, boolor, x, y);
125  return ret;
126 }
@ RZ_IL_OP_OR

References NULL, rz_il_op_new_2, RZ_IL_OP_OR, rz_return_val_if_fail, and x.

Referenced by rz_il_op_new_sge(), and rz_il_op_new_uge().

◆ rz_il_op_new_bool_xor()

RZ_API RZ_OWN RzILOpBool* rz_il_op_new_bool_xor ( RZ_NONNULL RzILOpBool x,
RZ_NONNULL RzILOpBool y 
)

op structure for xor (bool -> bool -> bool)

BAP equivalent: val xor_ : bool -> bool -> bool xor(x, y) is a conjunction of x xor y.

Definition at line 135 of file il_opcodes.c.

135  {
137  RzILOpBool *ret;
138  rz_il_op_new_2(Bool, RZ_IL_OP_XOR, RzILOpArgsBoolXor, boolxor, x, y);
139  return ret;
140 }
@ RZ_IL_OP_XOR

References NULL, rz_il_op_new_2, RZ_IL_OP_XOR, rz_return_val_if_fail, and x.

◆ rz_il_op_new_branch()

RZ_API RZ_OWN RzILOpEffect* rz_il_op_new_branch ( RZ_NONNULL RzILOpBool condition,
RZ_NULLABLE RzILOpEffect true_eff,
RZ_NULLABLE RzILOpEffect false_eff 
)

op structure for branch (bool -> 'a eff -> 'a eff -> 'a eff)

branch c lhs rhs if c holds then performs lhs else rhs.

Definition at line 702 of file il_opcodes.c.

702  {
703  rz_return_val_if_fail(condition && (true_eff || false_eff), NULL);
704  RzILOpEffect *ret;
705  if (!true_eff) {
706  true_eff = rz_il_op_new_nop();
707  }
708  if (!false_eff) {
709  false_eff = rz_il_op_new_nop();
710  }
711  rz_il_op_new_3(Effect, RZ_IL_OP_BRANCH, RzILOpArgsBranch, branch, condition, true_eff, false_eff);
712  return ret;
713 }
RZ_API RZ_OWN RzILOpEffect * rz_il_op_new_nop()
Definition: il_opcodes.c:566
op structure for branch (bool -> 'a eff -> 'a eff -> 'a eff)

References test-lz4-speed::branch, NULL, RZ_IL_OP_BRANCH, rz_il_op_new_3, rz_il_op_new_nop(), and rz_return_val_if_fail.

Referenced by bf_llimit(), and bf_rlimit().

◆ rz_il_op_new_cast()

RZ_API RZ_OWN RzILOpBitVector* rz_il_op_new_cast ( ut32  length,
RZ_NONNULL RzILOpBool fill,
RZ_NONNULL RzILOpBitVector val 
)

op structure for casting bitv

Definition at line 341 of file il_opcodes.c.

341  {
343  RzILOpBitVector *ret;
345  return ret;
346 }
#define cast(x, y)
Definition: arch_53.h:166
ut16 val
Definition: armass64_const.h:6
@ RZ_IL_OP_CAST
op structure for casting bitv

References cast, length, NULL, RZ_IL_OP_CAST, rz_il_op_new_3, rz_return_val_if_fail, and val.

Referenced by rz_il_op_new_signed(), rz_il_op_new_unsigned(), and sh_il_signed().

◆ rz_il_op_new_div()

op structure for two-operand algorithm and logical operations ('s bitv -> 's bitv -> 's bitv)

[DIV] div x y unsigned division modulo 2^'s truncating towards 0. The division by zero is defined to be a vector of all ones of size 's.

Definition at line 433 of file il_opcodes.c.

433  {
435  RzILOpBitVector *ret;
436  rz_il_op_new_2(BitVector, RZ_IL_OP_DIV, RzILOpArgsDiv, div, x, y);
437  return ret;
438 }
@ RZ_IL_OP_DIV

References NULL, RZ_IL_OP_DIV, rz_il_op_new_2, rz_return_val_if_fail, and x.

◆ rz_il_op_new_empty()

RZ_API RZ_OWN RzILOpEffect* rz_il_op_new_empty ( )

oop structure for an empty effect (val empty : 'a sort -> 'a t)

empty s creates an empty effect value. The empty effect denotes an absence of any specific knowledge about the effects produced by a term.

Definition at line 560 of file il_opcodes.c.

560  {
561  RzILOpEffect *ret;
563  return ret;
564 }

References RZ_IL_OP_EMPTY, and rz_il_op_new_0.

◆ rz_il_op_new_eq()

[EQ] eq x y binary predicate for bitwise equality

Definition at line 251 of file il_opcodes.c.

251  {
253  RzILOpBool *ret;
255  return ret;
256 }
@ RZ_IL_OP_EQ
op structure for binary comparison ops ('a bitv -> 'a bitv -> bool)

References eq, NULL, RZ_IL_OP_EQ, rz_il_op_new_2, rz_return_val_if_fail, and x.

Referenced by rz_il_op_new_sge(), rz_il_op_new_slt(), rz_il_op_new_uge(), and rz_il_op_new_ult().

◆ rz_il_op_new_goto()

RZ_API RZ_OWN RzILOpEffect* rz_il_op_new_goto ( RZ_NONNULL const char *  lbl)

op structure for goto (label -> ctrl eff)

goto label passes the control to a program labeled with lbl.

Definition at line 601 of file il_opcodes.c.

601  {
603  RzILOpEffect *ret;
604  rz_il_op_new_1(Effect, RZ_IL_OP_GOTO, RzILOpArgsGoto, goto_, lbl);
605  return ret;
606 }
op structure for goto (label -> ctrl eff)

References NULL, RZ_IL_OP_GOTO, rz_il_op_new_1, and rz_return_val_if_fail.

Referenced by bf_in(), and bf_out().

◆ rz_il_op_new_is_zero()

RZ_API RZ_OWN RzILOpBool* rz_il_op_new_is_zero ( RZ_NONNULL RzILOpPure bv)

[IS_ZERO] is_zero x holds if x is a bitvector of all zeros.

Definition at line 233 of file il_opcodes.c.

233  {
235  RzILOpBool *ret;
236  rz_il_op_new_1(Bool, RZ_IL_OP_IS_ZERO, RzILOpArgsIsZero, is_zero, bv);
237  return ret;
238 }
@ RZ_IL_OP_IS_ZERO
op structure for 's bitv -> bool [MSB] msb x is the most significant bit of x. [LSB] lsb x is the lea...
Definition: rz_il_opcodes.h:61

References NULL, RZ_IL_OP_IS_ZERO, rz_il_op_new_1, and rz_return_val_if_fail.

Referenced by rz_il_op_new_non_zero().

◆ rz_il_op_new_ite()

RZ_API RZ_OWN RzILOpPure* rz_il_op_new_ite ( RZ_NONNULL RzILOpPure condition,
RZ_NULLABLE RzILOpPure x,
RZ_NULLABLE RzILOpPure y 
)

op structure for ite (bool -> 'a pure -> 'a pure -> 'a pure)

ite condition x y is x if condition evaluates to b1 else y.

Definition at line 53 of file il_opcodes.c.

53  {
54  rz_return_val_if_fail(condition && (x || y), NULL);
55  RzILOpPure *ret;
56  rz_il_op_new_3(Pure, RZ_IL_OP_ITE, RzILOpArgsIte, ite, condition, x, y);
57  return ret;
58 }
@ RZ_IL_OP_ITE
op structure for ite (bool -> 'a pure -> 'a pure -> 'a pure)

References NULL, RZ_IL_OP_ITE, rz_il_op_new_3, rz_return_val_if_fail, and x.

Referenced by avr_il_cpc(), and avr_il_sreg_bit_as_imm().

◆ rz_il_op_new_jmp()

RZ_API RZ_OWN RzILOpEffect* rz_il_op_new_jmp ( RZ_NONNULL RzILOpBitVector dst)

op structure for jmp (_ bitv -> ctrl eff)

jmp dst passes the control to a program located at dst.

Definition at line 589 of file il_opcodes.c.

589  {
591  RzILOpEffect *ret;
593  return ret;
594 }
op structure for jmp (_ bitv -> ctrl eff)

References dst, jmp, NULL, RZ_IL_OP_JMP, rz_il_op_new_1, and rz_return_val_if_fail.

Referenced by bf_llimit(), and bf_rlimit().

◆ rz_il_op_new_let()

RZ_API RZ_OWN RzILOpPure* rz_il_op_new_let ( RZ_NONNULL const char *  name,
RZ_NONNULL RzILOpPure exp,
RZ_NONNULL RzILOpPure body 
)

let_ v exp body binds the value of exp to v body.

Definition at line 75 of file il_opcodes.c.

75  {
76  rz_return_val_if_fail(name && exp && body, NULL);
77  RzILOpPure *ret;
78  rz_il_op_new_3(Pure, RZ_IL_OP_LET, RzILOpArgsLet, let, name, exp, body);
79  return ret;
80 }
@ RZ_IL_OP_LET
Definition: z80asm.h:102
op structure for let_ : 'a var -> 'a pure -> 'b pure -> 'b pure

References NULL, RZ_IL_OP_LET, rz_il_op_new_3, and rz_return_val_if_fail.

◆ rz_il_op_new_load()

RZ_API RZ_OWN RzILOpPure* rz_il_op_new_load ( RzILMemIndex  mem,
RZ_NONNULL RzILOpPure key 
)

Helper to create RzILOpArgsLoad.

Definition at line 718 of file il_opcodes.c.

718  {
720  RzILOpPure *ret;
722  return ret;
723 }
void * mem
Definition: libc.cpp:91
void * load(const char *name, size_t *len)
Definition: pufftest.c:60
@ RZ_IL_OP_LOAD
op structure for load (('a, 'b) mem -> 'a bitv -> 'b bitv)

References key, load(), mem, NULL, RZ_IL_OP_LOAD, rz_il_op_new_2, and rz_return_val_if_fail.

Referenced by bf_dec(), bf_inc(), bf_llimit(), and bf_rlimit().

◆ rz_il_op_new_loadw()

RZ_API RZ_OWN RzILOpPure* rz_il_op_new_loadw ( RzILMemIndex  mem,
RZ_NONNULL RzILOpBitVector key,
ut32  n_bits 
)

Helper to create RzILOpArgsLoadW.

Definition at line 738 of file il_opcodes.c.

738  {
739  rz_return_val_if_fail(key && n_bits, NULL);
740  RzILOpPure *ret;
741  rz_il_op_new_3(Pure, RZ_IL_OP_LOADW, RzILOpArgsLoadW, loadw, mem, key, n_bits);
742  return ret;
743 }
@ RZ_IL_OP_LOADW
Load an entire word of arbitrary bit size from a memory.

References key, mem, NULL, RZ_IL_OP_LOADW, rz_il_op_new_3, and rz_return_val_if_fail.

Referenced by avr_il_lpm().

◆ rz_il_op_new_log_and()

op structure for two-operand algorithm and logical operations ('s bitv -> 's bitv -> 's bitv)

[LOGAND] logand x y is a bitwise logical and of x and y.

Definition at line 481 of file il_opcodes.c.

481  {
483  RzILOpBitVector *ret;
484  rz_il_op_new_2(BitVector, RZ_IL_OP_LOGAND, RzILOpArgsLogand, logand, x, y);
485  return ret;
486 }
@ RZ_IL_OP_LOGAND

References NULL, RZ_IL_OP_LOGAND, rz_il_op_new_2, rz_return_val_if_fail, and x.

◆ rz_il_op_new_log_not()

RZ_API RZ_OWN RzILOpBitVector* rz_il_op_new_log_not ( RZ_NONNULL RzILOpBitVector bv)

op structure for not ('s bitv -> 's bitv)

not x is one-complement unary minus

Definition at line 385 of file il_opcodes.c.

385  {
387  RzILOpBitVector *ret;
388  rz_il_op_new_1(BitVector, RZ_IL_OP_LOGNOT, RzILOpArgsLogNot, lognot, bv);
389  return ret;
390 }
@ RZ_IL_OP_LOGNOT

References NULL, RZ_IL_OP_LOGNOT, rz_il_op_new_1, and rz_return_val_if_fail.

◆ rz_il_op_new_log_or()

op structure for two-operand algorithm and logical operations ('s bitv -> 's bitv -> 's bitv)

[LOGOR] logor x y is a bitwise logical or of x and y.

Definition at line 493 of file il_opcodes.c.

493  {
495  RzILOpBitVector *ret;
496  rz_il_op_new_2(BitVector, RZ_IL_OP_LOGOR, RzILOpArgsLogor, logor, x, y);
497  return ret;
498 }
@ RZ_IL_OP_LOGOR

References NULL, RZ_IL_OP_LOGOR, rz_il_op_new_2, rz_return_val_if_fail, and x.

◆ rz_il_op_new_log_xor()

op structure for two-operand algorithm and logical operations ('s bitv -> 's bitv -> 's bitv)

[LOGXOR] logxor x y is a bitwise logical xor of x and y.

Definition at line 505 of file il_opcodes.c.

505  {
507  RzILOpBitVector *ret;
508  rz_il_op_new_2(BitVector, RZ_IL_OP_LOGXOR, RzILOpArgsLogxor, logxor, x, y);
509  return ret;
510 }
@ RZ_IL_OP_LOGXOR

References NULL, RZ_IL_OP_LOGXOR, rz_il_op_new_2, rz_return_val_if_fail, and x.

◆ rz_il_op_new_lsb()

RZ_API RZ_OWN RzILOpBool* rz_il_op_new_lsb ( RZ_NONNULL RzILOpBitVector bv)

op structure for lsb ('s bitv -> bool) [LSB] lsb x is the least significant bit of x.

Definition at line 223 of file il_opcodes.c.

223  {
225  RzILOpBool *ret;
226  rz_il_op_new_1(Bool, RZ_IL_OP_LSB, RzILOpArgsMsb, lsb, bv);
227  return ret;
228 }
@ RZ_IL_OP_LSB

References NULL, RZ_IL_OP_LSB, rz_il_op_new_1, and rz_return_val_if_fail.

◆ rz_il_op_new_mod()

op structure for two-operand algorithm and logical operations ('s bitv -> 's bitv -> 's bitv)

[MOD] modulo x y is the remainder of div x y modulo 2^'s.

Definition at line 469 of file il_opcodes.c.

469  {
471  RzILOpBitVector *ret;
472  rz_il_op_new_2(BitVector, RZ_IL_OP_SMOD, RzILOpArgsMod, mod, x, y);
473  return ret;
474 }
int mod(int a, int b)
Definition: crypto_rot.c:8
@ RZ_IL_OP_SMOD

References mod(), NULL, rz_il_op_new_2, RZ_IL_OP_SMOD, rz_return_val_if_fail, and x.

◆ rz_il_op_new_msb()

RZ_API RZ_OWN RzILOpBool* rz_il_op_new_msb ( RZ_NONNULL RzILOpBitVector bv)

op structure for msb ('s bitv -> bool) [MSB] msb x is the most significant bit of x.

Definition at line 212 of file il_opcodes.c.

212  {
214  RzILOpBool *ret;
215  rz_il_op_new_1(Bool, RZ_IL_OP_MSB, RzILOpArgsLsb, lsb, bv);
216  return ret;
217 }
@ RZ_IL_OP_MSB

References NULL, RZ_IL_OP_MSB, rz_il_op_new_1, and rz_return_val_if_fail.

Referenced by rz_il_op_new_shiftr_arith(), and rz_il_op_new_signed().

◆ rz_il_op_new_mul()

op structure for two-operand algorithm and logical operations ('s bitv -> 's bitv -> 's bitv)

[MUL] mul x y multiplication modulo 2^'s

Definition at line 421 of file il_opcodes.c.

421  {
423  RzILOpBitVector *ret;
424  rz_il_op_new_2(BitVector, RZ_IL_OP_MUL, RzILOpArgsMul, mul, x, y);
425  return ret;
426 }
static RzILOpEffect * mul(cs_insn *insn, bool is_thumb)
Definition: arm_il32.c:539
@ RZ_IL_OP_MUL

References mul(), NULL, RZ_IL_OP_MUL, rz_il_op_new_2, rz_return_val_if_fail, and x.

◆ rz_il_op_new_neg()

op structure for neg ('s bitv -> 's bitv)

neg x is two-complement unary minus

Definition at line 373 of file il_opcodes.c.

373  {
375  RzILOpBitVector *ret;
376  rz_il_op_new_1(BitVector, RZ_IL_OP_NEG, RzILOpArgsNeg, neg, bv);
377  return ret;
378 }
static ut32 neg(ArmOp *op)
Definition: armass64.c:981
@ RZ_IL_OP_NEG

References neg(), NULL, RZ_IL_OP_NEG, rz_il_op_new_1, and rz_return_val_if_fail.

◆ rz_il_op_new_non_zero()

RZ_API RZ_OWN RzILOpBool* rz_il_op_new_non_zero ( RZ_NONNULL RzILOpPure bv)

[NON_ZERO] non_zero x holds if x is not a bitvector of all zeroes.

Definition at line 243 of file il_opcodes.c.

243  {
246 }
RZ_API RZ_OWN RzILOpBool * rz_il_op_new_is_zero(RZ_NONNULL RzILOpPure *bv)
Definition: il_opcodes.c:233
RZ_API RZ_OWN RzILOpBool * rz_il_op_new_bool_inv(RZ_NONNULL RzILOpBool *x)
op structure for inv (!bool -> bool)
Definition: il_opcodes.c:149

References NULL, rz_il_op_new_bool_inv(), rz_il_op_new_is_zero(), and rz_return_val_if_fail.

Referenced by bf_llimit(), and bf_rlimit().

◆ rz_il_op_new_nop()

RZ_API RZ_OWN RzILOpEffect* rz_il_op_new_nop ( )

Definition at line 566 of file il_opcodes.c.

566  {
567  RzILOpEffect *ret;
568  rz_il_op_new_0(Effect, RZ_IL_OP_NOP);
569  return ret;
570 }

References rz_il_op_new_0, and RZ_IL_OP_NOP.

Referenced by _6502_op(), bf_op(), rz_il_op_new_branch(), and rz_il_op_new_seqn().

◆ rz_il_op_new_repeat()

RZ_API RZ_OWN RzILOpEffect* rz_il_op_new_repeat ( RZ_NONNULL RzILOpBool condition,
RZ_NONNULL RzILOpEffect data_eff 
)

op structure for repeat (bool -> data eff -> data eff)

repeat c data repeats data effects until the condition c holds.

Definition at line 690 of file il_opcodes.c.

690  {
691  rz_return_val_if_fail(condition && data_eff, NULL);
692  RzILOpEffect *ret;
693  rz_il_op_new_2(Effect, RZ_IL_OP_REPEAT, RzILOpArgsRepeat, repeat, condition, data_eff);
694  return ret;
695 }
op structure for repeat (bool -> data eff -> data eff)

References NULL, repeat(), rz_il_op_new_2, RZ_IL_OP_REPEAT, and rz_return_val_if_fail.

◆ rz_il_op_new_sdiv()

op structure for two-operand algorithm and logical operations ('s bitv -> 's bitv -> 's bitv)

[SDIV] sdiv x y is signed division of x by y modulo 2^'s.

Definition at line 445 of file il_opcodes.c.

445  {
447  RzILOpBitVector *ret;
449  return ret;
450 }
static RzILOpEffect * sdiv(cs_insn *insn, bool is_thumb)
Definition: arm_il32.c:1911
@ RZ_IL_OP_SDIV

References NULL, rz_il_op_new_2, RZ_IL_OP_SDIV, rz_return_val_if_fail, sdiv(), and x.

◆ rz_il_op_new_seq()

op structure for Seq ('a eff -> 'a eff -> 'a eff)

seq x y performs effect x, after that perform effect y. Pack two effects into one.

Definition at line 613 of file il_opcodes.c.

613  {
615  RzILOpEffect *ret;
616  rz_il_op_new_2(Effect, RZ_IL_OP_SEQ, RzILOpArgsSeq, seq, x, y);
617  return ret;
618 }
op structure for Seq ('a eff -> 'a eff -> 'a eff)

References NULL, rz_il_op_new_2, RZ_IL_OP_SEQ, rz_return_val_if_fail, and x.

◆ rz_il_op_new_seqn()

RZ_API RZ_OWN RzILOpEffect* rz_il_op_new_seqn ( ut32  n,
  ... 
)

Chain n opcodes given as varargs in sequence using seq if necessary

It works exactly like this seq helper from BAP: let rec seq = function | [] -> CT.perform Theory.Effect.Sort.bot | [x] -> x | x :: xs -> CT.seq x @ seq xs

Parameters
nnumber of total opcodes given
...num RzILOpEffect * ops to be executed in sequence

Definition at line 632 of file il_opcodes.c.

632  {
633  if (!n) {
634  return rz_il_op_new_nop();
635  }
637  RzILOpEffect *prev_seq = NULL;
638  va_list args;
639  va_start(args, n);
640  for (ut32 i = 0; i < n; ++i) {
641  RzILOpEffect *cur_op = va_arg(args, RzILOpEffect *);
642  if (i == n - 1) {
643  // last one
644  if (prev_seq) {
645  prev_seq->op.seq.y = cur_op;
646  } else {
647  // n == 1, no need for seq at all
648  root = cur_op;
649  }
650  break;
651  }
653  if (!seq) {
654  break;
655  }
656  seq->code = RZ_IL_OP_SEQ;
657  seq->op.seq.x = cur_op;
658  if (prev_seq) {
659  // not the first one
660  // We let the seq recurse in the second op because that
661  // can enable tail call elimination in the evaluation.
662  prev_seq->op.seq.y = seq;
663  } else {
664  // first one
665  root = seq;
666  }
667  prev_seq = seq;
668  }
669  va_end(args);
670  return root;
671 }
lzma_index ** i
Definition: index.h:629
uint32_t ut32
int root
Definition: enough.c:226
int args
Definition: mipsasm.c:18
int n
Definition: mipsasm.c:19
RzILOpEffect * y
perform this second
RzILOpEffect * x
perform this first
RzILOpEffectCode code
RzILOpArgsSeq seq
union rz_il_op_effect_t::@287 op

References args, rz_il_op_effect_t::code, i, n, NULL, rz_il_op_effect_t::op, root, rz_il_op_new_nop(), RZ_IL_OP_SEQ, RZ_NEW0, rz_il_op_effect_t::seq, rz_il_op_args_seq_t::x, and rz_il_op_args_seq_t::y.

◆ rz_il_op_new_set()

RZ_API RZ_OWN RzILOpEffect* rz_il_op_new_set ( RZ_NONNULL const char *  v,
bool  is_local,
RZ_NONNULL RzILOpPure x 
)

op structure for set ('a var -> 'a pure -> data eff)

set v x changes the value stored in v to the value of x.

Definition at line 577 of file il_opcodes.c.

577  {
579  RzILOpEffect *ret;
580  rz_il_op_new_3(Effect, RZ_IL_OP_SET, RzILOpArgsSet, set, v, is_local, x);
581  return ret;
582 }
const char * v
Definition: dsignal.c:12
op structure for set ('a var -> 'a pure -> data eff)

References NULL, rz_il_op_new_3, RZ_IL_OP_SET, rz_return_val_if_fail, v, and x.

◆ rz_il_op_new_sge()

RZ_API RZ_OWN RzILOpBool* rz_il_op_new_sge ( RZ_NONNULL RzILOpPure x,
RZ_NONNULL RzILOpPure y 
)

signed greater or equal

Definition at line 315 of file il_opcodes.c.

315  {
317  return rz_il_op_new_bool_or(
320 }
RZ_API RZ_OWN RzILOpBool * rz_il_op_new_eq(RZ_NONNULL RzILOpBitVector *x, RZ_NONNULL RzILOpBitVector *y)
Definition: il_opcodes.c:251
RZ_API RZ_OWN RzILOpBool * rz_il_op_new_bool_or(RZ_NONNULL RzILOpBool *x, RZ_NONNULL RzILOpBool *y)
op structure for or (bool -> bool -> bool)
Definition: il_opcodes.c:121
RZ_API RZ_OWN RzILOpBool * rz_il_op_new_sle(RZ_NONNULL RzILOpBitVector *x, RZ_NONNULL RzILOpBitVector *y)
op structure for sle/ule ('a bitv -> 'a bitv -> bool)
Definition: il_opcodes.c:275

References NULL, rz_il_op_new_bool_inv(), rz_il_op_new_bool_or(), rz_il_op_new_eq(), rz_il_op_new_sle(), rz_il_op_pure_dup(), rz_return_val_if_fail, and x.

◆ rz_il_op_new_sgt()

RZ_API RZ_OWN RzILOpBool* rz_il_op_new_sgt ( RZ_NONNULL RzILOpPure x,
RZ_NONNULL RzILOpPure y 
)

signed strictly greater than

Definition at line 333 of file il_opcodes.c.

333  {
336 }

References NULL, rz_il_op_new_bool_inv(), rz_il_op_new_sle(), rz_return_val_if_fail, and x.

◆ rz_il_op_new_shiftl()

op structure for left shift (bool -> 's bitv -> 'b bitv -> 's bitv)

[LSHIFT] shiftl s x m shifts x left by m bits filling with s.

Definition at line 517 of file il_opcodes.c.

517  {
518  rz_return_val_if_fail(fill_bit && x && y, NULL);
519  RzILOpBitVector *ret;
520  rz_il_op_new_3(BitVector, RZ_IL_OP_SHIFTL, RzILOpArgsShiftLeft, shiftl, fill_bit, x, y);
521  return ret;
522 }
@ RZ_IL_OP_SHIFTL
op structure for lshift and rshift (bool -> 's bitv -> 'b bitv -> 's bitv)

References NULL, rz_il_op_new_3, RZ_IL_OP_SHIFTL, rz_return_val_if_fail, and x.

◆ rz_il_op_new_shiftr()

op structure for right shift (bool -> 's bitv -> 'b bitv -> 's bitv)

[RSHIFT] shiftr s x m shifts x right by m bits filling with s.

Definition at line 529 of file il_opcodes.c.

529  {
530  rz_return_val_if_fail(fill_bit && x && y, NULL);
531  RzILOpBitVector *ret;
532  rz_il_op_new_3(BitVector, RZ_IL_OP_SHIFTR, RzILOpArgsShiftRight, shiftr, fill_bit, x, y);
533  return ret;
534 }
@ RZ_IL_OP_SHIFTR

References NULL, rz_il_op_new_3, RZ_IL_OP_SHIFTR, rz_return_val_if_fail, and x.

Referenced by rz_il_op_new_shiftr_arith().

◆ rz_il_op_new_shiftr_arith()

RZ_API RZ_OWN RzILOpBitVector* rz_il_op_new_shiftr_arith ( RZ_NONNULL RzILOpBitVector x,
RZ_NONNULL RzILOpBitVector y 
)

alias for shiftr (msb x) x d, right-shift filling up with the left operand's msb

Definition at line 539 of file il_opcodes.c.

539  {
542 }
RZ_API RZ_OWN RzILOpBitVector * rz_il_op_new_shiftr(RZ_NONNULL RzILOpBool *fill_bit, RZ_NONNULL RzILOpBitVector *x, RZ_NONNULL RzILOpBitVector *y)
op structure for right shift (bool -> 's bitv -> 'b bitv -> 's bitv)
Definition: il_opcodes.c:529
RZ_API RZ_OWN RzILOpBool * rz_il_op_new_msb(RZ_NONNULL RzILOpBitVector *bv)
op structure for msb ('s bitv -> bool) [MSB] msb x is the most significant bit of x.
Definition: il_opcodes.c:212

References NULL, rz_il_op_new_msb(), rz_il_op_new_shiftr(), rz_il_op_pure_dup(), rz_return_val_if_fail, and x.

◆ rz_il_op_new_signed()

RZ_API RZ_OWN RzILOpBitVector* rz_il_op_new_signed ( ut32  length,
RZ_NONNULL RzILOpBitVector val 
)

Extend val to length bits, filling up with val's most significant bit.

For length > val->len, this fits the general notion of sign extension.

Definition at line 363 of file il_opcodes.c.

363  {
366 }
RZ_API RZ_OWN RzILOpBitVector * rz_il_op_new_cast(ut32 length, RZ_NONNULL RzILOpBool *fill, RZ_NONNULL RzILOpBitVector *val)
op structure for casting bitv
Definition: il_opcodes.c:341

References length, NULL, rz_il_op_new_cast(), rz_il_op_new_msb(), rz_il_op_pure_dup(), rz_return_val_if_fail, and val.

Referenced by qadd16(), qadd8(), sadd16(), and sadd8().

◆ rz_il_op_new_sle()

op structure for sle/ule ('a bitv -> 'a bitv -> bool)

[SLE] sle x y binary predicate for signed less than or equal

Definition at line 275 of file il_opcodes.c.

275  {
277  RzILOpBool *ret;
278  rz_il_op_new_2(Bool, RZ_IL_OP_SLE, RzILOpArgsSle, sle, x, y);
279  return ret;
280 }
@ RZ_IL_OP_SLE

References NULL, rz_il_op_new_2, RZ_IL_OP_SLE, rz_return_val_if_fail, and x.

Referenced by rz_il_op_new_sge(), rz_il_op_new_sgt(), and rz_il_op_new_slt().

◆ rz_il_op_new_slt()

RZ_API RZ_OWN RzILOpBool* rz_il_op_new_slt ( RZ_NONNULL RzILOpPure x,
RZ_NONNULL RzILOpPure y 
)

signed strict less than

Definition at line 295 of file il_opcodes.c.

295  {
297  return rz_il_op_new_bool_and(
298  rz_il_op_new_sle(x, y),
300 }
RZ_API RZ_OWN RzILOpBool * rz_il_op_new_bool_and(RZ_NONNULL RzILOpBool *x, RZ_NONNULL RzILOpBool *y)
op structure for and (bool -> bool -> bool)
Definition: il_opcodes.c:107

References NULL, rz_il_op_new_bool_and(), rz_il_op_new_bool_inv(), rz_il_op_new_eq(), rz_il_op_new_sle(), rz_il_op_pure_dup(), rz_return_val_if_fail, and x.

◆ rz_il_op_new_smod()

op structure for two-operand algorithm and logical operations ('s bitv -> 's bitv -> 's bitv)

[SMOD] smodulo x y is the signed remainder of div x y modulo 2^'s.

Definition at line 457 of file il_opcodes.c.

457  {
459  RzILOpBitVector *ret;
460  rz_il_op_new_2(BitVector, RZ_IL_OP_MOD, RzILOpArgsSmod, smod, x, y);
461  return ret;
462 }
@ RZ_IL_OP_MOD

References NULL, RZ_IL_OP_MOD, rz_il_op_new_2, rz_return_val_if_fail, and x.

◆ rz_il_op_new_store()

RZ_API RZ_OWN RzILOpEffect* rz_il_op_new_store ( RzILMemIndex  mem,
RZ_NONNULL RzILOpBitVector key,
RZ_NONNULL RzILOpBitVector value 
)

Helper to create RzILOpArgsStoreW.

Definition at line 728 of file il_opcodes.c.

728  {
730  RzILOpEffect *ret;
732  return ret;
733 }
op structure for store (('a, 'b) mem -> 'a bitv -> 'b bitv -> ('a, 'b) mem)

References key, mem, NULL, rz_il_op_new_3, RZ_IL_OP_STORE, rz_return_val_if_fail, and value.

Referenced by bf_dec(), and bf_inc().

◆ rz_il_op_new_storew()

RZ_API RZ_OWN RzILOpEffect* rz_il_op_new_storew ( RzILMemIndex  mem,
RZ_NONNULL RzILOpBitVector key,
RZ_NONNULL RzILOpBitVector value 
)

Helper to create RzILOpArgsStoreW.

Definition at line 748 of file il_opcodes.c.

748  {
750  RzILOpEffect *ret;
752  return ret;
753 }
Store an entire word of arbitrary bit size into a memory.

References key, mem, NULL, rz_il_op_new_3, RZ_IL_OP_STOREW, rz_return_val_if_fail, and value.

◆ rz_il_op_new_sub()

op structure for two-operand algorithm and logical operations ('s bitv -> 's bitv -> 's bitv)

[SUB] sub x y subtraction modulo 2^'s

Definition at line 409 of file il_opcodes.c.

409  {
411  RzILOpBitVector *ret;
412  rz_il_op_new_2(BitVector, RZ_IL_OP_SUB, RzILOpArgsSub, sub, x, y);
413  return ret;
414 }
@ RZ_IL_OP_SUB

References NULL, rz_il_op_new_2, RZ_IL_OP_SUB, rz_return_val_if_fail, and x.

Referenced by bf_dec(), and bf_left_arrow().

◆ rz_il_op_new_uge()

RZ_API RZ_OWN RzILOpBool* rz_il_op_new_uge ( RZ_NONNULL RzILOpPure x,
RZ_NONNULL RzILOpPure y 
)

unsigned greater or equal

Definition at line 305 of file il_opcodes.c.

305  {
307  return rz_il_op_new_bool_or(
310 }
RZ_API RZ_OWN RzILOpBool * rz_il_op_new_ule(RZ_NONNULL RzILOpBitVector *x, RZ_NONNULL RzILOpBitVector *y)
op structure for sle/ule ('a bitv -> 'a bitv -> bool)
Definition: il_opcodes.c:263

References NULL, rz_il_op_new_bool_inv(), rz_il_op_new_bool_or(), rz_il_op_new_eq(), rz_il_op_new_ule(), rz_il_op_pure_dup(), rz_return_val_if_fail, and x.

◆ rz_il_op_new_ugt()

RZ_API RZ_OWN RzILOpBool* rz_il_op_new_ugt ( RZ_NONNULL RzILOpPure x,
RZ_NONNULL RzILOpPure y 
)

unsigned strictly greater than

Definition at line 325 of file il_opcodes.c.

325  {
328 }

References NULL, rz_il_op_new_bool_inv(), rz_il_op_new_ule(), rz_return_val_if_fail, and x.

◆ rz_il_op_new_ule()

op structure for sle/ule ('a bitv -> 'a bitv -> bool)

[ULE] ule x y binary predicate for unsigned less than or equal

Definition at line 263 of file il_opcodes.c.

263  {
265  RzILOpBool *ret;
266  rz_il_op_new_2(Bool, RZ_IL_OP_ULE, RzILOpArgsUle, ule, x, y);
267  return ret;
268 }
@ RZ_IL_OP_ULE

References NULL, rz_il_op_new_2, RZ_IL_OP_ULE, rz_return_val_if_fail, and x.

Referenced by rz_il_op_new_uge(), rz_il_op_new_ugt(), and rz_il_op_new_ult().

◆ rz_il_op_new_ult()

◆ rz_il_op_new_unsigned()

RZ_API RZ_OWN RzILOpBitVector* rz_il_op_new_unsigned ( ut32  length,
RZ_NONNULL RzILOpBitVector val 
)

Extend val to length bits, filling up with zeroes.

For length > val->len, this fits the general notion of zero extension.

Definition at line 353 of file il_opcodes.c.

353  {
356 }
RZ_API RZ_OWN RzILOpBool * rz_il_op_new_b0()
op structure for bool false
Definition: il_opcodes.c:85

References length, NULL, rz_il_op_new_b0(), rz_il_op_new_cast(), rz_return_val_if_fail, and val.

Referenced by qadd16(), qadd8(), sadd16(), and sadd8().

◆ rz_il_op_new_var()

RZ_API RZ_OWN RzILOpPure* rz_il_op_new_var ( RZ_NONNULL const char *  v,
RzILVarKind  kind 
)

op structure for var ('a var -> 'a pure)

var v is the value of the variable v.

Definition at line 65 of file il_opcodes.c.

65  {
67  RzILOpPure *ret;
68  rz_il_op_new_2(Pure, RZ_IL_OP_VAR, RzILOpArgsVar, var, v, kind);
69  return ret;
70 }
@ RZ_IL_OP_VAR
op structure for var ('a var -> 'a pure)

References NULL, rz_il_op_new_2, RZ_IL_OP_VAR, rz_return_val_if_fail, and v.

Referenced by bf_llimit(), and bf_rlimit().

◆ rz_il_op_pure_dup()

RZ_API RzILOpPure* rz_il_op_pure_dup ( RZ_NONNULL RzILOpPure op)

Duplicate the given op recursively, for example to reuse it multiple times in another op.

Definition at line 763 of file il_opcodes.c.

763  {
766  if (!r) {
767  return NULL;
768  }
769 #define DUP_OP1(arg, m0) \
770  do { \
771  r->op.arg.m0 = rz_il_op_pure_dup(op->op.arg.m0); \
772  if (!r->op.arg.m0) { \
773  return NULL; \
774  } \
775  } while (0);
776 #define DUP_OP2(arg, m0, m1) \
777  do { \
778  r->op.arg.m0 = rz_il_op_pure_dup(op->op.arg.m0); \
779  r->op.arg.m1 = rz_il_op_pure_dup(op->op.arg.m1); \
780  if (!r->op.arg.m0 || !r->op.arg.m1) { \
781  rz_il_op_pure_free(r->op.arg.m0); \
782  rz_il_op_pure_free(r->op.arg.m1); \
783  return NULL; \
784  } \
785  } while (0);
786 #define DUP_OP3(arg, m0, m1, m2) \
787  do { \
788  r->op.arg.m0 = rz_il_op_pure_dup(op->op.arg.m0); \
789  r->op.arg.m1 = rz_il_op_pure_dup(op->op.arg.m1); \
790  r->op.arg.m2 = rz_il_op_pure_dup(op->op.arg.m2); \
791  if (!r->op.arg.m0 || !r->op.arg.m1 || !r->op.arg.m2) { \
792  rz_il_op_pure_free(r->op.arg.m0); \
793  rz_il_op_pure_free(r->op.arg.m1); \
794  rz_il_op_pure_free(r->op.arg.m2); \
795  return NULL; \
796  } \
797  } while (0);
798  r->code = op->code;
799  switch (op->code) {
800  case RZ_IL_OP_VAR:
801  r->op.var.v = op->op.var.v;
802  r->op.var.kind = op->op.var.kind;
803  break;
804  case RZ_IL_OP_ITE:
805  DUP_OP3(ite, condition, x, y);
806  break;
807  case RZ_IL_OP_LET:
808  r->op.let.name = op->op.let.name;
809  DUP_OP2(let, exp, body);
810  break;
811  case RZ_IL_OP_B0:
812  break;
813  case RZ_IL_OP_B1:
814  break;
815  case RZ_IL_OP_INV:
816  DUP_OP1(boolinv, x);
817  break;
818  case RZ_IL_OP_AND:
819  DUP_OP2(booland, x, y);
820  break;
821  case RZ_IL_OP_OR:
822  DUP_OP2(boolor, x, y);
823  break;
824  case RZ_IL_OP_XOR:
825  DUP_OP2(boolxor, x, y);
826  break;
827  case RZ_IL_OP_BITV:
828  r->op.bitv.value = rz_bv_dup(op->op.bitv.value);
829  break;
830  case RZ_IL_OP_MSB:
831  DUP_OP1(msb, bv);
832  break;
833  case RZ_IL_OP_LSB:
834  DUP_OP1(lsb, bv);
835  break;
836  case RZ_IL_OP_IS_ZERO:
837  DUP_OP1(is_zero, bv);
838  break;
839  case RZ_IL_OP_NEG:
840  DUP_OP1(neg, bv);
841  break;
842  case RZ_IL_OP_LOGNOT:
843  DUP_OP1(lognot, bv);
844  break;
845  case RZ_IL_OP_ADD:
846  DUP_OP2(add, x, y);
847  break;
848  case RZ_IL_OP_SUB:
849  DUP_OP2(sub, x, y);
850  break;
851  case RZ_IL_OP_MUL:
852  DUP_OP2(mul, x, y);
853  break;
854  case RZ_IL_OP_DIV:
855  DUP_OP2(div, x, y);
856  break;
857  case RZ_IL_OP_SDIV:
858  DUP_OP2(sdiv, x, y);
859  break;
860  case RZ_IL_OP_MOD:
861  DUP_OP2(mod, x, y);
862  break;
863  case RZ_IL_OP_SMOD:
864  DUP_OP2(smod, x, y);
865  break;
866  case RZ_IL_OP_LOGAND:
867  DUP_OP2(logand, x, y);
868  break;
869  case RZ_IL_OP_LOGOR:
870  DUP_OP2(logor, x, y);
871  break;
872  case RZ_IL_OP_LOGXOR:
873  DUP_OP2(logxor, x, y);
874  break;
875  case RZ_IL_OP_SHIFTR:
876  DUP_OP3(shiftr, x, y, fill_bit);
877  break;
878  case RZ_IL_OP_SHIFTL:
879  DUP_OP3(shiftl, x, y, fill_bit);
880  break;
881  case RZ_IL_OP_EQ:
882  DUP_OP2(eq, x, y);
883  break;
884  case RZ_IL_OP_SLE:
885  DUP_OP2(sle, x, y);
886  break;
887  case RZ_IL_OP_ULE:
888  DUP_OP2(ule, x, y);
889  break;
890  case RZ_IL_OP_CAST:
891  r->op.cast.length = op->op.cast.length;
892  DUP_OP2(cast, fill, val);
893  break;
894  case RZ_IL_OP_APPEND:
895  DUP_OP2(append, high, low);
896  break;
897  case RZ_IL_OP_LOAD:
898  r->op.load.mem = op->op.load.mem;
899  DUP_OP1(load, key);
900  break;
901  case RZ_IL_OP_LOADW:
902  r->op.loadw.mem = op->op.loadw.mem;
903  r->op.loadw.n_bits = op->op.loadw.n_bits;
904  DUP_OP1(loadw, key);
905  break;
906  default:
908  break;
909  }
910 #undef DUP_OP
911 #undef DUP_OP2
912 #undef DUP_OP3
913  return r;
914 }
#define DUP_OP2(arg, m0, m1)
#define DUP_OP1(arg, m0)
#define DUP_OP3(arg, m0, m1, m2)
RZ_API RZ_OWN RzBitVector * rz_bv_dup(const RZ_NONNULL RzBitVector *bv)
Definition: bitvector.c:167

References add(), append, cast, op::code, DUP_OP1, DUP_OP2, DUP_OP3, eq, key, load(), mod(), mul(), neg(), NULL, r, rz_bv_dup(), RZ_IL_OP_ADD, RZ_IL_OP_AND, RZ_IL_OP_APPEND, RZ_IL_OP_B0, RZ_IL_OP_B1, RZ_IL_OP_BITV, RZ_IL_OP_CAST, RZ_IL_OP_DIV, RZ_IL_OP_EQ, RZ_IL_OP_INV, RZ_IL_OP_IS_ZERO, RZ_IL_OP_ITE, RZ_IL_OP_LET, RZ_IL_OP_LOAD, RZ_IL_OP_LOADW, RZ_IL_OP_LOGAND, RZ_IL_OP_LOGNOT, RZ_IL_OP_LOGOR, RZ_IL_OP_LOGXOR, RZ_IL_OP_LSB, RZ_IL_OP_MOD, RZ_IL_OP_MSB, RZ_IL_OP_MUL, RZ_IL_OP_NEG, RZ_IL_OP_OR, RZ_IL_OP_SDIV, RZ_IL_OP_SHIFTL, RZ_IL_OP_SHIFTR, RZ_IL_OP_SLE, RZ_IL_OP_SMOD, RZ_IL_OP_SUB, RZ_IL_OP_ULE, RZ_IL_OP_VAR, RZ_IL_OP_XOR, RZ_NEW0, rz_return_val_if_fail, rz_warn_if_reached, sdiv(), val, and x.

Referenced by rz_il_op_new_sge(), rz_il_op_new_shiftr_arith(), rz_il_op_new_signed(), rz_il_op_new_slt(), rz_il_op_new_uge(), and rz_il_op_new_ult().

◆ rz_il_op_pure_free()

RZ_API void rz_il_op_pure_free ( RZ_NULLABLE RzILOpPure op)

Definition at line 928 of file il_opcodes.c.

928  {
929  if (!op) {
930  return;
931  }
932  switch (op->code) {
933  case RZ_IL_OP_VAR:
934  break;
935  case RZ_IL_OP_ITE:
936  rz_il_op_free_3(pure, ite, condition, x, y);
937  break;
938  case RZ_IL_OP_LET:
939  rz_il_op_free_2(pure, let, exp, body);
940  break;
941  case RZ_IL_OP_B0:
942  case RZ_IL_OP_B1:
943  break;
944  case RZ_IL_OP_INV:
945  rz_il_op_free_1(pure, boolinv, x);
946  break;
947  case RZ_IL_OP_AND:
948  case RZ_IL_OP_OR:
949  case RZ_IL_OP_XOR:
950  // BoolXor, BoolOr and BoolAnd shares the same struct
951  rz_il_op_free_2(pure, boolxor, x, y);
952  break;
953  case RZ_IL_OP_BITV:
954  rz_bv_free(op->op.bitv.value);
955  break;
956  case RZ_IL_OP_MSB:
957  rz_il_op_free_1(pure, msb, bv);
958  break;
959  case RZ_IL_OP_LSB:
960  rz_il_op_free_1(pure, lsb, bv);
961  break;
962  case RZ_IL_OP_IS_ZERO:
963  rz_il_op_free_1(pure, is_zero, bv);
964  break;
965  case RZ_IL_OP_NEG:
966  rz_il_op_free_1(pure, neg, bv);
967  break;
968  case RZ_IL_OP_LOGNOT:
969  rz_il_op_free_1(pure, lognot, bv);
970  break;
971  case RZ_IL_OP_ADD:
972  rz_il_op_free_2(pure, add, x, y);
973  break;
974  case RZ_IL_OP_SUB:
975  rz_il_op_free_2(pure, sub, x, y);
976  break;
977  case RZ_IL_OP_MUL:
978  rz_il_op_free_2(pure, mul, x, y);
979  break;
980  case RZ_IL_OP_DIV:
981  rz_il_op_free_2(pure, div, x, y);
982  break;
983  case RZ_IL_OP_SDIV:
984  rz_il_op_free_2(pure, sdiv, x, y);
985  break;
986  case RZ_IL_OP_MOD:
987  rz_il_op_free_2(pure, mod, x, y);
988  break;
989  case RZ_IL_OP_SMOD:
990  rz_il_op_free_2(pure, smod, x, y);
991  break;
992  case RZ_IL_OP_LOGAND:
993  rz_il_op_free_2(pure, logand, x, y);
994  break;
995  case RZ_IL_OP_LOGOR:
996  rz_il_op_free_2(pure, logor, x, y);
997  break;
998  case RZ_IL_OP_LOGXOR:
999  rz_il_op_free_2(pure, logxor, x, y);
1000  break;
1001  case RZ_IL_OP_SHIFTR:
1002  rz_il_op_free_3(pure, shiftr, fill_bit, x, y);
1003  break;
1004  case RZ_IL_OP_SHIFTL:
1005  rz_il_op_free_3(pure, shiftl, fill_bit, x, y);
1006  break;
1007  case RZ_IL_OP_EQ:
1008  rz_il_op_free_2(pure, eq, x, y);
1009  break;
1010  case RZ_IL_OP_SLE:
1011  rz_il_op_free_2(pure, sle, x, y);
1012  break;
1013  case RZ_IL_OP_ULE:
1014  rz_il_op_free_2(pure, ule, x, y);
1015  break;
1016  case RZ_IL_OP_CAST:
1017  rz_il_op_free_2(pure, cast, fill, val);
1018  break;
1019  case RZ_IL_OP_APPEND:
1020  rz_il_op_free_2(pure, append, high, low);
1021  break;
1022  case RZ_IL_OP_LOAD:
1023  rz_il_op_free_1(pure, load, key);
1024  break;
1025  case RZ_IL_OP_LOADW:
1026  rz_il_op_free_1(pure, loadw, key);
1027  break;
1028  default:
1030  RZ_LOG_ERROR("RzIL: unknown opcode %u\n", op->code);
1031  break;
1032  }
1033  free(op);
1034 }
#define rz_il_op_free_3(sort, s, v0, v1, v2)
Definition: il_opcodes.c:923

References add(), append, cast, op::code, eq, free(), key, load(), mod(), mul(), neg(), rz_bv_free(), RZ_IL_OP_ADD, RZ_IL_OP_AND, RZ_IL_OP_APPEND, RZ_IL_OP_B0, RZ_IL_OP_B1, RZ_IL_OP_BITV, RZ_IL_OP_CAST, RZ_IL_OP_DIV, RZ_IL_OP_EQ, rz_il_op_free_1, rz_il_op_free_2, rz_il_op_free_3, RZ_IL_OP_INV, RZ_IL_OP_IS_ZERO, RZ_IL_OP_ITE, RZ_IL_OP_LET, RZ_IL_OP_LOAD, RZ_IL_OP_LOADW, RZ_IL_OP_LOGAND, RZ_IL_OP_LOGNOT, RZ_IL_OP_LOGOR, RZ_IL_OP_LOGXOR, RZ_IL_OP_LSB, RZ_IL_OP_MOD, RZ_IL_OP_MSB, RZ_IL_OP_MUL, RZ_IL_OP_NEG, RZ_IL_OP_OR, RZ_IL_OP_SDIV, RZ_IL_OP_SHIFTL, RZ_IL_OP_SHIFTR, RZ_IL_OP_SLE, RZ_IL_OP_SMOD, RZ_IL_OP_SUB, RZ_IL_OP_ULE, RZ_IL_OP_VAR, RZ_IL_OP_XOR, RZ_LOG_ERROR, rz_warn_if_reached, sdiv(), val, and x.

Referenced by add_sub(), bfi(), bic(), bitwise(), cbz(), cmp(), csinc(), extr(), ldm(), mla(), mov(), mul(), pkhbt(), qadd(), qadd16(), qadd8(), rfe(), rz_il_op_effect_free(), sadd16(), sadd8(), sdiv(), sel(), shift(), smaddl(), smlabb(), smlal(), smlaw(), smmla(), smmul(), smuad(), smulbb(), smulh(), smull(), ssat(), ssat16(), stm(), str(), strex(), tbz(), tst(), udiv(), umaal(), umull(), usad8(), uxt(), uxt16(), and write_reg().