diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a3ec8a0d4a2..708503640b9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2002-09-05 Jason Thorpe + + * config/arm/arm.c (arm_return_in_memory): Implement ATPCS + return-in-memory rules. + * config/arm/arm.h (ARM_FLAG_ATPCS, TARGET_ATPCS): Define. + 2002-09-05 David Edelsohn * config/rs6000/xcoff.h (HOT_TEXT_SECTION_NAME): Delete. diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 336f1821bd2..93c571dd534 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -1756,9 +1756,20 @@ int arm_return_in_memory (type) tree type; { + HOST_WIDE_INT size; + if (!AGGREGATE_TYPE_P (type)) /* All simple types are returned in registers. */ return 0; + + size = int_size_in_bytes (type); + + if (TARGET_ATPCS) + { + /* ATPCS returns aggregate types in memory only if they are + larger than a word (or are variable size). */ + return (size < 0 || size > UNITS_PER_WORD); + } /* For the arm-wince targets we choose to be compitable with Microsoft's ARM and Thumb compilers, which always return aggregates in memory. */ @@ -1767,7 +1778,7 @@ arm_return_in_memory (type) Also catch the case where int_size_in_bytes returns -1. In this case the aggregate is either huge or of varaible size, and in either case we will want to return it via memory and not in a register. */ - if (((unsigned int) int_size_in_bytes (type)) > UNITS_PER_WORD) + if (size < 0 || size > UNITS_PER_WORD) return 1; if (TREE_CODE (type) == RECORD_TYPE) diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 58654729884..ce1961ddf05 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -373,6 +373,9 @@ Unrecognized value in TARGET_CPU_DEFAULT. /* Nonzero means target uses VFP FP. */ #define ARM_FLAG_VFP (1 << 21) +/* Nonzero means to use ARM/Thumb Procedure Call Standard conventions. */ +#define ARM_FLAG_ATPCS (1 << 22) + #define TARGET_APCS_FRAME (target_flags & ARM_FLAG_APCS_FRAME) #define TARGET_POKE_FUNCTION_NAME (target_flags & ARM_FLAG_POKE) #define TARGET_FPE (target_flags & ARM_FLAG_FPE) @@ -380,6 +383,7 @@ Unrecognized value in TARGET_CPU_DEFAULT. #define TARGET_APCS_STACK (target_flags & ARM_FLAG_APCS_STACK) #define TARGET_APCS_FLOAT (target_flags & ARM_FLAG_APCS_FLOAT) #define TARGET_APCS_REENT (target_flags & ARM_FLAG_APCS_REENT) +#define TARGET_ATPCS (target_flags & ARM_FLAG_ATPCS) #define TARGET_MMU_TRAPS (target_flags & ARM_FLAG_MMU_TRAPS) #define TARGET_SOFT_FLOAT (target_flags & ARM_FLAG_SOFT_FLOAT) #define TARGET_HARD_FLOAT (! TARGET_SOFT_FLOAT)