[LLVMdev] Using isa with derived types
Eli Friedman
eli.friedman at gmail.com
Mon Dec 8 14:22:07 PST 2008
On Mon, Dec 8, 2008 at 1:22 PM, Zappel-Phillip <phillip.wright at yahoo.com> wrote:
>
> I believe I failed to ask the question properly, I am not trying to determine
> whether the elements of an array are scalar type. Instead, I want to be able
> to iterate over the function's parameters and determine whether a pointer
> argument is actually an array being passed which contains scalar values, or
> simply a pointer with a single scalar value. In other words, I want to
> ignore functions that accept arrays as arguments.
If I'm following correctly, you want to distinguish between "int
a(char* x)" and "int a(char x[])"? That's impossible purely looking
at types; C itself doesn't distinguish between them.
One somewhat effective approach would be to look at the users of the
argument; if the argument only gets used directly by load and store
instructions (i.e. the function never manipulates or stores away the
pointer), the function is treating it as a pointer. In general,
though, it's impossible to distinguish the two cases.
-Eli
More information about the llvm-dev
mailing list