Hi, Yeah I found that it is running LLVM's functions. The functions that are running are: main llvm.dbg.func.start llvm.dbg.stoppoint scanf llvm.dbg.region.end But I dont want all the functions to be called as I am using Dominator Trees and whenever I the statement DominatorTree &DT = getAnalysis<DominatorTree>(F); is encountered by functions other than main, it gives error. What can I do? regards, Ambika Trevor Harmon wrote:> On May 24, 2010, at 12:58 PM, ambika wrote: > >> I run this for different files, each having one function each ie main(), >> but for one it loops twice, and for another it loops thrice. >> for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) > > It might be iterating over the LLVM intrinsic functions as well as the > user-defined functions. Try printing out the function names on each > iteration and see what you get. > > Trevor >
ambika wrote:> Hi, > > Yeah I found that it is running LLVM's functions. The functions that are > running are: > > main > llvm.dbg.func.start > llvm.dbg.stoppoint > scanf > llvm.dbg.region.end > > But I dont want all the functions to be called as I am using Dominator > Trees and whenever I the statement > > DominatorTree &DT = getAnalysis<DominatorTree>(F); > > is encountered by functions other than main, it gives error. > > What can I do? >You should first check to see if the function is an external function before calling getAnalysis<DominatorTree>() on it: if (!(F->isDeclaration())) { DominatorTree & DT = getAnalysis<DominatorTree>(F); ... } -- John T.> > regards, > Ambika > > Trevor Harmon wrote: > >> On May 24, 2010, at 12:58 PM, ambika wrote: >> >> >>> I run this for different files, each having one function each ie main(), >>> but for one it loops twice, and for another it loops thrice. >>> for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) >>> >> It might be iterating over the LLVM intrinsic functions as well as the >> user-defined functions. Try printing out the function names on each >> iteration and see what you get. >> >> Trevor >> >> > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Thanks a lot !!!! John Criswell wrote:> ambika wrote: >> Hi, >> >> Yeah I found that it is running LLVM's functions. The functions that >> are running are: >> >> main >> llvm.dbg.func.start >> llvm.dbg.stoppoint >> scanf >> llvm.dbg.region.end >> >> But I dont want all the functions to be called as I am using >> Dominator Trees and whenever I the statement >> >> DominatorTree &DT = getAnalysis<DominatorTree>(F); >> >> is encountered by functions other than main, it gives error. >> >> What can I do? >> > > You should first check to see if the function is an external function > before calling getAnalysis<DominatorTree>() on it: > > if (!(F->isDeclaration())) { > DominatorTree & DT = getAnalysis<DominatorTree>(F); > ... > } > > -- John T. > >> >> regards, >> Ambika >> >> Trevor Harmon wrote: >> >>> On May 24, 2010, at 12:58 PM, ambika wrote: >>> >>> >>>> I run this for different files, each having one function each ie >>>> main(), >>>> but for one it loops twice, and for another it loops thrice. >>>> for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) >>>> >>> It might be iterating over the LLVM intrinsic functions as well as >>> the user-defined functions. Try printing out the function names on >>> each iteration and see what you get. >>> >>> Trevor >>> >>> >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> >