/** * Returns true if this value can fit in 16 bits with sign-extension. * * @return true if the sign-extended lower 16 bits are the same as * the value. */ public boolean fitsIn16Bits() { if (! fitsInInt()) { return false; } int bits = getIntBits(); return (short) bits == bits; }
/** * Returns true if the register contains an integer 0 or a known-null * object reference * * @param spec non-null spec * @return true for 0 or null type bearers */ private static boolean isConstIntZeroOrKnownNull(RegisterSpec spec) { TypeBearer tb = spec.getTypeBearer(); if (tb instanceof CstLiteralBits) { CstLiteralBits clb = (CstLiteralBits) tb; return (clb.getLongBits() == 0); } return false; }
/** * Helper method to return a literal bits argument string. * * @param value the value * @return {@code non-null;} the string form */ protected static String literalBitsString(CstLiteralBits value) { StringBuffer sb = new StringBuffer(100); sb.append('#'); if (value instanceof CstKnownNull) { sb.append("null"); } else { sb.append(value.typeName()); sb.append(' '); sb.append(value.toHuman()); } return sb.toString(); }
/** {@inheritDoc} */ @Override public void writeTo(AnnotatedOutput out, DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); CstLiteralBits cb = (CstLiteralBits) ((CstInsn) insn).getConstant(); short bits; // Where the high bits are depends on the category of the target. if (regs.get(0).getCategory() == 1) { bits = (short) (cb.getIntBits() >>> 16); } else { bits = (short) (cb.getLongBits() >>> 48); } write(out, opcodeUnit(insn, regs.get(0).getReg()), bits); } }
/** {@inheritDoc} */ @Override public void writeTo(AnnotatedOutput out, DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); int value = ((CstLiteralBits) ((CstInsn) insn).getConstant()).getIntBits(); write(out, opcodeUnit(insn, regs.get(0).getReg()), (short) value); } }
/** {@inheritDoc} */ @Override public boolean isCompatible(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); if (!((insn instanceof CstInsn) && (regs.size() == 1) && unsignedFitsInByte(regs.get(0).getReg()))) { return false; } CstInsn ci = (CstInsn) insn; Constant cst = ci.getConstant(); if (!(cst instanceof CstLiteralBits)) { return false; } return ((CstLiteralBits) cst).fitsInInt(); }
/** {@inheritDoc} */ @Override public void writeTo(AnnotatedOutput out, DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); CstLiteralBits cb = (CstLiteralBits) ((CstInsn) insn).getConstant(); short bits; // Where the high bits are depends on the category of the target. if (regs.get(0).getCategory() == 1) { bits = (short) (cb.getIntBits() >>> 16); } else { bits = (short) (cb.getLongBits() >>> 48); } write(out, opcodeUnit(insn, regs.get(0).getReg()), bits); } }
/** {@inheritDoc} */ @Override public void writeTo(AnnotatedOutput out, DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); int value = ((CstLiteralBits) ((CstInsn) insn).getConstant()).getIntBits(); write(out, opcodeUnit(insn, regs.get(0).getReg()), value); } }
/** {@inheritDoc} */ @Override public boolean isCompatible(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); if (!((insn instanceof CstInsn) && (regs.size() == 1) && unsignedFitsInByte(regs.get(0).getReg()))) { return false; } CstInsn ci = (CstInsn) insn; Constant cst = ci.getConstant(); if (!(cst instanceof CstLiteralBits)) { return false; } return ((CstLiteralBits) cst).fitsInInt(); }
/** * Returns true if this value can fit in 16 bits with sign-extension. * * @return true if the sign-extended lower 16 bits are the same as * the value. */ public boolean fitsIn16Bits() { if (! fitsInInt()) { return false; } int bits = getIntBits(); return (short) bits == bits; }
/** {@inheritDoc} */ @Override public void writeTo(AnnotatedOutput out, DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); CstLiteralBits cb = (CstLiteralBits) ((CstInsn) insn).getConstant(); short bits; // Where the high bits are depends on the category of the target. if (regs.get(0).getCategory() == 1) { bits = (short) (cb.getIntBits() >>> 16); } else { bits = (short) (cb.getLongBits() >>> 48); } write(out, opcodeUnit(insn, regs.get(0).getReg()), bits); } }
/** * Helper method to return a literal bits argument string. * * @param value the value * @return {@code non-null;} the string form */ protected static String literalBitsString(CstLiteralBits value) { StringBuffer sb = new StringBuffer(100); sb.append('#'); if (value instanceof CstKnownNull) { sb.append("null"); } else { sb.append(value.typeName()); sb.append(' '); sb.append(value.toHuman()); } return sb.toString(); }
/** {@inheritDoc} */ @Override public void writeTo(AnnotatedOutput out, DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); int value = ((CstLiteralBits) ((CstInsn) insn).getConstant()).getIntBits(); write(out, opcodeUnit(insn, regs.get(0).getReg()), (short) value); } }
/** * Returns true if the register contains an integer 0 or a known-null * object reference * * @param spec non-null spec * @return true for 0 or null type bearers */ private static boolean isConstIntZeroOrKnownNull(RegisterSpec spec) { TypeBearer tb = spec.getTypeBearer(); if (tb instanceof CstLiteralBits) { CstLiteralBits clb = (CstLiteralBits) tb; return (clb.getLongBits() == 0); } return false; }
/** {@inheritDoc} */ @Override public boolean isCompatible(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); if (!((insn instanceof CstInsn) && (regs.size() == 1) && unsignedFitsInByte(regs.get(0).getReg()))) { return false; } CstInsn ci = (CstInsn) insn; Constant cst = ci.getConstant(); if (!(cst instanceof CstLiteralBits)) { return false; } return ((CstLiteralBits) cst).fitsInInt(); }
/** * Returns true if this value can fit in 16 bits with sign-extension. * * @return true if the sign-extended lower 16 bits are the same as * the value. */ public boolean fitsIn16Bits() { if (! fitsInInt()) { return false; } int bits = getIntBits(); return (short) bits == bits; }
/** {@inheritDoc} */ @Override public void writeTo(AnnotatedOutput out, DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); CstLiteralBits cb = (CstLiteralBits) ((CstInsn) insn).getConstant(); short bits; // Where the high bits are depends on the category of the target. if (regs.get(0).getCategory() == 1) { bits = (short) (cb.getIntBits() >>> 16); } else { bits = (short) (cb.getLongBits() >>> 48); } write(out, opcodeUnit(insn, regs.get(0).getReg()), bits); } }
/** * Helper method to return a literal bits argument string. * * @param value the value * @return {@code non-null;} the string form */ protected static String literalBitsString(CstLiteralBits value) { StringBuffer sb = new StringBuffer(100); sb.append('#'); if (value instanceof CstKnownNull) { sb.append("null"); } else { sb.append(value.typeName()); sb.append(' '); sb.append(value.toHuman()); } return sb.toString(); }
/** {@inheritDoc} */ @Override public void writeTo(AnnotatedOutput out, DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); int value = ((CstLiteralBits) ((CstInsn) insn).getConstant()).getIntBits(); write(out, opcodeUnit(insn, regs.get(0).getReg()), value); } }
/** * Returns true if the register contains an integer 0 or a known-null * object reference * * @param spec non-null spec * @return true for 0 or null type bearers */ private static boolean isConstIntZeroOrKnownNull(RegisterSpec spec) { TypeBearer tb = spec.getTypeBearer(); if (tb instanceof CstLiteralBits) { CstLiteralBits clb = (CstLiteralBits) tb; return (clb.getLongBits() == 0); } return false; }