[LLVMdev] using alias-analysis

RAAD B raad_7007 at yahoo.com
Sun Mar 15 06:06:02 PDT 2009


Hi together,

i want to create a map containing a set of aliases for each value.

For example, for a code like:

int main() {

    int i;
    int *p1 = &i;
    int *p2 = &i;
  
    return 0;
} 

the map should contain something like:

{i --> (p1, p2), 
.....
}

For that, i do followings in my pass:

AliasAnalysis &AA = getAnalysis<AliasAnalysis>();
AliasSetTracker *tracker = new AliasSetTracker(AA);

for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) {
    tracker->add(*BB);
}

using the print-method of AliasSetTracker, i see:

Alias Set Tracker: 4 alias sets for 4 pointer values.
  AliasSet[0x8528d08,1] must alias, Mod       Pointers: (i32** %p1, 4)
  AliasSet[0x8528d48,1] must alias, Mod       Pointers: (i32** %p2, 4)
  AliasSet[0x8522d18,1] must alias, Mod/Ref   Pointers: (i32* %0, 4)
  AliasSet[0x8522d58,1] must alias, Mod/Ref   Pointers: (i32* %retval, 4)

can i create this map using the info in AliasSetTracker?


Regards
Raad


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090315/f35f1f4e/attachment.html>


More information about the llvm-dev mailing list