On Fri, May 3, 2013 at 12:26 AM, Richard Sandiford <rdsandif...@googlemail.com> wrote: > "Steve Ellcey " <sell...@imgtec.com> writes: >> MIPS architectures set TARGET_PROMOTE_PROTOTYPES to true. I would like >> to have an option to set this to false in order to avoid extra masking >> when passing char or short types. I don't think we can change this by >> default since it would affect the ABI, but I would like to allow users >> the option of turning if off if desired. >> >> Tested on mips-mti-elf. OK for checkin? >> >> Steve Ellcey >> sell...@imgtec.com >> >> >> 2013-05-02 Steve Ellcey <sell...@imgtec.com> >> >> * config/mips/mips.c (mips_promote_prototypes) :New. >> (TARGET_PROMOTE_PROTOTYPES): Change to use mips_promote_prototypes. >> * config/mips/mips.opt (mpromote-prototypes): New. > > It'd need an invoke.texi change too. > > The ABI thing is a problem though. Unlike the recent -mimadd option, > this isn't something a user could reasonably turn on and off for > individual files to see what happens. They'd need to rebuild all > their libraries with it. And as written, the patch provides no way > to compile gcc's own libraries that way, so they'd need to patch the > gcc sources locally. > > If you want to change the TARGET_PROMOTE_PROTOTYPES part of the > ABI for mips*-mti-elf then that would be OK with me. It would > be better done without a command-line option. > > I'm less keen on adding -mpromote-prototypes to mips*-mti-elf, > both because of the large number of variations there already, > and because continuing to have -mno-promote-prototypes multilibs > would give the impression that the change isn't much of a win. > > Ideally we'd also have a .gnu_attribute to record which promotion > rules are being used, so that the linker can pick up incompatibilities. > > Sorry to be a pain...
An alternative approach would be to change the default for local, non-exported functions only. Similar to how the i386 backend chooses different argument passing conventions if it doesn't affect the ABI. You'd see the most effect when using -flto only, of course. Richard. > Thanks, > Richard