On 07/20/2015 03:19 PM, Nathan Sidwell wrote:
I was looking at adding another target builtin, and found this code rather convoluted. It seemed to have been cloned from somewhere more complicated -- for instance, nvptx_expand_binop_builtin's comment discusses a MACFLAG argument, which is nowhere to be seen.
Okay, I admit to tuning out comments for code that I know, and I didn't notice that one. As for being convoluted - this is pretty much the standard structure for the machine specific builtins which is used in a lot of ports.
I ended up reimplementing using a single array describing the builtins and allowing direct indexing using the builtin number, rather than iteration when expanding.
If you really want to, that's fine, but note the point about consistency with other ports.
Bernd