public interface SSAIndirectionData<T extends SSAIndirectionData.Name>
SSALoadIndirectInstruction
takes as an argument a pointer value. This map tells which locals that pointer
may alias.
So if we have
Example A:
v2 = SSAAddressOf v1;
v7 = #1;
v3 = SSALoadIndirect v2; (1)
<\tt>
Then this map will tell us that instruction (1) indirectly uses whichever source-level entity (in the source or bytecode) v1 represents.
(Don't be confused by AddressOf v1 .. we're not actually taking the address of v1 ... we're taking the address of some source level entity (like a local variable in source code or bytecode) for which v1 is just an SSA name)
As a more complex example, when we have lexical scoping, we can have the following IR generated, which passes a local by reference:
Example B:
foo:
v3 = AddressOf v2;
bar(v3) (1)
bar(v1):
StoreIndirect v1, #7.
In this case, the instruction (1) potentially defs the locals aliased by v2. The lexical scoping support could/should use this
information to rebuild SSA accounting for the fact that (1) defs v2.Modifier and Type | Interface and Description |
---|---|
static interface |
SSAIndirectionData.Name
A Name is a mock interface introduced just for strong typing.
|
Modifier and Type | Method and Description |
---|---|
int |
getDef(int instructionIndex,
T name)
For the instruction at the given index, and a source-level name, return the SSA value number which represents this
instruction's def of that name.
|
Collection<T> |
getNames()
Returns the set of "source" level names (e.g.
|
int |
getUse(int instructionIndex,
T name)
For the instruction at the given index, and a source-level name, return the SSA value number which represents this
instruction's use of that name.
|
void |
setDef(int instructionIndex,
T name,
int newDef)
Record the fact that a particular instruction defs a particular SSA value number (newDef), representing the value of a "source" entity
"name".
|
void |
setUse(int instructionIndex,
T name,
int newUse) |
Collection<T> getNames()
int getDef(int instructionIndex, T name)
void setDef(int instructionIndex, T name, int newDef)
getDef(int, T)
int getUse(int instructionIndex, T name)
void setUse(int instructionIndex, T name, int newUse)
getUse(int, T)