Discussion forum for David Beazley

Working with PointerType in llvmlite

Dear all,

When building a compiler, we used llvmlite and now I want to go forward. In the language BeGone we didn’t use pointers so I decided to try to see if I can extend this language by using pointers.

I wrote this code but it doesn’t work. What am I doing wrong?

from llvmlite.ir import (
Module, Function, FunctionType, IntType,PointerType,
Constant, IRBuilder
)

from llvmlite.ir import DoubleType
mod = Module(‘hello’)
hello_func = Function(mod, FunctionType(IntType(32), []), name=‘hello’)
block = hello_func.append_basic_block(“entry”)
builder = IRBuilder(block)
puntero = mod.context.get_identified_type(“puntero”)
x = builder.alloca(mod.context.identified_types[“puntero”])
builder.store(Constant(IntType(32),1), x)
builder.ret(Constant(IntType(32), 37))