Hi I request you to help me understand the solution to my problem. Am I misunderstanding the data structures or is there something wrong with my examples?
Thanks and Regards Rohit On Thu, Jul 9, 2015 at 5:59 PM, rohit bhatia <rohit2...@gmail.com> wrote: > Hi > > I am implementing a GCC Pass as IPA_Pass before the pass > "whole-program". I am using LTO to run my pass once during linking > phase. > > I am having trouble interpreting the results of the def-use chains for > SSA Variables. I am traversing the def use chains backwards to access > the variables that affect the current one's values. > This is my sample code > > struct dpndntStmt * getDpndStmt(tree ssaName){ > gimple stmt = SSA_NAME_DEF_STMT(ssaName); > ... > use_optype_p ptr; > for (ptr = gimple_use_ops (stmt); ptr; ptr = ptr->next){ > list->push_back( getDpndStmt( *(ptr->use_ptr.use) ) ); > } > ... > } > > Essentially, I am accessing the variables that are used in the current > statement, and look for uses in their definition statements (creating > a data dependence tree). > > This works perfectly in some examples, but it gives unexplainable > results in other cases (squid, postgres). One of the examples are > given below > > OUTPUT > " Stmt: _23 = SkipBuildPrefix ("HttpHeader.cc"); > Defines > _23 > Uses > Stmt: _20 = getDebugOut (); > Defines > .MEM_59 > Uses > Stmt: sectionLevel = sectionLevel.220_17; > " > > > IR > " <bb 5>: > sectionLevel = sectionLevel.220_17; > _20 = getDebugOut (); > # DEBUG _dbo => _20 > level.219_21 = level; > if (level.219_21 > 1) > goto <bb 6>; > else > goto <bb 10>; > > <bb 6>: > _23 = SkipBuildPrefix ("HttpHeader.cc"); > # DEBUG __out => _20 > # DEBUG __s => _23 > if (_23 == 0B) > goto <bb 7>; > else > goto <bb 8>; > " > > What the def use chains say is that the statement "_23 = > SkipBuildPrefix ("HttpHeader.cc");" defines _23 (correct) but uses _20 > variable (incorrect?). Going forward with the statement "_20 = > getDebugOut ();", we see more issues in the Output above. > > > I was hoping you could enlighten me if I am misinterpreting the data > structures. I will be thankful for your help. > > > Thanks and Regards > Rohit Bhatia