Package ghidra.pcode.emu.jit.gen.op
Interface BinOpGen<T extends JitBinOp>
- Type Parameters:
T- the class of p-code op node in the use-def graph
- All Superinterfaces:
OpGen<T>
- All Known Subinterfaces:
FloatCompareBinOpGen<T>,FloatOpBinOpGen<T>,IntBitwiseBinOpGen<T>,IntCompareBinOpGen<T>,IntOpBinOpGen<T>,IntPredBinOpGen<T>,IntShiftBinOpGen<T>
- All Known Implementing Classes:
BoolAndOpGen,BoolOrOpGen,BoolXorOpGen,FloatAddOpGen,FloatDivOpGen,FloatEqualOpGen,FloatLessEqualOpGen,FloatLessOpGen,FloatMultOpGen,FloatNotEqualOpGen,FloatSubOpGen,IntAddOpGen,IntAndOpGen,IntCarryOpGen,IntDivOpGen,IntEqualOpGen,IntLeftOpGen,IntLessEqualOpGen,IntLessOpGen,IntMultOpGen,IntNotEqualOpGen,IntOrOpGen,IntRemOpGen,IntRightOpGen,IntSBorrowOpGen,IntSCarryOpGen,IntSDivOpGen,IntSLessEqualOpGen,IntSLessOpGen,IntSRemOpGen,IntSRightOpGen,IntSubOpGen,IntXorOpGen
An extension that provides conveniences and common implementations for binary p-code operators
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumA choice of static method parameter to take as operator outputNested classes/interfaces inherited from interface ghidra.pcode.emu.jit.gen.op.OpGen
OpGen.DeadOpResult, OpGen.LiveOpResult, OpGen.OpResult -
Method Summary
Modifier and TypeMethodDescriptiondefault Opnd.Extext()When loading and storing variables, the kind of extension to applydefault <THIS extends JitCompiledPassage>
Emitter<Emitter.Bot> genMpDelegationToStaticMethod(Emitter<Emitter.Bot> em, JitCodeGenerator<THIS> gen, Local<Types.TRef<THIS>> localThis, JitType.MpIntJitType type, String methodName, JitBinOp op, int slackLeft, BinOpGen.TakeOut takeOut, Scope scope) Emit bytecode that implements an mp-int binary operator via delegation to a static method onJitCompiledPassage.booleanisSigned()Whether this operator is signeddefault Opnd.ExtrExt()When loading the right operand, the kind of extension to apply
-
Method Details
-
genMpDelegationToStaticMethod
default <THIS extends JitCompiledPassage> Emitter<Emitter.Bot> genMpDelegationToStaticMethod(Emitter<Emitter.Bot> em, JitCodeGenerator<THIS> gen, Local<Types.TRef<THIS>> localThis, JitType.MpIntJitType type, String methodName, JitBinOp op, int slackLeft, BinOpGen.TakeOut takeOut, Scope scope) Emit bytecode that implements an mp-int binary operator via delegation to a static method onJitCompiledPassage. The method must have the signature:void method(int[] out, int[] inL, int[] inR);
This method presumes that the left operand's legs are at the top of the stack, least-significant leg on top, followed by the right operand legs, also least-significant leg on top. This will allocate the output array, move the operands into their respective input arrays, invoke the method, and then place the result legs on the stack, least-significant leg on top.
- Type Parameters:
THIS- the type of the generated passage- Parameters:
em- the emitter typed with the empty stackgen- the code generatorlocalThis- a handle to the local holding thethisreferencetype- the type of the operandsmethodName- the name of the method inJitCompiledPassageto invokeop- the p-code opslackLeft- the number of extra ints to allocate for the left operand's array. This is to facilitate Knuth's division algorithm, which may require an extra leading leg in the dividend after normalization.takeOut- indicates which operand of the static method to actually take for the output. This is to facilitate the remainder operator, because Knuth's algorithm leaves the remainder where there dividend was.scope- a scope for generating temporary local storage- Returns:
- the emitter typed with the empty stack
-
isSigned
boolean isSigned()Whether 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.
- Returns:
- true for signed, false if not
-
ext
When loading and storing variables, the kind of extension to apply- Returns:
- the extension kind
-
rExt
When loading the right operand, the kind of extension to apply- Returns:
- the extension kind
-