Optimized local call conventions

By: Adrian (a.delete@this.acm.org), July 3, 2021 10:04 pm
Room: Moderated Discussions
anon2 (anon.delete@this.anon.com) on July 3, 2021 12:10 am wrote:
> Adrian (a.delete@this.acm.org) on July 2, 2021 10:03 pm wrote:
> >
> >
> > I am not sure whether your question was about compilers choosing a call
> > convention by themselves, or only when the programmer specifies that.
>
> The former. And to rwessel's comment yes I do know about IPA including register allocation
> in literature (it was a usual if not highly detailed chapter of basic compiler books
> decades ago IIRC). I just wonder if any (common) compilers do it today.
>
> >
> >
> > In old 32-bit x86 libraries written in C or C++, it was not uncommon to have a
> > mix of calling conventions, with the calling convention specified for each function
> > by the programmer, using attributes like "fastcall", "pascal" or "cdecl".
> >
> >
> > There are also compilers for various programming languages
> > that have the option to do "whole program optimization".
> >
> > If that is chosen, then the compiler translates the compilation units from all the source files
> > simultaneously, generating the complete executable file, so the compiler is free to choose for
> > each function a custom calling convention, i.e. each function may use different registers for
> > passing the arguments and it may also save different registers than other functions.
>
> I am most interested in C / "ELF" ABI type of compilers here, but would
> be interesting to hear about others too. Which ones do this?


While I have heard of some others, the one that I have used is the MLton compiler for the Standard ML language:

https://web.archive.org/web/20070629215827/http://mlton.org/pages/References/attachments/060916-mlton.pdf


https://github.com/MLton/mlton



>
> >
> >
> > While the current compilers for more mainstream programming languages like C/C++ also have some options
> > for "whole program optimization" or LTO, those are more limited and I do not have experience with them,
> > so I do not know if they also may use customized calling conventions for some functions.
> >

Using -fwhole-program and -flto with gcc and similar options with clang is supposed to allow interprocedural optimizations, which should result in non-standard calling conventions.

However, I have not used these options until now, so I do not know if they really can cause the use of calling conventions significantly different from the ABI, e.g. with allocating different registers for arguments in every function or just in avoiding to save and restore registers when that is not necessary.









