[LLVMdev] How do you determine whether a function is defined externally to a module ?
Chris Lattner
sabre at nondot.org
Sun Jul 3 16:04:14 PDT 2005
On Sun, 3 Jul 2005, Aaron Gray wrote:
> How do you determine whether a function is defined externally ?
> Basically I want a list of external functions but cannot seem to get one.
>
> e.g. I want to create the following list for a module
>
> EXTERN _printf : NEAR
> EXTERN _malloc : NEAR
> EXTERN _an_external_fn : NEAR
>
> I have tried all the obvious permutations but cannot seem to get only the extrnally defined symbols.
Something like this should work:
for (Module::iterator F = M->begin(), E = M->end(); F != E; ++F)
if (F->isExternal())
... Function* F is external! ...
If you take a look at the PowerPC asm printer, it has to do some special
things for external functions as well, it might give you some ideas.
-Chris
--
http://nondot.org/sabre/
http://llvm.cs.uiuc.edu/
More information about the llvm-dev
mailing list