Ok thanks, I'll keep on with plan B (INIT_CUMULATIVE_LIBCALL_ARGS with special 
libcall handling)

Selim

-----Message d'origine-----
De : Ian Lance Taylor [mailto:i...@google.com] 
Envoyé : vendredi 4 mai 2012 15:58
À : BELBACHIR Selim
Cc : gcc@gcc.gnu.org
Objet : Re: type argument in FUNCTION_ARG macro

BELBACHIR Selim <selim.belbac...@fr.thalesgroup.com> writes:

> I'm working on an architecture where the calling convention depends on the 
> type of the parameter (i.e. pointers are passed into $C regs and non-pointers 
> are passed into $R regs).  I've implemented this difference by using the 
> POINTER_TYPE_P() macro on the 'type' argument of the FUNCTION_ARG macro.
>
> I'm having a problem with this approach with calls to libgcc function 
> like  _Unwind_SjLj_Register(struct foo * ). As this function is invoked as a 
> library function, the 'type' argument to the FUNCTION_ARG() macro is NULL.  
> Thus, the pointer parameter is not passed as pointer but the function body 
> expects a pointer.
>
> Any ideas on how to get around this problem?

If possible, avoid using SJLJ exceptions.  DWARF exceptions are better.

I see three ways to go.

Change the middle-end to avoid using emit_library_call when calling 
_Unwind_SjLj_Register.  There is no particular reason for making this a special 
library call.  But this is probably a bit painful to implement.

Define INIT_CUMULATIVE_LIBCALL_ARGS for your target, and check the function.  
If it's _Unwind_SjLj_Register, apply special handling.  This option is nice 
because you only have to change your backend.

Change the implementation of _Unwind_SjLj_Register to take a parameter of type 
uintptr_t, and cast it to struct SjLj_Function_Context *.

Ian

Reply via email to