[RFC] prototype altivec function overloading rewrite

Paolo Bonzini bonzini@gnu.org
Wed Apr 14 07:46:00 GMT 2004


> The following allows a backend to intercept places in which the front-end
> builds a call to a target-specific builtin, and lets it generate anything
> it likes.  Kinda gross, as it's the sort of thing that's ripe for abuse,
> but it does allow us to implement a kind of function overloading in C.

Do you think it would be possible to do so using a fold_builtin target hook
which folds the overloaded function calls into the standard builtins?  Or is
it too late in fold_builtin to check types properly (as Aldy suggested)?  I
have a prototype that implements vec_step and has the machinery to resolve
types in fold_builtin, but I went to bed and had no time to test how types are
actually resolved.  If you decide it would be less gross, I could go on from
this approach instead of your expand_overloaded_builtin -- I'll do some tests.

> Cause otherwise the table approach that I'm
> using is gonna get pretty large.

Still smaller than altivec.h, and concentrated in the compiler rather than in
user code.

Paolo




More information about the Gcc-patches mailing list