aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/asm.h81
-rw-r--r--gcc/config/darwin-c.c88
-rw-r--r--gcc/config/darwin-protos.h8
-rw-r--r--gcc/config/darwin.c2
-rw-r--r--gcc/config/darwin.h20
-rw-r--r--gcc/config/i386/darwin.h17
-rw-r--r--gcc/config/i386/i386-protos.h11
-rw-r--r--gcc/config/i386/i386.c427
-rw-r--r--gcc/config/i386/i386.h126
-rw-r--r--gcc/config/i386/mmintrin.h3
-rw-r--r--gcc/config/rs6000/rs6000-protos.h2
-rw-r--r--gcc/config/rs6000/rs6000.c236
-rw-r--r--gcc/config/rs6000/rs6000.h8
-rw-r--r--gcc/config/rs6000/rs6000.md40
-rw-r--r--gcc/config/rs6000/t-darwin3
-rw-r--r--gcc/config/t-darwin3
16 files changed, 777 insertions, 298 deletions
diff --git a/gcc/config/asm.h b/gcc/config/asm.h
index 3c3c2e389b5..19d6fa1abcb 100644
--- a/gcc/config/asm.h
+++ b/gcc/config/asm.h
@@ -6,35 +6,35 @@
/* We use a small state machine to inform the lexer when to start
returning tokens marking the beginning of each asm line. */
-enum cw_asm_states {
+enum iasm_states {
/* Normal code. */
- cw_asm_none,
+ iasm_none,
/* '{' of asm block seen, decls may appear. */
- cw_asm_decls,
+ iasm_decls,
/* No more decls, in asm block proper, '}' not seen yet. */
- cw_asm_asm
+ iasm_asm
};
/* Nonzero means that CodeWarrior-style inline assembler is to be parsed. */
-extern int flag_cw_asm_blocks;
+extern int flag_iasm_blocks;
-extern enum cw_asm_states cw_asm_state;
-extern int cw_asm_in_decl;
-extern int inside_cw_asm_block;
-extern int cw_asm_at_bol;
-extern int cw_asm_in_operands;
-extern const cpp_token *cw_split_next;
-void cw_insert_saved_token (void);
-extern tree cw_do_id (tree);
+extern enum iasm_states iasm_state;
+extern bool iasm_in_decl;
+extern bool inside_iasm_block;
+extern bool iasm_at_bol;
+extern int iasm_in_operands;
+extern const cpp_token *iasm_split_next;
+void iasm_insert_saved_token (void);
+extern tree iasm_do_id (tree);
/* Maximum number of arguments. */
-#define CW_MAX_ARG 11
+#define IASM_MAX_ARG 11
-#ifndef TARGET_CW_EXTRA_INFO
-#define TARGET_CW_EXTRA_INFO
+#ifndef TARGET_IASM_EXTRA_INFO
+#define TARGET_IASM_EXTRA_INFO
#endif
-struct cw_md_Extra_info {
+struct iasm_md_Extra_info {
/* Number of operands to the ASM_expr. Note, this can be different
from the number of operands to the instruction, in cases like:
@@ -51,30 +51,35 @@ struct cw_md_Extra_info {
char *arg_p;
bool must_be_reg;
bool was_output;
- } dat[CW_MAX_ARG];
+ } dat[IASM_MAX_ARG];
- TARGET_CW_EXTRA_INFO
+ bool no_label_map;
+
+ TARGET_IASM_EXTRA_INFO
};
-typedef struct cw_md_Extra_info cw_md_extra_info;
+typedef struct iasm_md_Extra_info iasm_md_extra_info;
-void print_cw_asm_operand (char *buf, tree arg, unsigned argnum, tree *uses,
- bool must_be_reg, bool must_not_be_reg, cw_md_extra_info *e);
+void iasm_print_operand (char *buf, tree arg, unsigned argnum, tree *uses,
+ bool must_be_reg, bool must_not_be_reg, iasm_md_extra_info *e);
-extern tree cw_asm_stmt (tree, tree, int);
-extern tree cw_asm_build_register_offset (tree, tree);
-extern tree cw_asm_label (tree, int);
+extern tree iasm_stmt (tree, tree, int);
+extern tree iasm_build_register_offset (tree, tree);
+extern tree iasm_label (tree, int);
extern tree prepend_char_identifier (tree, char);
-extern void clear_cw_asm_labels (void);
-extern tree cw_asm_reg_name (tree);
-extern tree cw_asm_entry (tree, tree, tree);
-extern int cw_asm_typename_or_reserved (tree);
-extern tree cw_asm_c_build_component_ref (tree, tree);
-extern tree cw_get_identifier (tree, const char *);
-extern tree cw_build_bracket (tree, tree);
-extern bool cw_is_prefix (tree);
-extern void cw_skip_to_eol (void);
-extern void cw_force_constraint (const char *c, cw_md_extra_info *e);
-extern tree cw_ptr_conv (tree type, tree exp);
-extern void cw_asm_get_register_var (tree var, const char *modifier, char *buf,
- unsigned argnum, bool must_be_reg, cw_md_extra_info *e);
+extern void iasm_clear_labels (void);
+extern tree iasm_reg_name (tree);
+extern tree iasm_entry (tree, tree, tree);
+extern int iasm_typename_or_reserved (tree);
+extern tree iasm_c_build_component_ref (tree, tree);
+extern tree iasm_get_identifier (tree, const char *);
+extern tree iasm_build_bracket (tree, tree);
+extern bool iasm_is_prefix (tree);
+extern void iasm_skip_to_eol (void);
+extern bool iasm_memory_clobber (const char *);
+extern void iasm_force_constraint (const char *c, iasm_md_extra_info *e);
+extern tree iasm_ptr_conv (tree type, tree exp);
+extern void iasm_get_register_var (tree var, const char *modifier, char *buf,
+ unsigned argnum, bool must_be_reg, iasm_md_extra_info *e);
+extern bool iasm_is_pseudo (const char *);
+extern tree iasm_addr (tree);
#endif
diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c
index 4a586f8e841..0b33a2875c2 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 d0cd39eae42..167b7627a3d 100644
--- a/gcc/config/darwin-protos.h
+++ b/gcc/config/darwin-protos.h
@@ -70,8 +70,10 @@ 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_cw_asm_special_label (tree);
+extern tree darwin_iasm_special_label (tree);
#endif /* TREE_CODE */
@@ -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 */
@@ -212,7 +216,7 @@ extern tree darwin_construct_objc_string (tree);
/* APPLE LOCAL end constant cfstrings */
/* APPLE LOCAL CW asm blocks */
-#define CW_ASM_SPECIAL_LABEL(ID) darwin_cw_asm_special_label (ID)
+#define IASM_SPECIAL_LABEL(ID) darwin_iasm_special_label (ID)
/* APPLE LOCAL begin KEXT */
#ifdef TREE_CODE
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index d0080ec7c5c..d97a6b27c73 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -2163,7 +2163,7 @@ darwin_build_constant_cfstring (tree str)
otherwise return NULL signifying that we have no special
knowledge. */
tree
-darwin_cw_asm_special_label (tree id)
+darwin_iasm_special_label (tree id)
{
const char *name = IDENTIFIER_POINTER (id);
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index af7c0e49a6e..c7c8ffcf246 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)); \
@@ -1379,6 +1379,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); \
diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h
index 75c6f895c0c..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 \
@@ -206,7 +204,7 @@ extern void darwin_x86_file_end (void);
} while (0)
/* APPLE LOCAL CW asm blocks */
-extern int flag_cw_asm_blocks;
+extern int flag_iasm_blocks;
/* APPLE LOCAL begin fix-and-continue x86 */
#undef SUBTARGET_OVERRIDE_OPTIONS
#define SUBTARGET_OVERRIDE_OPTIONS \
@@ -234,7 +232,7 @@ extern int flag_cw_asm_blocks;
} \
/* APPLE LOCAL end AT&T-style stub 4164563 */ \
/* APPLE LOCAL begin CW asm blocks */ \
- if (flag_cw_asm_blocks) \
+ if (flag_iasm_blocks) \
flag_ms_asms = 1; \
/* APPLE LOCAL end CW asm blocks */ \
} while (0)
@@ -254,10 +252,6 @@ extern int flag_cw_asm_blocks;
#define TARGET_FIX_AND_CONTINUE (darwin_fix_and_continue)
/* APPLE LOCAL end fix-and-continue x86 */
-/* APPLE LOCAL begin CW asm blocks */
-#define CW_ASM_REGISTER_NAME(STR, BUF) i386_cw_asm_register_name (STR, BUF)
-/* APPLE LOCAL end CW asm blocks */
-
/* APPLE LOCAL begin mainline 2006-02-21 4439051 */
/* Darwin uses the standard DWARF register numbers but the default
register numbers for STABS. Fortunately for 64-bit code the
@@ -286,3 +280,10 @@ extern int flag_cw_asm_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/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
index 5a1896ed218..06a66efeb97 100644
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@ -279,11 +279,12 @@ extern enum rtx_code ix86_fp_compare_code_to_integer (enum rtx_code);
#endif
/* APPLE LOCAL begin CW asm blocks */
-extern const char *i386_cw_asm_register_name (const char *regname, char *buf);
-extern bool cw_x86_needs_swapping (const char *);
-extern bool cw_print_op (char *buf, tree arg, unsigned argnum, tree *uses,
- bool must_be_reg, bool must_not_be_reg, void *);
-extern void x86_cw_print_prefix (char *buf, tree prefix_list);
+extern const char *i386_iasm_register_name (const char *regname, char *buf);
+extern bool iasm_x86_needs_swapping (const char *);
+extern bool iasm_print_op (char *buf, tree arg, unsigned argnum, tree *uses,
+ bool must_be_reg, bool must_not_be_reg, void *);
+extern void iasm_x86_print_prefix (char *buf, tree prefix_list);
+extern tree iasm_raise_reg (tree);
/* APPLE LOCAL end CW asm blocks */
/* APPLE LOCAL begin 4356747 stack realign */
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 7d1a535ff8b..4a81c09b1e9 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -4475,7 +4475,7 @@ ix86_save_reg (unsigned int regno, int maybe_eh_return)
/* APPLE LOCAL begin CW asm blocks */
/* For an asm function, we don't save any registers, instead, the
user is responsible. */
- if (cfun->cw_asm_function)
+ if (cfun->iasm_asm_function)
return 0;
/* APPLE LOCAL end CW asm blocks */
@@ -4971,7 +4971,7 @@ ix86_expand_prologue (void)
else if (! TARGET_STACK_PROBE || allocate < CHECK_STACK_LIMIT)
/* APPLE LOCAL begin CW asm blocks */
{
- if (! cfun->cw_asm_function)
+ if (! cfun->iasm_asm_function)
pro_epilogue_adjust_stack (stack_pointer_rtx, stack_pointer_rtx,
GEN_INT (-allocate), -1);
}
@@ -5108,7 +5108,7 @@ ix86_expand_epilogue (int style)
/* APPLE LOCAL begin CW asm blocks */
/* For an asm function, don't generate an epilogue. */
- if (cfun->cw_asm_function)
+ if (cfun->iasm_asm_function)
{
emit_jump_insn (gen_return_internal ());
return;
@@ -18978,11 +18978,13 @@ ix86_darwin_handle_regparmandstackparm (tree fndecl)
#define CTI_MAX c_CTI_MAX
#include "c-common.h"
#undef CTI_MAX
+#undef GCC_DIAG_STYLE
+#include "c-tree.h"
/* Addition register names accepted for inline assembly that would
otherwise not be registers. This table must be sorted for
bsearch. */
-static const char *additional_names[] = {
+static const char *iasm_additional_names[] = {
"AH", "AL", "AX", "BH", "BL", "BP", "BX", "CH", "CL", "CX", "DH",
"DI", "DL", "DX", "EAX", "EBP", "EBX", "ECX", "EDI", "EDX", "ESI",
"ESP", "MM0", "MM1", "MM2", "MM3", "MM4", "MM5", "MM6", "MM7", "R10",
@@ -18994,7 +18996,7 @@ static const char *additional_names[] = {
/* Comparison function for bsearch to find additional register names. */
static int
-cw_reg_comp (const void *a, const void *b)
+iasm_reg_comp (const void *a, const void *b)
{
char *const*x = a;
char *const*y = b;
@@ -19006,7 +19008,7 @@ cw_reg_comp (const void *a, const void *b)
forms. */
const char *
-i386_cw_asm_register_name (const char *regname, char *buf)
+i386_iasm_register_name (const char *regname, char *buf)
{
const char **r;
@@ -19021,9 +19023,9 @@ i386_cw_asm_register_name (const char *regname, char *buf)
/* If we can find a lower case version of any registers in
additional_names, return it. */
- r = bsearch (&regname, additional_names,
- sizeof (additional_names) / sizeof (additional_names[0]),
- sizeof (additional_names[0]), cw_reg_comp);
+ r = bsearch (&regname, iasm_additional_names,
+ sizeof (iasm_additional_names) / sizeof (iasm_additional_names[0]),
+ sizeof (iasm_additional_names[0]), iasm_reg_comp);
if (r)
{
char *p;
@@ -19042,11 +19044,10 @@ i386_cw_asm_register_name (const char *regname, char *buf)
return NULL;
}
-extern bool cw_memory_clobber (const char *);
/* Return true iff the opcode wants memory to be stable. We arrange
for a memory clobber in these instances. */
bool
-cw_memory_clobber (const char *ARG_UNUSED (opcode))
+iasm_memory_clobber (const char *ARG_UNUSED (opcode))
{
return true;
}
@@ -19054,7 +19055,7 @@ cw_memory_clobber (const char *ARG_UNUSED (opcode))
/* Return true iff the operands need swapping. */
bool
-cw_x86_needs_swapping (const char *opcode)
+iasm_x86_needs_swapping (const char *opcode)
{
/* Don't swap if output format is the same as input format. */
if (ASSEMBLER_DIALECT == ASM_INTEL)
@@ -19065,6 +19066,8 @@ cw_x86_needs_swapping (const char *opcode)
return false;
if (strcasecmp (opcode, "invlpga") == 0)
return false;
+ if (opcode[0] == ' ' && iasm_is_pseudo (opcode+1))
+ return false;
return true;
}
@@ -19073,11 +19076,11 @@ cw_x86_needs_swapping (const char *opcode)
is in ATT syntax. */
static tree
-x86_swap_operands (const char *opcode, tree args)
+iasm_x86_swap_operands (const char *opcode, tree args)
{
int noperands;
- if (cw_x86_needs_swapping (opcode) == false)
+ if (iasm_x86_needs_swapping (opcode) == false)
return args;
#if 0
@@ -19095,27 +19098,123 @@ x86_swap_operands (const char *opcode, tree args)
return args;
}
+/* Map a register name to a high level tree type for a VAR_DECL of
+ that type, whose RTL will refer to the given register. */
+
+static tree
+iasm_type_for (tree arg)
+{
+ tree type = NULL_TREE;
+
+ if (IDENTIFIER_LENGTH (arg) > 2
+ && IDENTIFIER_POINTER (arg)[0] == '%')
+ {
+ enum machine_mode mode = VOIDmode;
+ if (IDENTIFIER_POINTER (arg)[1] == 'e')
+ mode = SImode;
+ else if (/* IDENTIFIER_POINTER (arg)[2] == 'h'
+ || */ IDENTIFIER_POINTER (arg)[2] == 'l')
+ mode = QImode;
+ else if (IDENTIFIER_POINTER (arg)[2] == 'x')
+ mode = HImode;
+ else if (IDENTIFIER_POINTER (arg)[1] == 'r')
+ mode = DImode;
+ else if (IDENTIFIER_POINTER (arg)[1] == 'x')
+ mode = SFmode;
+ else if (IDENTIFIER_POINTER (arg)[1] == 'm')
+ mode = SFmode;
+
+ if (mode != VOIDmode)
+ type = c_common_type_for_mode (mode, 1);
+ }
+
+ return type;
+}
+
+/* We raise the code from a named register into a VAR_DECL of an
+ appropriate type that refers to the register so that reload doesn't
+ run out of registers. */
+
+tree
+iasm_raise_reg (tree arg)
+{
+ int regno = decode_reg_name (IDENTIFIER_POINTER (arg));
+ if (regno >= 0)
+ {
+ tree decl = NULL_TREE;
+
+ decl = lookup_name_two (arg, 0);
+ if (decl == error_mark_node)
+ decl = 0;
+ if (decl == 0)
+ {
+ tree type = iasm_type_for (arg);
+ if (type)
+ {
+ decl = build_decl (VAR_DECL, arg, type);
+ DECL_ARTIFICIAL (decl) = 1;
+ DECL_REGISTER (decl) = 1;
+ C_DECL_REGISTER (decl) = 1;
+ DECL_HARD_REGISTER (decl) = 1;
+ change_decl_assembler_name (decl, arg);
+ decl = pushdecl (decl);
+ }
+ }
+
+ if (decl)
+ return decl;
+ }
+
+ return arg;
+}
+
+/* Allow constants and readonly variables to be used in instructions
+ in places that require constants. */
+
+static tree
+iasm_default_conv (tree e)
+{
+ if (e == NULL_TREE)
+ return e;
+
+ if (TREE_CODE (e) == CONST_DECL)
+ e = DECL_INITIAL (e);
+
+ if (DECL_P (e) && DECL_MODE (e) != BLKmode)
+ e = decl_constant_value (e);
+ return e;
+}
+
/* Return true iff the operand is suitible for as the offset for a
memory instruction. */
static bool
-cw_is_offset (tree v)
+iasm_is_offset (tree v)
{
if (TREE_CODE (v) == INTEGER_CST)
return true;
if (TREE_CODE (v) == ADDR_EXPR)
- return true;
+ {
+ v = TREE_OPERAND (v, 0);
+ if (TREE_CODE (v) == VAR_DECL
+ && TREE_STATIC (v)
+ && MEM_P (DECL_RTL (v)))
+ return true;
+ if (TREE_CODE (v) == LABEL_DECL)
+ return true;
+ return false;
+ }
if (TREE_CODE (v) == VAR_DECL
&& TREE_STATIC (v)
&& MEM_P (DECL_RTL (v)))
return true;
if ((TREE_CODE (v) == MINUS_EXPR
|| TREE_CODE (v) == PLUS_EXPR)
- && cw_is_offset (TREE_OPERAND (v, 0))
- && cw_is_offset (TREE_OPERAND (v, 1)))
+ && iasm_is_offset (TREE_OPERAND (v, 0))
+ && iasm_is_offset (TREE_OPERAND (v, 1)))
return true;
if (TREE_CODE (v) == NEGATE_EXPR
- && cw_is_offset (TREE_OPERAND (v, 0)))
+ && iasm_is_offset (TREE_OPERAND (v, 0)))
return true;
return false;
@@ -19124,7 +19223,7 @@ cw_is_offset (tree v)
/* Combine two types for [] expressions. */
static tree
-cw_combine_type (tree type0, tree type1)
+iasm_combine_type (tree type0, tree type1)
{
if (type0 == void_type_node
|| type0 == NULL_TREE)
@@ -19153,7 +19252,7 @@ cw_combine_type (tree type0, tree type1)
TREE_OPERAND (, 0) is the offset portion of the expression. ARGP
points to the current part of the tree we're walking.
- Thee tranformations we do:
+ The tranformations we do:
(A+O) ==> A
(A-O) ==> A
@@ -19162,13 +19261,15 @@ cw_combine_type (tree type0, tree type1)
where O are offset expressions. */
static tree
-cw_canonicalize_bracket_1 (tree* argp, tree top)
+iasm_canonicalize_bracket_1 (tree* argp, tree top)
{
tree arg = *argp;
tree offset = TREE_OPERAND (top, 0);
tree arg0, arg1;
tree rtype = NULL_TREE;
+ *argp = arg = iasm_default_conv (arg);
+
switch (TREE_CODE (arg))
{
case NOP_EXPR:
@@ -19186,7 +19287,10 @@ cw_canonicalize_bracket_1 (tree* argp, tree top)
arg0 = TREE_OPERAND (arg, 0);
arg1 = TREE_OPERAND (arg, 1);
- if (cw_is_offset (arg0))
+ arg0 = iasm_default_conv (arg0);
+ arg1 = iasm_default_conv (arg1);
+
+ if (iasm_is_offset (arg0))
{
if (offset != integer_zero_node)
arg0 = build2 (PLUS_EXPR, void_type_node, arg0, offset);
@@ -19194,24 +19298,24 @@ cw_canonicalize_bracket_1 (tree* argp, tree top)
*argp = arg1;
if (arg1)
- return cw_combine_type (rtype, cw_canonicalize_bracket_1 (argp, top));
+ return iasm_combine_type (rtype, iasm_canonicalize_bracket_1 (argp, top));
}
- else if (arg1 && cw_is_offset (arg1))
+ else if (arg1 && iasm_is_offset (arg1))
{
if (offset != integer_zero_node)
arg1 = build2 (PLUS_EXPR, void_type_node, arg1, offset);
TREE_OPERAND (top, 0) = arg1;
*argp = arg0;
- return cw_combine_type (rtype, cw_canonicalize_bracket_1 (argp, top));
+ return iasm_combine_type (rtype, iasm_canonicalize_bracket_1 (argp, top));
}
else
{
- rtype = cw_combine_type (rtype,
- cw_canonicalize_bracket_1 (&TREE_OPERAND (arg, 0), top));
+ rtype = iasm_combine_type (rtype,
+ iasm_canonicalize_bracket_1 (&TREE_OPERAND (arg, 0), top));
if (arg1)
- rtype = cw_combine_type (rtype,
- cw_canonicalize_bracket_1 (&TREE_OPERAND (arg, 1), top));
+ rtype = iasm_combine_type (rtype,
+ iasm_canonicalize_bracket_1 (&TREE_OPERAND (arg, 1), top));
if (TREE_OPERAND (arg, 0) == NULL_TREE)
{
if (TREE_OPERAND (arg, 1))
@@ -19222,14 +19326,29 @@ cw_canonicalize_bracket_1 (tree* argp, tree top)
else
*argp = NULL_TREE;
}
+ else if (TREE_OPERAND (arg, 1) == NULL_TREE && rtype == NULL_TREE)
+ *argp = TREE_OPERAND (arg, 0);
+ if (TREE_CODE (arg) == PLUS_EXPR
+ && TREE_TYPE (arg) == NULL_TREE
+ && TREE_TYPE (TREE_OPERAND (arg, 0))
+ && TREE_TYPE (TREE_OPERAND (arg, 1))
+ && (POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (arg, 1)))
+ || POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (arg, 0)))))
+ {
+ tree type = TREE_TYPE (TREE_OPERAND (arg, 1));
+ if (INTEGRAL_TYPE_P (type))
+ type = TREE_TYPE (TREE_OPERAND (arg, 0));
+ TREE_TYPE (arg) = type;
+ }
}
return rtype;
case MINUS_EXPR:
- rtype = cw_canonicalize_bracket_1 (&TREE_OPERAND (arg, 0), top);
+ rtype = iasm_canonicalize_bracket_1 (&TREE_OPERAND (arg, 0), top);
arg0 = TREE_OPERAND (arg, 0);
arg1 = TREE_OPERAND (arg, 1);
- if (cw_is_offset (arg1))
+ arg1 = iasm_default_conv (arg1);
+ if (iasm_is_offset (arg1))
{
offset = TREE_OPERAND (top, 0);
if (offset == integer_zero_node)
@@ -19240,10 +19359,36 @@ cw_canonicalize_bracket_1 (tree* argp, tree top)
arg1 = build2 (MINUS_EXPR, void_type_node, offset, arg1);
TREE_OPERAND (top, 0) = arg1;
*argp = arg0;
- return cw_combine_type (rtype, cw_canonicalize_bracket_1 (argp, top));;
+ return iasm_combine_type (rtype, iasm_canonicalize_bracket_1 (argp, top));;
}
return rtype;
+ case PARM_DECL:
+ case VAR_DECL:
+ {
+ *argp = iasm_addr (arg);
+ break;
+ }
+
+ case IDENTIFIER_NODE:
+ {
+ *argp = iasm_raise_reg (arg);
+ break;
+ }
+
+ case MULT_EXPR:
+ if (TREE_TYPE (arg) == NULL_TREE)
+ {
+ if (TREE_CODE (TREE_OPERAND (arg, 1)) == IDENTIFIER_NODE)
+ TREE_OPERAND (arg, 1) = iasm_raise_reg (TREE_OPERAND (arg, 1));
+ if (TREE_CODE (TREE_OPERAND (arg, 0)) == IDENTIFIER_NODE)
+ TREE_OPERAND (arg, 0) = iasm_raise_reg (TREE_OPERAND (arg, 0));
+ if (TREE_TYPE (TREE_OPERAND (arg, 0))
+ && TREE_TYPE (TREE_OPERAND (arg, 1)))
+ TREE_TYPE (arg) = TREE_TYPE (TREE_OPERAND (arg, 0));
+ }
+ break;
+
default:
break;
}
@@ -19251,11 +19396,47 @@ cw_canonicalize_bracket_1 (tree* argp, tree top)
return NULL_TREE;
}
+/* Form an indirection for an inline asm address expression operand.
+ We give a warning when we think the optimizer might have to be used
+ to reform complex addresses, &stack_var + %eax + 4 for example,
+ after gimplification rips the address apart. */
+
+static tree
+iasm_indirect (tree addr)
+{
+ if (TREE_CODE (addr) == ADDR_EXPR
+ /* && TREE_CODE (TREE_OPERAND (addr, 0)) == ARRAY_REF */)
+ return TREE_OPERAND (addr, 0);
+
+ addr = fold (build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (addr)), addr));
+
+ if (! optimize && TREE_CODE (addr) == INDIRECT_REF)
+ warning ("addressing mode too complex when not optimizing, will consume extra register(s)");
+
+ return addr;
+}
+
+/* For an address addition for an inline asm address expression. We
+ try and form ARRAY_REFs, as they will go through gimplification
+ without being ripped apart. */
+
+static tree
+iasm_add (tree addr, tree off)
+{
+ if (integer_zerop (off))
+ return addr;
+
+ /* We have to convert the offset to an int type, as we rip apart
+ trees whose type has been converted to a pointer type for the
+ offset already. */
+ return pointer_int_sum (PLUS_EXPR, addr, convert (integer_type_node, off));
+}
+
/* We canonicalize the inputs form of bracket expressions as the input
forms are less constrained than what the assembler will accept. */
-static void
-cw_canonicalize_bracket (tree arg)
+static tree
+iasm_canonicalize_bracket (tree arg)
{
tree rtype;
@@ -19268,11 +19449,16 @@ cw_canonicalize_bracket (tree arg)
if (TREE_OPERAND (arg, 1) == NULL_TREE
&& TREE_TYPE (TREE_OPERAND (arg, 0))
&& POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (arg, 0))))
- return;
+ {
+ if (TREE_CODE (TREE_OPERAND (arg, 0)) == VAR_DECL
+ || TREE_CODE (TREE_OPERAND (arg, 0)) == PARM_DECL)
+ return arg;
+ return iasm_indirect (TREE_OPERAND (arg, 0));
+ }
/* Ensure that 0 is an offset */
if (TREE_OPERAND (arg, 0)
- && cw_is_offset (TREE_OPERAND (arg, 0)))
+ && iasm_is_offset (TREE_OPERAND (arg, 0)))
{
/* we win if 0 is an offset already. */
}
@@ -19286,26 +19472,80 @@ cw_canonicalize_bracket (tree arg)
{
tree swp;
/* Just have to force it now */
- swp = cw_build_bracket (TREE_OPERAND (arg, 0), TREE_OPERAND (arg, 1));
+ swp = iasm_build_bracket (TREE_OPERAND (arg, 0), TREE_OPERAND (arg, 1));
TREE_OPERAND (arg, 0) = integer_zero_node;
TREE_OPERAND (arg, 1) = swp;
}
if (TREE_OPERAND (arg, 1))
{
- rtype = cw_canonicalize_bracket_1 (&TREE_OPERAND (arg, 1), arg);
+ rtype = iasm_canonicalize_bracket_1 (&TREE_OPERAND (arg, 1), arg);
if (rtype)
- TREE_TYPE (arg) = cw_combine_type (TREE_TYPE (arg), rtype);
+ TREE_TYPE (arg) = iasm_combine_type (TREE_TYPE (arg), rtype);
+ }
+
+ /* For correctness, pointer types should be raised to the tree
+ level, as they denote address calculations with stack based
+ objects, and we want print_operand to print the entire address so
+ that it can combine contants and hard registers into the address.
+ Unfortunnately we might have to rely upon the optimizer to reform
+ the address after the gimplification pass rips it apart. */
+
+ /* Handle [INTEGER_CST][ptr][op3] */
+ if (TREE_OPERAND (arg, 1)
+ && TREE_TYPE (arg) == void_type_node
+ && TREE_CODE (TREE_OPERAND (arg, 0)) == INTEGER_CST
+ && TREE_CODE (TREE_OPERAND (arg, 1)) == BRACKET_EXPR
+ && TREE_TYPE (TREE_OPERAND (TREE_OPERAND (arg, 1), 0))
+ && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (arg, 1), 0)))
+ && TREE_TYPE (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (arg, 1), 0))) != void_type_node)
+ {
+ tree op3 = TREE_OPERAND (TREE_OPERAND (arg, 1), 1);
+ tree addr = iasm_add (TREE_OPERAND (TREE_OPERAND (arg, 1), 0),
+ TREE_OPERAND (arg, 0));
+ tree type;
+ addr = iasm_indirect (addr);
+ if (op3 == NULL_TREE)
+ return addr;
+ type = TREE_TYPE (addr);
+ type = build_pointer_type (type);
+ addr = build1 (ADDR_EXPR, type, addr);
+ addr = fold (build2 (PLUS_EXPR, type, addr, op3));
+ return iasm_indirect (addr);
}
+
+ /* Handle ptr + INTEGER_CST */
+ if (TREE_OPERAND (arg, 1)
+ && TREE_TYPE (arg) == void_type_node
+ && TREE_TYPE (TREE_OPERAND (arg, 1))
+ && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (arg, 1)))
+ && TREE_TYPE (TREE_TYPE (TREE_OPERAND (arg, 1))) != void_type_node)
+ {
+ if (TREE_CODE (TREE_OPERAND (arg, 1)) == ADDR_EXPR)
+ {
+ if (TREE_OPERAND (arg, 0) == integer_zero_node)
+ return TREE_OPERAND (TREE_OPERAND (arg, 1), 0);
+ if (TREE_CODE (TREE_OPERAND (arg, 0)) == INTEGER_CST)
+ return iasm_indirect (iasm_add (TREE_OPERAND (arg, 1), TREE_OPERAND (arg, 0)));
+ }
+ if (TREE_CODE (TREE_OPERAND (arg, 1)) == PLUS_EXPR)
+ {
+ if (TREE_OPERAND (arg, 0) == integer_zero_node)
+ return iasm_indirect (TREE_OPERAND (arg, 1));
+ if (TREE_CODE (TREE_OPERAND (arg, 0)) == INTEGER_CST)
+ return iasm_indirect (iasm_add (TREE_OPERAND (arg, 1), TREE_OPERAND (arg, 0)));
+ }
+ }
+ return arg;
}
/* We canonicalize the instruction by swapping operands and rewritting
the opcode if the output style is in ATT syntax. */
tree
-x86_canonicalize_operands (const char **opcode_p, tree iargs, void *ep)
+iasm_x86_canonicalize_operands (const char **opcode_p, tree iargs, void *ep)
{
- cw_md_extra_info *e = ep;
+ iasm_md_extra_info *e = ep;
static char buf[40];
tree args = iargs;
int argnum = 1;
@@ -19344,10 +19584,11 @@ x86_canonicalize_operands (const char **opcode_p, tree iargs, void *ep)
}
}
else if (TREE_CODE (arg) == BRACKET_EXPR)
- cw_canonicalize_bracket (arg);
+ TREE_VALUE (args) = arg = iasm_canonicalize_bracket (arg);
switch (TREE_CODE (arg))
{
+ case ARRAY_REF:
case VAR_DECL:
case PARM_DECL:
case INDIRECT_REF:
@@ -19414,7 +19655,9 @@ x86_canonicalize_operands (const char **opcode_p, tree iargs, void *ep)
}
--argnum;
- args = x86_swap_operands (opcode, iargs);
+ args = iasm_x86_swap_operands (opcode, iargs);
+ if (opcode[0] == ' ' && iasm_is_pseudo (opcode+1))
+ e->pseudo = true;
/* movsx isn't part of the AT&T syntax, they spell it movs. */
if (strcasecmp (opcode, "movsx") == 0)
@@ -19427,7 +19670,8 @@ x86_canonicalize_operands (const char **opcode_p, tree iargs, void *ep)
same before and after size is accepted and it just a normal
move. */
if (argnum == 2
- && e->mod[0] == e->mod[1])
+ && (e->mod[0] == e->mod[1]
+ || e->mod[1] == 0))
opcode = "mov";
else
opcode = "movz";
@@ -19450,7 +19694,9 @@ x86_canonicalize_operands (const char **opcode_p, tree iargs, void *ep)
e->mod[1] = 'l';
}
- if (strcasecmp (opcode, "out") == 0
+ if (e->pseudo)
+ e->mod[0] = e->mod[1] = 0;
+ else if (strcasecmp (opcode, "out") == 0
|| strcasecmp (opcode, "movntq") == 0
|| strcasecmp (opcode, "movd") == 0
|| strcasecmp (opcode, "movq") == 0
@@ -19489,10 +19735,10 @@ x86_canonicalize_operands (const char **opcode_p, tree iargs, void *ep)
/* Character used to seperate the prefix words. */
/* See radr://4141844 for the enhancement to make this uniformly ' '. */
-#define CW_PREFIX_SEP '/'
+#define IASM_PREFIX_SEP '/'
void
-x86_cw_print_prefix (char *buf, tree prefix_list)
+iasm_x86_print_prefix (char *buf, tree prefix_list)
{
buf += strlen (buf);
while (prefix_list)
@@ -19501,18 +19747,30 @@ x86_cw_print_prefix (char *buf, tree prefix_list)
size_t len = IDENTIFIER_LENGTH (prefix);
memcpy (buf, IDENTIFIER_POINTER (prefix), len);
buf += len;
- buf[0] = CW_PREFIX_SEP;
+ buf[0] = IASM_PREFIX_SEP;
++buf;
buf[0] = 0;
prefix_list = TREE_CHAIN (prefix_list);
}
}
+/* Warn when a variables address is used to form a memory address when
+ that address will use an extra register during reload. */
+
+static void
+iasm_warn_extra_reg (tree arg)
+{
+ if (TREE_CODE (arg) == ADDR_EXPR
+ && (TREE_CODE (TREE_OPERAND (arg, 0)) == VAR_DECL
+ || TREE_CODE (TREE_OPERAND (arg, 0)) == PARM_DECL))
+ warning ("addressing mode too complex, will consume an extra register");
+}
+
bool
-cw_print_op (char *buf, tree arg, unsigned argnum, tree *uses,
- bool must_be_reg, bool must_not_be_reg, void *ep)
+iasm_print_op (char *buf, tree arg, unsigned argnum, tree *uses,
+ bool must_be_reg, bool must_not_be_reg, void *ep)
{
- cw_md_extra_info *e = ep;
+ iasm_md_extra_info *e = ep;
switch (TREE_CODE (arg))
{
case BRACKET_EXPR:
@@ -19530,15 +19788,14 @@ cw_print_op (char *buf, tree arg, unsigned argnum, tree *uses,
decompose it into parts so that things like (%esp + 20) + 4
can be output as 24(%esp) by the optimizer instead of 4(%0)
and burning an "R" with (%esp + 20). */
- cw_force_constraint ("m", e);
- op1 = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (op1)), op1);
- op1 = fold (op1);
- cw_asm_get_register_var (op1, "", buf, argnum, must_be_reg, e);
- cw_force_constraint (0, e);
+ iasm_force_constraint ("m", e);
+ iasm_get_register_var (op1, "", buf, argnum, must_be_reg, e);
+ iasm_force_constraint (0, e);
break;
}
- if (TREE_CODE (op2) == BRACKET_EXPR)
+ if (op2
+ && TREE_CODE (op2) == BRACKET_EXPR)
{
op3 = TREE_OPERAND (op2, 1);
op2 = TREE_OPERAND (op2, 0);
@@ -19550,12 +19807,6 @@ cw_print_op (char *buf, tree arg, unsigned argnum, tree *uses,
}
if (op0)
return false;
- if (op2 == NULL_TREE)
- {
- op2 = op1;
- op1 = op0;
- op0 = NULL_TREE;
- }
if (ASSEMBLER_DIALECT == ASM_INTEL)
strcat (buf, "[");
@@ -19592,10 +19843,14 @@ cw_print_op (char *buf, tree arg, unsigned argnum, tree *uses,
}
e->as_immediate = true;
- print_cw_asm_operand (buf, op1, argnum, uses,
- must_be_reg, must_not_be_reg, e);
+ iasm_print_operand (buf, op1, argnum, uses,
+ must_be_reg, must_not_be_reg, e);
e->as_immediate = false;
+ /* Just an immediate. */
+ if (op2 == NULL_TREE && op3 == NULL_TREE)
+ break;
+
if (ASSEMBLER_DIALECT == ASM_INTEL)
strcat (buf, "]");
if (ASSEMBLER_DIALECT == ASM_INTEL)
@@ -19606,10 +19861,11 @@ cw_print_op (char *buf, tree arg, unsigned argnum, tree *uses,
if (op2)
{
/* We know by context, this has to be an R. */
- cw_force_constraint ("R", e);
- print_cw_asm_operand (buf, op2, argnum, uses,
- must_be_reg, must_not_be_reg, e);
- cw_force_constraint (0, e);
+ iasm_force_constraint ("R", e);
+ iasm_warn_extra_reg (op2);
+ iasm_print_operand (buf, op2, argnum, uses,
+ must_be_reg, must_not_be_reg, e);
+ iasm_force_constraint (0, e);
}
if (op3)
{
@@ -19619,16 +19875,17 @@ cw_print_op (char *buf, tree arg, unsigned argnum, tree *uses,
strcat (buf, ",");
/* We know by context, this has to be an l. */
- cw_force_constraint ("l", e);
- print_cw_asm_operand (buf, op3, argnum, uses,
- must_be_reg, must_not_be_reg, e);
- cw_force_constraint (0, e);
+ iasm_force_constraint ("l", e);
+ iasm_warn_extra_reg (op3);
+ iasm_print_operand (buf, op3, argnum, uses,
+ must_be_reg, must_not_be_reg, e);
+ iasm_force_constraint (0, e);
if (scale)
{
strcat (buf, ",");
e->as_immediate = true;
- print_cw_asm_operand (buf, scale, argnum, uses,
- must_be_reg, must_not_be_reg, e);
+ iasm_print_operand (buf, scale, argnum, uses,
+ must_be_reg, must_not_be_reg, e);
e->as_immediate = false;
}
}
@@ -19640,19 +19897,25 @@ cw_print_op (char *buf, tree arg, unsigned argnum, tree *uses,
break;
case ADDR_EXPR:
+ if (TREE_CODE (TREE_OPERAND (arg, 0)) == ARRAY_REF
+ || TREE_CODE (TREE_OPERAND (arg, 0)) == VAR_DECL)
+ {
+ iasm_get_register_var (arg, "", buf, argnum, must_be_reg, e);
+ break;
+ }
if (! e->as_immediate)
e->as_offset = true;
- print_cw_asm_operand (buf, TREE_OPERAND (arg, 0), argnum, uses,
- must_be_reg, must_not_be_reg, e);
+ iasm_print_operand (buf, TREE_OPERAND (arg, 0), argnum, uses,
+ must_be_reg, must_not_be_reg, e);
e->as_offset = false;
break;
case MULT_EXPR:
- print_cw_asm_operand (buf, TREE_OPERAND (arg, 0), argnum, uses,
- must_be_reg, must_not_be_reg, e);
+ iasm_print_operand (buf, TREE_OPERAND (arg, 0), argnum, uses,
+ must_be_reg, must_not_be_reg, e);
strcat (buf, "*");
- print_cw_asm_operand (buf, TREE_OPERAND (arg, 1), argnum, uses,
- must_be_reg, must_not_be_reg, e);
+ iasm_print_operand (buf, TREE_OPERAND (arg, 1), argnum, uses,
+ must_be_reg, must_not_be_reg, e);
break;
default:
return false;
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 7fdf2564985..2342ce27067 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -2616,21 +2616,22 @@ struct machine_function GTY(())
#define X86_FILE_START_FLTUSED false
/* APPLE LOCAL begin CW asm blocks */
-#undef TARGET_CW_EXTRA_INFO
-#define TARGET_CW_EXTRA_INFO \
+#undef TARGET_IASM_EXTRA_INFO
+#define TARGET_IASM_EXTRA_INFO \
char mod[3]; \
bool as_immediate; \
- bool as_offset;
+ bool as_offset; \
+ bool pseudo;
-#define TARGET_CW_REORDER_ARG(OPCODE, NEWARGNUM, NUM_ARGS, ARGNUM) \
+#define TARGET_IASM_REORDER_ARG(OPCODE, NEWARGNUM, NUM_ARGS, ARGNUM) \
do { \
/* If we are outputting AT&T style assembly language, the argument \
numbering is reversed. */ \
- if (cw_x86_needs_swapping (opcode)) \
+ if (iasm_x86_needs_swapping (opcode)) \
NEWARGNUM = NUM_ARGS - ARGNUM + 1; \
} while (0)
-#define CW_SYNTH_CONSTRAINTS(R, ARGNUM, NUM_ARGS, DB) \
+#define IASM_SYNTH_CONSTRAINTS(R, ARGNUM, NUM_ARGS, DB) \
do { \
/* On x86, operand 2 or 3 can be left out and the assembler will deal with it. \
\
@@ -2660,18 +2661,18 @@ struct machine_function GTY(())
} \
} while (0)
-#define TARGET_CW_PRINT_OP(BUF, ARG, ARGNUM, USES, MUST_BE_REG, MUST_NOT_BE_REG, E) \
- cw_print_op (BUF, ARG, ARGNUM, USES, MUST_BE_REG, MUST_NOT_BE_REG, E)
+#define TARGET_IASM_PRINT_OP(BUF, ARG, ARGNUM, USES, MUST_BE_REG, MUST_NOT_BE_REG, E) \
+ iasm_print_op (BUF, ARG, ARGNUM, USES, MUST_BE_REG, MUST_NOT_BE_REG, E)
-extern tree x86_canonicalize_operands (const char **, tree, void *);
+extern tree iasm_x86_canonicalize_operands (const char **, tree, void *);
/* On x86, we can rewrite opcodes, change argument ordering and so no... */
-#define CW_CANONICALIZE_OPERANDS(OPCODE, NEW_OPCODE, IARGS, E) \
- do { \
- NEW_OPCODE = OPCODE; \
- IARGS = x86_canonicalize_operands (&NEW_OPCODE, IARGS, E); \
+#define IASM_CANONICALIZE_OPERANDS(OPCODE, NEW_OPCODE, IARGS, E) \
+ do { \
+ NEW_OPCODE = OPCODE; \
+ IARGS = iasm_x86_canonicalize_operands (&NEW_OPCODE, IARGS, E); \
} while (0)
-#define CW_SEE_OPCODE(YYCHAR, T) \
+#define IASM_SEE_OPCODE(YYCHAR, T) \
/* If we see an int, arrange to see it as an identifier (opcode), \
not as a type. */ \
((YYCHAR == TYPESPEC \
@@ -2680,7 +2681,7 @@ extern tree x86_canonicalize_operands (const char **, tree, void *);
/* Return true iff the ID is a prefix for an instruction. */
-#define CW_IS_PREFIX(ID) \
+#define IASM_IS_PREFIX(ID) \
do { \
const char *myname = IDENTIFIER_POINTER (ID); \
if (strcasecmp (myname, "lock") == 0 \
@@ -2692,32 +2693,32 @@ extern tree x86_canonicalize_operands (const char **, tree, void *);
return true; \
} while (0)
-#define CW_PRINT_PREFIX(BUF, PREFIX_LIST) x86_cw_print_prefix(BUF, PREFIX_LIST)
+#define IASM_PRINT_PREFIX(BUF, PREFIX_LIST) iasm_x86_print_prefix(BUF, PREFIX_LIST)
-#define CW_IMMED_PREFIX(E, BUF) \
+#define IASM_IMMED_PREFIX(E, BUF) \
do { \
- if (! E->as_immediate) \
+ if (!E->pseudo && ! E->as_immediate) \
sprintf (BUF + strlen (BUF), "$"); \
} while (0)
-#define CW_OFFSET_PREFIX(E, BUF) \
+#define IASM_OFFSET_PREFIX(E, BUF) \
do { \
if (E->as_offset) \
sprintf (BUF + strlen (BUF), "$"); \
} while (0)
/* We can't yet expose ST(x) to reg-stack.c, don't try. */
-#define CW_HIDE_REG(R) FP_REGNO_P (R)
+#define IASM_HIDE_REG(R) FP_REGNO_P (R)
-#define CW_SEE_IMMEDIATE(E) \
+#define IASM_SEE_IMMEDIATE(E) \
E->as_immediate = true
-#define CW_SEE_NO_IMMEDIATE(E) \
+#define IASM_SEE_NO_IMMEDIATE(E) \
E->as_immediate = false
/* Table of instructions that need extra constraints. Keep this table sorted. */
-#undef TARGET_CW_OP_CONSTRAINT
-#define TARGET_CW_OP_CONSTRAINT \
+#undef TARGET_IASM_OP_CONSTRAINT
+#define TARGET_IASM_OP_CONSTRAINT \
{ "adc", 1, "+rm,r" }, \
{ "adc", 2, "ir,m" }, \
{ "add", 1, "+rm,r" }, \
@@ -2792,6 +2793,62 @@ extern tree x86_canonicalize_operands (const char **, tree, void *);
{ "cmovz", 2, U("rm")}, \
{ "cmp", 1, "rm,r"}, \
{ "cmp", 2, "ir,m"}, \
+ { "cmpeqpd", 1, "=x"}, \
+ { "cmpeqpd", 2, "xm"}, \
+ { "cmpeqps", 1, "=x"}, \
+ { "cmpeqps", 2, "xm"}, \
+ { "cmpeqsd", 1, "=x"}, \
+ { "cmpeqsd", 2, "xm"}, \
+ { "cmpeqss", 1, "=x"}, \
+ { "cmpeqss", 2, "xm"}, \
+ { "cmplepd", 1, "=x"}, \
+ { "cmplepd", 2, "xm"}, \
+ { "cmpleps", 1, "=x"}, \
+ { "cmpleps", 2, "xm"}, \
+ { "cmplesd", 1, "=x"}, \
+ { "cmplesd", 2, "xm"}, \
+ { "cmpless", 1, "=x"}, \
+ { "cmpless", 2, "xm"}, \
+ { "cmpltpd", 1, "=x"}, \
+ { "cmpltpd", 2, "xm"}, \
+ { "cmpltps", 1, "=x"}, \
+ { "cmpltps", 2, "xm"}, \
+ { "cmpltsd", 1, "=x"}, \
+ { "cmpltsd", 2, "xm"}, \
+ { "cmpltss", 1, "=x"}, \
+ { "cmpltss", 2, "xm"}, \
+ { "cmpneqpd", 1, "=x"}, \
+ { "cmpneqpd", 2, "xm"}, \
+ { "cmpneqps", 1, "=x"}, \
+ { "cmpneqps", 2, "xm"}, \
+ { "cmpneqsd", 1, "=x"}, \
+ { "cmpneqsd", 2, "xm"}, \
+ { "cmpneqss", 1, "=x"}, \
+ { "cmpneqss", 2, "xm"}, \
+ { "cmpnlepd", 1, "=x"}, \
+ { "cmpnlepd", 2, "xm"}, \
+ { "cmpnleps", 1, "=x"}, \
+ { "cmpnleps", 2, "xm"}, \
+ { "cmpnlesd", 1, "=x"}, \
+ { "cmpnlesd", 2, "xm"}, \
+ { "cmpnless", 1, "=x"}, \
+ { "cmpnless", 2, "xm"}, \
+ { "cmpnltpd", 1, "=x"}, \
+ { "cmpnltpd", 2, "xm"}, \
+ { "cmpnltps", 1, "=x"}, \
+ { "cmpnltps", 2, "xm"}, \
+ { "cmpnltsd", 1, "=x"}, \
+ { "cmpnltsd", 2, "xm"}, \
+ { "cmpnltss", 1, "=x"}, \
+ { "cmpnltss", 2, "xm"}, \
+ { "cmpordpd", 1, "=x"}, \
+ { "cmpordpd", 2, "xm"}, \
+ { "cmpordps", 1, "=x"}, \
+ { "cmpordps", 2, "xm"}, \
+ { "cmpordsd", 1, "=x"}, \
+ { "cmpordsd", 2, "xm"}, \
+ { "cmpordss", 1, "=x"}, \
+ { "cmpordss", 2, "xm"}, \
{ "cmppd", 1, "=x"}, \
{ "cmppd", 2, "xm"}, \
{ "cmppd", 3, "i"}, \
@@ -2804,6 +2861,14 @@ extern tree x86_canonicalize_operands (const char **, tree, void *);
{ "cmpss", 1, "=x"}, \
{ "cmpss", 2, "xm"}, \
{ "cmpss", 3, "i"}, \
+ { "cmpunordpd", 1, "=x"}, \
+ { "cmpunordpd", 2, "xm"}, \
+ { "cmpunordps", 1, "=x"}, \
+ { "cmpunordps", 2, "xm"}, \
+ { "cmpunordsd", 1, "=x"}, \
+ { "cmpunordsd", 2, "xm"}, \
+ { "cmpunordss", 1, "=x"}, \
+ { "cmpunordss", 2, "xm"}, \
{ "cmpxchg", 1, "+mr"}, \
{ "cmpxchg", 2, "r"}, \
{ "comisd", 1, "x"}, \
@@ -3400,10 +3465,19 @@ extern tree x86_canonicalize_operands (const char **, tree, void *);
{ "xorps", 1, "+x"}, \
{ "xorps", 2, "xm"},
-#define TARGET_CW_EXTRA_CLOBBERS \
+#define TARGET_IASM_EXTRA_CLOBBERS \
{ "rdtsc", { "edx", "eax"} }
-#define CW_FUNCTION_MODIFIER "P"
+#define IASM_FUNCTION_MODIFIER "P"
+
+#define IASM_VALID_PIC(DECL, E) \
+ do { \
+ if (E->as_immediate && ! TARGET_DYNAMIC_NO_PIC && flag_pic) \
+ warning ("non-pic addressing form not suitible for pic code"); \
+ } while (0)
+
+#define IASM_REGISTER_NAME(STR, BUF) i386_iasm_register_name (STR, BUF)
+
/* APPLE LOCAL end CW asm blocks */
/*
diff --git a/gcc/config/i386/mmintrin.h b/gcc/config/i386/mmintrin.h
index a366783cfa3..5820efb18f3 100644
--- a/gcc/config/i386/mmintrin.h
+++ b/gcc/config/i386/mmintrin.h
@@ -35,7 +35,8 @@
# error "MMX instruction set not enabled"
#else
/* The data type intended for user use. */
-typedef int __m64 __attribute__ ((__vector_size__ (8)));
+/* APPLE LOCAL 4505813 */
+typedef long long __m64 __attribute__ ((__vector_size__ (8)));
/* Internal data types for implementing the intrinsics. */
typedef int __v2si __attribute__ ((__vector_size__ (8)));
diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h
index 3562c7c5dab..9e6ad849b22 100644
--- a/gcc/config/rs6000/rs6000-protos.h
+++ b/gcc/config/rs6000/rs6000-protos.h
@@ -215,7 +215,7 @@ extern void rs6000_conditional_register_usage (void);
/* APPLE LOCAL AltiVec */
extern tree rs6000_fold_builtin (tree, bool);
/* APPLE LOCAL CW asm blocks */
-extern const char *rs6000_cw_asm_register_name (const char *, char *);
+extern const char *rs6000_iasm_register_name (const char *, char *);
/* Declare functions in rs6000-c.c */
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index c2c2b302839..39f7f78bf2d 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -661,6 +661,10 @@ static void rs6000_assemble_visibility (tree, int);
static int rs6000_ra_ever_killed (void);
static tree rs6000_handle_longcall_attribute (tree *, tree, tree, int, bool *);
static tree rs6000_handle_altivec_attribute (tree *, tree, tree, int, bool *);
+/* APPLE LOCAL begin mainline */
+static bool rs6000_ms_bitfield_layout_p (tree);
+static tree rs6000_handle_struct_attribute (tree *, tree, tree, int, bool *);
+/* APPLE LOCAL end mainline */
static void rs6000_eliminate_indexed_memrefs (rtx operands[2]);
static const char *rs6000_mangle_fundamental_type (tree);
extern const struct attribute_spec rs6000_attribute_table[];
@@ -1025,6 +1029,11 @@ static const char alt_reg_names[][8] =
/* APPLE LOCAL end pragma reverse_bitfields */
#endif
+/* APPLE LOCAL begin mainline */
+#undef TARGET_MS_BITFIELD_LAYOUT_P
+#define TARGET_MS_BITFIELD_LAYOUT_P rs6000_ms_bitfield_layout_p
+
+/* APPLE LOCAL end mainline */
#undef TARGET_ASM_OUTPUT_MI_THUNK
#define TARGET_ASM_OUTPUT_MI_THUNK rs6000_output_mi_thunk
@@ -1385,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;
@@ -1396,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");
@@ -1428,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. */
@@ -2022,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)
@@ -2392,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));
}
@@ -3150,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. */
@@ -3161,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)
@@ -3488,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);
@@ -5019,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))
@@ -5609,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);
}
@@ -5776,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;
@@ -5820,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;
@@ -5844,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)
{
@@ -5878,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)
@@ -5888,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)
@@ -5902,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.
@@ -6548,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;
@@ -6559,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 */
@@ -6870,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,
@@ -6885,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
@@ -6937,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. */
@@ -7413,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
@@ -7443,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)
@@ -7586,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
@@ -7645,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;
@@ -14851,16 +14860,16 @@ rs6000_stack_info (void)
/* If we have an assembly function, maybe use an explicit size. To
be consistent with CW behavior (and because it's safer), let
RS6000_ALIGN round the explicit size up if necessary. */
- if (cfun->cw_asm_function && cfun->cw_asm_frame_size != -2)
+ if (cfun->iasm_asm_function && cfun->iasm_frame_size != -2)
{
- if (cfun->cw_asm_frame_size == -1)
+ if (cfun->iasm_frame_size == -1)
non_fixed_size = 32;
- else if (cfun->cw_asm_frame_size < 32)
+ else if (cfun->iasm_frame_size < 32)
error ("fralloc frame size must be at least 32");
else
- non_fixed_size = cfun->cw_asm_frame_size;
+ 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
@@ -14881,7 +14890,7 @@ rs6000_stack_info (void)
that the debugger can handle stackless frames. */
/* APPLE LOCAL CW asm blocks */
- if (info_ptr->calls_p || (cfun->cw_asm_function && cfun->cw_asm_frame_size != -2))
+ if (info_ptr->calls_p || (cfun->iasm_asm_function && cfun->iasm_frame_size != -2))
info_ptr->push_p = 1;
else if (DEFAULT_ABI == ABI_V4)
@@ -15154,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)
@@ -15791,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;
@@ -15815,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.
@@ -15859,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 ();
@@ -16013,33 +16022,33 @@ rs6000_emit_prologue (void)
int objc_method_using_pic = 0;
/* APPLE LOCAL begin CW asm block */
- if (cfun->cw_asm_function && cfun->cw_asm_frame_size == -2)
+ if (cfun->iasm_asm_function && cfun->iasm_frame_size == -2)
return;
/* 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)));
}
}
@@ -16362,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 */
@@ -16431,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
@@ -16483,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 */
@@ -16574,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 */
@@ -16695,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),
@@ -16799,9 +16808,9 @@ rs6000_emit_epilogue (int sibcall)
int i;
/* APPLE LOCAL begin CW asm block */
- if (cfun->cw_asm_function && cfun->cw_asm_frame_size == -2)
+ if (cfun->iasm_asm_function && cfun->iasm_frame_size == -2)
{
-
+
rtvec p = rtvec_alloc (2);
RTVEC_ELT (p, 0) = gen_rtx_RETURN (VOIDmode);
@@ -17028,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 */
}
@@ -17107,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,
@@ -17739,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))
;
@@ -18956,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
@@ -19462,7 +19471,8 @@ rs6000_initialize_trampoline (rtx addr, rtx fnaddr, rtx cxt)
/* Under V.4/eabi/darwin, __trampoline_setup does the real work. */
case ABI_DARWIN:
case ABI_V4:
- emit_library_call (gen_rtx_SYMBOL_REF (SImode, "__trampoline_setup"),
+ /* APPLE LOCAL 4505290 */
+ emit_library_call (gen_rtx_SYMBOL_REF (pmode, "__trampoline_setup"),
FALSE, VOIDmode, 4,
addr, pmode,
GEN_INT (rs6000_trampoline_size ()), SImode,
@@ -19483,6 +19493,10 @@ const struct attribute_spec rs6000_attribute_table[] =
{ "altivec", 1, 1, false, true, false, rs6000_handle_altivec_attribute },
{ "longcall", 0, 0, false, true, true, rs6000_handle_longcall_attribute },
{ "shortcall", 0, 0, false, true, true, rs6000_handle_longcall_attribute },
+ /* APPLE LOCAL begin mainline */
+ { "ms_struct", 0, 0, false, false, false, rs6000_handle_struct_attribute },
+ { "gcc_struct", 0, 0, false, false, false, rs6000_handle_struct_attribute },
+ /* APPLE LOCAL end mainline */
#ifdef SUBTARGET_ATTRIBUTE_TABLE
SUBTARGET_ATTRIBUTE_TABLE,
#endif
@@ -19658,6 +19672,11 @@ rs6000_set_default_type_attributes (tree type)
TYPE_ATTRIBUTES (type) = tree_cons (get_identifier ("longcall"),
NULL_TREE,
TYPE_ATTRIBUTES (type));
+ /* APPLE LOCAL begin mainline */
+#if TARGET_MACHO
+ darwin_set_default_type_attributes (type);
+#endif
+ /* APPLE LOCAL end mainline */
}
/* Return a reference suitable for calling a function with the
@@ -19686,6 +19705,55 @@ rs6000_longcall_ref (rtx call_ref)
return force_reg (Pmode, call_ref);
}
+/* APPLE LOCAL begin mainline */
+#ifndef TARGET_USE_MS_BITFIELD_LAYOUT
+#define TARGET_USE_MS_BITFIELD_LAYOUT 0
+#endif
+
+/* Handle a "ms_struct" or "gcc_struct" attribute; arguments as in
+ struct attribute_spec.handler. */
+static tree
+rs6000_handle_struct_attribute (tree *node, tree name,
+ tree args ATTRIBUTE_UNUSED,
+ int flags ATTRIBUTE_UNUSED, bool *no_add_attrs)
+{
+ tree *type = NULL;
+ if (DECL_P (*node))
+ {
+ if (TREE_CODE (*node) == TYPE_DECL)
+ type = &TREE_TYPE (*node);
+ }
+ else
+ type = node;
+
+ if (!(type && (TREE_CODE (*type) == RECORD_TYPE
+ || TREE_CODE (*type) == UNION_TYPE)))
+ {
+ warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
+ *no_add_attrs = true;
+ }
+
+ else if ((is_attribute_p ("ms_struct", name)
+ && lookup_attribute ("gcc_struct", TYPE_ATTRIBUTES (*type)))
+ || ((is_attribute_p ("gcc_struct", name)
+ && lookup_attribute ("ms_struct", TYPE_ATTRIBUTES (*type)))))
+ {
+ warning ("%qs incompatible attribute ignored", IDENTIFIER_POINTER (name));
+ *no_add_attrs = true;
+ }
+
+ return NULL_TREE;
+}
+
+static bool
+rs6000_ms_bitfield_layout_p (tree record_type)
+{
+ return (TARGET_USE_MS_BITFIELD_LAYOUT &&
+ !lookup_attribute ("gcc_struct", TYPE_ATTRIBUTES (record_type)))
+ || lookup_attribute ("ms_struct", TYPE_ATTRIBUTES (record_type));
+}
+
+/* APPLE LOCAL end mainline */
#ifdef USING_ELFOS_H
/* A C statement or statements to switch to the appropriate section
@@ -19995,7 +20063,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))
;
@@ -20016,7 +20084,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]);
@@ -20244,14 +20312,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)
@@ -20268,7 +20336,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)
@@ -20282,7 +20350,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. */
@@ -20294,7 +20362,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
@@ -20337,7 +20405,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 */
@@ -20347,7 +20415,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 */
@@ -20686,7 +20754,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 */
@@ -21410,7 +21478,7 @@ rs6000_dbx_register_number (unsigned int regno)
forms. */
const char *
-rs6000_cw_asm_register_name (const char *regname, char *buf)
+rs6000_iasm_register_name (const char *regname, char *buf)
{
/* SP is a valid reg name, but asm doesn't like it yet, so translate. */
if (strcmp (regname, "sp") == 0)
@@ -21441,11 +21509,11 @@ rs6000_cw_asm_register_name (const char *regname, char *buf)
return NULL;
}
-extern bool cw_memory_clobber (const char *);
+extern bool iasm_memory_clobber (const char *);
/* Return true iff the opcode wants memory to be stable. We arrange
for a memory clobber in these instances. */
bool
-cw_memory_clobber (const char *ARG_UNUSED (opcode))
+iasm_memory_clobber (const char *ARG_UNUSED (opcode))
{
return strncmp (opcode, "st", 2) == 0
|| (strncmp (opcode, "l", 1) == 0 && (strcmp (opcode, "la") != 0
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index 327fdce693d..50980fc6360 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -2559,7 +2559,7 @@ extern char rs6000_reg_names[][8]; /* register names (0 vs. %r0). */
fprintf (FILE, "\t.align %d\n", (LOG))
/* APPLE LOCAL begin CW asm blocks */
-#define CW_ASM_REGISTER_NAME(STR, BUF) rs6000_cw_asm_register_name (STR, BUF)
+#define IASM_REGISTER_NAME(STR, BUF) rs6000_iasm_register_name (STR, BUF)
/* APPLE LOCAL end CW asm blocks */
/* Pick up the return address upon entry to a procedure. Used for
@@ -3567,8 +3567,8 @@ enum rs6000_builtins
/* APPLE LOCAL begin CW asm blocks */
/* Table of instructions that need extra constraints. */
-#undef TARGET_CW_OP_CONSTRAINT
-#define TARGET_CW_OP_CONSTRAINT \
+#undef TARGET_IASM_OP_CONSTRAINT
+#define TARGET_IASM_OP_CONSTRAINT \
{ "la", 2, "m" }, \
{ "lbz", 2, "m" }, \
{ "lbzu", 2, "m" }, \
@@ -3600,6 +3600,6 @@ enum rs6000_builtins
{ "stw", 2, "m" }, \
{ "stwu", 2, "m" },
-#define CW_FUNCTION_MODIFIER "z"
+#define IASM_FUNCTION_MODIFIER "z"
/* APPLE LOCAL end CW asm blocks */
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 4cf4e4f7b99..0f5d2f2cac0 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -10608,8 +10608,10 @@
;; which indicates how to set cr1
;; APPLE LOCAL begin separate cl into c,*l; switch and attr's expanded to match
-(define_insn "*call_indirect_nonlocal_sysv"
- [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l,c,*l"))
+;; APPLE LOCAL begin 4505290
+(define_insn "*call_indirect_nonlocal_sysv<mode>"
+ [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
+;; APPLE LOCAL end 4505290
(match_operand 1 "" "g,g,g,g"))
(use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
(clobber (match_scratch:SI 3 "=l,l,l,l"))]
@@ -10628,8 +10630,10 @@
(set_attr "length" "4,4,8,8")])
;; APPLE LOCAL end separate cl into c,*l; switch and attr's expanded to match
-(define_insn "*call_nonlocal_sysv"
- [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
+;; APPLE LOCAL begin 4505290
+(define_insn "*call_nonlocal_sysv<mode>"
+ [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
+;; APPLE LOCAL end 4505290
(match_operand 1 "" "g,g"))
(use (match_operand:SI 2 "immediate_operand" "O,n"))
(clobber (match_scratch:SI 3 "=l,l"))]
@@ -10668,9 +10672,11 @@
(set_attr "length" "4,8")])
;; APPLE LOCAL begin separate cl into c,*l; switch and attr's expanded to match
-(define_insn "*call_value_indirect_nonlocal_sysv"
+;; APPLE LOCAL begin 4505290
+(define_insn "*call_value_indirect_nonlocal_sysv<mode>"
[(set (match_operand 0 "" "")
- (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l,c,*l"))
+ (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
+;; APPLE LOCAL end 4505290
(match_operand 2 "" "g,g,g,g")))
(use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
(clobber (match_scratch:SI 4 "=l,l,l,l"))]
@@ -10689,9 +10695,11 @@
(set_attr "length" "4,4,8,8")])
;; APPLE LOCAL end separate cl into c,*l; switch and attr's expanded to match
-(define_insn "*call_value_nonlocal_sysv"
+;; APPLE LOCAL begin 4505290
+(define_insn "*call_value_nonlocal_sysv<mode>"
[(set (match_operand 0 "" "")
- (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
+ (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
+;; APPLE LOCAL end 4505290
(match_operand 2 "" "g,g")))
(use (match_operand:SI 3 "immediate_operand" "O,n"))
(clobber (match_scratch:SI 4 "=l,l"))]
@@ -11012,8 +11020,10 @@
[(set_attr "type" "branch")
(set_attr "length" "4")])
-(define_insn "*sibcall_nonlocal_sysv"
- [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
+;; APPLE LOCAL begin 4505290
+(define_insn "*sibcall_nonlocal_sysv<mode>"
+ [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
+;; APPLE LOCAL end 4505290
(match_operand 1 "" ""))
(use (match_operand 2 "immediate_operand" "O,n"))
(use (match_operand:SI 3 "register_operand" "l,l"))
@@ -11057,9 +11067,11 @@
}")
-(define_insn "*sibcall_value_nonlocal_sysv"
+;; APPLE LOCAL begin 4505290
+(define_insn "*sibcall_value_nonlocal_sysv<mode>"
[(set (match_operand 0 "" "")
- (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
+ (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
+;; APPLE LOCAL end 4505290
(match_operand 2 "" "")))
(use (match_operand:SI 3 "immediate_operand" "O,n"))
(use (match_operand:SI 4 "register_operand" "l,l"))
@@ -14145,7 +14157,7 @@
"direct_return ()"
"*
{
- if (cfun->cw_asm_noreturn)
+ if (cfun->iasm_noreturn)
return \";{br|blr}\";
else
return \"{br|blr}\";
@@ -14826,7 +14838,7 @@
"TARGET_32BIT"
"*
{
- if (cfun->cw_asm_noreturn)
+ if (cfun->iasm_noreturn)
return \"; b%T0\";
else
return \"b%T0\";
diff --git a/gcc/config/rs6000/t-darwin b/gcc/config/rs6000/t-darwin
index 973bb321d05..eac3049e283 100644
--- a/gcc/config/rs6000/t-darwin
+++ b/gcc/config/rs6000/t-darwin
@@ -31,6 +31,9 @@ darwin-fpsave.o: $(srcdir)/config/rs6000/darwin-asm.h
darwin-tramp.o: $(srcdir)/config/rs6000/darwin-asm.h
# APPLE LOCAL begin mainline 2006-03-15 3992198
+# APPLE LOCAL 4505290
+DARWIN_EXTRA_CRT_BUILD_CFLAGS = -mlongcall
+
# Explain how to build crt2.o
$(T)crt2$(objext): $(srcdir)/config/darwin-crt2.c $(GCC_PASSES) \
$(TCONFIG_H) stmp-int-hdrs tsystem.h
diff --git a/gcc/config/t-darwin b/gcc/config/t-darwin
index bb5c31c84d6..bbb8ab58454 100644
--- a/gcc/config/t-darwin
+++ b/gcc/config/t-darwin
@@ -18,13 +18,16 @@ darwin-c.o: $(srcdir)/config/darwin-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
gt-darwin.h : s-gtype ; @true
# APPLE LOCAL begin mainline 2006-03-15 3992198
+ # APPLE LOCAL begin 4505290
# How to build crt3.o
EXTRA_MULTILIB_PARTS=crt3.o
$(T)crt3$(objext): $(srcdir)/config/darwin-crt3.c $(GCC_PASSES) \
$(TCONFIG_H) stmp-int-hdrs tsystem.h
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) \
+ $(DARWIN_EXTRA_CRT_BUILD_CFLAGS) \
-c $(srcdir)/config/darwin-crt3.c -o $(T)crt3$(objext)
+ # APPLE LOCAL end 4505290
# APPLE LOCAL end mainline 2006-03-15 3992198
# Use unwind-dw2-fde-darwin
LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde-darwin.c \