search for: gettypeid

Displaying 20 results from an estimated 64 matches for "gettypeid".

Did you mean: gettype
2009 Apr 07
3
[LLVMdev] Patch: MSIL backend global pointers initialization
...or this but I'll > > appreciate any hints. > Why do you need this? Won't be enough just to compare function types? I do something like this: static bool areSame(Instruction *A, Instruction *B) { if (A->getOpcode() != B->getOpcode()) return false; if (A->getType()->getTypeID() != B->getType()->getTypeID()) return false; unsigned int a = A->getNumOperands(); if (a != B->getNumOperands()) return false; for (unsigned int i = 0; i < a; ++i) if (A->getOperand(i)->getType()->getTypeID() != B->getOperand(i)->getType()->getTypeI...
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...
2010 Jan 18
5
[LLVMdev] [patch] Union Types - work in progress
...patch, please don't :) Funky indentation in ConstantUnion::replaceUsesOfWithOnConstant and implementation missing :) In UnionValType methods, please use "UT" instead of "ST" as an acronym. +bool UnionType::isValidElementType(const Type *ElemTy) { + return ElemTy->getTypeID() != VoidTyID && ElemTy->getTypeID() != LabelTyID && + ElemTy->getTypeID() != MetadataTyID && ! isa<FunctionType>(ElemTy); +} Please use "!ElemTy->isVoidTy()" etc. --- lib/VMCore/ConstantsContext.h (revision 93451) +template<> +st...
2008 Apr 21
3
[LLVMdev] newbie question for type comparison
...methods, get ALL struct 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...
2010 Jan 28
0
[LLVMdev] [patch] Union Types - work in progress
...> Funky indentation in ConstantUnion::replaceUsesOfWithOnConstant and > implementation missing :) > > In UnionValType methods, please use "UT" instead of "ST" as an acronym. > > +bool UnionType::isValidElementType(const Type *ElemTy) { > + return ElemTy->getTypeID() != VoidTyID && ElemTy->getTypeID() != > LabelTyID && > + ElemTy->getTypeID() != MetadataTyID && > !isa<FunctionType>(ElemTy); > +} > > Please use "!ElemTy->isVoidTy()" etc. > > --- lib/VMCore/ConstantsContext.h...
2009 Apr 07
0
[LLVMdev] Patch: MSIL backend global pointers initialization
Hi, Artur > %1 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr ([16 x > i8]* @.str, i32 0, i32 0), i32 %0) nounwind > %10 = call i32 (i8*, ...)* @printf(i8* noalias getelementptr ([11 x i8]* > @.str2, i32 0, i32 0), i32 5) nounwind > > Instruction::isSameOperationAs() returns false for those two. Is it a > bug or I misunderstood something? These are two
2008 Apr 21
0
[LLVMdev] newbie question for type comparison
Gordon Henriksen wrote: > 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 b...
2008 Apr 21
0
[LLVMdev] newbie question for type comparison
...n 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: > I'm not sure why the above doesn't work. My best guess is that the allocated type is not an operand (since it...
2009 Apr 06
2
[LLVMdev] Patch: MSIL backend global pointers initialization
Hi Anton, Anton Korobeynikov wrote: > Minor comments: > Thanks for your comments and your patience, I'll now check the style four times before I send anything ;) >> + Instruction *instr = >> + const_cast<Instruction*>(dynamic_cast<const >> Instruction*>(*i)); >> > Sounds hacky. Why do you need to cast away const?
2009 Apr 07
0
[LLVMdev] Patch: MSIL backend global pointers initialization
...t you'll obtain the "declaration" (=variadic) type of the callee. This should be enough for almost all purposes. You should not try to invent some custom "comparison schemes", almost surely in such situation you're reinventing the wheel :) > if (A->getType()->getTypeID() != B->getType()->getTypeID()) return false; TypeID is internal thing for type. All types are unique inside LLVM, so you should just compare Type*'s. > if (A->getOperand(i)->getType()->getTypeID() > != B->getOperand(i)->getType()->getTypeID()) return fa...
2004 Jul 01
1
[LLVMdev] Add assert in llvm::StroreInst::init and llvm::LoadInst::init
I'm make silly error (swap arguments in llvm::StroreInst constructor call: llvm::Value* var = genExpr(bb,*varExpr,false); llvm::Value* val = genExpr(bb,*valExpr,true ); llvm::StoreInst* lStore = new llvm::StoreInst(var,val,bb); instead assert(var && var->getType()->getTypeID()==llvm::Type::PointerTyID && "var side isn't pointer type"); llvm::StoreInst* lStore = new llvm::StoreInst(val,var,bb); For val with type T* and var with type T** error catched in verifier: Stored value type does not match pointer operand type! store "Type10::C...
2008 Nov 07
2
[LLVMdev] non-pointer gcroot
...#39;m not sure how to. Can anyone suggest what should go at "todo; something here"? ... for (AllocaInst **I = Roots, **E = Roots + Count; I != E; ++I) if (!InitedRoots.count(*I)) { const Type* Ty = cast<PointerType>((*I)->getType())->getElementType(); if (Ty->getTypeID() == Type::PointerTyID) { new StoreInst(ConstantPointerNull::get(cast<PointerType>(Ty)), *I, IP); } else { // todo; something here } MadeChange = true; } ... thanks, scott
2010 Jan 28
0
[LLVMdev] [patch] Union Types - work in progress
...> Funky indentation in ConstantUnion::replaceUsesOfWithOnConstant and > implementation missing :) > > In UnionValType methods, please use "UT" instead of "ST" as an acronym. > > +bool UnionType::isValidElementType(const Type *ElemTy) { > + return ElemTy->getTypeID() != VoidTyID && ElemTy->getTypeID() != > LabelTyID && > + ElemTy->getTypeID() != MetadataTyID && > !isa<FunctionType>(ElemTy); > +} > > Please use "!ElemTy->isVoidTy()" etc. > > --- lib/VMCore/ConstantsContext.h...
2008 Nov 13
0
[LLVMdev] Using isa with derived types
...value and not a function, > array, struct, etc. > > What am I missing? Please see the doxygen: http://llvm.org/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 doi...
2008 Nov 08
0
[LLVMdev] non-pointer gcroot
...suggest what should go at "todo; something here"? > > ... > for (AllocaInst **I = Roots, **E = Roots + Count; I != E; ++I) > if (!InitedRoots.count(*I)) { > const Type* Ty = cast<PointerType>((*I)->getType())- > >getElementType(); > if (Ty->getTypeID() == Type::PointerTyID) { > new StoreInst(ConstantPointerNull::get(cast<PointerType>(Ty)), > *I, IP); > } else { > // todo; something here > } > MadeChange = true; > } > ... Hi Scott, Using the new support for first-class aggregate valu...
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,
2008 Apr 21
2
[LLVMdev] newbie question for type comparison
...ere $struct.S is defined 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 Target...
2014 Jan 22
2
[LLVMdev] MergeFunctions: reduce complexity to O(log(N))
On 2014 Jan 22, at 07:35, Stepan Dyatkovskiy <stpworld at narod.ru> wrote: > Hi Raul and Duncan, > > Duncan, > Thank you for review. I hope to present fixed patch tomorrow. > > First, I would like to show few performance results: > > command: "time opt -mergefunc <test>" > > File: tramp3d-v4.ll, 12963 functions > Current
2011 Mar 28
2
[LLVMdev] regarding function pointer pass
...program. I could detect function pointer calls using the getCalledFunction(). However,i am stuck in identifying function pointer declaration and use. is there a way one can distinguish between data and function pointers in llvm? I tried the following, I->getType()->getElementType()->getTypeID() but this always returns me 12 i.e pointer type id (for pointers) irrespective if the pointer is a data or a function pointer. Kindly let me know where i am going wrong. Regards, Netra Mtech,CSE,IIT BOMBAY
2010 Jan 16
0
[LLVMdev] [patch] Union Types - work in progress
OK here's the patch for real this time :) On Fri, Jan 15, 2010 at 4:36 PM, Talin <viridia at gmail.com> wrote: > Here's a work in progress of the union patch. Note that the test "union.ll" > does not work, so you probably don't want to check this in as is. However, > I'd be interested in any feedback you're willing to give. > > -- > -- Talin