[LLVMdev] simple Data Structure Analysis example

Zvonimir Rakamaric zrakamar at gmail.com
Thu Feb 28 12:10:13 PST 2008


Hi everybody,

I've been playing with the data structure analysis (poolalloc project,
llvm 2.2) on this simple example:
#include <stdlib.h>

void setArray(int *array) {
  array[0] = 5;
}

int main() {
  int *array = (int*)malloc(10 * sizeof(int));
  setArray(array);
  free(array);
  return 0;
}

What really confuses me are flags set for the node "array" in the
setArray and main functions. I read a couple of papers about the DSA,
but still can't figure this out. I am using the dsa-td pass.

So, the node "array" in function main has flags HME set. Why is flag E
(This node comes from an external source) set here? I don't see any
external sources in this simple program.

In function setArray, the node "array" has flags HIME set. Why is this
node Incomplete here (flag I)?

I would appreciate if somebody could clarify this. Thanks a lot!

Cheers,
-- Zvonimir



More information about the llvm-dev mailing list