[LLVMdev] RFC: Constant Creation API

Chris Lattner clattner at apple.com
Sat Jul 25 10:47:06 PDT 2009


On Jul 25, 2009, at 5:44 AM, Maurice Gittens wrote:
> Assuming that I have a threaded JIT server which has an llvmContext  
> object
> on the stack of every JITting thread in the server.
>
> When using the 2.5. API like:
> C = llvm::ConstantInt::get(llvm::Type::Int32Ty, 0);
>
> I need to assume that there exists some global llvmContext object  
> which holds
> the predefined llvm types.
>
> Does this entail that in my threaded server I need to create new  
> types for
> llvm::Type::Int32Ty and the like,  which are associated with the  
> llvm::Context on the stack?

Yes, you'll have to write something like:

C = llvm::ConstantInt::get(llvm::Type::getInt32Ty(Context), 0);

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090725/c627032e/attachment.html>


More information about the llvm-dev mailing list