[Rose-public] Pointer Analysis in Rose
qingyi at cs.utsa.edu
Wed Sep 1 10:34:31 PDT 2010
On 9/1/10 11:49 AM, Fredrik Kjolstad wrote:
> Hi all,
> I am trying to use Rose as the analysis backend for a refactoring
> engine and for one of the refactorings I am implementing I need
> whole-program pointer analysis. Rose has an implementation of
> steensgard's algorithm and I have some questions regarding how to use
> I looked at the file steensgaardTest2.C to figure out how to invoke
> this analysis and I am a bit perplexed:
> 1. The file SteensgaardPtrAnal.h that is included by the test is not
> present in the include directory of my installed version of Rose.
> Does this mean that the Steensgaard implementation is not a part of
> the shipped compiler, or does it mean that I have to retrieve an
> instance of it through some factory method whose static return type is
I believe it is in the shipped compiler. And you're using the correct
file to figure out how to use it. It should be in the installed include
directory --- if it is not, it's probably something that needs to be
fixed. But you can copy the include file from
ROSE/src/midend/programAnalysis/pointerAnal/ as a temporary fix
> 2. How do I initialize the alias analysis for a given SgProject? Is
> this done through the overloaded ()?
The steensgaardTest2.C file shows how to set up everything to invoke the
analysis. Right now you need to go over each function definition and
invoke the analysis explicitly, as illustrated by the main function in
> 3. Say I want to query whether two pointer variables alias and I have
> SGNodes to their declarations. How do I get the AstNodePtr needed to
> invoke the may_alias(AstInterface&, const AstNodePtr&, const
> AstNodePtr&) function? Or maybe I should rather invoke the version of
> may_alias that takes two strings (varnames)?
To convert a SgNode* x to AstNodePtr, wrap it inside an AstNodePtrImpl
object, i.e., do AstNodePtrImpl(x), as illustrated inside the ()
operator of TestPtrAnal in steensgaardTest2.C.
> 4. How do I query whether two parameters alias?
The PtrAnal class has the following interface method
may_alias(AstInterface& fa, const AstNodePtr& r1, const AstNodePtr&
It is implemented in SteensgaardPtrAnal class, which inherit PtrAnal
class. To build AstInterface and AstNodePtr,
you simply need to wrap SgNode* with some wrapper classes, illustrated
> I have looked around for documentation on how to use the aliasing
> interfaces, but have been unable to find any. If there is some that I
> don't know about, then I'd be happy to figure out the answers to these
> questions myself.
> Fredrik Berg Kjolstad
> University of Illinois, Urbana-Champaign
> rose-public mailing list
> rose-public at nersc.gov
More information about the rose-public