Enum Class LzCountOpGen
- All Implemented Interfaces:
IntCountUnOpGen<JitLzCountOp>,OpGen<JitLzCountOp>,UnOpGen<JitLzCountOp>,Serializable,Comparable<LzCountOpGen>,Constable
lzcount.
This uses the unary operator generator and emits an invocation of
Integer.numberOfLeadingZeros(int) or Long.numberOfLeadingZeros(long), depending
on the type.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>Nested classes/interfaces inherited from interface ghidra.pcode.emu.jit.gen.op.OpGen
OpGen.DeadOpResult, OpGen.LiveOpResult, OpGen.OpResult -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescription<THIS extends JitCompiledPassage>
Emitter<Emitter.Ent<Emitter.Bot, Types.TInt>> genRunMpInt(Emitter<Emitter.Bot> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, JitLzCountOp op, JitType.MpIntJitType type, Scope scope) Emit the JVM bytecode to perform the operator with mp-int operands.booleanisSigned()Whether this operator is signed<N1 extends Emitter.Next,N0 extends Emitter.Ent<N1, Types.TInt>>
Emitter<Emitter.Ent<N1, Types.TInt>> opForInt(Emitter<N0> em, JitType.IntJitType type) Emit the JVM bytecode to perform the operator with int operands on the stack.<N1 extends Emitter.Next,N0 extends Emitter.Ent<N1, Types.TLong>>
Emitter<Emitter.Ent<N1, Types.TInt>> opForLong(Emitter<N0> em, JitType.LongJitType type) Emit the JVM bytecode to perform the operator with long operands on the stack.static LzCountOpGenReturns the enum constant of this class with the specified name.static LzCountOpGen[]values()Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOfMethods inherited from interface ghidra.pcode.emu.jit.gen.op.IntCountUnOpGen
genRun
-
Enum Constant Details
-
GEN
The generator singleton
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
isSigned
public boolean isSigned()Description copied from interface:UnOpGenWhether this operator is signedIn many cases, the operator itself is not affected by the signedness of the operands; however, if size adjustments to the operands are needed, this can determine how those operands are extended.
- Specified by:
isSignedin interfaceUnOpGen<JitLzCountOp>- Returns:
- true for signed, false if not
-
opForInt
public <N1 extends Emitter.Next,N0 extends Emitter.Ent<N1, Emitter<Emitter.Ent<N1,Types.TInt>> Types.TInt>> opForInt(Emitter<N0> em, JitType.IntJitType type) Description copied from interface:IntCountUnOpGenEmit the JVM bytecode to perform the operator with int operands on the stack.- Specified by:
opForIntin interfaceIntCountUnOpGen<JitLzCountOp>- Type Parameters:
N1- the tail of the incoming stackN0- the incoming stack with the input operand on top- Parameters:
em- the emitter typed with the incoming stacktype- the p-code type of the input operand- Returns:
- the emitter typed with the resulting stack, i.e., the tail with the result pushed
-
opForLong
public <N1 extends Emitter.Next,N0 extends Emitter.Ent<N1, Emitter<Emitter.Ent<N1,Types.TLong>> Types.TInt>> opForLong(Emitter<N0> em, JitType.LongJitType type) Description copied from interface:IntCountUnOpGenEmit the JVM bytecode to perform the operator with long operands on the stack.- Specified by:
opForLongin interfaceIntCountUnOpGen<JitLzCountOp>- Type Parameters:
N1- the tail of the incoming stackN0- the incoming stack with the input operand on top- Parameters:
em- the emitter typed with the incoming stacktype- the p-code type of the input operand- Returns:
- the emitter typed with the resulting stack, i.e., the tail with the result pushed
-
genRunMpInt
public <THIS extends JitCompiledPassage> Emitter<Emitter.Ent<Emitter.Bot,Types.TInt>> genRunMpInt(Emitter<Emitter.Bot> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, JitLzCountOp op, JitType.MpIntJitType type, Scope scope) Emit the JVM bytecode to perform the operator with mp-int operands.The strategy here is straightforward: Start with the most-significant leg, totalling up the number of leading zeros, until we encounter a situation where the leg did not have 32 zeros. We test for this by checking if the running total is equal to 32 times the number of legs processed so far. We need not load or compute any legs beyond the point where we come up with less. When we reach the end, we made need to subtract some constant number of bits to account for types that do not occupy the full most-significant leg.
- Specified by:
genRunMpIntin interfaceIntCountUnOpGen<JitLzCountOp>- Type Parameters:
THIS- the type of the generated passage- Parameters:
em- the emitter typed with the empty stacklocalThis- a handle to the local holding thethisreferencegen- the code generatorop- the p-code optype- the p-code type of the input operandscope- a scope for generating temporary local storage- Returns:
- the emitter typed with the resulting stack, i.e., with only the result pushed
-