[LLVMdev] EH and C++ intergation

Chris Lattner
Tue, 21 Nov 2006 19:29:24 -0000

On Tue, 21 Nov 2006, [ISO-8859-2] Žiga Osolin wrote:
>> Sure.  Anton can give you ideas for this.
>>
> I think it should not be too difficult because you allow custom call
> conversions and this is quite easy to add, we only have to garantee that
> the backend will emit it.

Right.

>>> 2) the ret instruction should be able to return structs (as Chris
has
>>> already written on his page).
>>
>> This won't help C++ or C.
> I don't agree. For example:
>
> struct SmartPtr { void* px; shared* py; }
>
> Now, if I write the following method signature in C++:
> SmartPtr foo(int whatever);
>
> When I return, the llvm cannot return value in registers what is
> required by Visual C++ (or at least I think it is). I am posing
> this issue because I really need this feature in llvm for my project.

You're missing one piece: LLVM types are not C/C++ types, they have to be
lowered.  This lowering discards some information, which can affect the
ABI (e.g. some ABIs treat a 'complex double' differently than a struct
with two doubles).  LLVM types are not sufficient for making ABI
decisions, at least some part of the abi decision currently needs to be
made by the front-end.

-Chris

--