public static BuilderInstruction buildConstant(long value, int register) { BuilderInstruction result; int bitCount = Long.SIZE - Long.numberOfLeadingZeros(value); if (bitCount < 16 && (register & 0xFFFFFF00) == 0) { result = new BuilderInstruction21s(Opcode.CONST_WIDE_16, register, (int) value); } else if (bitCount < 32 && (register & 0xFFFFFF00) == 0) { result = new BuilderInstruction31i(Opcode.CONST_WIDE_32, register, (int) value); } else { result = new BuilderInstruction51l(Opcode.CONST_WIDE, register, value); } return result; }
@Override protected BuilderInstruction getRealInsn0(LabelAssigner assigner) { return new BuilderInstruction10x(opc); } }
public static BuilderInstruction buildConstant(int value, int register) { BuilderInstruction result; int bitCount = value == 0 ? 1 : 1 + Integer.numberOfTrailingZeros(Integer.highestOneBit(value)); if (bitCount < 4 && (register & 0xFFFFFFF0) == 0) { result = new BuilderInstruction11n(Opcode.CONST_4, register, value); } else if (bitCount < 16 && (register & 0xFFFFFF00) == 0) { result = new BuilderInstruction21s(Opcode.CONST_16, register, value); } else { result = new BuilderInstruction31i(Opcode.CONST, register, value); } return result; }
@Nonnull private BuilderInstruction32x newBuilderInstruction32x(@Nonnull Instruction32x instruction) { return new BuilderInstruction32x( instruction.getOpcode(), instruction.getRegisterA(), instruction.getRegisterB()); }
@Nonnull private BuilderInstruction21s newBuilderInstruction21s(@Nonnull Instruction21s instruction) { return new BuilderInstruction21s( instruction.getOpcode(), instruction.getRegisterA(), instruction.getNarrowLiteral()); }
@Nonnull private BuilderInstruction31i newBuilderInstruction31i(@Nonnull Instruction31i instruction) { return new BuilderInstruction31i( instruction.getOpcode(), instruction.getRegisterA(), instruction.getNarrowLiteral()); }
@Nonnull private BuilderInstruction51l newBuilderInstruction51l(@Nonnull Instruction51l instruction) { return new BuilderInstruction51l( instruction.getOpcode(), instruction.getRegisterA(), instruction.getWideLiteral()); }
@Nonnull private BuilderInstruction11n newBuilderInstruction11n(@Nonnull Instruction11n instruction) { return new BuilderInstruction11n( instruction.getOpcode(), instruction.getRegisterA(), instruction.getNarrowLiteral()); }
@Nonnull private BuilderArrayPayload newBuilderArrayPayload(@Nonnull ArrayPayload instruction) { return new BuilderArrayPayload(instruction.getElementWidth(), instruction.getArrayElements()); }
@Nonnull private BuilderInstruction12x newBuilderInstruction12x(@Nonnull Instruction12x instruction) { return new BuilderInstruction12x( instruction.getOpcode(), instruction.getRegisterA(), instruction.getRegisterB()); }
@Nonnull private BuilderInstruction21lh newBuilderInstruction21lh(@Nonnull Instruction21lh instruction) { return new BuilderInstruction21lh( instruction.getOpcode(), instruction.getRegisterA(), instruction.getWideLiteral()); }
@Nonnull private BuilderInstruction21ih newBuilderInstruction21ih(@Nonnull Instruction21ih instruction) { return new BuilderInstruction21ih( instruction.getOpcode(), instruction.getRegisterA(), instruction.getNarrowLiteral()); }
@Nonnull private BuilderInstruction20t newBuilderInstruction20t(int codeAddress, int[] codeAddressToIndex, @Nonnull Instruction20t instruction) { return new BuilderInstruction20t( instruction.getOpcode(), newLabel(codeAddressToIndex, codeAddress + instruction.getCodeOffset())); }
@Nonnull private BuilderInstruction23x newBuilderInstruction23x(@Nonnull Instruction23x instruction) { return new BuilderInstruction23x( instruction.getOpcode(), instruction.getRegisterA(), instruction.getRegisterB(), instruction.getRegisterC()); }
@Nonnull private BuilderInstruction11x newBuilderInstruction11x(@Nonnull Instruction11x instruction) { return new BuilderInstruction11x( instruction.getOpcode(), instruction.getRegisterA()); }
@Nonnull private BuilderInstruction22x newBuilderInstruction22x(@Nonnull Instruction22x instruction) { return new BuilderInstruction22x( instruction.getOpcode(), instruction.getRegisterA(), instruction.getRegisterB()); }
@Nonnull private BuilderInstruction22s newBuilderInstruction22s(@Nonnull Instruction22s instruction) { return new BuilderInstruction22s( instruction.getOpcode(), instruction.getRegisterA(), instruction.getRegisterB(), instruction.getNarrowLiteral()); }
@Nonnull private BuilderInstruction22b newBuilderInstruction22b(@Nonnull Instruction22b instruction) { return new BuilderInstruction22b( instruction.getOpcode(), instruction.getRegisterA(), instruction.getRegisterB(), instruction.getNarrowLiteral()); }
@Nonnull private BuilderInstruction25x newBuilderInstruction25x(@Nonnull Instruction25x instruction) { return new BuilderInstruction25x( instruction.getOpcode(), instruction.getParameterRegisterCount(), instruction.getRegisterFixedC(), instruction.getRegisterParameterD(), instruction.getRegisterParameterE(), instruction.getRegisterParameterF(), instruction.getRegisterParameterG()); }
@Nonnull private BuilderInstruction10x newBuilderInstruction10x(@Nonnull Instruction10x instruction) { return new BuilderInstruction10x( instruction.getOpcode()); }