> I tried to used the getScalarMap function of the DSGraph to get the nodes > that the scalars point to in a function. But the getScalarMap returns a > null map always. Is there any problem in the getScalarMap function or is > there any "protocol" to be followed while using the function?DSGraph::getScalarMap returns a reference to the map, so this cannot be null. Do you mean that all of the "entries" in the map are null? If so, remember that DSGraphs are built in the context of some function (as indicated by hasFunction/getFunction), so only scalars in that context will be in the map... -Chris -- http://llvm.cs.uiuc.edu/ http://www.nondot.org/~sabre/Projects/
Specifically we did the following: ...... DSGraph* DSG = getAnalysis<BUDataStructures>().getDSGraph( F ); std::map< Value*, DSNodeHandle> scalarmap = DSG->getScalarMap(); ...... The scalarmap is always empty. I printed the size of the map which came out to be zero always. But the getNodeForValue works correctly for the same DSG, which means that the scalarmap cannot be empty. But we always have an empty scalarmap being returned. Thanks, Ganesh On Wed, 20 Nov 2002, Chris Lattner wrote:> > I tried to used the getScalarMap function of the DSGraph to get the nodes > > that the scalars point to in a function. But the getScalarMap returns a > > null map always. Is there any problem in the getScalarMap function or is > > there any "protocol" to be followed while using the function? > > DSGraph::getScalarMap returns a reference to the map, so this cannot be > null. Do you mean that all of the "entries" in the map are null? If so, > remember that DSGraphs are built in the context of some function (as > indicated by hasFunction/getFunction), so only scalars in that context > will be in the map... > > -Chris > > -- > http://llvm.cs.uiuc.edu/ > http://www.nondot.org/~sabre/Projects/ > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev >Graduate Research Assistant Computer Science University of Illinois, Champaign-Urbana
> ...... > DSGraph* DSG = getAnalysis<BUDataStructures>().getDSGraph( F ); > std::map< Value*, DSNodeHandle> scalarmap = DSG->getScalarMap(); > ...... > > The scalarmap is always empty. I printed the size of the map which came > out to be zero always. But the getNodeForValue works correctly for the > same DSG, which means that the scalarmap cannot be empty. But we always > have an empty scalarmap being returned.Try capturing a reference to the map instead of copying it: std::map<Value*, DSNodeHandle> &scalarmap = DSG->getScalarMap(); -Chris> On Wed, 20 Nov 2002, Chris Lattner wrote: > > > > I tried to used the getScalarMap function of the DSGraph to get the nodes > > > that the scalars point to in a function. But the getScalarMap returns a > > > null map always. Is there any problem in the getScalarMap function or is > > > there any "protocol" to be followed while using the function? > > > > DSGraph::getScalarMap returns a reference to the map, so this cannot be > > null. Do you mean that all of the "entries" in the map are null? If so, > > remember that DSGraphs are built in the context of some function (as > > indicated by hasFunction/getFunction), so only scalars in that context > > will be in the map... > > > > -Chris > > > > -- > > http://llvm.cs.uiuc.edu/ > > http://www.nondot.org/~sabre/Projects/ > > > > _______________________________________________ > > LLVM Developers mailing list > > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > > http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev > > > > Graduate Research Assistant > Computer Science > University of Illinois, Champaign-Urbana >-Chris -- http://llvm.cs.uiuc.edu/ http://www.nondot.org/~sabre/Projects/