search for: constantaggregatezero

Displaying 20 results from an estimated 37 matches for "constantaggregatezero".

2012 Jan 20
2
[LLVMdev] How to force the creation of arrays with zeroes?
Hi all. I propose to use wrapper for this kind of constant objects. Consider next code: Constant* C = reinterpret_cast<Constant*>(I->getOperand(idx)); Constant* ArrayItem; if (!isa<ConstantAggregateZero>(C)) ArrayItem = reinterpret_cast<Constant*>(I->getOperand(ArrItemIdx)); else ArrayItem = ZeroInt; Code analog within wrapper: ConstOrZero C(I->getOperand(idx)); Constant* ArrayItem = C.getOperand(ArrItemIdx); // Unpleasant work with isa<> inside. Advantages of this ap...
2012 Jan 20
2
[LLVMdev] How to force the creation of arrays with zeroes?
> you can't, you can only get a ConstantAggregateZero.  This is actually kind of > annoying, and means that places expecting a ConstantArray have to remember to > also check for ConstantAggregateZero.  Perhaps there's a good reason for the > current design, but if not it would be great to eliminate this wart. Well, I think the main reason...
2012 Jan 20
0
[LLVMdev] How to force the creation of arrays with zeroes?
Hi Anton, >> you can't, you can only get a ConstantAggregateZero. This is actually kind of >> annoying, and means that places expecting a ConstantArray have to remember to >> also check for ConstantAggregateZero. Perhaps there's a good reason for the >> current design, but if not it would be great to eliminate this wart. > Well, I thin...
2012 Jan 21
0
[LLVMdev] How to force the creation of arrays with zeroes?
...at 12:16 PM, Stepan Dyatkovskiy <STPWORLD at narod.ru> wrote: > Hi all. I propose to use wrapper for this kind of constant objects. > > Consider next code: > > Constant* C = reinterpret_cast<Constant*>(I->getOperand(idx)); > Constant* ArrayItem; > if (!isa<ConstantAggregateZero>(C)) > ArrayItem = reinterpret_cast<Constant*>(I->getOperand(ArrItemIdx)); > else > ArrayItem = ZeroInt; > > Code analog within wrapper: > > ConstOrZero C(I->getOperand(idx)); > Constant* ArrayItem = C.getOperand(ArrItemIdx); // Unpleasant work with isa&lt...
2009 Jan 21
2
[LLVMdev] RFA: Constant String c"\000"
The Constants.cpp file returns a ConstantAggregateZero object when you pass it a c"\000" string. Here is the code: Constant *ConstantArray::get(const ArrayType *Ty, const std::vector<Constant*> &V) { // If this is an all-zero array, return a ConstantAggregateZero object if (!V.empty()) { Constan...
2012 Jan 21
0
[LLVMdev] How to force the creation of arrays with zeroes?
How many times will a typical client call getOperand on your helper when it wraps a 10,000 element ConstantAggregateZero? With CAZ the client is force to think about this case, and often handles it much much more efficiently. CAZ is a time optimization as well as a space optimization. -Chris On Jan 21, 2012, at 12:03 AM, Stepan Dyatkovskiy <STPWORLD at narod.ru> wrote: > Hi Chris. There is no zero array...
2012 Jan 21
4
[LLVMdev] How to force the creation of arrays with zeroes?
Hi Chris. There is no zero arrays created. Probably this patch is not optimal and I'll reworked it today. But the main idea is keep a single zero-item when ConstantAggregateZero was wrapped and return this zero item as result of getOperand call. Note that wrapper has no parent classes, it has very local and short lifetime (method body), it exists outside the LLVMContext and needed for replacement of isa<ConstantAggregateZero>(C) checks only. -Stepan 21.01.2012, 08:...
2012 Jan 20
3
[LLVMdev] How to force the creation of arrays with zeroes?
Hi all. How to force the creation of arrays with zeroes? Or this use-case is not provided? -- Truly yours, Stepan Dyatkovskiy
2012 Jan 20
0
[LLVMdev] How to force the creation of arrays with zeroes?
Hi Stepan, > Hi all. How to force the creation of arrays with zeroes? Or this use-case is not provided? you can't, you can only get a ConstantAggregateZero. This is actually kind of annoying, and means that places expecting a ConstantArray have to remember to also check for ConstantAggregateZero. Perhaps there's a good reason for the current design, but if not it would be great to eliminate this wart. Ciao, Duncan.
2012 Sep 04
2
[LLVMdev] [NVPTX] Backend cannot handle array-of-arrays constant
...0 +++ NVPTXAsmPrinter.cpp 2012-09-04 15:47:17.859398193 +0200 @@ -1890,17 +1890,15 @@ case Type::ArrayTyID: case Type::VectorTyID: case Type::StructTyID: { - if (isa<ConstantArray>(CPV) || isa<ConstantVector>(CPV) || - isa<ConstantStruct>(CPV)) { + if (isa<ConstantAggregateZero>(CPV)) + aggBuffer->addZeros(Bytes); + else + { int ElementSize = TD->getTypeAllocSize(CPV->getType()); bufferAggregateConstant(CPV, aggBuffer); if ( Bytes > ElementSize ) aggBuffer->addZeros(Bytes-ElementSize); } - else if (isa<...
2015 Mar 05
4
[LLVMdev] global variable
Hi all, I am newbie for llvm. I just create a global variable, there are some statements in my pass like: LoadInst* int64_64 = new LoadInst(pthreadPID, "", false, OptAplusOne); int64_64->setAlignment(8); int64_64->dump(); LoadInst* int32_65 = new LoadInst(gvar_int32_myFlag, "", false, OptAplusOne); int32_65->setAlignment(4);
2012 Sep 06
0
[LLVMdev] [NVPTX] Backend cannot handle array-of-arrays constant
...5:47:17.859398193 +0200 > @@ -1890,17 +1890,15 @@ > case Type::ArrayTyID: > case Type::VectorTyID: > case Type::StructTyID: { > - if (isa<ConstantArray>(CPV) || isa<ConstantVector>(CPV) || > - isa<ConstantStruct>(CPV)) { > + if (isa<ConstantAggregateZero>(CPV)) > + aggBuffer->addZeros(Bytes); > + else > + { > int ElementSize = TD->getTypeAllocSize(CPV->getType()); > bufferAggregateConstant(CPV, aggBuffer); > if ( Bytes > ElementSize ) > aggBuffer->addZeros(Bytes-Ele...
2010 Mar 29
0
[LLVMdev] Union types
...onstants.cpp (revision 99809) +++ lib/VMCore/Constants.cpp (working copy) @@ -59,6 +59,7 @@ case Type::PointerTyID: return ConstantPointerNull::get(cast<PointerType>(Ty)); case Type::StructTyID: + case Type::UnionTyID: case Type::ArrayTyID: case Type::VectorTyID: return ConstantAggregateZero::get(Ty); @@ -944,7 +945,8 @@ // Factory Function Implementation ConstantAggregateZero* ConstantAggregateZero::get(const Type* Ty) { - assert((Ty->isStructTy() || Ty->isArrayTy() || Ty->isVectorTy()) && + assert((Ty->isStructTy() || Ty->isUnionTy()...
2007 May 11
2
[LLVMdev] identifing mallocs with constant sizes
...t array size if(the array size is a ConstantInt){ -- the array size can be obtained using getLimitedValue() } else if(the array size is a ConstantExpr){ -- there should be some way to evaluate the constant expression??? } else if(the array size is a ConstantAggregateZero){ -- the malloc is for size 0 } else if(the array size is a ConstantFP){ -- I don't believe this case should happen but if it did, the array size could be obtained by calling getValue() } else if(the array size is a ConstantArray or ConstantPointerNul...
2009 Jan 27
0
[LLVMdev] RFC: -fwritable-strings Change
...lprit > is the @"\01LC" global. (This is generated with my hack, so it has an > explicit "section".) Any suggestions for a back-end fix would be > welcome Fix commited :) Actually it was my fault. We have ConstantArray stuff for everything string-like but non-zero and ConstantAggregateZero for string-like but zero (rather odd!). I was not aware about such during writing of section selection code, thus missed the second opportunity. Now everything should be ok as of r63139. Let me know, if it still fails for you somehow. I'm currently in paper-deadline-really-soon-but-no-...
2009 Nov 13
1
[LLVMdev] Poolalloc asserts when passing in pool descriptors
Hi, The poolalloc library fails in TransformFunctionBody.cpp, line 746 --- Value *ArgVal = ConstantAggregateZero::get(PoolAllocate::PoolDescPtrTy); --- opt -load /path_to_lib/libpoolalloc.dylib -poolalloc constaggr.bc -o opt.bc -f triggers the problem (bc file attached). Assertion failed: ((isa<StructType>(Ty) || isa<ArrayType>(Ty) || isa<VectorType>(Ty)) && "Cannot create...
2010 Mar 29
6
[LLVMdev] Union types
Hi All, I've noticed the union type in the language manual [1] but it seems it's not used too much. According to the manual, the code: union { int a; double b; } a; Could be compiled to: %union.anon = type union { i32, double } @a = common global %union.anon zeroinitializer, align 8 ; <%union.anon*> [#uses=0] But when I try to assemble it, I get: $ llvm-as union.ll
2014 Jan 29
2
[LLVMdev] getelementptr on static const struct
Hi, I found a mysterious behavior of LLVM optimizer. I compiled the following code by clang -emit-llvm -S: #include <stddef.h> static const struct t {char t[4]; char s;} p = {{}, 'a'}; char f() { return ((char*)&p)[offsetof(struct t, s)]; } then I obtained the following LLVM IR: %struct.t = type { [4 x i8], i8 } @p = constant %struct.t { [4 x i8] zeroinitializer, i8 97
2007 May 11
0
[LLVMdev] identifing mallocs with constant sizes
...e is a ConstantInt){ > -- the array size can be obtained using getLimitedValue() > } > else if(the array size is a ConstantExpr){ > -- there should be some way to evaluate the constant > expression??? > } > else if(the array size is a ConstantAggregateZero){ > -- the malloc is for size 0 > } > else if(the array size is a ConstantFP){ > -- I don't believe this case should happen but if it did, > the array size could be obtained by calling getValue() > } > else if(the array size is a...
2015 Jan 20
2
[LLVMdev] Bug in InsertElement constant propagation?
...if you think there is a more obvious way to do it. Right now the only way to create a ConstantDataVector are those method: /// get() constructors - Return a constant with vector type with an element /// count and element type matching the ArrayRef passed in. Note that this /// can return a ConstantAggregateZero object. static Constant *get(LLVMContext &Context, ArrayRef<uint8_t> Elts); static Constant *get(LLVMContext &Context, ArrayRef<uint16_t> Elts); static Constant *get(LLVMContext &Context, ArrayRef<uint32_t> Elts); static Constant *get(LLVMContext &Context,...