use of com.android.dx.rop.code.LocalItem in project buck by facebook.
the class OutputFinisher method addConstants.
/**
* Helper for {@link #getAllConstants} which adds all the info for
* a single {@code RegisterSpec}.
*
* @param result {@code non-null;} result set to add to
* @param spec {@code null-ok;} register spec to add
*/
private static void addConstants(HashSet<Constant> result, RegisterSpec spec) {
if (spec == null) {
return;
}
LocalItem local = spec.getLocalItem();
CstString name = local.getName();
CstString signature = local.getSignature();
Type type = spec.getType();
if (type != Type.KNOWN_NULL) {
result.add(CstType.intern(type));
}
if (name != null) {
result.add(name);
}
if (signature != null) {
result.add(signature);
}
}
use of com.android.dx.rop.code.LocalItem in project buck by facebook.
the class SsaRenamer method setNameForSsaReg.
/**
* Records a debug (local variable) name for a specified register.
*
* @param ssaReg non-null named register spec in SSA name space
*/
private void setNameForSsaReg(RegisterSpec ssaReg) {
int reg = ssaReg.getReg();
LocalItem local = ssaReg.getLocalItem();
ssaRegToLocalItems.ensureCapacity(reg + 1);
while (ssaRegToLocalItems.size() <= reg) {
ssaRegToLocalItems.add(null);
}
ssaRegToLocalItems.set(reg, local);
}
use of com.android.dx.rop.code.LocalItem in project buck by facebook.
the class FirstFitLocalCombiningAllocator method adjustAndMapSourceRangeRange.
/**
* Maps the source registers of the specified instruction such that they
* will fall in a contiguous range in rop form. Moves are inserted as
* necessary to allow the range to be allocated.
*
* @param insn {@code non-null;} insn whos sources to process
*/
private void adjustAndMapSourceRangeRange(NormalSsaInsn insn) {
int newRegStart = findRangeAndAdjust(insn);
RegisterSpecList sources = insn.getSources();
int szSources = sources.size();
int nextRopReg = newRegStart;
for (int i = 0; i < szSources; i++) {
RegisterSpec source = sources.get(i);
int sourceReg = source.getReg();
int category = source.getCategory();
int curRopReg = nextRopReg;
nextRopReg += category;
if (ssaRegsMapped.get(sourceReg)) {
continue;
}
LocalItem localItem = getLocalItemForReg(sourceReg);
addMapping(source, curRopReg);
if (localItem != null) {
markReserved(curRopReg, category);
ArrayList<RegisterSpec> similarRegisters = localVariables.get(localItem);
int szSimilar = similarRegisters.size();
/*
* Try to map all SSA registers also associated with
* this local.
*/
for (int j = 0; j < szSimilar; j++) {
RegisterSpec similarSpec = similarRegisters.get(j);
int similarReg = similarSpec.getReg();
// Don't map anything that's also a source.
if (-1 != sources.indexOfRegister(similarReg)) {
continue;
}
// Registers left unmapped will get handled later.
tryMapReg(similarSpec, curRopReg, category);
}
}
}
}
use of com.android.dx.rop.code.LocalItem in project J2ME-Loader by nikita36078.
the class FirstFitLocalCombiningAllocator method printLocalVars.
/**
* Dumps local variable table to stdout for debugging.
*/
private void printLocalVars() {
System.out.println("Printing local vars");
for (Map.Entry<LocalItem, ArrayList<RegisterSpec>> e : localVariables.entrySet()) {
StringBuilder regs = new StringBuilder();
regs.append('{');
regs.append(' ');
for (RegisterSpec reg : e.getValue()) {
regs.append('v');
regs.append(reg.getReg());
regs.append(' ');
}
regs.append('}');
System.out.printf("Local: %s Registers: %s\n", e.getKey(), regs);
}
}
use of com.android.dx.rop.code.LocalItem in project J2ME-Loader by nikita36078.
the class SsaRenamer method setNameForSsaReg.
/**
* Records a debug (local variable) name for a specified register.
*
* @param ssaReg non-null named register spec in SSA name space
*/
private void setNameForSsaReg(RegisterSpec ssaReg) {
int reg = ssaReg.getReg();
LocalItem local = ssaReg.getLocalItem();
ssaRegToLocalItems.ensureCapacity(reg + 1);
while (ssaRegToLocalItems.size() <= reg) {
ssaRegToLocalItems.add(null);
}
ssaRegToLocalItems.set(reg, local);
}
Aggregations