[LLVMdev] How do you determine whether a function isdefinedexternally to a module ?

Aaron Gray angray at beeb.net
Tue Jul 5 10:43:45 PDT 2005


> Which functions in particular are you not seeing?

_alloc and _free
 
>> I am compiling the examples from llvm/test/feature, about 28 out of 34 
>> assemble fine. Just cannot seem to get the externals listed, been trying for 
>> several hours :(
> 
> There are two types of external functions that the code generator deals 
> with: external functions that are present in the LLVM program, and 
> external functions used by the code generator.  I suspect that you are 
> hitting cases where the later are not getting printed.
> 
> If you look at the PowerPCAsmPrinter.cpp it has to do very similar things 
> to what you are doing.  Note that it uses a "FnStubs" set to collect 
> references to external functions as they are emitted.  Once it builds this 
> set, it emits a stub for each external function at the bottom of the file. 
> I think you should do something similar to this.

I was getting confused by the feature test cases. So am now writting my own.
Sorry It was late and I have just not been looking at things quite properly and so have been getting confused.

if (!M.empty())
  for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F)
    if ( !F->getIntrinsicID() && F->isExternal())
      O << "EXTERN " << Mang->getValueName(F) << " : NEAR" << "\n";

The above works fine with normal external functions.

Regarding _alloc and _free they do not seem to be added to the external functions when they are used in the test case "feature/testmemory.ll", so should I include such cases in an include file or add them to the head of the generated file or something like that.

Doing quite well now.

I have just got to deal with STRUC's as the MASM assembler requires some level of typing.
And then produce some conclusive purpose written test cases.

I should take a rest and then perservere a bit more before panicing and asking for help !

Cheers,

Aaron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20050705/17233e37/attachment.html>


More information about the llvm-dev mailing list