The fact that main is the entry point is not known to LLVM (except in a couple of places that special-case main, such as the internalise pass), because it is an artefact of C/C++, not a generic property. On most *NIX platforms, the real entry point for a program is something like __start or _start, which then call main. In most compilation units, there is no single entry point, because they do not contain the program entry point and so can be entered by any externally visible function.
It might help if you explained why you need this.
David
_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
This is not sound. The linkage of boo means that it is externally visible. There is no guarantee that it will not be called from another compilation unit. If boo had internal or private linkage, then you would be safe to delete it as soon as its uses count dropped to zero (and LLVM’s dead code elimination pass will do exactly that).
If you run the Internalize pass first, then it will mark functions that are not reachable from main as internal and then DCE can delete them.