[LLVMdev] How To Get The Name of the type the popinter is pointing to

NAKAMURA Takumi geek4civic at gmail.com
Thu Sep 20 21:34:27 PDT 2012


2012/9/21 amitjai <amitjaiswal.knit at gmail.com>:
> i am using llvm ,
> i did this
>
>                         if (  AllocaInst *allocInst =
> dyn_cast<AllocaInst>(&*bbit)){
>                                 PointerType *p = allocInst->getType();
>                                 if ( p->getElementType()->isPointerTy()){
>                                         StringRef name =
> allocInst->getName();
>                                         Type *type =
> allocInst->getOperand(0)->getType();;

(AllocaInst)getOperand(0) is "array size". It must be
(ConstantInt)(i32 1) in most case.
Please try AllocaInst::getAllocatedType().

...Takumi



More information about the llvm-dev mailing list