[LLVMdev] Opaque type

ac at tml.hut.fi ac at tml.hut.fi
Mon Jan 14 06:30:08 PST 2008

I'm trying to translate part of Java code in LLVM code. I have some  
problems with the "opaque type", I think because I did not understand  
how to use.
So, the java code is:

int[] ai;
ai = new int[1];

I am using LLVM API in this way:

//I create a pointer of Opaque type, because I don't know yet the array size!
OpaqueType* ot =  OpaqueType::get();
AllocaInst* ptr_addrOP = new AllocaInst(ot, "ai_addr", label_entry);

//I create pointer of Array type when it is initialized
ArrayType* art = ArrayType::get(Type::IntTy, 1);
AllocaInst* ptr_addrAr = new AllocaInst(art, "ai_addr", label_entry);

//I try to make concrete the abstract pointer
((PointerType*)ptr_addrOP -> getType()) ->  
typeBecameConcrete(ptr_addrAr-> getType());

But "ptr_addrOP" type is still abstract and nothing changed, in the  
SymbolTable there are still both the pointers.

What I'm doing wrong?
Can you suggest me the wright way to do?

Alessandro Cogliati

I am using LLVM 1.9

More information about the llvm-dev mailing list