This is the mail archive of the
mailing list for the GCC project.
Re: TARGET_PROMOTE_PROTOTYPES question
- From: "Maciej W. Rozycki" <macro at imgtec dot com>
- To: Jeff Law <law at redhat dot com>
- Cc: Steve Ellcey <sellcey at imgtec dot com>, <gcc at gcc dot gnu dot org>
- Date: Mon, 26 Oct 2015 20:31:00 +0000
- Subject: Re: TARGET_PROMOTE_PROTOTYPES question
- Authentication-results: sourceware.org; auth=none
- References: <7030b197-a603-45b7-84bf-4586a03e919c at BAMAIL02 dot ba dot imgtec dot org> <56279448 dot 4030409 at redhat dot com>
On Wed, 21 Oct 2015, Jeff Law wrote:
> > Now I know that we can't get rid of these truncation/extensions
> > entirely, but do we need both? It seems like foo could say that
> > if the original registers (198 and 200) are argument registers
> > that were extended to SImode due to TARGET_PROMOTE_PROTOTYPES
> > then we don't need to do the truncation/extension in the callee
> > and could just use the SImode values directly. Am I missing
> > something? Or are we doing both just to have belts and suspenders
> > and want to keep it that way?
> From reading the docs for TARGET_PROMOTE_PROTYPES, it would seem like it's the
> caller's responsibility.
> However, it's not clear from the docs if it's something the callee can rely
> on, particularly when interoperating with a non-GCC compiler.
> Does the ABI say anything about sub-word argument handling on the caller or
> callee side?
The 32-bit (o32) MIPS psABI does:
"All integer-valued arguments are passed as 32-bit words, with signed or
unsigned bytes and halfwords expanded (promoted) as necessary."
The 64-bit documents then say:
"All integer parameters are promoted (that is, sign- or zero-extended to
64-bit integers and passed in a single register). Normally, no code is
required for the promotion."
Which I understand as making the caller responsible for the promotion.
 "SYSTEM V APPLICATION BINARY INTERFACE, MIPS RISC Processor
Supplement, 3rd Edition", "Argument Passing", p. 3-18
 "MIPSpro 64-Bit Porting and Transition Guide", "Native 64-Bit
Subprogram Interface for MIPS Architectures", p. 21
 "MIPSpro N32 ABI Handbook", "N32 and Native 64-Bit (N64) Subprogram
Interface for MIPS Architectures", p. 5