On Fri, 22 Nov 2002, lee white baugh wrote:> do calls to exit() always have a null target-function pointer? that is > what i think i am seeing.Currently, yes. What's actually happening is that the call gets moved to the "globals graph". Essentially, this is due to the fact that the function call cannot modify the local memory graph of the current function. In cases where the target pointer is null like this, you can safely assume that the called function doesn't modify the current graph. -Chris -- http://llvm.cs.uiuc.edu/ http://www.nondot.org/~sabre/Projects/
It is valid that a function returns without using an Instruction::Ret as the last instruction? If so, can we assume that a BasicBlock with no successors is an exit BB?
On Fri, 22 Nov 2002, Juan Nicolas Ruiz wrote:> It is valid that a function returns without using an Instruction::Ret > as the last instruction?No: http://llvm.cs.uiuc.edu/docs/LangRef.html#terminators All basic blocks must have a terminator.> If so, can we assume that a BasicBlock with > no successors is an exit BB?Yes, but you don't want to do this. Just do: if (isa<ReturnInst>(BB->getTerminator())) and be done with it, that's much more explicit. -Chris -- http://llvm.cs.uiuc.edu/ http://www.nondot.org/~sabre/Projects/
I have some questions regarding how globals are represented in DS graph. Specifically, I wrote the following simple program: List *g; void alloc_func(){ g = ( List* ) malloc( sizeof( List ) ); } void free_func(){ free( g ); } int main(){ alloc_func(); free_func(); } I noticed that the DSnode for g in alloc_func is different from that of free_func and NEITHER of them had GlobalNode bit set in their types. Only the malloc bit and the incomplete bit have been set. I am completely clueless how to figure out if it is a global node or not. I used getGlobals and found that the returned map had size 0. How can I get the "common" global node of g?