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

public interface BinOpGen<T extends JitBinOp> extends OpGen<T>
An extension that provides conveniences and common implementations for binary p-code operators
  • 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 on JitCompiledPassage. 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 stack
      gen - the code generator
      localThis - a handle to the local holding the this reference
      type - the type of the operands
      methodName - the name of the method in JitCompiledPassage to invoke
      op - the p-code op
      slackLeft - 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 signed

      In 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

      default Opnd.Ext ext()
      When loading and storing variables, the kind of extension to apply
      Returns:
      the extension kind
    • rExt

      default Opnd.Ext rExt()
      When loading the right operand, the kind of extension to apply
      Returns:
      the extension kind