[LLVMdev] RefineAbstractType

David Greene dag at cray.com
Wed Nov 12 14:59:02 PST 2008


Is there some reason that RefineAbstractType doesn't recurse down DerivedTypes
and further resolve abstract types?

In Fortran it is possible to have a routine that takes a function pointer to a 
routine with the same signature.  This is not possible to express in C/C++.
I'm not sure it's possible to express in LLVM either without using varargs
(opinions welcome).

In a simpler C++ example, we end upcreating a function pointer type:

void (...) * (opaque *)

We want to resolve "opaque" to be

void (...)

Note that this isn't the same issue as in Fortran (it's not a recursive type) 
but it serves the purpose for this question.

Unfortunately, calling FunctionType::refineAbstractType(opaque, void (...)) 
doesn't work because RefineAbstractType doesn't recurse down into the
pointee types.  It ends up giving back

void (...) * (opaque *)

so it didn't resolve anything.

It's not clear how to fix this without a core LLVM change because the pointee
depth could be arbitrary (pointer to pointer to pointer...).

Thoughts?

                                           -Dave



More information about the llvm-dev mailing list