com.android.dx.rop.cst.CstLiteralBits Java Examples
The following examples show how to use
com.android.dx.rop.cst.CstLiteralBits.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Form22s.java From Box with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override public boolean isCompatible(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); if (!((insn instanceof CstInsn) && (regs.size() == 2) && unsignedFitsInNibble(regs.get(0).getReg()) && unsignedFitsInNibble(regs.get(1).getReg()))) { return false; } CstInsn ci = (CstInsn) insn; Constant cst = ci.getConstant(); if (!(cst instanceof CstLiteralBits)) { return false; } CstLiteralBits cb = (CstLiteralBits) cst; return cb.fitsInInt() && signedFitsInShort(cb.getIntBits()); }
Example #2
Source File: Form21s.java From buck with Apache License 2.0 | 6 votes |
/** {@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; } CstLiteralBits cb = (CstLiteralBits) cst; return cb.fitsInInt() && signedFitsInShort(cb.getIntBits()); }
Example #3
Source File: Form21h.java From Box with Apache License 2.0 | 6 votes |
/** {@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); }
Example #4
Source File: Form31i.java From Box with Apache License 2.0 | 6 votes |
/** {@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(); }
Example #5
Source File: InsnFormat.java From buck with Apache License 2.0 | 6 votes |
/** * 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(); }
Example #6
Source File: Form22s.java From Box with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override public boolean isCompatible(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); if (!((insn instanceof CstInsn) && (regs.size() == 2) && unsignedFitsInNibble(regs.get(0).getReg()) && unsignedFitsInNibble(regs.get(1).getReg()))) { return false; } CstInsn ci = (CstInsn) insn; Constant cst = ci.getConstant(); if (!(cst instanceof CstLiteralBits)) { return false; } CstLiteralBits cb = (CstLiteralBits) cst; return cb.fitsInInt() && signedFitsInShort(cb.getIntBits()); }
Example #7
Source File: Form21h.java From buck with Apache License 2.0 | 6 votes |
/** {@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); }
Example #8
Source File: Form31i.java From J2ME-Loader with Apache License 2.0 | 6 votes |
/** {@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(); }
Example #9
Source File: Form31i.java From buck with Apache License 2.0 | 6 votes |
/** {@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(); }
Example #10
Source File: Form22b.java From J2ME-Loader with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override public boolean isCompatible(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); if (!((insn instanceof CstInsn) && (regs.size() == 2) && unsignedFitsInByte(regs.get(0).getReg()) && unsignedFitsInByte(regs.get(1).getReg()))) { return false; } CstInsn ci = (CstInsn) insn; Constant cst = ci.getConstant(); if (!(cst instanceof CstLiteralBits)) { return false; } CstLiteralBits cb = (CstLiteralBits) cst; return cb.fitsInInt() && signedFitsInByte(cb.getIntBits()); }
Example #11
Source File: Form21h.java From J2ME-Loader with Apache License 2.0 | 6 votes |
/** {@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); }
Example #12
Source File: Form21s.java From J2ME-Loader with Apache License 2.0 | 6 votes |
/** {@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; } CstLiteralBits cb = (CstLiteralBits) cst; return cb.fitsInInt() && signedFitsInShort(cb.getIntBits()); }
Example #13
Source File: Form22b.java From Box with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override public boolean isCompatible(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); if (!((insn instanceof CstInsn) && (regs.size() == 2) && unsignedFitsInByte(regs.get(0).getReg()) && unsignedFitsInByte(regs.get(1).getReg()))) { return false; } CstInsn ci = (CstInsn) insn; Constant cst = ci.getConstant(); if (!(cst instanceof CstLiteralBits)) { return false; } CstLiteralBits cb = (CstLiteralBits) cst; return cb.fitsInInt() && signedFitsInByte(cb.getIntBits()); }
Example #14
Source File: Form11n.java From buck with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override public boolean isCompatible(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); if (!((insn instanceof CstInsn) && (regs.size() == 1) && unsignedFitsInNibble(regs.get(0).getReg()))) { return false; } CstInsn ci = (CstInsn) insn; Constant cst = ci.getConstant(); if (!(cst instanceof CstLiteralBits)) { return false; } CstLiteralBits cb = (CstLiteralBits) cst; return cb.fitsInInt() && signedFitsInNibble(cb.getIntBits()); }
Example #15
Source File: Form21s.java From Box with Apache License 2.0 | 6 votes |
/** {@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; } CstLiteralBits cb = (CstLiteralBits) cst; return cb.fitsInInt() && signedFitsInShort(cb.getIntBits()); }
Example #16
Source File: Form22b.java From buck with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override public boolean isCompatible(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); if (!((insn instanceof CstInsn) && (regs.size() == 2) && unsignedFitsInByte(regs.get(0).getReg()) && unsignedFitsInByte(regs.get(1).getReg()))) { return false; } CstInsn ci = (CstInsn) insn; Constant cst = ci.getConstant(); if (!(cst instanceof CstLiteralBits)) { return false; } CstLiteralBits cb = (CstLiteralBits) cst; return cb.fitsInInt() && signedFitsInByte(cb.getIntBits()); }
Example #17
Source File: Form11n.java From Box with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override public boolean isCompatible(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); if (!((insn instanceof CstInsn) && (regs.size() == 1) && unsignedFitsInNibble(regs.get(0).getReg()))) { return false; } CstInsn ci = (CstInsn) insn; Constant cst = ci.getConstant(); if (!(cst instanceof CstLiteralBits)) { return false; } CstLiteralBits cb = (CstLiteralBits) cst; return cb.fitsInInt() && signedFitsInNibble(cb.getIntBits()); }
Example #18
Source File: InsnFormat.java From Box with Apache License 2.0 | 6 votes |
/** * 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) { StringBuilder sb = new StringBuilder(100); sb.append('#'); if (value instanceof CstKnownNull) { sb.append("null"); } else { sb.append(value.typeName()); sb.append(' '); sb.append(value.toHuman()); } return sb.toString(); }
Example #19
Source File: Form11n.java From J2ME-Loader with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override public boolean isCompatible(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); if (!((insn instanceof CstInsn) && (regs.size() == 1) && unsignedFitsInNibble(regs.get(0).getReg()))) { return false; } CstInsn ci = (CstInsn) insn; Constant cst = ci.getConstant(); if (!(cst instanceof CstLiteralBits)) { return false; } CstLiteralBits cb = (CstLiteralBits) cst; return cb.fitsInInt() && signedFitsInNibble(cb.getIntBits()); }
Example #20
Source File: Form21s.java From Box with Apache License 2.0 | 6 votes |
/** {@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; } CstLiteralBits cb = (CstLiteralBits) cst; return cb.fitsInInt() && signedFitsInShort(cb.getIntBits()); }
Example #21
Source File: Form51l.java From J2ME-Loader with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override public String insnArgString(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); CstLiteralBits value = (CstLiteralBits) ((CstInsn) insn).getConstant(); return regs.get(0).regString() + ", " + literalBitsString(value); }
Example #22
Source File: Form21s.java From buck with Apache License 2.0 | 5 votes |
/** {@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); }
Example #23
Source File: Form21s.java From Box with Apache License 2.0 | 5 votes |
/** {@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); }
Example #24
Source File: Form22b.java From buck with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override public String insnArgString(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); CstLiteralBits value = (CstLiteralBits) ((CstInsn) insn).getConstant(); return regs.get(0).regString() + ", " + regs.get(1).regString() + ", " + literalBitsString(value); }
Example #25
Source File: LiteralOpUpgrader.java From buck with Apache License 2.0 | 5 votes |
/** * 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; }
Example #26
Source File: Form22b.java From buck with Apache License 2.0 | 5 votes |
/** {@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()), codeUnit(regs.get(1).getReg(), value & 0xff)); }
Example #27
Source File: InsnFormat.java From buck with Apache License 2.0 | 5 votes |
/** * Helper method to return a literal bits comment string. * * @param value the value * @param width the width of the constant, in bits (used for displaying * the uninterpreted bits; one of: {@code 4 8 16 32 64} * @return {@code non-null;} the comment */ protected static String literalBitsComment(CstLiteralBits value, int width) { StringBuffer sb = new StringBuffer(20); sb.append("#"); long bits; if (value instanceof CstLiteral64) { bits = ((CstLiteral64) value).getLongBits(); } else { bits = value.getIntBits(); } switch (width) { case 4: sb.append(Hex.uNibble((int) bits)); break; case 8: sb.append(Hex.u1((int) bits)); break; case 16: sb.append(Hex.u2((int) bits)); break; case 32: sb.append(Hex.u4((int) bits)); break; case 64: sb.append(Hex.u8(bits)); break; default: { throw new RuntimeException("shouldn't happen"); } } return sb.toString(); }
Example #28
Source File: Form21s.java From Box with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override public String insnArgString(DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); CstLiteralBits value = (CstLiteralBits) ((CstInsn) insn).getConstant(); return regs.get(0).regString() + ", " + literalBitsString(value); }
Example #29
Source File: Form22s.java From Box with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override public void writeTo(AnnotatedOutput out, DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); int value = ((CstLiteralBits) ((CstInsn) insn).getConstant()).getIntBits(); write(out, opcodeUnit(insn, makeByte(regs.get(0).getReg(), regs.get(1).getReg())), (short) value); }
Example #30
Source File: Form11n.java From J2ME-Loader with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override public void writeTo(AnnotatedOutput out, DalvInsn insn) { RegisterSpecList regs = insn.getRegisters(); int value = ((CstLiteralBits) ((CstInsn) insn).getConstant()).getIntBits(); write(out, opcodeUnit(insn, makeByte(regs.get(0).getReg(), value & 0xf))); }