[LLVMdev] Function Parameter Requirements?

Duncan Sands baldrick at free.fr
Sun Mar 30 15:09:08 PDT 2008


Hi,

> I'm trying to find the requirements for function parameters in the 
> documentation.  The assembler rejects 'i32({i32,i32})' with the error 
> 'Function arguments must be value types!' so I'm guessing that each 
> parameter type must be a first-class type.

they must be first-class types or opaque types.

> The assembler also rejects  
> '{i32,i32}(i32)' with the error 'LLVM Functions cannot return 
> aggregates'.  This error seems to contradict the documentation which 
> states 'The return type of a function type is a scalar type or a void 
> type or a struct type'.

The documentation is based on svn head, which is currently getting
support for functions returning multiple values.  This is done by
having the function return a struct type (the struct type cannot
contain other structs: first-class types only).

> Finally, I suggest defining these additional terms in the 
> type-classification section:
> - value type
> - scalar type
> - aggregate type

Good idea.  Want to prepare a patch?

Best wishes,

Duncan.



More information about the llvm-dev mailing list