[cfe-dev] Question on LiveVariables analysis
Guoping Long
longguoping at gmail.com
Fri Oct 7 21:32:56 PDT 2011
Hi,
While LiveVariables analysis (tools/clang/lib/Analysis/LiveVariables.cpp)
does not generate any output? Specifically, for this simple program:
1 int main(int argc, char *argv[])
2 {
3 int a,b,c,d,x;
4
5 a = 3; //Basic block B1
6 b = 5;
7 d = 4;
8 x = 100;
9
10 if(a>b){ //Basic block B2
11 c = a+b;
12 d = 2;
13 }
14
15 c = 4; //Basic block B3
16 return b * d + c;
17 }
This simple example is taken from this wiki page illustrating live variables
analysis (http://en.wikipedia.org/wiki/Live_variable_analysis).
Both B2 and B3 should have live variables, but the output (using
LiveVariables::dumpBlockLiveness(SourceManager &)) says no live variables
exist. I am trying to use this analysis as an example on how to write a good
analysis algorithm for Clang, but really did not expect this behavior for
this analysis.
Anybody who knows the answer please let me know. Many thanks!!!
--------
Guoping
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111007/80621982/attachment.html>
More information about the cfe-dev
mailing list