I'm trying to detect array declarations and build a symbol value table for static sized arrays. It will contain a name-arraySize pairing. I have several questions:
Given an instruction such as
%a = alloca [200 x i8], align 16
how can I extracta, the name of the array from it?I'm trying to extract the
200as the array size but this code:if(AllocaInst *allocInst = dyn_cast<AllocaInst>(&*I)){ PointerType *p = allocInst->getType(); if(p->getElementType()->isArrayTy()){ Value* v = allocInst->getOperand(0); errs() << *v ; } }yields me
i32 1when I printv.
Does anyone know why this is?
I didn't think there was anything 32bit about this except maybe the address.