[llvm-dev] [RFC] Introduce new call-site attribute

Evgueni Brevnov via llvm-dev llvm-dev at lists.llvm.org
Wed Sep 1 06:31:28 PDT 2021


Hi Everyone,

Introduction:
On Intel x86_64 architecture you can make a call using either relative 32
bits offset or absolute address. Currently LLVM uses a notion of "code
model" that defines which version will be generated. In other words, for
small and medium code models 32 bits relative calls are generated, for
large code model calls via an absolute address are generated. The thing is
that a single lowering scheme is used for the entire compilation unit and
there is no way to specialize for a particular call. In managed
environments (JIT compilers) we have control where specific functions are
loaded in memory and can guarantee that particular call site is within
32-bits offset. We would like to use  relative calls for such functions
while the global code model is set to 'large'.

Proposal:
Introduce 'fits-32bits' call site attribute. For calls marked with the
attribute compiler may assume the target address is within 32-bits offset
from the end of the generated call. Program semantics is not changed if it
is ignored by the compiler.The attribute overrides the current code model
for the specific call site.

Thanks
Evgeniy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210901/97ed2e1e/attachment.html>


More information about the llvm-dev mailing list