[LLVMdev] Question about structure of SymbolTable

Chris Lattner sabre at nondot.org
Mon Nov 17 18:24:01 PST 2003


On Mon, 17 Nov 2003, Brian Fahs wrote:

> I was trying to look through the SymbolTable code for LLVM.  What does
> the SymbolTable for a Module contain?  Is it just GlobalVariables and
> Functions?

The Module-level symbol table contains types, global variables and
functions.

> How are program constants and static variables declared within functions
> handled?  When I said program constants, I meant things like strings
> (e.g., char* foo = "Hello world\n";).

You can try it out on the demo page:
http://llvm.cs.uiuc.edu/demo/

... but the answer to your question is that the C front-end transforms
them into global variables.  Thus, the constant string "Hello world\n"
turns into the LLVM global:

%.str_1 = internal constant [13 x sbyte] c"Hello world\0A\00"

File static variables are handled similarly,

-Chris

-- 
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/




More information about the llvm-dev mailing list