diff options
| author | Mark Rowe <mark@vector35.com> | 2026-06-03 21:25:55 -0700 |
|---|---|---|
| committer | Mark Rowe <mark@vector35.com> | 2026-06-04 14:31:09 -0700 |
| commit | d592ed6dafbb134553bf3a0b8ee70ff7f2049aba (patch) | |
| tree | 1bfe7e335e5b4e21371cde4bf8858c6439bc3f18 /lowlevelilinstruction.cpp | |
| parent | 9987102015875991813200116558306851763009 (diff) | |
Add bswap, popcnt, clz, ctz, cls, and rbit instructions
Diffstat (limited to 'lowlevelilinstruction.cpp')
| -rw-r--r-- | lowlevelilinstruction.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/lowlevelilinstruction.cpp b/lowlevelilinstruction.cpp index 228e8328..5a100080 100644 --- a/lowlevelilinstruction.cpp +++ b/lowlevelilinstruction.cpp @@ -332,6 +332,12 @@ static constexpr std::array s_instructionOperandUsage = { OperandUsage{LLIL_REG_STACK_PHI, {DestSSARegisterStackLowLevelOperandUsage, SourceSSARegisterStacksLowLevelOperandUsage}}, OperandUsage{LLIL_FLAG_PHI, {DestSSAFlagLowLevelOperandUsage, SourceSSAFlagsLowLevelOperandUsage}}, OperandUsage{LLIL_MEM_PHI, {DestMemoryVersionLowLevelOperandUsage, SourceMemoryVersionsLowLevelOperandUsage}}, + OperandUsage{LLIL_BSWAP, {SourceExprLowLevelOperandUsage}}, + OperandUsage{LLIL_POPCNT, {SourceExprLowLevelOperandUsage}}, + OperandUsage{LLIL_CLZ, {SourceExprLowLevelOperandUsage}}, + OperandUsage{LLIL_CTZ, {SourceExprLowLevelOperandUsage}}, + OperandUsage{LLIL_RBIT, {SourceExprLowLevelOperandUsage}}, + OperandUsage{LLIL_CLS, {SourceExprLowLevelOperandUsage}}, }; @@ -1984,6 +1990,12 @@ void LowLevelILInstruction::VisitExprs(bn::base::function_ref<bool(const LowLeve case LLIL_PUSH: case LLIL_NEG: case LLIL_NOT: + case LLIL_BSWAP: + case LLIL_POPCNT: + case LLIL_CLZ: + case LLIL_CTZ: + case LLIL_RBIT: + case LLIL_CLS: case LLIL_SX: case LLIL_ZX: case LLIL_LOW_PART: @@ -2301,6 +2313,12 @@ ExprId LowLevelILInstruction::CopyTo( case LLIL_PUSH: case LLIL_NEG: case LLIL_NOT: + case LLIL_BSWAP: + case LLIL_POPCNT: + case LLIL_CLZ: + case LLIL_CTZ: + case LLIL_RBIT: + case LLIL_CLS: case LLIL_SX: case LLIL_ZX: case LLIL_LOW_PART: @@ -3352,6 +3370,42 @@ ExprId LowLevelILFunction::Not(size_t size, ExprId a, uint32_t flags, const ILSo } +ExprId LowLevelILFunction::ByteSwap(size_t size, ExprId a, uint32_t flags, const ILSourceLocation& loc) +{ + return AddExprWithLocation(LLIL_BSWAP, loc, size, flags, a); +} + + +ExprId LowLevelILFunction::PopulationCount(size_t size, ExprId a, uint32_t flags, const ILSourceLocation& loc) +{ + return AddExprWithLocation(LLIL_POPCNT, loc, size, flags, a); +} + + +ExprId LowLevelILFunction::CountLeadingZeros(size_t size, ExprId a, uint32_t flags, const ILSourceLocation& loc) +{ + return AddExprWithLocation(LLIL_CLZ, loc, size, flags, a); +} + + +ExprId LowLevelILFunction::CountTrailingZeros(size_t size, ExprId a, uint32_t flags, const ILSourceLocation& loc) +{ + return AddExprWithLocation(LLIL_CTZ, loc, size, flags, a); +} + + +ExprId LowLevelILFunction::ReverseBits(size_t size, ExprId a, uint32_t flags, const ILSourceLocation& loc) +{ + return AddExprWithLocation(LLIL_RBIT, loc, size, flags, a); +} + + +ExprId LowLevelILFunction::CountLeadingSigns(size_t size, ExprId a, uint32_t flags, const ILSourceLocation& loc) +{ + return AddExprWithLocation(LLIL_CLS, loc, size, flags, a); +} + + ExprId LowLevelILFunction::SignExtend(size_t size, ExprId a, uint32_t flags, const ILSourceLocation& loc) { return AddExprWithLocation(LLIL_SX, loc, size, flags, a); |
