public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* user sets ABI
@ 2023-07-06 22:27 André Albergaria Coelho
  2023-07-07  8:26 ` David Brown
  0 siblings, 1 reply; 2+ messages in thread
From: André Albergaria Coelho @ 2023-07-06 22:27 UTC (permalink / raw)
  To: gcc

What if the user chooses in own ABI, say specifying a config file like

My abi

" Parameters = pushed in stack"


say

gcc -abi "My abi" some.c -o some

what would be the problems of specifying an ABI?? would that improve the 
usage of user? less complex / more

simpler for user (say user is used to code asm in a way)


thanks

later


andre


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: user sets ABI
  2023-07-06 22:27 user sets ABI André Albergaria Coelho
@ 2023-07-07  8:26 ` David Brown
  0 siblings, 0 replies; 2+ messages in thread
From: David Brown @ 2023-07-07  8:26 UTC (permalink / raw)
  To: André Albergaria Coelho, gcc

On 07/07/2023 00:27, André Albergaria Coelho via Gcc wrote:
> What if the user chooses in own ABI, say specifying a config file like
> 
> My abi
> 
> " Parameters = pushed in stack"
> 
> 
> say
> 
> gcc -abi "My abi" some.c -o some
> 
> what would be the problems of specifying an ABI?? would that improve the 
> usage of user? less complex / more
> 
> simpler for user (say user is used to code asm in a way)
> 


You can fiddle things a bit, using the -ffixed-reg, -fcall-used-reg and 
-fcall-saved-reg flags:

<https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html>

This is almost certainly a bad idea for most situations - you really 
have to have a special niche case to make it worth doing.  The register 
allocation algorithms in GCC are complex, and I would expect changing 
these settings would give you less efficient results.  And of course it 
will mess up all calls to any code compiled with different settings - 
such as library code.

A far better solution is for the user who is used to coding in assembly, 
to get used to coding in C, C++, or other languages supported by GCC. 
If you really need some assembly, as happens occasionally, then learn 
about GCC's extended syntax inline assembly.  That lets GCC worry about 
details such as register allocation and operands, so that your assembly 
is minimal, and allows the assembly to work well along with the compiler 
optimisation.

If you have legacy assembly functions that are written to a non-standard 
calling convention, write a thunk to translate as necessary.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-07  8:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-06 22:27 user sets ABI André Albergaria Coelho
2023-07-07  8:26 ` David Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).