> ...... > 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/
Chris, We tried that too...but still it returns an empty map. We also saw that Scalar Type has been removed from the DSNode types. Why is that? Thanks, Ganesh On Wed, 20 Nov 2002, Chris Lattner wrote:> > ...... > > 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 > > > > > > > -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 >
> We tried that too...but still it returns an empty map.I'm not sure what's going on then. :) I think that Vikram is planning to update CVS soon, you might try that, as there has been significant updates. I'm not sure why getNodeForValue would work for you but getScalarMap doesn't... getNodeForValue USES the scalar map! :)> We also saw that Scalar Type has been removed from the DSNode types. Why > is that?Originally, LLVM values were represented in the DSGraph as DSNodes with the Scalar field set. Thus you would have something like this: X: ( int*%X ) | | v A: [ S int*] | | v B: [ H int] IOW, X in the scalar map would point to a "scalar" node (A), which would point to the actual data the scalar points to (B). This was wasteful because scalars in LLVM can never alias each other, thus they don't need to be in the graphs. We changed the graph to now represent this situation like this: ( int*%X ) | | v B: [ H int] Now X is represented ONLY in the scalar map, and it points to whatever the scalar points to. Because the scalar nodes don't exist in the graph anymore, we dropped the flag. -Chris> > > ...... > > > 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 > > > > > > > > > > > -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 > > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev >-Chris -- http://llvm.cs.uiuc.edu/ http://www.nondot.org/~sabre/Projects/