From fc79c021734d47fa693a45e8d5b785c9f32e4399 Mon Sep 17 00:00:00 2001 From: Dale Johannesen Date: Thu, 22 Dec 2005 22:04:45 +0000 Subject: 2005-12-22 Dale Johannesen Radar 4387676 4388773 * tree.h (TREE_FIELDS_REVERSED): Remove. * varasm.c (output_constructor): Remove reference to it. * stor-layout.c (place_field): Ditto. 2005-12-22 Dale Johannesen Radar 4387676 4388773 * gcc.apple/bitreverse-14.c: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/apple-local-200502-branch@108980 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog.apple-ppc | 7 ++++ gcc/stor-layout.c | 3 -- gcc/testsuite/ChangeLog.apple-ppc | 5 +++ gcc/testsuite/gcc.apple/bitreverse-14.c | 49 ++++++++++++++++++++++ gcc/tree.h | 3 -- gcc/varasm.c | 73 ++++++++++++++++----------------- 6 files changed, 96 insertions(+), 44 deletions(-) create mode 100644 gcc/testsuite/gcc.apple/bitreverse-14.c diff --git a/gcc/ChangeLog.apple-ppc b/gcc/ChangeLog.apple-ppc index 00c78f5f572..5392bcfed54 100644 --- a/gcc/ChangeLog.apple-ppc +++ b/gcc/ChangeLog.apple-ppc @@ -1,3 +1,10 @@ +2005-12-22 Dale Johannesen + + Radar 4387676 4388773 + * tree.h (TREE_FIELDS_REVERSED): Remove. + * varasm.c (output_constructor): Remove reference to it. + * stor-layout.c (place_field): Ditto. + 2005-12-22 Stuart Hastings * gcc/config/darwin.c (machopic_force_indirect_call_target): diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index c4860277f07..e6e8db409b5 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -1182,9 +1182,6 @@ place_field (record_layout_info rli, tree field) tree bitpos; tree fsize = DECL_SIZE (field); tree tsize = TYPE_SIZE (TREE_TYPE (field)); - /* APPLE LOCAL begin bitfield reversal 4228294 */ - TREE_FIELDS_REVERSED (field) = 1; - /* APPLE LOCAL end bitfield reversal 4228294 */ /* If we've gone into the next word, move "offset" forward and adjust "bitpos" to compensate. */ while (! INT_CST_LT_UNSIGNED (rli->bitpos, tsize)) diff --git a/gcc/testsuite/ChangeLog.apple-ppc b/gcc/testsuite/ChangeLog.apple-ppc index 49fe7c6e959..cc398cf30cf 100644 --- a/gcc/testsuite/ChangeLog.apple-ppc +++ b/gcc/testsuite/ChangeLog.apple-ppc @@ -1,3 +1,8 @@ +2005-12-22 Dale Johannesen + + Radar 4387676 4388773 + * gcc.apple/bitreverse-14.c: New. + 2005-12-21 Stuart Hastings Radar 4380298, 4299630 diff --git a/gcc/testsuite/gcc.apple/bitreverse-14.c b/gcc/testsuite/gcc.apple/bitreverse-14.c new file mode 100644 index 00000000000..4b7790cf824 --- /dev/null +++ b/gcc/testsuite/gcc.apple/bitreverse-14.c @@ -0,0 +1,49 @@ +/* APPLE LOCAL file 4388773 */ +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-std=gnu99" } */ +#pragma reverse_bitfields on +#pragma pack(push, 1) + +typedef struct _kyc + { + void *pkeyres; + int ipfnctb; + unsigned short icetab:11, + fPrompt:1, + coper:4; + unsigned short ioperArg:14, + fArg:1, + fCetab:1; + int tcidEquiv; + } KYC; +#pragma pack(pop) + +KYC rgkycMain[] = + { + {0,1,0,0,0,0,0,0,0}, + {0,1,0,0,0,0,0,0,0}, + {0,1,0,0,0,0,0,0,0}, + {0,1,0,0,0,0,0,0,0}, + {0,1,0,0,0,0,0,0,0}, + {0,1,0,0,0,0,0,0,0}, + {0,1,0,0,0,0,0,0,0}, + {0,1,0,0,0,0,0,0,0}, + {0,1,0,0,0,0,0,0,0}, + {0,1,0,0,0,0,0,0,0}, + {0,1,0,0,0,0,0,0,0}, + {0,1,0,0,0,0,0,0,0}, + {0,1,0,0,0,0,0,0,0}, + {0,1,0,0,0,0,0,0,0}, + {0,1,0,0,0,0,0,0,0}, + {0,1,0,0,0,0,0,0,0}, + {0,1,0,0,0,0,0,0,0}, + {0,0,0x6,1,0,0,0,1,0}, + {0,0,0x8,1,0,0,0,1,0}, + {0,0,0x9,1,0,0,0,1,0}, + {0,0,0xa,1,0,0,0,1,0}, + {0,1,0,0,0,0,0,0,0}, + {0,1,0,0,0,0,0,0,0}, + {0,1,0,0,0,0,0,0,0}, + {0,0,0xfe,1,0,0,0,1,0}, + {0,0,0x5,1,0,0,0,1,0}, + }; diff --git a/gcc/tree.h b/gcc/tree.h index 4ddd47bc493..60d5dc95756 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -1040,9 +1040,6 @@ extern void tree_operand_check_failed (int, enum tree_code, unavailable feature by __attribute__((unavailable)). */ #define TREE_UNAVAILABLE(NODE) ((NODE)->common.unavailable_flag) /* APPLE LOCAL end "unavailable" attribute (Radar 2809697) */ -/* APPLE LOCAL begin bitfield reversal 4228294 */ -#define TREE_FIELDS_REVERSED(NODE) ((NODE)->common.reversed_flag) -/* APPLE LOCAL end bitfield reversal 4228294 */ /* Value of expression is function invariant. A strict subset of TREE_CONSTANT, such an expression is constant over any one function diff --git a/gcc/varasm.c b/gcc/varasm.c index cdaa8e53f5d..28bbaaf7702 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -3993,53 +3993,50 @@ output_constructor (tree exp, unsigned HOST_WIDE_INT size, if (HOST_BITS_PER_WIDE_INT < BITS_PER_UNIT) abort (); - /* APPLE LOCAL begin bitfield reversal 4228294 */ - if (TREE_CODE (type) == RECORD_TYPE) + /* APPLE LOCAL begin bitfield reversal 4228294 4387676 4388773 */ + if (TREE_CODE (type) == RECORD_TYPE && TYPE_FIELDS (type)) { - if (TYPE_FIELDS (type) && TREE_FIELDS_REVERSED (TYPE_FIELDS (type))) + /* If bitfields were reversed they will not be in ascending + address order here, which confuses the code below. Sort + the constructor. Note that the type retains the old + ordering, for debug info purposes. (The comment below that + says FIELD goes through the structure fields is misleading; + FIELD is set from the constructor, not the type, so uses + the constructor list's ordering.) */ + tree head, last, afterlast, prev = NULL; + for (head = CONSTRUCTOR_ELTS (exp); + head; + prev = head, head = TREE_CHAIN (head)) { - /* If bitfields were reversed they will not be in ascending - address order here, which confuses the code below. Sort - the constructor. Note that the type retains the old - ordering, for debug info purposes. (The comment below that - says FIELD goes through the structure fields is misleading; - FIELD is set from the constructor, not the type, so uses - the constructor list's ordering.) */ - tree head, last, afterlast, prev = NULL; - for (head = CONSTRUCTOR_ELTS (exp); - head; - prev = head, head = TREE_CHAIN (head)) + if (TREE_PURPOSE (head)) { - if (TREE_PURPOSE (head)) + HOST_WIDE_INT pos = int_bit_position (TREE_PURPOSE (head)); + /* Find next field that is after "head" in memory. */ + last = head; + afterlast = TREE_CHAIN (head); + while (afterlast && TREE_PURPOSE (afterlast) + && int_bit_position (TREE_PURPOSE (afterlast)) < pos) { - HOST_WIDE_INT pos = int_bit_position (TREE_PURPOSE (head)); - /* Find next field that is after "head" in memory. */ - last = head; - afterlast = TREE_CHAIN (head); - while (afterlast && TREE_PURPOSE (afterlast) - && int_bit_position (TREE_PURPOSE (afterlast)) < pos) - { - last = afterlast; - afterlast = TREE_CHAIN (last); - } - /* Reverse fields head..last inclusive. */ - if (last != head) - { - TREE_CHAIN (last) = NULL; - last = nreverse (head); - if (prev) - TREE_CHAIN (prev) = last; - else - CONSTRUCTOR_ELTS (exp) = last; - TREE_CHAIN (head) = afterlast; - /* Outer loop will continue at afterlast. */ - } + last = afterlast; + afterlast = TREE_CHAIN (last); + } + /* Reverse fields head..last inclusive. */ + if (last != head) + { + TREE_CHAIN (last) = NULL; + last = nreverse (head); + if (prev) + TREE_CHAIN (prev) = last; + else + CONSTRUCTOR_ELTS (exp) = last; + TREE_CHAIN (head) = afterlast; + /* Outer loop will continue at afterlast. */ } } } field = TYPE_FIELDS (type); } - /* APPLE LOCAL end bitfield reversal 4228294 */ + /* APPLE LOCAL end bitfield reversal 4228294 4387676 4388773 */ if (TREE_CODE (type) == ARRAY_TYPE && TYPE_DOMAIN (type) != 0) -- cgit v1.2.3