use of com.taobao.android.dx.rop.code.RegisterSpecList in project atlas by alibaba.
the class Form51l 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();
return (cst instanceof CstLiteral64);
}
use of com.taobao.android.dx.rop.code.RegisterSpecList in project atlas by alibaba.
the class Form51l method compatibleRegs.
/** {@inheritDoc} */
@Override
public BitSet compatibleRegs(DalvInsn insn) {
RegisterSpecList regs = insn.getRegisters();
BitSet bits = new BitSet(1);
bits.set(0, unsignedFitsInByte(regs.get(0).getReg()));
return bits;
}
use of com.taobao.android.dx.rop.code.RegisterSpecList in project atlas by alibaba.
the class OutputFinisher method align64bits.
private void align64bits(Dop[] opcodes) {
while (true) {
int notAligned64bitRegAccess = 0;
int aligned64bitRegAccess = 0;
int notAligned64bitParamAccess = 0;
int aligned64bitParamAccess = 0;
int lastParameter = unreservedRegCount + reservedCount + reservedParameterCount;
int firstParameter = lastParameter - paramSize;
// Collects the number of time that 64-bit registers are accessed aligned or not.
for (DalvInsn insn : insns) {
RegisterSpecList regs = insn.getRegisters();
for (int usedRegIdx = 0; usedRegIdx < regs.size(); usedRegIdx++) {
RegisterSpec reg = regs.get(usedRegIdx);
if (reg.isCategory2()) {
boolean isParameter = reg.getReg() >= firstParameter;
if (reg.isEvenRegister()) {
if (isParameter) {
aligned64bitParamAccess++;
} else {
aligned64bitRegAccess++;
}
} else {
if (isParameter) {
notAligned64bitParamAccess++;
} else {
notAligned64bitRegAccess++;
}
}
}
}
}
if (notAligned64bitParamAccess > aligned64bitParamAccess && notAligned64bitRegAccess > aligned64bitRegAccess) {
addReservedRegisters(1);
} else if (notAligned64bitParamAccess > aligned64bitParamAccess) {
addReservedParameters(1);
} else if (notAligned64bitRegAccess > aligned64bitRegAccess) {
addReservedRegisters(1);
// so the number of aligned become the number of unaligned.
if (paramSize != 0 && aligned64bitParamAccess > notAligned64bitParamAccess) {
addReservedParameters(1);
}
} else {
break;
}
if (!reserveRegisters(opcodes)) {
break;
}
}
}
use of com.taobao.android.dx.rop.code.RegisterSpecList in project atlas by alibaba.
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.taobao.android.dx.rop.code.RegisterSpecList in project atlas by alibaba.
the class Form11n method writeTo.
/** {@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)));
}
Aggregations