Hi, everyone, the llvm LangRef gives an explanation about alloca instruction.
syntax:
<result> = alloca [inalloca] <type> [, <ty> <NumElements>]
argument:
The ‘alloca’ instruction allocates sizeof(<type>)*NumElements bytes of memory on the runtime stack, returning a pointer of the appropriate type to the program.
My question is what “ty” means before NumElements parameter,since type has given the data type,is it the type of NumElements,could anybody help me, thanks.
@mehdi_amini, thank you, so it is the type of NumElements and NumElements is a SSA value, right?
in fact, what I have seen NumElements is just a number, constant.
%1 = alloca i32, i32 8
Could you tell me the way you find the code, maybe next time I can find answer in llvm src code by myself
Constant is a subclass of Value
in LLVM. You could have something else here, like here for example: https://github.com/llvm/llvm-project/blob/master/llvm/test/CodeGen/VE/Scalar/alloca.ll#L22
OK, I get it, thank you. Could you tell me the way you find the code, maybe next time I can find answer in llvm src code by myself.
git grep 'alloca.*%' llvm/test
; it is easier when you know what to look for 