private static int[] buildRegisters3rc(Instruction3rc instruction) { int registerCount = instruction.getRegisterCount(); int start = instruction.getStartRegister(); int end = start + registerCount; int[] registers = new int[registerCount]; for (int i = start; i < end; i++) { registers[i - start] = i; } return registers; }
/** * Check if register is referenced by this instruction. * */ private boolean isRegisterUsed(int register) { Instruction35c i = (Instruction35c) instruction; return register == i.getRegisterD() || register == i.getRegisterE() || register == i.getRegisterF() || register == i.getRegisterG() || register == i.getRegisterC(); }
@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 BuilderInstruction23x newBuilderInstruction23x(@Nonnull Instruction23x instruction) { return new BuilderInstruction23x( instruction.getOpcode(), instruction.getRegisterA(), instruction.getRegisterB(), instruction.getRegisterC()); }
@Nonnull private BuilderInstruction22s newBuilderInstruction22s(@Nonnull Instruction22s instruction) { return new BuilderInstruction22s( instruction.getOpcode(), instruction.getRegisterA(), instruction.getRegisterB(), instruction.getNarrowLiteral()); }
@Nonnull private BuilderInstruction12x newBuilderInstruction12x(@Nonnull Instruction12x instruction) { return new BuilderInstruction12x( instruction.getOpcode(), instruction.getRegisterA(), instruction.getRegisterB()); }
@Nonnull private BuilderInstruction22b newBuilderInstruction22b(@Nonnull Instruction22b instruction) { return new BuilderInstruction22b( instruction.getOpcode(), instruction.getRegisterA(), instruction.getRegisterB(), instruction.getNarrowLiteral()); }
@Nonnull private BuilderInstruction32x newBuilderInstruction32x(@Nonnull Instruction32x instruction) { return new BuilderInstruction32x( instruction.getOpcode(), instruction.getRegisterA(), instruction.getRegisterB()); }
@Nonnull private BuilderArrayPayload newBuilderArrayPayload(@Nonnull ArrayPayload instruction) { return new BuilderArrayPayload(instruction.getElementWidth(), instruction.getArrayElements()); }
@Nonnull private BuilderInstruction21t newBuilderInstruction21t(int codeAddress, int[] codeAddressToIndex, @Nonnull Instruction21t instruction) { return new BuilderInstruction21t( instruction.getOpcode(), instruction.getRegisterA(), newLabel(codeAddressToIndex, codeAddress + instruction.getCodeOffset())); }
@Nonnull private BuilderInstruction11n newBuilderInstruction11n(@Nonnull Instruction11n instruction) { return new BuilderInstruction11n( instruction.getOpcode(), instruction.getRegisterA(), instruction.getNarrowLiteral()); }
@Nonnull private BuilderInstruction21lh newBuilderInstruction21lh(@Nonnull Instruction21lh instruction) { return new BuilderInstruction21lh( instruction.getOpcode(), instruction.getRegisterA(), instruction.getWideLiteral()); }
@Nonnull private BuilderInstruction22x newBuilderInstruction22x(@Nonnull Instruction22x instruction) { return new BuilderInstruction22x( 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 BuilderInstruction21ih newBuilderInstruction21ih(@Nonnull Instruction21ih instruction) { return new BuilderInstruction21ih( instruction.getOpcode(), instruction.getRegisterA(), instruction.getNarrowLiteral()); }
@Nonnull private BuilderInstruction11x newBuilderInstruction11x(@Nonnull Instruction11x instruction) { return new BuilderInstruction11x( instruction.getOpcode(), instruction.getRegisterA()); }
@Nonnull private BuilderInstruction20t newBuilderInstruction20t(int codeAddress, int[] codeAddressToIndex, @Nonnull Instruction20t instruction) { return new BuilderInstruction20t( instruction.getOpcode(), newLabel(codeAddressToIndex, codeAddress + instruction.getCodeOffset())); }
@Nonnull private BuilderInstruction10x newBuilderInstruction10x(@Nonnull Instruction10x instruction) { return new BuilderInstruction10x( instruction.getOpcode()); }