[llvm-dev] [RFC] Introducing an explicit calling convention

Frej Drejhammar via llvm-dev
Wed, 16 Jan 2019 11:56:05 -0000

David Chisnall via llvm-dev <llvm-dev at lists.llvm.org> writes:

> On 15/01/2019 21:56, Manuel Jacob via llvm-dev wrote:
>>
>> Sometimes people complain that ABI handling in the frontend is hard
>> and that they have to duplicate (in their language’s frontend) what
>> Clang does.  However, I don’t think that pushing more of this
>> complexity into LLVM would be a good idea.  What I suggest is that
>> there should be a helper library for ABI lowering (ideally that
>> library should be used by Clang eventually).  What do you think?
>
> I would love to see this and I was hoping that some of the Swift work
> would lead to a refactored clang library that allowed you to generate
> IR corresponding to C/C++ functions.

Such a library would still have to have a way to send the low-level
information about register and stack slot mappings to the back-end. The
original proposal would have to be extended to support calling functions
with the explicit CC, but then it could serve as the target of this ABI
lowering library.

I quite like Philip Reames suggestion[1] (elsewhere in this thread) of
just providing a way to plug in an externally defined calling
convention. The ABI lowering library could produce such plugins and we
don't have to worry about syntax and the expressibility of the CC
description.

--Frej

[1] http://lists.llvm.org/pipermail/llvm-dev/2019-January/129189.html