msp430 port

nick clifton nickc@redhat.com
Wed Jul 31 13:48:00 GMT 2013


Hi DJ, Hi Richard,

>>> +;; The next two patterns are here to support a "feature" of how GCC implements
>>> +;; varargs.  When a function uses varargs and the *second* to last named
>>> +;; argument is split between argument registers and the stack, gcc expects the
>>> +;; callee to allocate space on the stack that can contain the register-based
>>> +;; part of the argument.  This space *has* to be just before the remaining
>>> +;; arguments (ie the ones that are fully on the stack).
>>
>> Ug.  We ought to have been able to convince the compiler to copy the other
>> direction.  I.e. create storage for that argument as if it were a regular local
>> variable, spill the register portion into it, and also copy in the fragment
>> from the stack.
>>
>> That sort of solution seems better than fiddling the location of the return
>> address in both directions.

I agree - but I just do not have the GCC-fu skills to do this.  Hence I 
created the two patterns.


>>> +static enum machine_mode
>>> +msp430_get_raw_arg_mode (int regno)
>>> +{
>>> +  return (regno == ARG_POINTER_REGNUM) ? VOIDmode : Pmode;
>>> +}
>>
>> How can the raw mode of AP be VOID?

It cannot.  This was a bit of debugging that I put in whilst trying to 
track down problems with __builtin_apply_args().  Sorry - it should have 
been removed.

Cheers
   Nick




More information about the Gcc-patches mailing list