[LLVMdev] What is a FunctionType really?

David Blaikie dblaikie at gmail.com
Sun Nov 18 10:07:52 PST 2012


On Sun, Nov 18, 2012 at 9:55 AM, edA-qa mort-ora-y <eda-qa at disemia.com> wrote:
> On 18/11/12 18:37, David Blaikie wrote:
>> Types, function or otherwise, have no in-memory representation. They
>> merely describe how bits should be interpreted.
>
> This is what I'm asking about the FunctionType. If I have a Pointer to a
> FunctionType

It's a pointer of some FunctionType (ie: it points to a function),
rather than a pointer to a FunctionType (it doesn't point to
FunctionType).


Unless you're literally talking about a "FunctionType*", which is a
pointer /to/ a FunctionType, but that doesn't exist in the running
LLVM code.

> it is clear how the bits should be interpreted, but what
> does the FunctionType it self say about the bits, if anything?

If you have a pointer of FunctionType then the FunctionType tells you
how you call that function (ie: with how many arguments & of what
type).

> In terms of use, can I create variables which are of FunctionType directly?

values in the SSA sense, or variable in the LLVM C++ API sense?

An SSA value of FunctionType is an llvm::Function.

As for variables in the LLVM C++ API sense, no, you get FunctionType*s
from FunctionType::get, you don't have direct FunctionType variables,
only pointers to them.

>
> --
> edA-qa mort-ora-y
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> Sign: Please digitally sign your emails.
> Encrypt: I'm also happy to receive encrypted mail.
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>



More information about the llvm-dev mailing list