Methods Summary |
---|
public void | addAssignment(Insn insn, RegisterSpec spec)Adds an assignment association for the given instruction and
register spec. This throws an exception if the instruction
doesn't actually perform a named variable assignment.
Note: Although the instruction contains its own spec for
the result, it still needs to be passed in explicitly to this
method, since the spec that is stored here should always have a
simple type and the one in the instruction can be an arbitrary
{@link TypeBearer} (such as a constant value).
throwIfImmutable();
if (insn == null) {
throw new NullPointerException("insn == null");
}
if (spec == null) {
throw new NullPointerException("spec == null");
}
insnAssignments.put(insn, spec);
|
public void | debugDump()
for (int label = 0 ; label < blockStarts.length; label++) {
if (blockStarts[label] == null) {
continue;
}
if (blockStarts[label] == emptySet) {
System.out.printf("%04x: empty set\n", label);
} else {
System.out.printf("%04x: %s\n", label, blockStarts[label]);
}
}
|
public RegisterSpec | getAssignment(Insn insn)Gets the named register being assigned by the given instruction, if
previously stored in this instance.
return insnAssignments.get(insn);
|
public int | getAssignmentCount()Gets the number of assignments recorded by this instance.
return insnAssignments.size();
|
public RegisterSpecSet | getStarts(int label)Gets the register set associated with the start of the block
with the given label. This returns an empty set with the appropriate
max size if no set was associated with the block in question.
RegisterSpecSet result = getStarts0(label);
return (result != null) ? result : emptySet;
|
public RegisterSpecSet | getStarts(BasicBlock block)Gets the register set associated with the start of the given
block. This is just convenient shorthand for
{@code getStarts(block.getLabel())}.
return getStarts(block.getLabel());
|
private RegisterSpecSet | getStarts0(int label)Helper method, to get the starts for a label, throwing the
right exception for range problems.
try {
return blockStarts[label];
} catch (ArrayIndexOutOfBoundsException ex) {
// Translate the exception.
throw new IllegalArgumentException("bogus label");
}
|
public boolean | mergeStarts(int label, RegisterSpecSet specs)Merges the given register set into the set for the block with the
given label. If there was not already an associated set, then this
is the same as calling {@link #setStarts}. Otherwise, this will
merge the two sets and call {@link #setStarts} on the result of the
merge.
RegisterSpecSet start = getStarts0(label);
boolean changed = false;
if (start == null) {
setStarts(label, specs);
return true;
}
RegisterSpecSet newStart = start.mutableCopy();
newStart.intersect(specs, true);
if (start.equals(newStart)) {
return false;
}
newStart.setImmutable();
setStarts(label, newStart);
return true;
|
public RegisterSpecSet | mutableCopyOfStarts(int label)Gets a mutable copy of the register set associated with the
start of the block with the given label. This returns a
newly-allocated empty {@link RegisterSpecSet} of appropriate
max size if there is not yet any set associated with the block.
RegisterSpecSet result = getStarts0(label);
return (result != null) ?
result.mutableCopy() : new RegisterSpecSet(regCount);
|
public void | setStarts(int label, RegisterSpecSet specs)Sets the register set associated with the start of the block with
the given label.
throwIfImmutable();
if (specs == null) {
throw new NullPointerException("specs == null");
}
try {
blockStarts[label] = specs;
} catch (ArrayIndexOutOfBoundsException ex) {
// Translate the exception.
throw new IllegalArgumentException("bogus label");
}
|