[LLVMdev] LLVM and Interrupt Service Routines.

Louis Gerbarg lgerbarg at gmail.com
Sat Aug 1 09:24:26 PDT 2009


On Sun, Jul 26, 2009 at 1:39 PM, Chris Lattner<clattner at apple.com> wrote:

> One really old patch that apple guys experimented in the past was a
> "slow and fast call" attribute, which you could stick on function
> declarations.  If you added it to a function, the frontend would
> generate an entry point with a standard calling convention as well as
> one with a faster in-register ABI.  Direct calls would use the fast
> entry point, but if you took the address, you'd get the address of the
> normal one.
>
> All of this was handled by the front-end, and works fine.  I think the
> patch eventually got ripped out of the compiler for other reasons
> though.

This is a very old idea indeed. At one point I hacked up an LLVM/ppc
build to use an r2 based calling convention (similiar to AIX or Mac OS
9) and then shove some glue to form externalized entry points that
were compatible with OS X calling conventions. I wish I could say I
came up with that idea, but it is entirely based on the CFM-68k Mac OS
calling conventions for indirect code
<http://devworld.apple.com/documentation/mac/runtimehtml/RTArch-33.html#HEADING33-0>.

I did it purely in the backend, but I built all functions using the
internal convention and generated slow stubs for all of them. I then
just mangle the entry point names to use the internal entry points if
they were in my compilation unit. Since the stub was only ~4
instructions per entry point on PPC that was not a big deal on
something like a G5. PIC16s have a lot less ram to work with and it
probably requires substantially different code, not just a small stub.
Conceivably one could generate ISR and non-ISR versions of every
function and then track which ones you need and throw out the rest,
but that seems pretty heavy handed.

Louis




More information about the llvm-dev mailing list