本文整理汇总了Java中com.android.dx.rop.code.RegisterSpecList类的典型用法代码示例。如果您正苦于以下问题:Java RegisterSpecList类的具体用法?Java RegisterSpecList怎么用?Java RegisterSpecList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RegisterSpecList类属于com.android.dx.rop.code包,在下文中一共展示了RegisterSpecList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: replaceDef
import com.android.dx.rop.code.RegisterSpecList; //导入依赖的package包/类
/**
* Replaces the instructions that define an array with equivalent registers.
* For each entry in the array, a register is created, initialized to zero.
* A mapping between this register and the corresponding array index is
* added.
*
* @param def {@code non-null;} move result instruction for array
* @param prev {@code non-null;} instruction for instantiating new array
* @param length size of the new array
* @param newRegs {@code non-null;} mapping of array indices to new
* registers to be populated
*/
private void replaceDef(SsaInsn def, SsaInsn prev, int length,
ArrayList<RegisterSpec> newRegs) {
Type resultType = def.getResult().getType();
// Create new zeroed out registers for each element in the array
for (int i = 0; i < length; i++) {
Constant newZero = Zeroes.zeroFor(resultType.getComponentType());
TypedConstant typedZero = (TypedConstant) newZero;
RegisterSpec newReg =
RegisterSpec.make(ssaMeth.makeNewSsaReg(), typedZero);
newRegs.add(newReg);
insertPlainInsnBefore(def, RegisterSpecList.EMPTY, newReg,
RegOps.CONST, newZero);
}
}
开发者ID:AndreJCL,项目名称:JCL,代码行数:28,代码来源:EscapeAnalysis.java
示例2: isCompatible
import com.android.dx.rop.code.RegisterSpecList; //导入依赖的package包/类
/** {@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());
}
开发者ID:johnlee175,项目名称:dex,代码行数:23,代码来源:Form22b.java
示例3: regListString
import com.android.dx.rop.code.RegisterSpecList; //导入依赖的package包/类
/**
* Helper method to return a register list string.
*
* @param list {@code non-null;} the list of registers
* @return {@code non-null;} the string form
*/
protected static String regListString(RegisterSpecList list) {
int sz = list.size();
StringBuffer sb = new StringBuffer(sz * 5 + 2);
sb.append('{');
for (int i = 0; i < sz; i++) {
if (i != 0) {
sb.append(", ");
}
sb.append(list.get(i).regString());
}
sb.append('}');
return sb.toString();
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:24,代码来源:InsnFormat.java
示例4: compatibleRegs
import com.android.dx.rop.code.RegisterSpecList; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public BitSet compatibleRegs(DalvInsn insn) {
RegisterSpecList regs = insn.getRegisters();
int sz = regs.size();
BitSet bits = new BitSet(sz);
boolean compat = unsignedFitsInByte(regs.get(0).getReg());
if (sz == 1) {
bits.set(0, compat);
} else {
if (regs.get(0).getReg() == regs.get(1).getReg()) {
bits.set(0, compat);
bits.set(1, compat);
}
}
return bits;
}
开发者ID:AndreJCL,项目名称:JCL,代码行数:20,代码来源:Form21c.java
示例5: isCompatible
import com.android.dx.rop.code.RegisterSpecList; //导入依赖的package包/类
/** {@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());
}
开发者ID:johnlee175,项目名称:dex,代码行数:23,代码来源:Form11n.java
示例6: changeOneSource
import com.android.dx.rop.code.RegisterSpecList; //导入依赖的package包/类
/**
* Changes one of the insn's sources. New source should be of same type
* and category.
*
* @param index {@code >=0;} index of source to change
* @param newSpec spec for new source
*/
public final void changeOneSource(int index, RegisterSpec newSpec) {
RegisterSpecList origSources = insn.getSources();
int sz = origSources.size();
RegisterSpecList newSources = new RegisterSpecList(sz);
for (int i = 0; i < sz; i++) {
newSources.set(i, i == index ? newSpec : origSources.get(i));
}
newSources.setImmutable();
RegisterSpec origSpec = origSources.get(index);
if (origSpec.getReg() != newSpec.getReg()) {
/*
* If the register remains unchanged, we're only changing
* the type or local var name so don't update use list
*/
getBlock().getParent().onSourceChanged(this, origSpec, newSpec);
}
insn = insn.withNewRegisters(getResult(), newSources);
}
开发者ID:johnlee175,项目名称:dex,代码行数:30,代码来源:NormalSsaInsn.java
示例7: isCompatible
import com.android.dx.rop.code.RegisterSpecList; //导入依赖的package包/类
/** {@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;
int cpi = ci.getIndex();
if (! unsignedFitsInShort(cpi)) {
return false;
}
Constant cst = ci.getConstant();
return (cst instanceof CstType) ||
(cst instanceof CstFieldRef);
}
开发者ID:AndreJCL,项目名称:JCL,代码行数:23,代码来源:Form22c.java
示例8: getRegs
import com.android.dx.rop.code.RegisterSpecList; //导入依赖的package包/类
/**
* Gets the complete register list (result and sources) out of a
* given rop instruction. For insns that are commutative, have
* two register sources, and have a source equal to the result,
* place that source first.
*
* @param insn {@code non-null;} instruction in question
* @param resultReg {@code null-ok;} the real result to use (ignore the insn's)
* @return {@code non-null;} the instruction's complete register list
*/
private static RegisterSpecList getRegs(Insn insn,
RegisterSpec resultReg) {
RegisterSpecList regs = insn.getSources();
if (insn.getOpcode().isCommutative()
&& (regs.size() == 2)
&& (resultReg.getReg() == regs.get(1).getReg())) {
/*
* For commutative ops which have two register sources,
* if the second source is the same register as the result,
* swap the sources so that an opcode of form 12x can be selected
* instead of one of form 23x
*/
regs = RegisterSpecList.make(regs.get(1), regs.get(0));
}
if (resultReg == null) {
return regs;
}
return regs.withFirst(resultReg);
}
开发者ID:AndreJCL,项目名称:JCL,代码行数:35,代码来源:RopTranslator.java
示例9: compatibleRegs
import com.android.dx.rop.code.RegisterSpecList; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public BitSet compatibleRegs(DalvInsn insn) {
RegisterSpecList regs = insn.getRegisters();
int sz = regs.size();
BitSet bits = new BitSet(sz);
for (int i = 0; i < sz; i++) {
RegisterSpec reg = regs.get(i);
/*
* The check below adds (category - 1) to the register, to
* account for the fact that the second half of a
* category-2 register has to be represented explicitly in
* the result.
*/
bits.set(i, unsignedFitsInNibble(reg.getReg() +
reg.getCategory() - 1));
}
return bits;
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:22,代码来源:Form35c.java
示例10: makeMove
import com.android.dx.rop.code.RegisterSpecList; //导入依赖的package包/类
/**
* Makes a move instruction, appropriate and ideal for the given arguments.
*
* @param position {@code non-null;} source position information
* @param dest {@code non-null;} destination register
* @param src {@code non-null;} source register
* @return {@code non-null;} an appropriately-constructed instance
*/
public static SimpleInsn makeMove(SourcePosition position,
RegisterSpec dest, RegisterSpec src) {
boolean category1 = dest.getCategory() == 1;
boolean reference = dest.getType().isReference();
int destReg = dest.getReg();
int srcReg = src.getReg();
Dop opcode;
if ((srcReg | destReg) < 16) {
opcode = reference ? Dops.MOVE_OBJECT :
(category1 ? Dops.MOVE : Dops.MOVE_WIDE);
} else if (destReg < 256) {
opcode = reference ? Dops.MOVE_OBJECT_FROM16 :
(category1 ? Dops.MOVE_FROM16 : Dops.MOVE_WIDE_FROM16);
} else {
opcode = reference ? Dops.MOVE_OBJECT_16 :
(category1 ? Dops.MOVE_16 : Dops.MOVE_WIDE_16);
}
return new SimpleInsn(opcode, position,
RegisterSpecList.make(dest, src));
}
开发者ID:AndreJCL,项目名称:JCL,代码行数:31,代码来源:DalvInsn.java
示例11: listingString0
import com.android.dx.rop.code.RegisterSpecList; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected String listingString0(boolean noteIndices) {
RegisterSpecList registers = getRegisters();
int sz = registers.size();
StringBuffer sb = new StringBuffer(100);
for (int i = 0, outAt = 0; i < sz; i++) {
RegisterSpec src = registers.get(i);
SimpleInsn insn = moveInsnFor(src, outAt);
if (i != 0) {
sb.append('\n');
}
sb.append(insn.listingString0(noteIndices));
outAt += src.getCategory();
}
return sb.toString();
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:23,代码来源:HighRegisterPrefix.java
示例12: writeTo
import com.android.dx.rop.code.RegisterSpecList; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void writeTo(AnnotatedOutput out, DalvInsn insn) {
RegisterSpecList regs = insn.getRegisters();
int sz = regs.size();
/*
* The (sz - 2) and (sz - 1) below makes this code work for
* both the two- and three-register ops. (See "case 3" in
* isCompatible(), above.)
*/
write(out, opcodeUnit(insn,
makeByte(regs.get(sz - 2).getReg(),
regs.get(sz - 1).getReg())));
}
开发者ID:AndreJCL,项目名称:JCL,代码行数:17,代码来源:Form12x.java
示例13: isCompatible
import com.android.dx.rop.code.RegisterSpecList; //导入依赖的package包/类
/** {@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());
}
开发者ID:AndreJCL,项目名称:JCL,代码行数:23,代码来源:Form22s.java
示例14: DalvInsn
import com.android.dx.rop.code.RegisterSpecList; //导入依赖的package包/类
/**
* Constructs an instance. The output address of this instance is initially
* unknown ({@code -1}).
*
* <p><b>Note:</b> In the unlikely event that an instruction takes
* absolutely no registers (e.g., a {@code nop} or a
* no-argument no-result static method call), then the given
* register list may be passed as {@link
* RegisterSpecList#EMPTY}.</p>
*
* @param opcode the opcode; one of the constants from {@link Dops}
* @param position {@code non-null;} source position
* @param registers {@code non-null;} register list, including a
* result register if appropriate (that is, registers may be either
* ins and outs)
*/
public DalvInsn(Dop opcode, SourcePosition position,
RegisterSpecList registers) {
if (opcode == null) {
throw new NullPointerException("opcode == null");
}
if (position == null) {
throw new NullPointerException("position == null");
}
if (registers == null) {
throw new NullPointerException("registers == null");
}
this.address = -1;
this.opcode = opcode;
this.position = position;
this.registers = registers;
}
开发者ID:johnlee175,项目名称:dex,代码行数:36,代码来源:DalvInsn.java
示例15: insnArgString
import com.android.dx.rop.code.RegisterSpecList; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public String insnArgString(DalvInsn insn) {
RegisterSpecList regs = insn.getRegisters();
CstLiteralBits value = (CstLiteralBits) ((CstInsn) insn).getConstant();
return regs.get(0).regString() + ", " + literalBitsString(value);
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:9,代码来源:Form21h.java
示例16: insnArgString
import com.android.dx.rop.code.RegisterSpecList; //导入依赖的package包/类
/** {@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);
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:10,代码来源:Form22b.java
示例17: simulatePhi
import com.android.dx.rop.code.RegisterSpecList; //导入依赖的package包/类
/**
* Simulates a PHI node and set the lattice for the result
* to the appropriate value.
* Meet values:
* TOP x anything = TOP
* VARYING x anything = VARYING
* CONSTANT x CONSTANT = CONSTANT if equal constants, VARYING otherwise
* @param insn PHI to simulate.
*/
private void simulatePhi(PhiInsn insn) {
int phiResultReg = insn.getResult().getReg();
if (latticeValues[phiResultReg] == VARYING) {
return;
}
RegisterSpecList sources = insn.getSources();
int phiResultValue = TOP;
Constant phiConstant = null;
int sourceSize = sources.size();
for (int i = 0; i < sourceSize; i++) {
int predBlockIndex = insn.predBlockIndexForSourcesIndex(i);
int sourceReg = sources.get(i).getReg();
int sourceRegValue = latticeValues[sourceReg];
if (!executableBlocks.get(predBlockIndex)) {
continue;
}
if (sourceRegValue == CONSTANT) {
if (phiConstant == null) {
phiConstant = latticeConstants[sourceReg];
phiResultValue = CONSTANT;
} else if (!latticeConstants[sourceReg].equals(phiConstant)){
phiResultValue = VARYING;
break;
}
} else {
phiResultValue = sourceRegValue;
break;
}
}
if (setLatticeValueTo(phiResultReg, phiResultValue, phiConstant)) {
addUsersToWorklist(phiResultReg, phiResultValue);
}
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:48,代码来源:SCCP.java
示例18: insnArgString
import com.android.dx.rop.code.RegisterSpecList; //导入依赖的package包/类
/** {@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);
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:10,代码来源:Form22s.java
示例19: mapSourceRegisters
import com.android.dx.rop.code.RegisterSpecList; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public final void mapSourceRegisters(RegisterMapper mapper) {
RegisterSpecList oldSources = insn.getSources();
RegisterSpecList newSources = mapper.map(oldSources);
if (newSources != oldSources) {
insn = insn.withNewRegisters(getResult(), newSources);
getBlock().getParent().onSourcesChanged(this, oldSources);
}
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:12,代码来源:NormalSsaInsn.java
示例20: replaceBranches
import com.android.dx.rop.code.RegisterSpecList; //导入依赖的package包/类
/**
* Replaces branches that have constant conditions with gotos
*/
private void replaceBranches() {
for (SsaInsn insn : branchWorklist) {
// Find if a successor block is never executed
int oldSuccessor = -1;
SsaBasicBlock block = insn.getBlock();
int successorSize = block.getSuccessorList().size();
for (int i = 0; i < successorSize; i++) {
int successorBlock = block.getSuccessorList().get(i);
if (!executableBlocks.get(successorBlock)) {
oldSuccessor = successorBlock;
}
}
/*
* Prune branches that have already been handled and ones that no
* longer have constant conditions (no nonexecutable successors)
*/
if (successorSize != 2 || oldSuccessor == -1) continue;
// Replace branch with goto
Insn originalRopInsn = insn.getOriginalRopInsn();
block.replaceLastInsn(new PlainInsn(Rops.GOTO,
originalRopInsn.getPosition(), null, RegisterSpecList.EMPTY));
block.removeSuccessor(oldSuccessor);
}
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:30,代码来源:SCCP.java
注:本文中的com.android.dx.rop.code.RegisterSpecList类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论