[LLVMdev] v3.0 type system rewrite question

Andrew Sorensen digegoo at gmail.com
Tue Aug 23 23:19:48 PDT 2011


Hi,

I have a question regarding the LLParser and the new type system
rewrite when running the JIT.  I think there may be a problem with the
parser not picking up on named types currently defined in a given
Module (global context). However, I don't have much experience with
the LLVM internals so there's a good chance that I'm not fully
understanding the new changes ;)

For Example:

This works fine (via ParseAssemblyString):

"%my_type = type double
define double @my_func(%my_type %a) {
entry:
   %return = fmul %my_type %a, 5.0
   ret %my_type %return
}"

However splitting this into two independent calls results in a parser error.

So this ...

"%my_type = type double"

followed at a later date by ...

"define double @my_func(%my_type %a) {
entry:
    %return = fmul %my_type %a, 5.0
    ret %my_type %return
}"

... doesn't work -> "use of undefined type"

This used to work fine in 2.9 and is easily 'fixed' in LLParser by
checking for the named type against the Module and adding it to the
NamedType map when the parser hits LocalVar. But this seems like a hack.
Anyway I guess I'm just checking that this is a bug and not something that
I'm not understanding correctly.

Cheers,
Andrew.




More information about the llvm-dev mailing list