Skip to content

Use i8* instead of void* for generated LLVM IR #8

@sampsyo

Description

@sampsyo

It looks like LLVM doesn't like using void* for opaque pointers. Trying to compile some LLVM IR actually gave me a useful hint:

$ /usr/local/Cellar/llvm/4.0.0_1/bin/opt add.ll             
/usr/local/Cellar/llvm/4.0.0_1/bin/opt: add.ll:6:22: error: pointers to void are invalid - use i8* instead
define i32 @main(void*) {

Apparently, at least until opaque pointer types come to LLVM IR, the right type to use for this sort of thing is a pointer to 8-bit integers.

One easy way to do this would be to define a constant for the i8* type (called FUNCTION_ENV_TYPE?) and then use it wherever we currently have llvm.PointerType.create(llvm.VoidType.create(), 0).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions