search for: structtyid

Displaying 20 results from an estimated 24 matches for "structtyid".

Did you mean: structty
2008 Apr 21
2
[LLVMdev] newbie question for type comparison
On Apr 21, 2008, at 15:07, John Criswell wrote: >> 1. For getting ALL struct allocation, when I use >> >> if( (AI = dyn_cast<AllocaInst>(&*i))) >> if(AI->getOperand(0)->getType()->getTypeID() == >> Type::StructTyID) { >> >> to get all alloca instructions allocating a structure, it does not >> work. In my gdb session, I've got the following dumps: >> > I'm not sure why the above doesn't work. My best guess is that the > allocated type is not an operand (since it is no...
2008 Apr 21
3
[LLVMdev] newbie question for type comparison
...ct allocation and a SPECIFIC struct allocation, at different situations. Here, I've got a couple of more questions. 1. For getting ALL struct allocation, when I use if( (AI = dyn_cast<AllocaInst>(&*i))) if(AI->getOperand(0)->getType()->getTypeID() == Type::StructTyID) { to get all alloca instructions allocating a structure, it does not work. In my gdb session, I've got the following dumps: (gdb) call AI->dump() %s = alloca %struct.S ; <%struct.S*> [#uses=4] (gdb) call AI->getOperand(0)->dump() i32 1 (gdb) call AI->get...
2008 Apr 21
0
[LLVMdev] newbie question for type comparison
...t; allocation, at different situations. Here, I've got a couple of more > questions. > > 1. For getting ALL struct allocation, when I use > > if( (AI = dyn_cast<AllocaInst>(&*i))) > if(AI->getOperand(0)->getType()->getTypeID() == > Type::StructTyID) { > > to get all alloca instructions allocating a structure, it does not > work. In my gdb session, I've got the following dumps: > I'm not sure why the above doesn't work. My best guess is that the allocated type is not an operand (since it is not an LLVM Value) but i...
2008 Apr 21
0
[LLVMdev] newbie question for type comparison
...Apr 21, 2008, at 15:07, John Criswell wrote: > > >>> 1. For getting ALL struct allocation, when I use >>> >>> if( (AI = dyn_cast<AllocaInst>(&*i))) >>> if(AI->getOperand(0)->getType()->getTypeID() == >>> Type::StructTyID) { >>> >>> to get all alloca instructions allocating a structure, it does not >>> work. In my gdb session, I've got the following dumps: >>> >>> >> I'm not sure why the above doesn't work. My best guess is that the >> allo...
2008 Apr 21
2
[LLVMdev] newbie question for type comparison
...d as a struct %struct.S = type { i32, i32 } I'm using the following loop: for(inst_iterator i = inst_begin(F), e = inst_end(F); i!= e; i++) { AllocaInst* ai; if( (ai = dyn_cast<AllocaInst>(&*i))){ if(ai->getOperand(0)->getType()->getTypeID() == Type::StructTyID) allocs.push_back(ai); } } However, I had the impression that the type comparison can be done by a pointer comparison. Can anyone please suggest me a better way to do it? Also, I want to get the size of %struct.S, should I use the following code? const TargetData &TD = getAnalys...
2008 Apr 21
0
[LLVMdev] newbie question for type comparison
...using the following loop: > > for(inst_iterator i = inst_begin(F), e = inst_end(F); i!= e; i++) > { > AllocaInst* ai; > if( (ai = dyn_cast<AllocaInst>(&*i))){ > if(ai->getOperand(0)->getType()->getTypeID() == > Type::StructTyID) > allocs.push_back(ai); > } > } > I might be misunderstanding something, but the above code finds all alloca instructions that allocate structure types. This is not quite what you want if you're looking specifically for type {i32, i32}. To se...
2008 Nov 13
0
[LLVMdev] Using isa with derived types
...g/doxygen/classllvm_1_1Type.html if (const PointerType *PTy = dyn_cast<PointerType>(...)) { const Type *InnerTy = PTy->getElementType(); switch (InnerTy->getTypeID()) { case Type::ArrayTyID: ... case Type::FunctionTyID: ... case Type::StructTyID: ... case Type::IntegerTyID: ... } } A switch on getTypeID() is equivalent to isa<>, but more efficient than a chain of if's when doing multiple tests. If you only care about whether it's first class or not, you can just call InnerTy->isFirstCla...
2008 Nov 13
3
[LLVMdev] Using isa with derived types
Hello, I am writing an optimization pass which optimizes code based on an online pointer analysis algorithm and need to detect pointers which are pointing to derived types. I have not had any problem identifying pointers in general using isa<PointerType>(...), but I can't seem to figure out how I can make sure that the pointer is pointing to a scalar value and not a function, array,
2004 Dec 03
1
[Fwd: [LLVMdev] GetElementPtr for packed types and VS build]
...onst PackedType *PTy = cast<PackedType>(Ty); > + getTypeInfo(PTy->getElementType(), TD, Size, Alignment); > + unsigned AlignedSize = (Size + Alignment - 1)/Alignment*Alignment; > + Size = AlignedSize*PTy->getNumElements(); > + return; > + } > case Type::StructTyID: { > // Get the layout annotation... which is lazily created on demand. > const StructLayout *Layout = TD->getStructLayout(cast<StructType>(Ty)); > Index: lib/VMCore/Type.cpp > =================================================================== > RCS file: /var/cvs...
2006 Dec 08
0
[LLVMdev] Proposed: first class packed structures
...' that StructType stores this bit in. @@ -196,10 +200,12 @@ public: // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const StructType *T) { return true; } static inline bool classof(const Type *T) { return T->getTypeID() == StructTyID; } + + virtual bool isPacked() const { return packed; } This doesn't need to be virtual. --- lib/VMCore/AsmWriter.cpp 6 Dec 2006 06:40:49 -0000 1.226 +++ lib/VMCore/AsmWriter.cpp 6 Dec 2006 18:03:06 -0000 @@ -286,18 +286,22 @@ static void calcTypeName(const Type *Ty, Result += &q...
2012 Sep 04
2
[LLVMdev] [NVPTX] Backend cannot handle array-of-arrays constant
...rect. NVPTX does not crash anymore and produces correct result with the following change: --- NVPTXAsmPrinter.cpp 2012-09-03 15:14:00.000000000 +0200 +++ 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());...
2012 Sep 06
0
[LLVMdev] [NVPTX] Backend cannot handle array-of-arrays constant
...d produces correct result with the following change: > > --- NVPTXAsmPrinter.cpp 2012-09-03 15:14:00.000000000 +0200 > +++ 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->getTyp...
2006 Dec 06
4
[LLVMdev] Proposed: first class packed structures
Currently, Structure layout is left to targets, which implement them according to the ABI of that platform. While this is fine for most structures, it makes packed structures very ugly. All fields in a packed type must be converted to byte arrays with casts to access fields, which bloats accesses and obsfucates the types. First class support for packed types would clean up the generated code
2008 Dec 08
1
[LLVMdev] Using isa with derived types
...if (const PointerType *PTy = dyn_cast<PointerType>(...)) { > const Type *InnerTy = PTy->getElementType(); > switch (InnerTy->getTypeID()) { > case Type::ArrayTyID: > ... > case Type::FunctionTyID: > ... > case Type::StructTyID: > ... > case Type::IntegerTyID: > ... > } > } > > -- View this message in context: http://www.nabble.com/Using-isa-with-derived-types-tp20472959p20903806.html Sent from the LLVM - Dev mailing list archive at Nabble.com.
2010 Mar 29
0
[LLVMdev] Union types
...e/Constants.cpp =================================================================== --- lib/VMCore/Constants.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()...
2012 Sep 04
0
[LLVMdev] [NVPTX] Backend cannot handle array-of-arrays constant
NVCC successfully handles the same IR, if we try to process the same .cu file with clang+nvptx and nvcc: CLANG/NVPTX: ============= $ cat dayofweek.cu __attribute__((device)) char yweek[7][4] = { "MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN" }; $ clang -cc1 -emit-llvm -fcuda-is-device dayofweek.cu -o dayofweek.ll $ cat
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
2007 Feb 05
0
[LLVMdev] automatically generating intrinsic declarations
On Mon, 5 Feb 2007, Dan Gohman wrote: > LLVM knows what all the types of the intrinsic functions are; I thought, > why are users (including llvm-gcc...) required to duplicate all this > information in order to use them? I mean in order to call > getOrInsertFunction to get declarations for them. That is an excellent question! :) In the bad old days, we used to allow intrinsics
2010 Mar 15
0
[LLVMdev] [patch] Writing ConstantUnions
...gt;(Ty)->getElementType(); -------------- next part -------------- Index: lib/Target/TargetData.cpp =================================================================== --- lib/Target/TargetData.cpp (revision 98552) +++ lib/Target/TargetData.cpp (working copy) @@ -460,6 +460,15 @@ case Type::StructTyID: // Get the layout annotation... which is lazily created on demand. return getStructLayout(cast<StructType>(Ty))->getSizeInBits(); + case Type::UnionTyID: { + const UnionType *UnTy = cast<UnionType>(Ty); + uint64_t Size = 0; + for (UnionType::element_iterator i =...
2012 Sep 03
2
[LLVMdev] [NVPTX] Backend cannot handle array-of-arrays constant
Dear all, Looks like the NVPTX backend cannot handle array-of-arrays contant (please see the reporocase below). Is it supposed to work? Any ideas how to get it working? Important for our target applications. Thanks, - Dima. $ cat test.ll ; ModuleID = '__kernelgen_main_module' target datalayout =