< Previous Post in ThreadNext Post in Thread >
TopicPosted ByDate
Interesting ARM compatibility shim for Windows 11Beastian2021/07/01 02:48 PM
  Interesting ARM compatibility shim for Windows 11Groo2021/07/01 03:44 PM
  Interesting ARM compatibility shim for Windows 11Doug S2021/07/01 08:20 PM
    Interesting ARM compatibility shim for Windows 11Mark Roulo2021/07/01 08:28 PM
      Interesting ARM compatibility shim for Windows 11Beastian2021/07/01 09:38 PM
        Interesting ARM compatibility shim for Windows 11Brett2021/07/02 02:45 AM
          Interesting ARM compatibility shim for Windows 11James2021/07/02 05:25 AM
          Interesting ARM compatibility shim for Windows 11dmcq2021/07/02 05:34 AM
          Interesting ARM compatibility shim for Windows 11Gabriele Svelto2021/07/02 09:02 AM
            Interesting ARM compatibility shim for Windows 11Kester L2021/07/02 09:33 AM
              Interesting ARM compatibility shim for Windows 11Jukka Larja2021/07/02 11:36 PM
                Interesting ARM compatibility shim for Windows 11Gabriele Svelto2021/07/03 05:37 AM
                  Interesting ARM compatibility shim for Windows 11Jukka Larja2021/07/03 10:38 AM
                    Interesting ARM compatibility shim for Windows 11Gabriele Svelto2021/07/03 02:07 PM
                Interesting ARM compatibility shim for Windows 11Kester L2021/07/06 07:48 AM
                  Interesting ARM compatibility shim for Windows 11Jukka Larja2021/07/06 10:46 PM
          Don't compare manufacturing unit cost with sales priceMark Roulo2021/07/02 10:07 AM
            Don't compare manufacturing unit cost with sales price---2021/07/02 11:22 AM
              Don't compare manufacturing unit cost with sales priceme2021/07/02 11:32 AM
              Don't compare manufacturing unit cost with sales priceDummond D. Slow2021/07/03 02:11 PM
          Interesting ARM compatibility shim for Windows 11anon2021/07/02 11:26 AM
            Interesting ARM compatibility shim for Windows 11Beastian2021/07/02 12:47 PM
              Interesting ARM compatibility shim for Windows 11Linus Torvalds2021/07/02 02:10 PM
                Optimized local call conventionsanon22021/07/02 07:49 PM
                  Optimized local call conventionsAdrian2021/07/02 10:03 PM
                    Optimized local call conventionsanon22021/07/03 12:10 AM
                      Optimized local call conventionsAdrian2021/07/03 10:04 PM
                  Optimized local call conventionsrwessel2021/07/02 11:44 PM
                    Optimized local call conventionsdmcq2021/07/03 01:47 PM
                  Optimized local call conventionsCarson2021/07/03 06:13 PM
                    Optimized local call conventionsanon22021/07/03 09:18 PM
                      Optimized local call conventionsCarson2021/07/04 01:23 PM
                Interesting ARM compatibility shim for Windows 11---2021/07/03 08:59 AM
                  Interesting ARM compatibility shim for Windows 11joema2021/07/03 10:37 AM
                    Interesting ARM compatibility shim for Windows 11Doug S2021/07/03 12:05 PM
                      Interesting ARM compatibility shim for Windows 11Linus Torvalds2021/07/03 12:26 PM
                        Interesting ARM compatibility shim for Windows 11Doug S2021/07/03 03:45 PM
                          Interesting ARM compatibility shim for Windows 11Michael S2021/07/03 04:54 PM
                          Interesting ARM compatibility shim for Windows 11-.-2021/07/04 06:57 AM
                            Interesting ARM compatibility shim for Windows 11---2021/07/04 09:25 AM
                            Interesting ARM compatibility shim for Windows 11Doug S2021/07/05 09:34 AM
                      Interesting ARM compatibility shim for Windows 11Foo_2021/07/04 02:25 AM
                        Interesting ARM compatibility shim for Windows 11Doug S2021/07/04 05:18 AM
                          Interesting ARM compatibility shim for Windows 11Jukka Larja2021/07/04 05:47 AM
                            Ongoing Windows 16 bit supportJames2021/07/05 02:17 AM
                              Ongoing Windows 16 bit supportgai2021/07/05 08:35 AM
                                Ongoing Windows 16 bit supportJukka Larja2021/07/05 11:11 PM
                          Interesting ARM compatibility shim for Windows 11Foo_2021/07/04 06:31 AM
                          Microsoft should drop x86 thinking...Dummond D. Slow2021/07/04 07:40 AM
                            Microsoft should drop x86 thinking...Doug S2021/07/05 09:56 AM
                              Microsoft should drop x86 thinking...Brett2021/07/05 01:47 PM
                                "DOOMED"Anon2021/07/06 01:01 AM
                                  "DOOMED"Michael S2021/07/06 03:15 AM
                                    "DOOMED"dmcq2021/07/06 04:08 AM
                                      "DOOMED"me2021/07/06 04:57 AM
                                      "DOOMED"Michael S2021/07/06 05:09 AM
                                        "DOOMED"Anon2021/07/06 05:50 AM
                                          "DOOMED"Michael S2021/07/06 06:29 AM
                                  "DOOMED"Doug S2021/07/06 08:41 AM
                                    "DOOMED"Jukka Larja2021/07/06 10:55 PM
                                      "DOOMED"Doug S2021/07/07 12:21 AM
                                Forgot about AMD?Chester2021/07/06 08:51 AM
                                dumb terminalsanonymous22021/07/06 10:51 AM
                              Microsoft should drop x86 thinking...Dummond D. Slow2021/07/06 06:40 AM
                  Interesting ARM compatibility - Procedure values?dmcq2021/07/04 03:49 AM
                    Interesting ARM compatibility - Procedure values?dmcq2021/07/04 04:18 AM
                      Interesting ARM compatibility - Procedure values?Etienne Lorrain2021/07/05 01:21 AM
                        Interesting ARM compatibility - Procedure values?dmcq2021/07/06 03:20 AM
                    Interesting ARM compatibility - Procedure values?---2021/07/04 09:42 AM
                      Interesting ARM compatibility - Procedure values?dmcq2021/07/04 02:44 PM
Reply to this Topic
Name:
Email:
Topic:
Body: No Text
How do you spell tangerine? 🍊