[LLVMdev] EH and C++ intergation

Chris Lattner sabre at nondot.org
Tue Nov 21 15:27:13 PST 2006


On Tue, 21 Nov 2006, [ISO-8859-2] Žiga Osolin wrote:
> But you can (as I am aware) define struct in llvm, such as struct
> smart_ptr { void* px; void* py; } and if you want to return such struct
> in the llvm, you must pass it as a pointer to the struct in order to
> return in correctly. You could actually return such struct as:
> ret void* px, void* py
> and enable the backend to either return it by struct (if not enough
> registers) or return it in registers. This is requered in order to call
> methods that return non-native types. I need this because we use boost
> smart pointers (which are basically struct of 2 pointers) and we must be
> able to return them.

That is what csretcc does.  At the LLVM level, the retval is passed by 
pointer, but when code generated, the target can choose to return the 
struct in registers.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/


More information about the llvm-dev mailing list