public class ArrayParameterAnalysis extends AnalysisPass
void func1(double b[][8][8]) {} // or double (*b)[8][8]
void func2(double b[][8]) {} // or double (*b)[8]
void func3(double b[]) {} // or double *b
int main() {
double a[8][8][8];
func1(a); // or func1(&a[0]);
func2(a[0]); // or func2(&a[0][0]);
func3(a[0][0]); // or func3(&a[0][0][0]);
return 0;
}
Result:
func1(a) = { b=>a }
func2(a[0]) = { b=>a[0] }
func3(a[0][0]) = { b=>a[0][0] }
In inliner this information is useful when expressing the array access
through "b" in terms of "a", keeping the transformed code as easy-to-read as
possible. In alias analysis, together with points-to information, the result
of this analysis can compute more precise alias-free relationship between
two formal parameters if they are equivalent to different portion of one
array in the callers.| Modifier and Type | Class and Description |
|---|---|
static class |
ArrayParameterAnalysis.Option
Available safety options
|
| Constructor and Description |
|---|
ArrayParameterAnalysis(Program prog,
ArrayParameterAnalysis.Option... opts)
Constructs a new analyzer with the given program.
|
| Modifier and Type | Method and Description |
|---|---|
Expression |
getCompatibleArgument(FunctionCall fcall,
Symbol param)
Returns caller's expression that is equivalent to the given parameter.
|
java.lang.String |
getPassName()
Returns the pass name.
|
static void |
invalidate()
Invalidates the analysis result.
|
boolean |
isDisjoint(Symbol symbol1,
Symbol symbol2,
Procedure procedure)
Checks if the two symbols are alias-free between themselves.
|
void |
start()
Starts the analysis; it visits each callee and performs the analysis.
|
runpublic ArrayParameterAnalysis(Program prog, ArrayParameterAnalysis.Option... opts)
prog - the input program.public static void invalidate()
public java.lang.String getPassName()
getPassName in class AnalysisPasspublic void start()
start in class AnalysisPasspublic boolean isDisjoint(Symbol symbol1, Symbol symbol2, Procedure procedure)
public Expression getCompatibleArgument(FunctionCall fcall, Symbol param)
fcall - the function call of interest.param - the formal parameter of interest.