lightning
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Lightning] Omit frame pointer


From: Paulo César Pereira de Andrade
Subject: Re: [Lightning] Omit frame pointer
Date: Mon, 4 Sep 2017 15:57:12 -0400

2017-09-03 11:32 GMT-04:00 Marc Nieper-Wißkirchen <address@hidden>:
> Some architectures like the x86 (32 bits or 64 bits with System V ABI) have
> only very few registers available. For those architectures it makes a lot of
> sense to make the frame pointer available as another callee-saved register.

  Lightning already makes available the JIT_FP register. So, one can use
it as a general purpose register, as long as it is restored before epilog and
properly used with jit_alloca*.

> (This mimicks the GCC option -fomit-frame-pointer.)
>
> For this to work, the stack pointer is used to access the locations in the
> current frame. The value returned by the allocai instruction will be
> adjusted because it will be relative to the stack pointer, not the frame
> pointer.
>
> Would this introduce any limitations to the code produced?

  This would require a far more complex function body analysis, as the
point of omit-frame-pointer would be to make a shorter prolog/epilog. If
jit_allocar were used (run time alloca) it would still need to save the
frame pointer. For lightning, larger function bodies are better, as it indeed
does not do a very good job optimizing prolog/epilog.
  It probably would require an API change to have jit_allocai receiving
a "node" argument, to be patched later with the proper offset, like
labels for branches.

> Marc

Thanks,
Paulo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]