This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: varargs target handling


Iceman wrote:
Question. Am I doing it wrong? If yes, what are my best options to tackle this problem?
If not, how can I implement the logic above in practical terms?
Thank you,

stdarg (varargs is obsolete by the way) can be done this way. There are a number of examples you can look at. See for instance the mips and rs6000 ports.


Alternatively, you can choose to use a simpler ABI for stdarg functions. You can choose to put all unnamed 64-bit arguments into the 32-bit registers, then you only have one register set to save and scan through. This does require that a stdarg function always have a prototype in scope when you call it, but the C standard has required that since 1989, so it shouldn't be a problem. Many targets implement stdarg this way. See for instance the mips and rs6000 ports, which use this scheme for some ABIs, and the more complicated scheme above for other ABIs.

Jim


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]