similar to: [LLVMdev] How to get a constant of some type?

Displaying 20 results from an estimated 20000 matches similar to: "[LLVMdev] How to get a constant of some type?"

2009 Jul 25
0
[LLVMdev] RFC: Constant Creation API
Hi, On Fri, Jul 24, 2009 at 7:03 PM, Chris Lattner <clattner at apple.com> wrote: > > On Jul 24, 2009, at 9:30 AM, Duncan Sands wrote: > > >> The ones that don't can be static functions on the type class that > >> take a context. For example, Type::Int32Ty needs to become a > >> function > >> that takes a context at some point. > >
2009 Jul 25
1
[LLVMdev] RFC: Constant Creation API
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
2009 Jul 24
2
[LLVMdev] RFC: Constant Creation API
On Jul 24, 2009, at 9:30 AM, Duncan Sands wrote: >> The ones that don't can be static functions on the type class that >> take a context. For example, Type::Int32Ty needs to become a >> function >> that takes a context at some point. > > Why is that? If it is read-only then it should be possible to share > it between all threads. Type's aren't
2008 Jun 28
2
[LLVMdev] need to store the address of a variable
Hello everybody, my problem is, that I want to get an array of pointers to all local variables in a function. This array will be used for transfering these Variables to another execution engine. I've code which generates this array, and a pointer to the target field of the array. name = variables.fname + "_pointerArray"; Instruction* pointerArray = new
2014 Oct 27
2
[LLVMdev] How to call a pointer that points to a C function
I have a pointer to a function that I need to invoke without going through llvm::Module::getOrInsertFunction. This example does not work: static int add(int x, int y); llvm::Value *one, *two; llvm::Constant* addfn = llvm::ConstantInt::get(JB->getIntPtrTy(DataLayout), (intptr_t)add); llvm::Type* args[] = { Int32Ty, Int32Ty }; llvm::FunctionType* ftype = llvm::FunctionType::get(Int32Ty,
2009 Jun 18
0
[LLVMdev] Initialising global Array
Andreas Neustifter wrote: > Hi, > > I try to create a array that has a nonzero initialiser: > > What i do is, first create the array type. > > > const ArrayType *ATy = ArrayType::get(Type::Int32Ty, NumEdges); > > Then create some constant values for the initializer. > > > std::vector<Constant*> Initializer; Initializer.reserve(NumEdges); > >
2009 Jun 18
3
[LLVMdev] Initialising global Array
Hi, I try to create a array that has a nonzero initialiser: What i do is, first create the array type. > const ArrayType *ATy = ArrayType::get(Type::Int32Ty, NumEdges); Then create some constant values for the initializer. > std::vector<Constant*> Initializer; Initializer.reserve(NumEdges); > APInt zero(32,0); Constant* zeroc = ConstantInt::get(zero); > APInt
2008 Jul 07
0
[LLVMdev] (GEP) Index validity
Hi all, I just found that TargetData also contains a similar assert, and that I forgot a "return" in my previous patch. Here's an updated patch, which allows to use any integer to index a CompositeType. It seems this enables GEP to work with any integer value as well, I tested indexing a struct with a i16 an i64 (also through llc). This should still be adressed somewhere, unless we
2009 Sep 23
2
[LLVMdev] DebugFactory
On Sep 22, 2009, at 4:49 PM, Talin wrote: > > // Calculate the size of the specified LLVM type. > Constant * DebugInfoBuilder::getSize(const Type * type) { > Constant * one = ConstantInt::get(Type::Int32Ty, 1); > return ConstantExpr::getPtrToInt( > ConstantExpr::getGetElementPtr( > ConstantPointerNull::get(PointerType::getUnqual(type)), >
2008 Jul 10
2
[LLVMdev] (GEP) Index validity
Hi all, any comments about this patch? I'd like to get it out of my working copy :-) Gr. Matthijs > Index: lib/VMCore/Type.cpp > =================================================================== > --- lib/VMCore/Type.cpp (revision 53136) > +++ lib/VMCore/Type.cpp (working copy) > @@ -394,9 +394,8 @@ > > bool StructType::indexValid(const Value *V) const { >
2008 Aug 19
7
[LLVMdev] Please help with LLVM C++ integration
Hi Gordon, I wrote a small example, but while running I get an error("Tied to execute an unknown external function"), where I am wrong? Thanks in advance. Kirill. int some_test_func( int ){ std::cout << "!!!!" << std::endl; return 8848; } int _tmain(int argc, _TCHAR* argv[]){ Module *M = new Module("test"); ExistingModuleProvider* MP = new
2008 Jun 19
1
[LLVMdev] Constant function pointers and inlining
Hello, I've been working on turning PHP scripts into LLVM IR and I've gotten to the stage where I'm able to construct LLVM code that calls the PHP opcode handlers that I've pre-compiled to LLVM IR in the correct order. However, the PHP API is designed so that the handlers are not globally accessible (qualified by "static" in the C source). Instead they're supposed to
2008 Aug 19
0
[LLVMdev] Please help with LLVM C++ integration
Hi Kirill, Don't forget to add X86TargetMachine.obj (add to Additional Dependencies in Linker options, if you are using MSVS) otherwise LLVM will try and use Interpreter instead of JIT. Hope this helps, Rob. > -----Original Message----- > From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] > On Behalf Of kirill havok > Sent: Wednesday, August 20, 2008
2009 Sep 22
0
[LLVMdev] DebugFactory
On Tue, Sep 22, 2009 at 9:21 AM, Devang Patel <devang.patel at gmail.com>wrote: > On Tue, Sep 22, 2009 at 9:21 AM, Devang Patel <devang.patel at gmail.com> > wrote: > > On Tue, Sep 22, 2009 at 12:14 AM, Talin <viridia at gmail.com> wrote: > >> So, one feature of the late, lamented DebugInfoBuilder that I am missing > >> quite badly, and which is not
2008 Aug 19
0
[LLVMdev] Please help with LLVM C++ integration
kirill havok wrote: > Hi Gordon, > I wrote a small example, but while running I get an error("Tied to > execute an unknown external function"), where I am wrong? > I think the problem is that some_test_func() is a C++ function, so its name is being mangled during compilation. To fix it, I think you want to add a declaration telling the compiler to treat some_test_func()
2011 Mar 14
2
[LLVMdev] How to load a data from the address of unsiged long type
Now I have an address that present in a unsigned long address like the following format: Value* addr = CONST(0xc0008000) But I do not know how to read the data from the above addr varaible. I tried the following three kind of code: 1. Code: Value* addr = CONST(0xc0008000); Value* data = new LoadInst(addr, "", false, bb); Error: Segmentation fault 2. Code(
2007 Aug 17
1
[LLVMdev] Inserting trace information during opt transformations
Hi all, In several of the transformations I'm working on I need to embed the logical equivalent of puts/printf/etc. calls inline with code. I am having some difficulties getting the transformation code right. As I understand it, I should be creating a ConstantArray based on the string (in this case I'm taking an instruction, 'disassembling' it to an ostringstream then turning
2008 Apr 11
4
[LLVMdev] LLVMBuilder vs LLVMFoldingBuilder
Hi Dominic, +//===-- llvm/Support/IRBuilder.h - Builder for LLVM Instrs -----*- C++ -*-===// is this line the right length? It seems shorter than the similar lines below like this one: +//===----------------------------------------------------------------------===// + GetElementPtrInst *CreateStructGEP(Value *Ptr, unsigned Idx, + const char *Name =
2008 Nov 17
2
[LLVMdev] Assertion `castIsValid(getOpcode(), S, Ty) && "Illegal BitCast"' failed.
ok.. So I am trying out what you have suggested. I have written the below code which basically tries to write the constant 10 to a file. myprint is a function pointer to a function which takes char * parameter and writes it to file. Value *Ten = ConstantInt::get(Type::Int32Ty, 10); const Type *VoidPtrTy = PointerType::getUnqual(Type::Int8Ty); AllocaInst *AI = new AllocaInst(Type::Int32Ty); Value
2009 Sep 23
0
[LLVMdev] DebugFactory
On Wed, Sep 23, 2009 at 1:51 PM, Dan Gohman <gohman at apple.com> wrote: > > On Sep 22, 2009, at 4:49 PM, Talin wrote: > >> >> // Calculate the size of the specified LLVM type. >> Constant * DebugInfoBuilder::getSize(const Type * type) { >> Constant * one = ConstantInt::get(Type::Int32Ty, 1); >> return ConstantExpr::getPtrToInt( >>