Enum Class IntMultOpGen
- All Implemented Interfaces:
BinOpGen<JitIntMultOp>,IntOpBinOpGen<JitIntMultOp>,OpGen<JitIntMultOp>,Serializable,Comparable<IntMultOpGen>,Constable
int_mult.
This uses the binary operator generator and simply emits imul or
lmul depending on the type.
For multi-precision multiplication, this emits code to invoke
JitCompiledPassage.mpIntMultiply(int[], int[], int[])
-
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.BinOpGen
BinOpGen.TakeOutNested 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.Bot> genRunMpInt(Emitter<Emitter.Bot> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, JitIntMultOp op, JitType.MpIntJitType type, Scope scope) Generate the mp-int multiply code.booleanisSigned()Whether this operator is signed<N2 extends Emitter.Next,N1 extends Emitter.Ent<N2, Types.TInt>, N0 extends Emitter.Ent<N1, Types.TInt>>
Emitter<Emitter.Ent<N2, Types.TInt>> opForInt(Emitter<N0> em, JitType.IntJitType type) Emit the JVM bytecode to perform the operator with intF operands on the stack.<N2 extends Emitter.Next,N1 extends Emitter.Ent<N2, Types.TLong>, N0 extends Emitter.Ent<N1, Types.TLong>>
Emitter<Emitter.Ent<N2, Types.TLong>> opForLong(Emitter<N0> em, JitType.LongJitType type) Emit the JVM bytecode to perform the operator with long operands on the stack.static IntMultOpGenReturns the enum constant of this class with the specified name.static IntMultOpGen[]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.BinOpGen
ext, genMpDelegationToStaticMethod, rExtMethods inherited from interface ghidra.pcode.emu.jit.gen.op.IntOpBinOpGen
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:BinOpGenWhether 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 interfaceBinOpGen<JitIntMultOp>- Returns:
- true for signed, false if not
-
opForInt
public <N2 extends Emitter.Next,N1 extends Emitter.Ent<N2, Emitter<Emitter.Ent<N2,Types.TInt>, N0 extends Emitter.Ent<N1, Types.TInt>> Types.TInt>> opForInt(Emitter<N0> em, JitType.IntJitType type) Description copied from interface:IntOpBinOpGenEmit the JVM bytecode to perform the operator with intF operands on the stack.- Specified by:
opForIntin interfaceIntOpBinOpGen<JitIntMultOp>- Type Parameters:
N2- the tail of the incoming stackN1- the tail of the incoming stack including the right operandN0- the incoming stack with the right and left operands on top- Parameters:
em- the emitter typed with the incoming stacktype- the p-code type of the operands- Returns:
- the emitter typed with the resulting stack, i.e., the tail with the result pushed
-
opForLong
public <N2 extends Emitter.Next,N1 extends Emitter.Ent<N2, Emitter<Emitter.Ent<N2,Types.TLong>, N0 extends Emitter.Ent<N1, Types.TLong>> Types.TLong>> opForLong(Emitter<N0> em, JitType.LongJitType type) Description copied from interface:IntOpBinOpGenEmit the JVM bytecode to perform the operator with long operands on the stack.- Specified by:
opForLongin interfaceIntOpBinOpGen<JitIntMultOp>- Type Parameters:
N2- the tail of the incoming stackN1- the tail of the incoming stack including the right operandN0- the incoming stack with the right and left operands on top- Parameters:
em- the emitter typed with the incoming stacktype- the p-code type of the operands- Returns:
- the emitter typed with the resulting stack, i.e., the tail with the result pushed
-
genRunMpInt
public <THIS extends JitCompiledPassage> Emitter<Emitter.Bot> genRunMpInt(Emitter<Emitter.Bot> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, JitIntMultOp op, JitType.MpIntJitType type, Scope scope) Generate the mp-int multiply code.NOTE: I'd really like to know how many legs of the input operands are actually relevant. Very often, the following idiom is used:
temp: 16 = zext(r1) * zext(r2); r0 = temp(0);
That ensures all the operand sizes match, which is often (at least conventionally) required by the Sleigh compiler. However, if r1 and r2 are each only 64 bits, and I can keep track of that fact, then I could perform about half as many multiplies and adds. It also be nice if I can look ahead and see that only 64 bits of temp is actually used. The same is true of
IntDivOpGen,IntRemOpGen,IntSDivOpGen, andIntSRemOpGen.IDEA: It would be quite a change, but perhaps generating a temporary JVM-level DFG would be useful for culling. The difficulty here is knowing whether or not a temp (unique) is used by a later cross-build. Maybe with the right API calls, I could derive that without additional Sleigh compiler support. If used, I should not cull any computations, so that the retired value is the full value.
- Specified by:
genRunMpIntin interfaceIntOpBinOpGen<JitIntMultOp>- Type Parameters:
THIS- the type of the generated passage- Parameters:
em- the code emitter with an empty stacklocalThis- a handle to the owning compiled passagegen- the code generatorop- the p-code optype- the (uniform) type of the inputs and output operandsscope- a scope for op-temporary variables- Returns:
- the emitter typed with the empty stack
-