Add name getter for RzIL effects. (#5643)

This commit is contained in:
Rot127 2025-12-18 19:11:01 +00:00 committed by GitHub
parent 12e26c839f
commit 83a8c21394
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 35 additions and 0 deletions

View file

@ -1115,6 +1115,40 @@ RZ_API void rz_il_event_stringify(RZ_NONNULL const RzILEvent *evt, RZ_NONNULL Rz
free(tmp2);
}
/**
* Get a readable representation of \p code
* \return constant string, must not be freed
*/
RZ_API RZ_NONNULL const char *rz_il_op_effect_code_stringify(RzILOpEffectCode code) {
switch (code) {
case RZ_IL_OP_STORE:
return "store";
case RZ_IL_OP_STOREW:
return "storew";
case RZ_IL_OP_EMPTY:
return "empty";
case RZ_IL_OP_NOP:
return "nop";
case RZ_IL_OP_SET:
return "set";
case RZ_IL_OP_JMP:
return "jmp";
case RZ_IL_OP_GOTO:
return "goto";
case RZ_IL_OP_SEQ:
return "seq";
case RZ_IL_OP_BLK:
return "blk";
case RZ_IL_OP_REPEAT:
return "repeat";
case RZ_IL_OP_BRANCH:
return "branch";
case RZ_IL_OP_EFFECT_MAX:
break;
}
return "invalid";
}
/**
* Get a readable representation of \p code
* \return constant string, must not be freed

View file

@ -853,6 +853,7 @@ RZ_API RZ_OWN RzILOpEffect *rz_il_op_new_store(RzILMemIndex mem, RZ_NONNULL RzIL
RZ_API RZ_OWN RzILOpEffect *rz_il_op_new_storew(RzILMemIndex mem, RZ_NONNULL RzILOpBitVector *key, RZ_NONNULL RzILOpBitVector *value);
// Printing/Export
RZ_API RZ_NONNULL const char *rz_il_op_effect_code_stringify(RzILOpEffectCode code);
RZ_API RZ_NONNULL const char *rz_il_op_pure_code_stringify(RzILOpPureCode code);
RZ_API RZ_OWN RzGraph /*<RzGraphNodeInfo *>*/ *rz_il_op_pure_graph(RZ_NONNULL RzILOpPure *op, RZ_NULLABLE const char *name);