Subject: RETURN_IN_MEMORY
To: None <port-arm@netbsd.org>
From: Jason R Thorpe <thorpej@wasabisystems.com>
List: port-arm
Date: 08/27/2002 13:18:14
Our GCC 2.95.3 does:

/* We override the default here because the default is to follow the
   APCS rules and we want to follow the (simpler) ATPCS rules. */
#undef RETURN_IN_MEMORY
#define RETURN_IN_MEMORY(TYPE) \
	(AGGREGATE_TYPE_P (TYPE) && int_size_in_bytes (TYPE) > 4)

In GCC 3.x, int_size_in_bytes() returns -1 to indicate a variable-sized
type, and you would think that we would want to handle that case as a
return-in-memory, as well.  Therefore, I think we want to cast the return
value of int_size_in_bytes() to (unsigned int) before the comparison.

Agree?  Disagree?  (This is the chunk I've added to my local copy of
GCC 3.x's arm_return_in_memory()):

  if (TARGET_ATPCS)
    {
      /* ATPCS returns aggregate types in memory only if they are
         larger than a word (or are variable size).  */
      return (((unsigned int) int_size_in_bytes (type)) > UNITS_PER_WORD);
    }

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>