[LLVMdev] TargetExternalSymbol and TargetGlobalAddress

Chris Lattner sabre at nondot.org
Tue Oct 17 11:30:32 PDT 2006


On Mon, 16 Oct 2006, [UTF-8] Rafael Esp?ndola wrote:
> I have noticed that TargetGlobalAddress is generated for "source code"
> functions and TargetExternalSymbol is generated for builtins like
> __lshrdi3. What is the difference between TargetExternalSymbol and
> TargetGlobalAddress?

The only real difference is that one exists in the LLVM code and one 
doesn't.  :)  In particular, TargetExternalSymbol's are limited to being 
defined in some other module, but TargetGlobalAddress can be defined in 
the current module.

TargetExternalSymbol is a somewhat ugly solution to handle things like 
"__lshrdi3" or "malloc", which don't necessarily exist in the LLVM .bc 
file.  Previously we would add new prototypes to represent these things to 
the LLVM module, but we aim to have the code generator not modify the 
LLVM module at all.

In my opinion, a better overall design would be to have the lowering phase 
totally eliminate LLVM GlobalValue references, making everything in the 
code generator be a reference to a lowered name.  This would simplify 
several pieces of code, particularly the x86 backend.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list