search for: constantstruct

Displaying 20 results from an estimated 72 matches for "constantstruct".

2020 Sep 30
2
Creating a global variable for a struct array
Let me clarify my question. I have a struct array h1 as follows: dhash h1[10]; I want to get a Constant* to variable h1. It looks like I can use ConstantStruct::get(StructType*, ArrayRef<Constant *>) to do this. My question is how to get the second argument of type ArrayRef<Constant *> from the above variable h1. Thanks, Chaitra ________________________________ From: Tim Northover <t.p.northover at gmail.com> Sent: Wednesday, September...
2013 Mar 01
1
[LLVMdev] llvm get annotations
Hi, I solved it. From the ConstantStruct you can call getOperand() multiple times, so "mine" as deep as you can. On Fri, Mar 1, 2013 at 1:41 PM, Alexandru Ionut Diaconescu < alexandruionutdiaconescu at gmail.com> wrote: > > Hi Sebastian, > > Thanks for the response. > > I already did this : > > I...
2013 Mar 01
0
[LLVMdev] llvm get annotations
...ponse. I already did this : I cast the entire annotated expression to Value*. Then, in order to avoid ugly things like getAsString(), I check if V->getValueID() == Value::ConstantArrayVal in order to cast it to ConstantArray. Because it contains only array[0], I cast array0>getOperand(0) to ConstantStruct. Therefore, from ConstantStruct you can get all the four operands. Now, as a TODO, is only to get the names of @f, @str from every field. But right now I have only a small step to do. ConstantStruct->getOperand(0) gives me i8* bitcast (i32* @f to i8*) . Do you know how I can get the name @f...
2013 Feb 27
3
[LLVMdev] llvm get annotations
Hello everyone ! I followed http://stackoverflow.com/questions/4976298/modern-equivalent-of-llvm-annotationmanagerin order to get annotations from my target bytecode. All the examples that I give in the following is related to the code from that link. I have `__attribute__((annotate("DS"))) int f=0;` into the target C++ program and the related IR code: @.str = private unnamed_addr
2020 Oct 01
2
Creating a global variable for a struct array
...uot; with a Constant* initializer? If so, we need to know what you want to initialize it to. Writing IR for dhash h1[10] = {0}; would be very different from dlist static_lst = {1, 5, NULL}; dhash h1[10] = {{"myfile.txt", &static_list}, 0 }; > It looks like I can use ConstantStruct::get(StructType*, ArrayRef<Constant *>) to do this. It would be involved in the second example above, but because h1 is an array you'd need a whole ContantArray of them. > My question is how to get the second argument of type ArrayRef<Constant *> from the above variable h1. In...
2011 Feb 01
2
[LLVMdev] Convenience methods in ConstantExpr et al
...ntion and had the same convenience methods as IRBuilder. (In fact, the naming convention between IRBuilder and the various Constants.h classes desperately needs to be reconciled, a point which I am sure everyone is painfully aware of.) Another thing I'd like to see is for ConstantArray::get(), ConstantStruct::get() and ConstantVector::get() to have an overload that takes an iterator pair like IRBuilder's CreateGEP and CreateCall methods. Also useful for creating small structs would be overloads for ConstantStruct::get that took 1-4 arguments, instead of having to create a vector every time. Even be...
2010 Mar 15
0
[LLVMdev] [patch] Writing ConstantUnions
...---------- next part -------------- Index: lib/Bitcode/Reader/BitcodeReader.cpp =================================================================== --- lib/Bitcode/Reader/BitcodeReader.cpp (revision 98552) +++ lib/Bitcode/Reader/BitcodeReader.cpp (working copy) @@ -293,6 +293,8 @@ } else if (ConstantStruct *UserCS = dyn_cast<ConstantStruct>(UserC)) { NewC = ConstantStruct::get(Context, &NewOps[0], NewOps.size(), UserCS->getType()->isPacked()); + } else if (ConstantUnion *UserCU = dyn_cast<ConstantUnion>(UserC)) { + N...
2009 Sep 15
1
[LLVMdev] [llvm-commits] [llvm] r81845 - in /llvm/trunk: lib/VMCore/ConstantFold.cpp test/Assembler/insertextractvalue.ll
Chris Lattner wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=81845&view=rev > Log: > fix PR4963: folding insertvalue would sometimes turn a packed struct into > an unpacked one. About this bug -- it happened because ConstantStruct::get has a default parameter for whether the struct should be packed or not, which defaults to not packed. This is strikingly error prone. We even list struct and packed struct as two different types in the LangRef. We don't need to go so far as to offer separate ConstantStruct and Constan...
2010 Mar 15
3
[LLVMdev] [patch] Writing ConstantUnions
Hello, I noticed a bit of a gap in the current code for unions: a ConstantUnion cannot be written out to .ll. Hopefully I'm not stepping on Talin's toes by posting this, it's a fairly straightforward adaptation of the code for structs just above. Tim. -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. --------------
2011 Feb 02
0
[LLVMdev] Convenience methods in ConstantExpr et al
...ience methods as IRBuilder. (In > fact, the naming convention between IRBuilder and the various Constants.h > classes desperately needs to be reconciled, a point which I am sure everyone > is painfully aware of.) > > Another thing I'd like to see is for ConstantArray::get(), > ConstantStruct::get() and ConstantVector::get() to have an overload that > takes an iterator pair like IRBuilder's CreateGEP and CreateCall methods. > Also useful for creating small structs would be overloads for > ConstantStruct::get that took 1-4 arguments, instead of having to create a > vector...
2019 Dec 19
2
Moving to ORCv2 - Where are my global constructors and destructors?
...different way: llvm::GlobalVariable *var = module->getNamedGlobal("llvm.global_ctors"); if(var) { llvm::ConstantArray *InitList = (llvm::ConstantArray*)var->getInitializer(); for(unsigned int n = 0; n < InitList->getNumOperands(); n++) { llvm::ConstantStruct *CS = (llvm::ConstantStruct*)InitList->getOperand(n); if(!CS) { continue; } llvm::Constant *FP = CS->getOperand(1); if(FP->isNullValue()) continue; llvm::ConstantExpr *CE...
2020 Sep 22
2
Creating a global variable for a struct array
...fst; int eoffst; uint8_t* dptr; }dlist; I also need to allocate space for: 1) the field llist in struct dhash which is a pointer to another struct dlist and 2) the field dptr in struct dlist Is there an example that I can refer to for doing this ? I tried to create a GlobalVariable using ConstantStruct::get(StructType*, ArrayRef<Constant *>). I'm not sure how to get the second argument of type ArrayRef<Constant *> from the above variable h1. Thanks, Chaitra -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev...
2011 Feb 02
2
[LLVMdev] Convenience methods in ConstantExpr et al
...which I am sure everyone is painfully aware of.) It's a matter of layering. IRBuilder will call into ConstantExpr as needed; the ConstantExpr API is at the same level as the llvm::Instruction hierarchy itself. > Another thing I'd like to see is for ConstantArray::get(), > ConstantStruct::get() and ConstantVector::get() to have an overload > that takes an iterator pair like IRBuilder's CreateGEP and > CreateCall methods. Also useful for creating small structs would be > overloads for ConstantStruct::get that took 1-4 arguments, instead > of having to...
2006 Mar 15
0
[LLVMdev] Re: Re: Re: Re: New GCC4-based C/C++/ObjC front-end for LLVM
Hi, Here is the follow on patch for this problem. Please apply this from the top of the tree and rebuild. -------------- next part -------------- A non-text attachment was scrubbed... Name: op Type: application/octet-stream Size: 2548 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20060315/eee8a766/attachment.obj> -------------- next part
2006 Mar 16
2
[LLVMdev] Re: Re: Re: Re: Re: New GCC4-based C/C++/ObjC front-end for LLVM
....h:249 249 const Type *getForwardedType() const { (gdb) where #0 llvm::PATypeHolder::get (this=0x8) at Type.h:249 #1 0x08514f1f in llvm::PATypeHolder::operator llvm::Type* (this=0x8) at AbstractTypeUser.h:140 #2 0x08514734 in llvm::Value::getType (this=0x0) at Value.h:76 #3 0x087a8f8a in ConstantStruct (this=0x8b28038, T=0x8b25730, V=@0xbf8adef0) at /home/ghost/Work/llvm-cvs/lib/VMCore/Constants.cpp:275 #4 0x087e9058 in llvm::ConstantCreator<llvm::ConstantStruct, llvm::StructType, std::vector<llvm::Constant*, std::allocator<llvm::Constant*> > >::create (Ty=0x8b25730, V=@0xb...
2020 Oct 01
3
Creating a global variable for a struct array
...); //create global variable for int Constant* intInit = ConstantInt::get(Type::getInt32Ty(M.getContext()), 10); Constant* intConst = new GlobalVariable(M, intInit->getType(), false, GlobalVariable::ExternalLinkage, intInit, ".int"); //create ConstantStruct for each hashtable entry Constant *dhashInit[] = {filenmConst, intConst}; Constant *dhashConst = ConstantStruct::get(dhashTy, dhashInit); Constant* htabInitArr[2]; htabInitArr[0] = dhashConst; htabInitArr[1] = dhashConst; ArrayType *htabTy = ArrayType::get(dhashTy, 2); Constant *htabInit...
2008 Jun 17
0
[LLVMdev] Transforming ConstantExprs to Instructions
...constant (inserted in the entry block immediately after all the allocas), and third, call replaceAllUsesWith on the constant. The bulk of the code, of course, is building the value. In general, it can take an arbitrary number of instructions to build a constant (for example, if the constant is a ConstantStruct), so be careful not to assume that a constant derivation maps to a single instruction. The case for ConstantExpr is probably the longest, but there aren't actually that many cases: you just have GetElementPtrInst, CastInst, CmpInst, SelectInst, InsertValueInst, and ExtractValueInst (assuming yo...
2016 Sep 24
2
RFC: ConstantData should not have use-lists
...t of bugs (see r263853 and r263875) and >> avoid some expensive walks through uninteresting code. >> >> (The same is not true of Constant, generally. A GlobalValue's use-list >> will local to the GlobalValue's Module. Any ConstantVector, >> ConstantArray, or ConstantStruct that points at a GlobalValue will also >> be local to the same Module. In these cases, we also need RAUW >> support.) >> >> Besides catching bugs, removing use-lists from ConstantData will >> guarantee that the compiler output *does not* depend on the use-list >&g...
2006 Mar 15
2
[LLVMdev] Re: Re: Re: Re: New GCC4-based C/C++/ObjC front-end for LLVM
On Wed, 15 Mar 2006, Vladimir Prus wrote: >> Please give it a try and let me know if it works any better for you! > > Here we go: Wow, you are good at finding problems! Thanks! > -fvisibility=hidden -DHIDE_EXPORTS > -c ../../2006-03-14-llvm-gcc-4/gcc/libgcc2.c -o libgcc/./_fixunsxfdi.o > cc1: /space/p2/ghost/build/llvm-cvs/include/llvm/Instructions.h:72: void >
2011 Feb 04
0
[LLVMdev] ConstantBuilder proposal
...idia at gmail.com> wrote: >   /// GetStruct - return a constant struct given a context and a vector >   /// of elements. >   static Constant *GetStruct( >     LLVMContext &Context, >     const std::vector<Constant*> &V, >     bool Packed = false) { >     return ConstantStruct::get(Context, V, Packed); >   } can remove it from their parameter list. It's probably pretty unlikely a given ConstantBuilder instance would be used with multiple LLVMContexts. Making this a class you need an instance of would likely also allow typing to be reduced a bit because said inst...