[LLVMdev] Getting a named value in llvm-c

Bill Hart goodwillhart at googlemail.com
Tue Nov 20 13:58:43 PST 2012


Hi all,

I am wondering if there is a way to get a value by name in the C
interface for the LLVM Jit?

There seems to be a way to name values consistently, but no way to
retrieve those LLVMValueRef's by name.

I see it is possible to get a struct by name and a type by name and a
function by name, and a few other esoteric things, but not a general
value.

The reason I am wanting this is that I am writing a language where
there is a separation between the back end and the code which
processes the AST. In particular, I do not have any LLVM values or
types in the AST nodes themselves, only strings naming those values
and types. When the back end processes the AST it looks up the
relevant types and values by string name.

The specific circumstance where this causes an issue is with
allocating local variables. The back end code needs to access such
variables at points different from where they were defined. At present
I have to store the relevant LLVMValueRef's in the AST or in some
other type information elsewhere in my implementation, rather than
store a string name and look them up as needed.

Bill.



More information about the llvm-dev mailing list