Re: [rfc] Implement support for IBM XL C for OpenCL vector ABI

Ulrich Weigand
2011-02-14T13:41:36Z

Mark Kettenis wrote:

> I didn't look too closely at the diff yet, but given that
> push_dummy_call() functions tend to be fairly complex already, would
> it be possible to move the OpenCL calling convention into a seperate
> function?

Having a completely separate function at the push_dummy_call level
would lead to significant code duplication, since most of the "regular"
data types are also available in OpenCL C. The new code just adds
support for the special vector types.

I certainly agree that those functions are quite complex already. One
reason for that is that pushing arguments is inherently stateful, and
that state is currently spread out across a significant number of local
variables in the push_dummy_call functions. This makes using subroutines
and helper functions difficult.

It seems one way towards a refactoring of those routines would be to
extract that state into an explicit data structure (along the lines of
CUMULATIVE_ARGS in GCC), and then split handling of different types
of arguments into functions of their own, passing that state around.

If this looks useful, I can work on patch along those lines ...

Bye,
Ulrich

--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com