Package ghidra.pcode.emu.jit.gen.op
Interface IntCompareBinOpGen<T extends JitIntTestOp>
- Type Parameters:
T- the class of p-code op node in the use-def graph
- All Superinterfaces:
BinOpGen<T>,IntPredBinOpGen<T>,OpGen<T>
- All Known Implementing Classes:
IntEqualOpGen,IntLessEqualOpGen,IntLessOpGen,IntNotEqualOpGen,IntSLessEqualOpGen,IntSLessOpGen
An extension for integer comparison operators
-
Nested Class Summary
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 -
Method Summary
Modifier and TypeMethodDescriptiondefault <N extends Emitter.Next>
Emitter<Emitter.Ent<N, Types.TInt>> Assuming a conditional jump bytecode was just emitted, emit bytecode to push 0 (false) onto the stack for the fall-through case, or 1 (true) onto the stack for the taken case.default <N1 extends Emitter.Next,N0 extends Emitter.Ent<N1, Types.TInt>>
Emitter<Emitter.Ent<N1, Types.TInt>> genIntViaIf(Emitter<N0> em, Function<Emitter<N0>, Lbl.LblEm<N1, N1>> opIf) A utility that emits the givenif<cond>along with the logic that pushes the correct result depending on whether or not the jump is taken.default <N2 extends Emitter.Next,N1 extends Emitter.Ent<N2, Types.TInt>, N0 extends Emitter.Ent<N1, Types.TInt>>
Emitter<Emitter.Ent<N2, Types.TInt>> genIntViaIfIcmp(Emitter<N0> em, Function<Emitter<N0>, Lbl.LblEm<N2, N2>> opIfIcmp) An implementation for (signed) int operands that simply emits the givenif_icmp<cond>jump.default <N2 extends Emitter.Next,N1 extends Emitter.Ent<N2, Types.TInt>, N0 extends Emitter.Ent<N1, Types.TInt>>
Emitter<Emitter.Ent<N2, Types.TInt>> genIntViaUcmpThenIf(Emitter<N0> em, Function<Emitter<Emitter.Ent<N2, Types.TInt>>, Lbl.LblEm<N2, N2>> opIf) An implementation for (unsigned) int operands that invokesInteger.compareUnsigned(int, int)and then emits the givenif<cond>jump.default <N2 extends Emitter.Next,N1 extends Emitter.Ent<N2, Types.TLong>, N0 extends Emitter.Ent<N1, Types.TLong>>
Emitter<Emitter.Ent<N2, Types.TInt>> genLongViaLcmpThenIf(Emitter<N0> em, Function<Emitter<Emitter.Ent<N2, Types.TInt>>, Lbl.LblEm<N2, N2>> opIf) An implementation for (signed) long operands that emitslcmpand then emits the givenif<cond>jump.default <N2 extends Emitter.Next,N1 extends Emitter.Ent<N2, Types.TLong>, N0 extends Emitter.Ent<N1, Types.TLong>>
Emitter<Emitter.Ent<N2, Types.TInt>> genLongViaUcmpThenIf(Emitter<N0> em, Function<Emitter<Emitter.Ent<N2, Types.TInt>>, Lbl.LblEm<N2, N2>> opIf) An implementation for (unsigned) long operands that invokesLong.compareUnsigned(long, long)and then emits the givenif<cond>jump.default <THIS extends JitCompiledPassage>
Emitter<Emitter.Ent<Emitter.Bot, Types.TInt>> genRunMpInt(Emitter<Emitter.Bot> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, T op, JitType.MpIntJitType type, Scope scope) Emit the JVM bytecode to perform the operator with multi-precision operands.static <N1 extends Emitter.Next,N0 extends Emitter.Ent<N1, Types.TInt>>
Emitter<Emitter.Ent<N1, Types.TInt>> Invert the boolean on top of the stackMethods inherited from interface ghidra.pcode.emu.jit.gen.op.BinOpGen
ext, genMpDelegationToStaticMethod, isSigned, rExtMethods inherited from interface ghidra.pcode.emu.jit.gen.op.IntPredBinOpGen
delegateIntFlagbit, delegateLongFlagbit, delegateMpIntFlagbit, genRun, opForInt, opForLong
-
Method Details
-
not
static <N1 extends Emitter.Next,N0 extends Emitter.Ent<N1, Emitter<Emitter.Ent<N1,Types.TInt>> Types.TInt>> not(Emitter<N0> em) Invert the boolean on top of the stack- Type Parameters:
N1- the tail of the incoming stackN0- the incoming stack with the boolean on top- Parameters:
em- the emitter typed with the incoming stack- Returns:
- the emitter typed with the resulting stack, i.e., the tail with the result pushed
-
genBool
default <N extends Emitter.Next> Emitter<Emitter.Ent<N,Types.TInt>> genBool(Lbl.LblEm<N, N> lblEmTrue) Assuming a conditional jump bytecode was just emitted, emit bytecode to push 0 (false) onto the stack for the fall-through case, or 1 (true) onto the stack for the taken case.- Type Parameters:
N- the incoming stack, i.e., that after emitting the conditional jump- Parameters:
lblEmTrue- the target label of the conditional jump just emitted, and the emitter typed with the incoming stack- Returns:
- the emitter with the resulting stack, i.e., having pushed the boolean result
-
genIntViaUcmpThenIf
default <N2 extends Emitter.Next,N1 extends Emitter.Ent<N2, Emitter<Emitter.Ent<N2,Types.TInt>, N0 extends Emitter.Ent<N1, Types.TInt>> Types.TInt>> genIntViaUcmpThenIf(Emitter<N0> em, Function<Emitter<Emitter.Ent<N2, Types.TInt>>, Lbl.LblEm<N2, N2>> opIf) An implementation for (unsigned) int operands that invokesInteger.compareUnsigned(int, int)and then emits the givenif<cond>jump.- 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 stackopIf- a method reference, e.g., toOp.ifge(Emitter, Lbl)for the conditional jump- Returns:
- the emitter typed with the resulting stack, i.e., the tail with the result pushed
-
genIntViaIfIcmp
default <N2 extends Emitter.Next,N1 extends Emitter.Ent<N2, Emitter<Emitter.Ent<N2,Types.TInt>, N0 extends Emitter.Ent<N1, Types.TInt>> Types.TInt>> genIntViaIfIcmp(Emitter<N0> em, Function<Emitter<N0>, Lbl.LblEm<N2, N2>> opIfIcmp) An implementation for (signed) int operands that simply emits the givenif_icmp<cond>jump.- 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 stackopIfIcmp- a method reference, e.g., toOp.if_icmpge(Emitter, Lbl)for the conditional jump- Returns:
- the emitter typed with the resulting stack, i.e., the tail with the result pushed
-
genIntViaIf
default <N1 extends Emitter.Next,N0 extends Emitter.Ent<N1, Emitter<Emitter.Ent<N1,Types.TInt>> Types.TInt>> genIntViaIf(Emitter<N0> em, Function<Emitter<N0>, Lbl.LblEm<N1, N1>> opIf) A utility that emits the givenif<cond>along with the logic that pushes the correct result depending on whether or not the jump is taken.- Type Parameters:
N1- the tail of the incoming stackN0- the incoming stack including the predicate, which is compared with 0- Parameters:
em- the emitter typed with the incoming stackopIf- a method reference, e.g., toOp.ifge(Emitter, Lbl)for the conditional jump- Returns:
- the emitter typed with the resulting stack, i.e., the tail with the result pushed
-
genLongViaLcmpThenIf
default <N2 extends Emitter.Next,N1 extends Emitter.Ent<N2, Emitter<Emitter.Ent<N2,Types.TLong>, N0 extends Emitter.Ent<N1, Types.TLong>> Types.TInt>> genLongViaLcmpThenIf(Emitter<N0> em, Function<Emitter<Emitter.Ent<N2, Types.TInt>>, Lbl.LblEm<N2, N2>> opIf) An implementation for (signed) long operands that emitslcmpand then emits the givenif<cond>jump.- 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 stackopIf- a method reference, e.g., toOp.ifge(Emitter, Lbl)for the conditional jump- Returns:
- the emitter typed with the resulting stack, i.e., the tail with the result pushed
-
genLongViaUcmpThenIf
default <N2 extends Emitter.Next,N1 extends Emitter.Ent<N2, Emitter<Emitter.Ent<N2,Types.TLong>, N0 extends Emitter.Ent<N1, Types.TLong>> Types.TInt>> genLongViaUcmpThenIf(Emitter<N0> em, Function<Emitter<Emitter.Ent<N2, Types.TInt>>, Lbl.LblEm<N2, N2>> opIf) An implementation for (unsigned) long operands that invokesLong.compareUnsigned(long, long)and then emits the givenif<cond>jump.- 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 stackopIf- a method reference, e.g., toOp.ifge(Emitter, Lbl)for the conditional jump- Returns:
- the emitter typed with the resulting stack, i.e., the tail with the result pushed
-
genRunMpInt
default <THIS extends JitCompiledPassage> Emitter<Emitter.Ent<Emitter.Bot,Types.TInt>> genRunMpInt(Emitter<Emitter.Bot> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, T op, JitType.MpIntJitType type, Scope scope) Emit the JVM bytecode to perform the operator with multi-precision operands.The strategy for multi-precision comparison can be applied to all comparisons: Start with the most-significant legs and compare for equality until we find the first not-equal pair. Then, apply
IntPredBinOpGen.opForInt(Emitter, IntJitType)to determine the overall result. There is no need to load or compare any legs beyond the most-significant not-equal pair. If we reach the final (least-significant) pair, we need not check them for equality. Just delegate toIntPredBinOpGen.opForInt(Emitter, IntJitType).- Specified by:
genRunMpIntin interfaceIntPredBinOpGen<T extends JitIntTestOp>- 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 operandsscope- a scope for generating temporary local storage- Returns:
- the emitter typed with the resulting stack, i.e., containing only the result
-