Reputation: 333
suppose I have the following LLVM IR
define void @foo(i32* %a, i32* %m) nounwind { ...
and I call foo by passing an array for the first arg and passing a variable's address for m. Now, I need to analyse the arg list of foo and determine which arg is passed an array, and which is simply a pointer address. I know that both are in fact addresses, but does LLVM provide some sort of metadata so that I can statically determine the type passed in.
Note: I am writing an opt pass
Upvotes: 0
Views: 139
Reputation:
You probably can use the "pointer to array" type instead:
define void @foo([0 x i32]* %a, i32* %m)
Zero-sized array is perfectly valid and the llvm documentation says that:
There is no restriction on indexing beyond the end of the array implied by a static type
Upvotes: 1