On 28 October 2013 21:24, David Nadlinger <c...@klickverbot.at> wrote:
> On Monday, 28 October 2013 at 21:07:07 UTC, Iain Buclaw wrote:
>>
>> From what I've read and gathered from David over a period of some
>> conversations.  Clang infrastructure-wise is much like gcc-3.3/gcc-4.0
>> was - they have a well defined AST that is capable of representing
>> everything you'd expect in a typical C-family language, with a
>> backdoor to lower level register/assembly representations for
>> target-specific implementations.
>
>
> If you are referring to LLVM here: Yes and no.
>
> It's true that the LLVM IR is mostly target-independent (except for data
> type sizes and so on) with a number of backdoors in the form of inline
> assembly, special intrinsics and so on.
>
> But at the same time, the LLVM IR is also of a very different quality than
> GCC GENERIC, being strictly in SSA form. I have not looked into the
current
> GCC architecture in any detail, but I'd guess that LLVM itself starts
> approximately at the point where the middle-end does in GCC.
>

That is pretty much what I gathered.  SSA forms are something of a
middle-end representation lowered from the GENERIC it receives from the
frontend.

> Clang itself is obviously on a higher layer, but unlike GENERIC, its data
> structures are not designed to be reused for non-C-family languages. So,
the
> questions of whether its AST can represent every concept from another
> language or if it needs contains backdoors to a lower level are somewhat
> moot.
>

I didn't say it needs to contain backdoors, I was just pointing out that
with LLVM you have the choice to drop to lower level if you choose to, I'd
imagine at some cost to the optimiser too.  For example, you are free to
implement your own calling convention from within the front-end in LLVM.
Something of which is not considered something to be language-dependent by
GCC, so you have no control over eg: *which* parameters are passed in
registers, the only possible talking with the backend is through target
hooks and setting the back-end attributes (such as 'regparm') to give hints.

-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';

Reply via email to