search for: allocated_typ

Displaying 7 results from an estimated 7 matches for "allocated_typ".

Did you mean: allocated_type
2009 Oct 20
3
[LLVMdev] Dereference PointerType?
...llocaInst and although I can find the number of elements allocated, (using Instruction::getOperand(0)), I can't find a way to get the size of each element. What I'd like to do is: AllocaInst *alloca; PointerType *ptr_type = dynamic_cast<PointerType*>(alloca); assert(ptr_type); Type *allocated_type = ptr_type->dereference(); // this is the operation that doesn't seem to exist. size_t size; if (isa<PointerType>(allocated_type)) { size = sizeof(void*) * 8; } else { size = allocated_type->getPrimitiveSizeInBits(); } // size now equals the size (in bits) of the type allocated...
2009 Oct 20
0
[LLVMdev] Dereference PointerType?
...number of elements allocated, (using > Instruction::getOperand(0)), I can't find a way to get the size of each > element. What I'd like to do is: > > AllocaInst *alloca; > > PointerType *ptr_type = dynamic_cast<PointerType*>(alloca); > assert(ptr_type); > Type *allocated_type = ptr_type->dereference(); // this is the operation > that doesn't seem to exist. > size_t size; > if (isa<PointerType>(allocated_type)) { > size = sizeof(void*) * 8; > } else { > size = allocated_type->getPrimitiveSizeInBits(); > } > // size now equals...
2009 Oct 20
2
[LLVMdev] Dereference PointerType?
Daniel Waterworth <da.waterworth at googlemail.com> writes: [snip] Use the getElementType method of PointerType. >> size_t size; >> if (isa<PointerType>(allocated_type)) { >> size = sizeof(void*) * 8; >> } else { >> size = allocated_type->getPrimitiveSizeInBits(); >> } >> // size now equals the size (in bits) of the type allocated This looks suspicious to me. Maybe you intented if (isa<PointerType>(allocated_type)) {...
2009 Oct 20
4
[LLVMdev] Dereference PointerType?
...<baldrick at free.fr> > Óscar Fuentes wrote: > >> Daniel Waterworth <da.waterworth at googlemail.com> writes: >> >> [snip] >> >> Use the getElementType method of PointerType. >> >> size_t size; >>>> if (isa<PointerType>(allocated_type)) { >>>> size = sizeof(void*) * 8; >>>> } else { >>>> size = allocated_type->getPrimitiveSizeInBits(); >>>> } >>>> // size now equals the size (in bits) of the type allocated >>>> >>> >> This looks suspicio...
2009 Oct 20
1
[LLVMdev] Dereference PointerType?
Hi Daniel, > Type *allocated_type = ptr_type->dereference(); // this is the > operation that doesn't seem to exist. Type *allocated_type = ptr_type->getElementType(); Ciao, Duncan.
2009 Oct 20
0
[LLVMdev] Dereference PointerType?
Óscar Fuentes wrote: > Daniel Waterworth <da.waterworth at googlemail.com> writes: > > [snip] > > Use the getElementType method of PointerType. > >>> size_t size; >>> if (isa<PointerType>(allocated_type)) { >>> size = sizeof(void*) * 8; >>> } else { >>> size = allocated_type->getPrimitiveSizeInBits(); >>> } >>> // size now equals the size (in bits) of the type allocated > > This looks suspicious to me. Probably he wants getTypeAllocSize...
2009 Oct 20
0
[LLVMdev] Dereference PointerType?
...ed it becomes a type i32* > and > ; the size of that is sizeof(void *) bytes What Duncan says is that any valid method for obtaining the size of a Type should work for a PointerType, which is just another kind of Type. >>>>> if (isa<PointerType>(allocated_type)) { >>>>> size = sizeof(void*) * 8; >>>>> } else { >>>>> size = allocated_type->getPrimitiveSizeInBits(); >>>>> } >>>>> // size now equals the size (in bits) of the type allocated -- Óscar