aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorechristo <echristo@138bc75d-0d04-0410-961f-82ee72b054a4>2006-04-28 01:06:13 +0000
committerechristo <echristo@138bc75d-0d04-0410-961f-82ee72b054a4>2006-04-28 01:06:13 +0000
commit01b3252d0a85925f88a869dc41b79826d5b25420 (patch)
tree56a98428f6d76dc98988221ae2db5b859bc83ed6
parentaebe876e73949a3e390b1a957b6a74c63f2d83ad (diff)
2006-04-27 Eric Christopher <echristo@apple.com>
Radar 4529978 * target-def.h (TARGET_SET_DEFAULT_TYPE_ATTRIBUTES): Bracket with #ifndef/#endif. * config/darwin-c.c (darwin_ms_struct): New. (darwin_pragma_ms_struct): Ditto. (darwin_set_default_type_attributes): Ditto. * config/darwin-protos.h (darwin_pragma_ms_struct): Declare. * config/darwin.h (DARWIN_REGISTER_TARGET_PRAGMAS): Register ms_struct pragma. * config/i386/darwin.h (REGISTER_TARGET_PRAGMAS): Declare. (TARGET_SET_DEFAULT_TYPE_ATTRIBUTES): Ditto. * config/rs6000/rs6000.c (rs6000_set_default_type_attributes): Call darwin_set_default_type_attributes if TARGET_MACHO. 2006-04-25 Eric Christopher <echristo@apple.com> Radar 4529978 * gcc.dg/pragma-ms_struct.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/apple/200605-release@113335 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog16
-rw-r--r--gcc/config/darwin-c.c88
-rw-r--r--gcc/config/darwin-protos.h4
-rw-r--r--gcc/config/darwin.h22
-rw-r--r--gcc/config/i386/darwin.h9
-rw-r--r--gcc/config/rs6000/rs6000.c150
-rw-r--r--gcc/target-def.h6
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/gcc.dg/pragma-ms_struct.c22
9 files changed, 214 insertions, 110 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 412a82da66f..9e4429b63e2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,19 @@
+2006-04-25 Eric Christopher <echristo@apple.com>
+
+ Radar 4529978
+ * target-def.h (TARGET_SET_DEFAULT_TYPE_ATTRIBUTES): Bracket
+ with #ifndef/#endif.
+ * config/darwin-c.c (darwin_ms_struct): New.
+ (darwin_pragma_ms_struct): Ditto.
+ (darwin_set_default_type_attributes): Ditto.
+ * config/darwin-protos.h (darwin_pragma_ms_struct): Declare.
+ * config/darwin.h (DARWIN_REGISTER_TARGET_PRAGMAS):
+ Register ms_struct pragma.
+ * config/i386/darwin.h (REGISTER_TARGET_PRAGMAS): Declare.
+ (TARGET_SET_DEFAULT_TYPE_ATTRIBUTES): Ditto.
+ * config/rs6000/rs6000.c (rs6000_set_default_type_attributes): Call
+ darwin_set_default_type_attributes if TARGET_MACHO.
+
2006-04-25 Geoffrey Keating <geoffk@apple.com>
Radar 4498201
diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c
index 9f47196c3d2..6f0e0535651 100644
--- a/gcc/config/darwin-c.c
+++ b/gcc/config/darwin-c.c
@@ -48,6 +48,11 @@ Boston, MA 02111-1307, USA. */
static bool using_frameworks = false;
+/* APPLE LOCAL begin mainline */
+/* True if we're setting __attribute__ ((ms_struct)). */
+static bool darwin_ms_struct = false;
+
+/* APPLE LOCAL end mainline */
/* APPLE LOCAL begin CALL_ON_LOAD/CALL_ON_UNLOAD pragmas 20020202 --turly */
static void directive_with_named_function (const char *, void (*sec_f)(void));
/* APPLE LOCAL end CALL_ON_LOAD/CALL_ON_UNLOAD pragmas 20020202 --turly */
@@ -77,7 +82,7 @@ static const char *find_subframework_header (cpp_reader *pfile, const char *head
else
mode = power
These modes are saved on the alignment stack by saving the values
- of maximum_field_alignment, TARGET_ALIGN_MAC68K, and
+ of maximum_field_alignment, TARGET_ALIGN_MAC68K, and
TARGET_ALIGN_NATURAL. */
typedef struct align_stack
{
@@ -92,7 +97,7 @@ static struct align_stack * field_align_stack = NULL;
/* APPLE LOCAL begin Macintosh alignment 2001-12-17 --ff */
static void
-push_field_alignment (int bit_alignment,
+push_field_alignment (int bit_alignment,
int mac68k_alignment, int natural_alignment)
{
align_stack *entry = (align_stack *) xmalloc (sizeof (align_stack));
@@ -208,10 +213,10 @@ darwin_pragma_options (cpp_reader *pfile ATTRIBUTE_UNUSED)
/* APPLE LOCAL begin Macintosh alignment 2002-1-22 --ff */
/* #pragma pack ()
- #pragma pack (N)
+ #pragma pack (N)
#pragma pack (pop[,id])
#pragma pack (push[,id],N)
-
+
We have a problem handling the semantics of these directives since,
to play well with the Macintosh alignment directives, we want the
usual pack(N) form to do a push of the previous alignment state.
@@ -293,7 +298,7 @@ else
if (c_lex (&x) != CPP_EOF)
warning ("junk at end of '#pragma pack'");
-
+
if (action != pop)
{
switch (align)
@@ -310,7 +315,7 @@ else
BAD2 ("alignment must be a small power of two, not %d", align);
}
}
-
+
switch (action)
{
case pop: pop_field_alignment (); break;
@@ -354,6 +359,41 @@ darwin_pragma_unused (cpp_reader *pfile ATTRIBUTE_UNUSED)
warning ("junk at end of '#pragma unused'");
}
+/* APPLE LOCAL begin mainline */
+/* Parse the ms_struct pragma. */
+void
+darwin_pragma_ms_struct (cpp_reader *pfile ATTRIBUTE_UNUSED)
+{
+ const char *arg;
+ tree t;
+
+ if (c_lex (&t) != CPP_NAME)
+ BAD ("malformed '#pragma ms_struct', ignoring");
+ arg = IDENTIFIER_POINTER (t);
+
+ if (!strcmp (arg, "on"))
+ darwin_ms_struct = true;
+ else if (!strcmp (arg, "off") || !strcmp (arg, "reset"))
+ darwin_ms_struct = false;
+ else
+ warning ("malformed '#pragma ms_struct {on|off|reset}', ignoring");
+
+ if (c_lex (&t) != CPP_EOF)
+ warning ("junk at end of '#pragma ms_struct'");
+}
+
+/* Set darwin specific type attributes on TYPE. */
+void
+darwin_set_default_type_attributes (tree type)
+{
+ /* Handle the ms_struct pragma. */
+ if (darwin_ms_struct
+ && TREE_CODE (type) == RECORD_TYPE)
+ TYPE_ATTRIBUTES (type) = tree_cons (get_identifier ("ms_struct"),
+ NULL_TREE,
+ TYPE_ATTRIBUTES (type));
+}
+/* APPLE LOCAL end mainline */
/* APPLE LOCAL begin pragma reverse_bitfields */
/* Handle the reverse_bitfields pragma. */
@@ -618,7 +658,7 @@ framework_construct_pathname (const char *fname, cpp_dir *dir)
/* Append framework_header_dirs and header file name */
for (i = 0; framework_header_dirs[i].dirName; i++)
{
- strncpy (&frname[frname_len],
+ strncpy (&frname[frname_len],
framework_header_dirs[i].dirName,
framework_header_dirs[i].dirNameLen);
strcpy (&frname[frname_len + framework_header_dirs[i].dirNameLen],
@@ -642,8 +682,8 @@ find_subframework_file (const char *fname, const char *pname)
{
char *sfrname;
const char *dot_framework = ".framework/";
- char *bufptr;
- int sfrname_len, i, fname_len;
+ char *bufptr;
+ int sfrname_len, i, fname_len;
struct cpp_dir *fast_dir;
static struct cpp_dir subframe_dir;
struct stat st;
@@ -653,7 +693,7 @@ find_subframework_file (const char *fname, const char *pname)
/* Subframework files must have / in the name. */
if (bufptr == 0)
return 0;
-
+
fname_len = bufptr - fname;
fast_dir = find_framework (fname, fname_len);
@@ -668,7 +708,7 @@ find_subframework_file (const char *fname, const char *pname)
return 0;
/* Now translate. For example, +- bufptr
- fname = CarbonCore/OSUtils.h |
+ fname = CarbonCore/OSUtils.h |
pname = /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h
into
sfrname = /System/Library/Frameworks/Foundation.framework/Frameworks/CarbonCore.framework/Headers/OSUtils.h */
@@ -676,10 +716,10 @@ find_subframework_file (const char *fname, const char *pname)
sfrname = (char *) xmalloc (strlen (pname) + strlen (fname) + 2 +
strlen ("Frameworks/") + strlen (".framework/")
+ strlen ("PrivateHeaders"));
-
+
bufptr += strlen (dot_framework);
- sfrname_len = bufptr - pname;
+ sfrname_len = bufptr - pname;
strncpy (&sfrname[0], pname, sfrname_len);
@@ -695,12 +735,12 @@ find_subframework_file (const char *fname, const char *pname)
/* Append framework_header_dirs and header file name */
for (i = 0; framework_header_dirs[i].dirName; i++)
{
- strncpy (&sfrname[sfrname_len],
+ strncpy (&sfrname[sfrname_len],
framework_header_dirs[i].dirName,
framework_header_dirs[i].dirNameLen);
strcpy (&sfrname[sfrname_len + framework_header_dirs[i].dirNameLen],
&fname[fname_len]);
-
+
if (stat (sfrname, &st) == 0)
{
if (fast_dir != &subframe_dir)
@@ -757,7 +797,7 @@ add_framework_path (char *path)
add_cpp_dir_path (p, BRACKET);
}
-static const char *framework_defaults [] =
+static const char *framework_defaults [] =
{
"/System/Library/Frameworks",
"/Library/Frameworks",
@@ -774,9 +814,9 @@ darwin_register_objc_includes (const char *sysroot, const char *iprefix,
/* We do not do anything if we do not want the standard includes. */
if (!stdinc)
return;
-
+
fname = GCC_INCLUDE_DIR "-gnu-runtime";
-
+
/* Register the GNU OBJC runtime include path if we are compiling OBJC
with GNU-runtime. */
@@ -793,13 +833,13 @@ darwin_register_objc_includes (const char *sysroot, const char *iprefix,
/* FIXME: wrap the headers for C++awareness. */
add_path (str, SYSTEM, /*c++aware=*/false, false);
}
-
+
/* Should this directory start with the sysroot? */
if (sysroot)
str = concat (sysroot, fname, NULL);
else
str = update_path (fname, "");
-
+
add_path (str, SYSTEM, /*c++aware=*/false, false);
}
}
@@ -923,13 +963,13 @@ darwin_pragma_call_on_unload (cpp_reader *pfile ATTRIBUTE_UNUSED)
/* Return the value of darwin_macosx_version_min suitable for the
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro,
- so '10.4.2' becomes 1042.
+ so '10.4.2' becomes 1042.
Print a warning if the version number is not known. */
static const char *
version_as_macro (void)
{
static char result[] = "1000";
-
+
if (strncmp (darwin_macosx_version_min, "10.", 3) != 0)
goto fail;
if (! ISDIGIT (darwin_macosx_version_min[3]))
@@ -947,9 +987,9 @@ version_as_macro (void)
}
else
result[3] = '0';
-
+
return result;
-
+
fail:
error ("Unknown value %qs of -mmacosx-version-min",
darwin_macosx_version_min);
diff --git a/gcc/config/darwin-protos.h b/gcc/config/darwin-protos.h
index 873f5d48220..32c12cf6f6f 100644
--- a/gcc/config/darwin-protos.h
+++ b/gcc/config/darwin-protos.h
@@ -70,6 +70,8 @@ extern void machopic_asm_out_destructor (rtx, int);
extern void machopic_define_symbol (rtx);
extern void darwin_encode_section_info (tree, rtx, int);
+/* APPLE LOCAL mainline */
+extern void darwin_set_default_type_attributes (tree);
/* APPLE LOCAL CW asm blocks */
extern tree darwin_iasm_special_label (tree);
@@ -94,6 +96,8 @@ extern void darwin_emit_except_table_label (FILE *);
extern void darwin_pragma_ignore (struct cpp_reader *);
extern void darwin_pragma_options (struct cpp_reader *);
extern void darwin_pragma_unused (struct cpp_reader *);
+/* APPLE LOCAL mainline */
+extern void darwin_pragma_ms_struct (struct cpp_reader *);
/* APPLE LOCAL pragma fenv */
extern void darwin_pragma_fenv (struct cpp_reader *);
/* APPLE LOCAL pragma reverse_bitfields */
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index 57fb9ceab43..1c5e1006d9d 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -106,12 +106,12 @@ extern int machopic_symbol_defined_p (rtx);
name, that also takes an argument, needs to be modified so the
prefix is different, otherwise a '*' after the shorter option will
match with the longer one.
-
+
The SUBTARGET_OPTION_TRANSLATE_TABLE macro, which _must_ be defined
in gcc/config/{i386,rs6000}/darwin.h, should contain any additional
command-line option translations specific to the particular target
architecture. */
-
+
#define TARGET_OPTION_TRANSLATE_TABLE \
/* APPLE LOCAL KEXT terminated-vtables */ \
{ "-fterminated-vtables", "-fapple-kext" }, \
@@ -181,7 +181,7 @@ extern int darwin_running_cxx;
but there are no more bits in rs6000 TARGET_SWITCHES. Note
that this switch has no "no-" variant. */
extern const char *darwin_one_byte_bool;
-
+
/* APPLE LOCAL begin pragma reverse_bitfields */
/* True if pragma reverse_bitfields is in effect. */
extern GTY(()) int darwin_reverse_bitfields;
@@ -485,7 +485,7 @@ do { \
you want to explicitly link against the static version of those
routines, because you know you don't need to unwind through system
libraries, you need to explicitly say -static-libgcc.
-
+
If it is linked against, it has to be before -lgcc, because it may
need symbols from -lgcc. */
#undef REAL_LIBGCC_SPEC
@@ -609,9 +609,9 @@ do { \
links to, so there's no need for weak-ness for that. */
#define GTHREAD_USE_WEAK 0
-/* The Darwin linker imposes two limitations on common symbols: they
+/* The Darwin linker imposes two limitations on common symbols: they
can't have hidden visibility, and they can't appear in dylibs. As
- a consequence, we should never use common symbols to represent
+ a consequence, we should never use common symbols to represent
vague linkage. */
#undef USE_COMMON_FOR_ONE_ONLY
#define USE_COMMON_FOR_ONE_ONLY 0
@@ -637,7 +637,7 @@ do { \
/* APPLE LOCAL mainline 2006-03-16 dwarf2 4392520 */
#define FRAME_BEGIN_LABEL (for_eh ? "EH_frame" : "Lframe")
-/* Emit a label for the FDE corresponding to DECL. EMPTY means
+/* Emit a label for the FDE corresponding to DECL. EMPTY means
emit a label for an empty FDE. */
#define TARGET_ASM_EMIT_UNWIND_LABEL darwin_emit_unwind_label
@@ -802,7 +802,7 @@ do { \
/* Ensure correct alignment of bss data. */
-#undef ASM_OUTPUT_ALIGNED_DECL_LOCAL
+#undef ASM_OUTPUT_ALIGNED_DECL_LOCAL
#define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \
do { \
fputs (".lcomm ", (FILE)); \
@@ -1340,6 +1340,10 @@ enum machopic_addr_class {
/* APPLE LOCAL pragma fenv */ \
c_register_pragma ("GCC", "fenv", darwin_pragma_fenv); \
c_register_pragma (0, "unused", darwin_pragma_unused); \
+ /* APPLE LOCAL begin mainline */ \
+ c_register_pragma (0, "ms_struct", \
+ darwin_pragma_ms_struct); \
+ /* APPLE LOCAL end mainline */ \
/* APPLE LOCAL begin pragma reverse_bitfields */ \
c_register_pragma (0, "reverse_bitfields", \
darwin_pragma_reverse_bitfields); \
@@ -1374,7 +1378,7 @@ extern void abort_assembly_and_exit (int status) ATTRIBUTE_NORETURN;
: MIN ((DESIRED), 16))
#else
#define PEG_ALIGN_FOR_MAC68K(DESIRED) MIN ((DESIRED), 16)
-#endif
+#endif
/* APPLE LOCAL end Macintosh alignment 2002-2-13 --ff */
/* APPLE LOCAL begin KEXT double destructor */
diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h
index 5ac57caff89..952231a78c3 100644
--- a/gcc/config/i386/darwin.h
+++ b/gcc/config/i386/darwin.h
@@ -169,8 +169,6 @@ extern void darwin_x86_file_end (void);
#define MASK_ALIGN_MAC68K 0x20000000
#define TARGET_ALIGN_MAC68K (target_flags & MASK_ALIGN_MAC68K)
-#define REGISTER_TARGET_PRAGMAS DARWIN_REGISTER_TARGET_PRAGMAS
-
#define ROUND_TYPE_ALIGN(TYPE, COMPUTED, SPECIFIED) \
(((TREE_CODE (TYPE) == RECORD_TYPE \
|| TREE_CODE (TYPE) == UNION_TYPE \
@@ -282,3 +280,10 @@ extern int flag_iasm_blocks;
extern void ix86_darwin_init_expanders (void);
#define INIT_EXPANDERS (ix86_darwin_init_expanders ())
/* APPLE LOCAL end 4457939 stack alignment mishandled */
+/* APPLE LOCAL begin mainline */
+#undef REGISTER_TARGET_PRAGMAS
+#define REGISTER_TARGET_PRAGMAS() DARWIN_REGISTER_TARGET_PRAGMAS()
+
+#undef TARGET_SET_DEFAULT_TYPE_ATTRIBUTES
+#define TARGET_SET_DEFAULT_TYPE_ATTRIBUTES darwin_set_default_type_attributes
+/* APPLE LOCAL end mainline */
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 5cde2eaca27..bdb01c0a9ba 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -1394,10 +1394,10 @@ rs6000_override_options (const char *default_cpu)
flag_strict_aliasing = 1;
flag_schedule_interblock = 1;
flag_gcse_las = 1;
- align_jumps_max_skip = 15;
+ align_jumps_max_skip = 15;
align_loops_max_skip = 15;
align_functions = 16;
- align_loops = 16;
+ align_loops = 16;
align_jumps = 16;
set_fast_math_flags (1);
flag_reorder_blocks = 1;
@@ -1405,7 +1405,7 @@ rs6000_override_options (const char *default_cpu)
flag_reorder_blocks_and_partition = 1;
if (!flag_pic)
set_target_switch ("dynamic-no-pic");
-
+
if (mcpu_cpu == PROCESSOR_POWER4)
{
set_target_switch ("powerpc-gpopt");
@@ -1437,8 +1437,8 @@ rs6000_override_options (const char *default_cpu)
target_flags |= ~target_flags_explicit & MASK_MULTIPLE;
/* If we are optimizing big endian systems for space, use the
- string instructions. But do not do this for Darwin, as the
- kernel can't properly support some hardware that doesn't have
+ string instructions. But do not do this for Darwin, as the
+ kernel can't properly support some hardware that doesn't have
these instructions. It's not clear that the compiler is the
right place to fix this, but that's how it is for now. See
*extensive* discussion in Radar 3509006. */
@@ -2031,7 +2031,7 @@ optimization_options (int level ATTRIBUTE_UNUSED, int size ATTRIBUTE_UNUSED)
Do not reset things unless they're per-function. */
void
-reset_optimization_options (int level ATTRIBUTE_UNUSED,
+reset_optimization_options (int level ATTRIBUTE_UNUSED,
int size ATTRIBUTE_UNUSED)
{
if (DEFAULT_ABI == ABI_DARWIN)
@@ -2401,10 +2401,10 @@ reg_or_cint_operand (rtx op, enum machine_mode mode)
int
scc_operand (rtx op, enum machine_mode mode)
{
- return ((GET_CODE (op) == CONST_INT
- && (CONST_OK_FOR_LETTER_P (INTVAL (op), 'I')
- || CONST_OK_FOR_LETTER_P (INTVAL (op), 'K')
- || CONST_OK_FOR_LETTER_P (INTVAL (op), 'O')
+ return ((GET_CODE (op) == CONST_INT
+ && (CONST_OK_FOR_LETTER_P (INTVAL (op), 'I')
+ || CONST_OK_FOR_LETTER_P (INTVAL (op), 'K')
+ || CONST_OK_FOR_LETTER_P (INTVAL (op), 'O')
|| CONST_OK_FOR_LETTER_P (INTVAL (op), (TARGET_32BIT ? 'L' : 'J'))))
|| gpc_reg_operand (op, mode));
}
@@ -3159,7 +3159,7 @@ mask64_1or2_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED,
{
HOST_WIDE_INT c, lsb;
bool one_ok;
-
+
c = INTVAL (op);
/* Disallow all zeros. */
@@ -3170,7 +3170,7 @@ mask64_1or2_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED,
AND there are zero, one or two transitions in the _whole_ of
C. */
one_ok = !(c & ~(HOST_WIDE_INT)0xffffffff);
-
+
/* We don't change the number of transitions by inverting,
so make sure we start with the LS bit zero. */
if (c & 1)
@@ -3497,7 +3497,7 @@ rs6000_special_round_type_align (tree type, int computed, int specified)
{
tree field = TYPE_FIELDS (type);
- /* Skip all non field decls */
+ /* Skip all non field decls */
while (field != NULL && TREE_CODE (field) != FIELD_DECL)
field = TREE_CHAIN (field);
@@ -5028,8 +5028,8 @@ rs6000_emit_move (rtx dest, rtx source, enum machine_mode mode)
if (DEFAULT_ABI == ABI_DARWIN && MACHOPIC_INDIRECT)
{
/* APPLE LOCAL begin radar 4232296 */
- /* If a symbol node has been generated but its flags not set; such as in the course of
- cost computation of generated code, do not attempt to update the static tables which
+ /* If a symbol node has been generated but its flags not set; such as in the course of
+ cost computation of generated code, do not attempt to update the static tables which
rely on flags of the referenced symbol to have been set. Otherwise, bogus PIC stub
will be generated. */
if (!(GET_CODE (operands[1]) == SYMBOL_REF && SYMBOL_REF_FLAGS (operands[1]) == 0))
@@ -5618,7 +5618,7 @@ function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode,
/* APPLE LOCAL fix 64-bit varargs 4028089 */
cum->floats_in_gpr = 0;
rs6000_darwin64_record_arg_advance_recurse (cum, type, 0);
- rs6000_darwin64_record_arg_advance_flush (cum,
+ rs6000_darwin64_record_arg_advance_flush (cum,
/* APPLE LOCAL fix 64-bit varargs 4028089 */
size * BITS_PER_UNIT, 1);
}
@@ -5785,7 +5785,7 @@ rs6000_spe_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode,
structure between cum->intoffset and bitpos to integer registers. */
static void
-rs6000_darwin64_record_arg_flush (CUMULATIVE_ARGS *cum,
+rs6000_darwin64_record_arg_flush (CUMULATIVE_ARGS *cum,
HOST_WIDE_INT bitpos, rtx rvec[], int *k)
{
enum machine_mode mode;
@@ -5829,7 +5829,7 @@ rs6000_darwin64_record_arg_flush (CUMULATIVE_ARGS *cum,
if (intregs > 0 && intregs > GP_ARG_NUM_REG - this_regno)
cum->use_stack = 1;
-
+
intregs = MIN (intregs, GP_ARG_NUM_REG - this_regno);
if (intregs <= 0)
return;
@@ -5853,7 +5853,7 @@ rs6000_darwin64_record_arg_flush (CUMULATIVE_ARGS *cum,
/* Recursive workhorse for the following. */
static void
-rs6000_darwin64_record_arg_recurse (CUMULATIVE_ARGS *cum, tree type,
+rs6000_darwin64_record_arg_recurse (CUMULATIVE_ARGS *cum, tree type,
HOST_WIDE_INT startbitpos, rtx rvec[],
int *k)
{
@@ -5887,7 +5887,7 @@ rs6000_darwin64_record_arg_recurse (CUMULATIVE_ARGS *cum, tree type,
#endif
rs6000_darwin64_record_arg_flush (cum, bitpos, rvec, k);
rvec[(*k)++]
- = gen_rtx_EXPR_LIST (VOIDmode,
+ = gen_rtx_EXPR_LIST (VOIDmode,
gen_rtx_REG (mode, cum->fregno++),
GEN_INT (bitpos / BITS_PER_UNIT));
if (mode == TFmode)
@@ -5897,8 +5897,8 @@ rs6000_darwin64_record_arg_recurse (CUMULATIVE_ARGS *cum, tree type,
{
rs6000_darwin64_record_arg_flush (cum, bitpos, rvec, k);
rvec[(*k)++]
- = gen_rtx_EXPR_LIST (VOIDmode,
- gen_rtx_REG (mode, cum->vregno++),
+ = gen_rtx_EXPR_LIST (VOIDmode,
+ gen_rtx_REG (mode, cum->vregno++),
GEN_INT (bitpos / BITS_PER_UNIT));
}
else if (cum->intoffset == -1)
@@ -5911,7 +5911,7 @@ rs6000_darwin64_record_arg_recurse (CUMULATIVE_ARGS *cum, tree type,
being passed by value, along with the offset of where the
register's value may be found in the block. FP fields go in FP
register, vector fields go in vector registers, and everything
- else goes in int registers, packed as in memory.
+ else goes in int registers, packed as in memory.
This code is also used for function return values. RETVAL indicates
whether this is the case.
@@ -6557,7 +6557,7 @@ setup_incoming_varargs (CUMULATIVE_ARGS *cum, enum machine_mode mode,
static
bool skip_vec_args(tree arg_type, int pass, int *last_pass)
-{
+{
if (DEFAULT_ABI != ABI_DARWIN)
return false;
@@ -6568,9 +6568,9 @@ bool skip_vec_args(tree arg_type, int pass, int *last_pass)
return true;
}
else if (pass == 2)
- return true;
+ return true;
return false;
-}
+}
/* APPLE LOCAL end Altivec */
@@ -6879,7 +6879,7 @@ do { \
are stored in ALTIVEC_PIM_TABLE below, each annotated with flags indicating
how its arguments should be matched and/or how its return type is to be
determined. */
-
+
enum pim_flags
{
/* CR6 predicate modifiers. Not used for operations. For predicates,
@@ -6894,7 +6894,7 @@ enum pim_flags
/* Function overload argument matching. Operations and predicates with
multiple overload candidates will have multiple entries, listed
- contiguously, in the ALTIVEC_PIM_TABLE below. When the
+ contiguously, in the ALTIVEC_PIM_TABLE below. When the
rs6000_fold_builtin() routine is called, it will first point at
the first entry. If any of the pim_ovl_... flags is set for this
entry, the argument(s) to rs6000_fold_builtin() will be type-checked
@@ -6946,7 +6946,7 @@ enum pim_flags
/* Mark the beginning of instruction groups. For our purposes, an
instruction group is the collection of overload candidates for
a particular instruction or predicate. For example, the entries
- "vec_abss", "vec_abss.2" and "vec_abss.3" defined in
+ "vec_abss", "vec_abss.2" and "vec_abss.3" defined in
altivec_init_builtins() below constitute a group, as does the
singleton "vec_addc" entry. */
@@ -7422,7 +7422,7 @@ static struct builtin_description bdesc_1arg[] =
static tree
altivec_cov_rt_12 (tree t1, tree t2)
-{
+{
/* NB: The ordering of the following statements is important.
Matching of more specific types (e.g., 'vector pixel') should
precede matching of more general types, esp. if they subsume the
@@ -7452,7 +7452,7 @@ altivec_cov_rt_12 (tree t1, tree t2)
static tree
altivec_cov_rt_2p (tree t)
-{
+{
/* Must be a pointer. */
if (!t)
@@ -7595,17 +7595,17 @@ altivec_ovl_resolve (struct altivec_pim_info *info, tree t1, tree t2)
|| t2 == unsigned_V4SI_type_node);
case pim_ovl_pqi_2:
- OVL_MATCH (TREE_CODE (t2) == POINTER_TYPE
+ OVL_MATCH (TREE_CODE (t2) == POINTER_TYPE
&& (TYPE_MODE (TREE_TYPE (t2)) == QImode
|| TYPE_MODE (TREE_TYPE (t2)) == V16QImode));
case pim_ovl_phi_2:
- OVL_MATCH (TREE_CODE (t2) == POINTER_TYPE
+ OVL_MATCH (TREE_CODE (t2) == POINTER_TYPE
&& (TYPE_MODE (TREE_TYPE (t2)) == HImode
|| TYPE_MODE (TREE_TYPE (t2)) == V8HImode));
case pim_ovl_psi_2:
- OVL_MATCH (TREE_CODE (t2) == POINTER_TYPE
+ OVL_MATCH (TREE_CODE (t2) == POINTER_TYPE
&& (TYPE_MODE (TREE_TYPE (t2)) == SImode
|| TYPE_MODE (TREE_TYPE (t2)) == V4SImode
|| TYPE_MODE (TREE_TYPE (t2)) == SFmode
@@ -7654,7 +7654,7 @@ altivec_convert_args (tree types, tree args)
tree
rs6000_fold_builtin (tree exp, bool ARG_UNUSED (ignore))
-{
+{
tree fndecl, arglist, rettype;
tree typ1 = NULL_TREE, typ2 = NULL_TREE;
int fcode, ovl_error = 0;
@@ -14869,7 +14869,7 @@ rs6000_stack_info (void)
else
non_fixed_size = cfun->iasm_frame_size;
non_fixed_size += 24;
- info_ptr->total_size = RS6000_ALIGN (non_fixed_size,
+ info_ptr->total_size = RS6000_ALIGN (non_fixed_size,
ABI_STACK_BOUNDARY / BITS_PER_UNIT);
}
else
@@ -15163,7 +15163,7 @@ rs6000_return_addr (int count, rtx frame)
/* APPLE LOCAL begin sibling calls
On Darwin only, indirect calls may be sibcalls. This is enabled
- primarily by target-specific logic in calls.c.
+ primarily by target-specific logic in calls.c.
APPLE LOCAL end sibling calls */
static bool
rs6000_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED)
@@ -15800,14 +15800,14 @@ static int name_encodes_objc_method_p (const char *piclabel_name)
/* APPLE LOCAL begin recompute PIC register use */
/* Sometimes a function has references that require the PIC register,
but optimization removes them all. To catch this case
- recompute current_function_uses_pic_offset_table here.
+ recompute current_function_uses_pic_offset_table here.
This may allow us to eliminate the prologue and epilogue. */
static int
recompute_PIC_register_use (void)
{
- if (DEFAULT_ABI == ABI_DARWIN
- && flag_pic && current_function_uses_pic_offset_table
+ if (DEFAULT_ABI == ABI_DARWIN
+ && flag_pic && current_function_uses_pic_offset_table
&& !cfun->machine->ra_needs_full_frame)
{
rtx insn;
@@ -15824,7 +15824,7 @@ recompute_PIC_register_use (void)
return 0;
}
/* APPLE LOCAL end recompute PIC register use */
-
+
/* APPLE LOCAL begin volatile pic base reg in leaves */
/* If this is a leaf function and we used any pic-based references,
see if there is an unused volatile reg we can use instead of R31.
@@ -15868,7 +15868,7 @@ try_leaf_pic_optimization (void)
{
if ( DEFAULT_ABI==ABI_DARWIN
&& flag_pic && current_function_uses_pic_offset_table
- && current_function_is_leaf
+ && current_function_is_leaf
&& !cfun->machine->ra_needs_full_frame )
{
int reg = alloc_volatile_reg ();
@@ -16027,28 +16027,28 @@ rs6000_emit_prologue (void)
/* APPLE LOCAL end CW asm block */
/* APPLE LOCAL begin special ObjC method use of R12 */
#if TARGET_MACHO
- if (DEFAULT_ABI == ABI_DARWIN
+ if (DEFAULT_ABI == ABI_DARWIN
&& current_function_uses_pic_offset_table && flag_pic
- && current_function_decl
+ && current_function_decl
&& DECL_ASSEMBLER_NAME_SET_P (current_function_decl))
{
/* At -O0, this will not be set yet, so we won't do this opt. */
- const char *piclabel_name
+ const char *piclabel_name
= IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl));
-
+
if (name_encodes_objc_method_p (piclabel_name)
/* If we're saving vector or FP regs via a function call,
then don't bother with this ObjC R12 optimization.
This test also eliminates world_save. */
&& (info->first_altivec_reg_save > LAST_ALTIVEC_REGNO
|| VECTOR_SAVE_INLINE (info->first_altivec_reg_save))
- && (info->first_fp_reg_save == 64
+ && (info->first_fp_reg_save == 64
|| FP_SAVE_INLINE (info->first_fp_reg_save)))
{
rtx lr = gen_rtx_REG (Pmode, LINK_REGISTER_REGNUM);
rtx src = machopic_function_base_sym ();
- objc_method_using_pic = 1;
- rs6000_maybe_dead (emit_insn (gen_load_macho_picbase_label (lr,
+ objc_method_using_pic = 1;
+ rs6000_maybe_dead (emit_insn (gen_load_macho_picbase_label (lr,
src)));
}
}
@@ -16371,7 +16371,7 @@ rs6000_emit_prologue (void)
#endif
/* If this is the last CALL in the prolog, then we've got our PC.
If we're saving AltiVec regs via a function, we're not last. */
- && (info->first_altivec_reg_save > LAST_ALTIVEC_REGNO
+ && (info->first_altivec_reg_save > LAST_ALTIVEC_REGNO
|| VECTOR_SAVE_INLINE (info->first_altivec_reg_save)))
gen_following_label = lr_already_set_up_for_pic = 1;
/* APPLE LOCAL end reduce code size */
@@ -16440,7 +16440,7 @@ rs6000_emit_prologue (void)
rtx mem = gen_rtx_MEM (Pmode, addr);
/* This should not be of rs6000_sr_alias_set, because of
__builtin_return_address. */
- RTVEC_ELT (p, count++) = gen_rtx_SET (Pmode, mem,
+ RTVEC_ELT (p, count++) = gen_rtx_SET (Pmode, mem,
gen_rtx_REG (Pmode, LINK_REGISTER_REGNUM));
}
#endif
@@ -16492,7 +16492,7 @@ rs6000_emit_prologue (void)
/* APPLE LOCAL begin volatile pic base reg in leaves */
|| (DEFAULT_ABI == ABI_DARWIN && flag_pic
&& ((current_function_uses_pic_offset_table
- && cfun->machine->substitute_pic_base_reg
+ && cfun->machine->substitute_pic_base_reg
== INVALID_REGNUM)
|| cfun->machine->ra_needs_full_frame)))))
/* APPLE LOCAL end volatile pic base reg in leaves */
@@ -16583,7 +16583,7 @@ rs6000_emit_prologue (void)
emit_move_insn (gen_rtx_REG (Pmode,
cfun->machine->substitute_pic_base_reg
== INVALID_REGNUM
- ? PIC_OFFSET_TABLE_REGNUM
+ ? PIC_OFFSET_TABLE_REGNUM
: cfun->machine->substitute_pic_base_reg),
gen_rtx_REG (Pmode, 12)));
/* APPLE LOCAL end special ObjC method use of R12 */
@@ -16704,7 +16704,7 @@ rs6000_emit_prologue (void)
/* APPLE LOCAL begin volatile pic base reg in leaves */
insn = emit_move_insn (gen_rtx_REG (Pmode,
- (cfun->machine->substitute_pic_base_reg
+ (cfun->machine->substitute_pic_base_reg
== INVALID_REGNUM)
? RS6000_PIC_OFFSET_TABLE_REGNUM
: cfun->machine->substitute_pic_base_reg),
@@ -16810,7 +16810,7 @@ rs6000_emit_epilogue (int sibcall)
/* APPLE LOCAL begin CW asm block */
if (cfun->iasm_asm_function && cfun->iasm_frame_size == -2)
{
-
+
rtvec p = rtvec_alloc (2);
RTVEC_ELT (p, 0) = gen_rtx_RETURN (VOIDmode);
@@ -17037,7 +17037,7 @@ rs6000_emit_epilogue (int sibcall)
set_mem_alias_set (mem, rs6000_sr_alias_set);
/* APPLE LOCAL begin use R11 because of ObjC use of R12 in sibcall to CTR */
- emit_move_insn (gen_rtx_REG (SImode,
+ emit_move_insn (gen_rtx_REG (SImode,
DEFAULT_ABI == ABI_DARWIN ? 11 : 12), mem);
/* APPLE LOCAL end use R11 because of ObjC use of R12 in sibcall to CTR */
}
@@ -17116,10 +17116,10 @@ rs6000_emit_epilogue (int sibcall)
/* APPLE LOCAL begin darwin native */
|| (DEFAULT_ABI == ABI_DARWIN && flag_pic
&& ((current_function_uses_pic_offset_table
- && cfun->machine->substitute_pic_base_reg
+ && cfun->machine->substitute_pic_base_reg
== INVALID_REGNUM)
|| cfun->machine->ra_needs_full_frame)))))
-
+
/* APPLE LOCAL end darwin native */
{
rtx addr = gen_rtx_PLUS (Pmode, frame_reg_rtx,
@@ -17748,7 +17748,7 @@ rs6000_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
/* APPLE LOCAL end 4380289 */
/* APPLE LOCAL begin 3910248, 3915171 */
for (insn = get_last_insn ();
- insn && (GET_CODE (insn) != NOTE
+ insn && (GET_CODE (insn) != NOTE
|| NOTE_LINE_NUMBER (insn) < 0);
insn = PREV_INSN (insn))
;
@@ -18965,16 +18965,16 @@ rs6000_is_costly_dependence (rtx insn, rtx next, rtx link, int cost,
|| GET_CODE (sto_mem) == SIGN_EXTEND)
load_mem = XEXP (sto_mem, 0);
if (GET_CODE (load_mem) == MEM && GET_CODE (sto_mem) == MEM)
- /* Only consider those true-depenedence cases that memory conflict
- can be determined. Exclude cases, where true-dependency was
- decided because memory conflict could not be determined from
+ /* Only consider those true-depenedence cases that memory conflict
+ can be determined. Exclude cases, where true-dependency was
+ decided because memory conflict could not be determined from
aliasing info. */
return must_true_dependence (load_mem, sto_mem);
}
return true;
}
/* APPLE LOCAL end nop on true-dependence. */
-
+
/* The flag is set to X; dependences with latency >= X are considered costly,
and will not be scheduled in the same group. */
if (rs6000_sched_costly_dep <= max_dep_latency
@@ -19672,6 +19672,10 @@ rs6000_set_default_type_attributes (tree type)
TYPE_ATTRIBUTES (type) = tree_cons (get_identifier ("longcall"),
NULL_TREE,
TYPE_ATTRIBUTES (type));
+ /* APPLE LOCAL mainline */
+#if TARGET_MACHO
+ darwin_set_default_type_attributes (type);
+#endif
}
/* Return a reference suitable for calling a function with the
@@ -20058,7 +20062,7 @@ output_call (rtx insn, rtx *operands, int dest_operand_number,
/* APPLE LOCAL begin 3910248, 3915171 */
for (;
- insn && (GET_CODE (insn) != NOTE
+ insn && (GET_CODE (insn) != NOTE
|| NOTE_LINE_NUMBER (insn) < 0);
insn = PREV_INSN (insn))
;
@@ -20079,7 +20083,7 @@ output_call (rtx insn, rtx *operands, int dest_operand_number,
away, the linkers (static and dynamic) won't know where
to send us. Ergo, when we're in a coalesced section, we
must always use a stub for all callees. */
-
+
operands[dest_operand_number] = in_text_section ()
? machopic_indirect_call_target (operands[dest_operand_number])
: machopic_force_indirect_call_target (operands[dest_operand_number]);
@@ -20307,14 +20311,14 @@ rs6000_darwin_file_start (void)
unsigned
round_type_align (tree the_struct, unsigned computed, unsigned specified)
{
- if (TREE_CODE (the_struct) == VECTOR_TYPE
+ if (TREE_CODE (the_struct) == VECTOR_TYPE
&& ALTIVEC_VECTOR_MODE (TYPE_MODE (the_struct)))
{
/* All vectors are (at least) 16-byte aligned. A struct or
union with a vector element is also 16-byte aligned. */
return MAX (RS6000_VECTOR_ALIGNMENT, MAX (computed, specified));
}
-
+
if (TREE_CODE (the_struct) == RECORD_TYPE
|| TREE_CODE (the_struct) == UNION_TYPE
|| TREE_CODE (the_struct) == QUAL_UNION_TYPE)
@@ -20331,7 +20335,7 @@ round_type_align (tree the_struct, unsigned computed, unsigned specified)
{
/* If other-than-default alignment (which includes mac68k
mode) is in effect, then no adjustments to the alignment
- should be necessary. Ditto if the struct has the
+ should be necessary. Ditto if the struct has the
__packed__ attribute. */
if (TYPE_PACKED (the_struct) || TARGET_ALIGN_MAC68K
|| TARGET_ALIGN_NATURAL || maximum_field_alignment != 0)
@@ -20345,7 +20349,7 @@ round_type_align (tree the_struct, unsigned computed, unsigned specified)
not enabled, alignment is generally limited to word
alignment. Consequently, the alignment of unions has
to be recalculated if AltiVec is not enabled.
-
+
Below we explicitly test for fields with greater than
word alignment: doubles, long longs, and structs and
arrays with greater than word alignment. */
@@ -20357,7 +20361,7 @@ round_type_align (tree the_struct, unsigned computed, unsigned specified)
if (TREE_CODE (the_struct) == UNION_TYPE && !TARGET_ALTIVEC)
{
tree field = first_field;
-
+
while (field != 0)
{
/* Don't consider statics, enums and constant fields
@@ -20400,7 +20404,7 @@ round_type_align (tree the_struct, unsigned computed, unsigned specified)
&& TYPE_MODE (field_type) == DImode)
val = MAX (RS6000_LONGLONG_ALIGNMENT, val);
}
-
+
return val;
}
} /* first_field != 0 */
@@ -20410,7 +20414,7 @@ round_type_align (tree the_struct, unsigned computed, unsigned specified)
if (TARGET_ALIGN_MAC68K && ! TYPE_PACKED (the_struct))
{
- if (computed < 16)
+ if (computed < 16)
computed = 16;
}
} /* RECORD_TYPE, etc */
@@ -20749,7 +20753,7 @@ static bool
rs6000_binds_local_p (tree decl)
{
/* APPLE LOCAL begin kext treat vtables as overridable */
- return default_binds_local_p_1 (decl,
+ return default_binds_local_p_1 (decl,
flag_apple_kext && lang_hooks.vtable_p (decl));
}
/* APPLE LOCAL end kext treat vtables as overridable */
diff --git a/gcc/target-def.h b/gcc/target-def.h
index 85fb012b986..3c8db3695d3 100644
--- a/gcc/target-def.h
+++ b/gcc/target-def.h
@@ -289,7 +289,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define TARGET_VECTORIZE \
/* APPLE LOCAL begin 4375453 */ \
{TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD, \
- TARGET_VECTOR_ALIGNMENT_REACHABLE}
+ TARGET_VECTOR_ALIGNMENT_REACHABLE}
/* APPLE LOCAL end 4375453 */
/* In except.c */
@@ -360,7 +360,11 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define TARGET_DELEGITIMIZE_ADDRESS hook_rtx_rtx_identity
#define TARGET_FUNCTION_OK_FOR_SIBCALL hook_bool_tree_tree_false
#define TARGET_COMP_TYPE_ATTRIBUTES hook_int_tree_tree_1
+/* APPLE LOCAL begin mainline */
+#ifndef TARGET_SET_DEFAULT_TYPE_ATTRIBUTES
#define TARGET_SET_DEFAULT_TYPE_ATTRIBUTES hook_void_tree
+#endif
+/* APPLE LOCAL end mainline */
#define TARGET_INSERT_ATTRIBUTES hook_void_tree_treeptr
#define TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P hook_bool_tree_false
#define TARGET_MS_BITFIELD_LAYOUT_P hook_bool_tree_false
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 238c4f4bfba..8f19314fec2 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2006-04-25 Eric Christopher <echristo@apple.com>
+
+ Radar 4529978
+ * gcc.dg/pragma-ms_struct.c: New.
+
2006-03-24 Geoffrey Keating <geoffk@apple.com>
Radar 4485597
@@ -11,7 +16,7 @@
* g++.dg/template/friend40.C: New test.
2006-03-15 Geoffrey Keating <geoffk@apple.com>
-
+
Radar 3992198
* g++.old-deja/g++.other/init18.C: New.
* g++.old-deja/g++.other/init5.C: Remove xfail.
diff --git a/gcc/testsuite/gcc.dg/pragma-ms_struct.c b/gcc/testsuite/gcc.dg/pragma-ms_struct.c
new file mode 100644
index 00000000000..ebdb73c65a2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pragma-ms_struct.c
@@ -0,0 +1,22 @@
+/* APPLE LOCAL file mainline */
+/* Darwin pragma for __attribute__ ((ms_struct)). */
+
+/* { dg-do compile { target *-*-darwin* } } */
+/* { dg-options "-Wall" } */
+
+#pragma ms_struct on
+
+#pragma ms_struct off
+
+#pragma ms_struct reset
+
+#pragma ms_struct /* { dg-warning "malformed" } */
+
+#pragma ms_struct on top of spaghetti /* { dg-warning "junk" } */
+
+struct foo
+{
+ int a;
+ int b;
+ char c;
+};