I am trying to use the LLVM classes (with Modules in memory) to represent some programs that use
the void* type but I am having some problems handling that type.
If I use WriteBytecodeToFile, I receive this error:
Assertion `slot != -1 && "Module broken!"`
If I save the module directly with PrintModulePass, it generates the .ll file fine, but if I try
to compile it with llvm-as, as soon as it finds 'void *' it complains that it was expecting an "("
instead of an "*". I suppose that the correct syntax is something like this: 'void (sbyte *)*'
For example, these lines can cause the error:
%castinst1 = cast typeXYZ* %var to void* ; <void*> [#uses=1]
or
%astruct = type { %int*, %void*, *astruct }
My question is, how can I generate 'void (sbyte*)*' using the LLVM classes?
No value can be stored in a void and a function returning void* points
to nowhere in particular. I think what you are really wanting to do here
is use an opaque type. The other alternative is to simply use sbyte*.
Remember, this isn't C even though some of the names/ideas look
familiar.
No value can be stored in a void and a function returning void* points
to nowhere in particular. I think what you are really wanting to do here
is use an opaque type. The other alternative is to simply use sbyte*.
Remember, this isn't C even though some of the names/ideas look
familiar.
I would recommend using 'sbyte*' instead of opaque*. Reid is right, void should only be used as a function return type. There will eventually be an assertion to enforce this, but the SparcV9 backend currently abuses void*'s, so we cannot add the assertion until it is fixed.
-Chris
Reid.
Hello,
I am trying to use the LLVM classes (with Modules in memory) to represent some programs that use
the void* type but I am having some problems handling that type.
If I use WriteBytecodeToFile, I receive this error:
Assertion `slot != -1 && "Module broken!"`
If I save the module directly with PrintModulePass, it generates the .ll file fine, but if I try
to compile it with llvm-as, as soon as it finds 'void *' it complains that it was expecting an "("
instead of an "*". I suppose that the correct syntax is something like this: 'void (sbyte *)*'
For example, these lines can cause the error:
%castinst1 = cast typeXYZ* %var to void* ; <void*> [#uses=1]
or
%astruct = type { %int*, %void*, *astruct }
My question is, how can I generate 'void (sbyte*)*' using the LLVM classes?