Subject: Re: EGCS 1.1 UPDATE rev. 2
To: Todd Vierling <tv@pobox.com>
From: Richard Earnshaw <rearnsha@arm.com>
List: tech-toolchain
Date: 08/19/1998 17:28:48
This is a multipart MIME message.
--==_Exmh_-14003037170
Content-Type: text/plain; charset=us-ascii
> On Wed, 19 Aug 1998, Richard Earnshaw wrote:
>
> : This will work, but my experiments show that the code will be less
> : efficient that the code generated by the old 2.7 compiler. I'm currently
> : working on a patch that would give us something like the Norcroft
> : compiler's "return_in_regs" attribute, but it won't be in the official
> : egcs 1.1 releases since these are now feature-frozen.
>
> This is fine, though, for us - if you have the time to do it and have a
> working fix, I can dump the diff right into the NetBSD tree so it will be
> thereeven if egcs doesn't have it.
>
Included below is a *HACK* that will make softfloat.c compile in the way
we want it to. Note that the hack does not work in general (it works ok
for structs that are exactly 2 or four words long, but not for other sized
structs -- for reasons that I won't dive into here). So it really needs
substantially more work before it can be documented and included by
default.
The Norcroft compiler works by attaching the "attribute" to the function
-- not to the structure -- but to implement this in gcc would need mid-end
modifications to the compiler which I need to discuss first on the egcs
lists.
Note, the patch to softfloat.h is to show you what needs to be done. It
should really be dressed up in #ifdefs to check the compiler version is at
least 2.8 (so that 2.7 won't emit warnings on the unrecognized attribute).
> Thanks for your help, btw. _I_ appreciate it personally. :>
No problem -- I have two machines with StrongARM's in, both running
NetBSD, which I use for testing egcs -- I think you could say I have a
vested interest in getting this to work.
Richard.
--==_Exmh_-14003037170
Content-Type: application/x-patch ; name="sf.patch"
Content-Description: sf.patch
Content-Disposition: attachment; filename="sf.patch"
*** softfloat.h~ Thu Jul 16 13:05:46 1998
--- softfloat.h Thu Jul 16 13:15:35 1998
*************** Software IEC/IEEE floating-point types.
*** 37,43 ****
typedef unsigned int float32;
typedef struct {
unsigned int high, low;
! } float64;
/*
-------------------------------------------------------------------------------
--- 37,43 ----
typedef unsigned int float32;
typedef struct {
unsigned int high, low;
! } __attribute__((return_in_regs)) float64;
/*
-------------------------------------------------------------------------------
--==_Exmh_-14003037170
Content-Type: application/x-patch ; name="retreg.patch"
Content-Description: retreg.patch
Content-Disposition: attachment; filename="retreg.patch"
? t-semi.keep
Index: arm.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/arm/arm.c,v
retrieving revision 1.11
diff -p -r1.11 arm.c
*** arm.c 1998/06/26 07:13:23 1.11
--- arm.c 1998/08/19 15:57:26
*************** int
*** 1128,1134 ****
arm_return_in_memory (type)
tree type;
{
! if (TREE_CODE (type) == RECORD_TYPE)
{
tree field;
--- 1127,1145 ----
arm_return_in_memory (type)
tree type;
{
! /* If the type has been given the attribute "return_in_regs" always try
! to honour it. aggregate_type_p may still force it in to memory,
! but there is nothing we can do about that. */
! if (lookup_attribute ("return_in_regs", TYPE_ATTRIBUTES (type)))
! return 0;
! /* Otherwise, BLKmode always needs memory. */
! else if (TYPE_MODE (type) == BLKmode)
! return 1;
! /* And non-aggregates never need memory */
! else if (! AGGREGATE_TYPE_P (type))
! return 0;
! /* For aggregates, obey the APCS rules */
! else if (TREE_CODE (type) == RECORD_TYPE)
{
tree field;
*************** arm_return_in_memory (type)
*** 1157,1164 ****
}
return 0;
}
! /* XXX Not sure what should be done for other aggregates, so put them in
! memory. */
return 1;
}
--- 1168,1175 ----
}
return 0;
}
! /* XXX Not sure what should be done for other aggregates
! (QUAL_UNIONs, ARRAYs and SETs), so put them in memory. */
return 1;
}
*************** multi_register_push (op, mode)
*** 2783,2788 ****
--- 2794,2819 ----
/* Routines for use with attributes */
+
+ /* If defined, a C expression whose value is nonzero if IDENTIFIER
+ with arguments ARGS is a valid machine specific attribute for TYPE.
+ The attributes in ATTRIBUTES have previously been assigned to TYPE. */
+
+ int
+ arm_valid_type_attribute_p (type, attributes, identifier, args)
+ tree type;
+ tree attributes ATTRIBUTE_UNUSED;
+ tree identifier;
+ tree args;
+ {
+ if (! AGGREGATE_TYPE_P(type))
+ return 0;
+
+ if (is_attribute_p ("return_in_regs", identifier))
+ return (args == NULL_TREE);
+
+ return 0;
+ }
/* Return nonzero if ATTR is a valid attribute for DECL.
ATTRIBUTES are any existing attributes and ARGS are the arguments
Index: arm.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/arm/arm.h,v
retrieving revision 1.11
diff -p -r1.11 arm.h
*** arm.h 1998/08/18 03:24:05 1.11
--- arm.h 1998/08/19 15:57:28
*************** do { \
*** 1012,1020 ****
/* How large values are returned */
/* A C expression which can inhibit the returning of certain function values
in registers, based on the type of value. */
! #define RETURN_IN_MEMORY(TYPE) \
! (TYPE_MODE ((TYPE)) == BLKmode || \
! (AGGREGATE_TYPE_P ((TYPE)) && arm_return_in_memory ((TYPE))))
/* Define DEFAULT_PCC_STRUCT_RETURN to 1 if all structure and union return
values must be in memory. On the ARM, they need only do so if larger
--- 1012,1018 ----
/* How large values are returned */
/* A C expression which can inhibit the returning of certain function values
in registers, based on the type of value. */
! #define RETURN_IN_MEMORY(TYPE) arm_return_in_memory ((TYPE))
/* Define DEFAULT_PCC_STRUCT_RETURN to 1 if all structure and union return
values must be in memory. On the ARM, they need only do so if larger
*************** do { \
*** 1239,1244 ****
--- 1237,1250 ----
emit_move_insn (gen_rtx (MEM, SImode, plus_constant ((TRAMP), 12)), \
(FNADDR)); \
}
+
+ /* If defined, a C expression whose value is nonzero if IDENTIFIER
+ with arguments ARGS is a valid machine specific attribute for TYPE.
+ The attributes in ATTRIBUTES have previously been assigned to TYPE. */
+
+ #define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, NAME, ARGS) \
+ (arm_valid_type_attribute_p (TYPE, ATTRIBUTES, NAME, ARGS))
+
/* Addressing modes, and classification of registers for them. */
*************** int store_multiple_sequence (/* struct r
*** 2072,2077 ****
--- 2078,2085 ----
HOST_WIDE_INT * */);
char *emit_stm_seq (/* struct rtx_def **, int */);
int multi_register_push (/* struct rtx_def *, enum machine_mode */);
+ int arm_valid_type_attribute_p (/* union tree_node *, union tree_node *,
+ union tree_node *, union tree_node * */);
int arm_valid_machine_decl_attribute (/* union tree_node *, union tree_node *,
union tree_node *,
union tree_node * */);
--==_Exmh_-14003037170--