use of com.android.dx.rop.cst.CstLiteralBits in project buck by facebook.
the class Form22s method insnArgString.
/** {@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);
}
use of com.android.dx.rop.cst.CstLiteralBits in project buck by facebook.
the class Form31i method isCompatible.
/** {@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();
}
use of com.android.dx.rop.cst.CstLiteralBits in project J2ME-Loader by nikita36078.
the class Form11n method isCompatible.
/**
* {@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());
}
use of com.android.dx.rop.cst.CstLiteralBits in project J2ME-Loader by nikita36078.
the class Form21h method isCompatible.
/**
* {@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;
// Where the high bits are depends on the category of the target.
if (regs.get(0).getCategory() == 1) {
int bits = cb.getIntBits();
return ((bits & 0xffff) == 0);
} else {
long bits = cb.getLongBits();
return ((bits & 0xffffffffffffL) == 0);
}
}
use of com.android.dx.rop.cst.CstLiteralBits in project J2ME-Loader by nikita36078.
the class Form21h method writeTo.
/**
* {@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);
}
Aggregations