diff options
author | kan <kan@FreeBSD.org> | 2003-08-22 02:56:07 +0000 |
---|---|---|
committer | kan <kan@FreeBSD.org> | 2003-08-22 02:56:07 +0000 |
commit | 61e519ea39ae3e7da7754ac55be8c0443ae420e2 (patch) | |
tree | d9ba6250139a4332cf27a501e45674c8157f1642 /contrib/gcc/config | |
parent | 6ff48acf086d689c2d10a6aecf71e05a04658ff5 (diff) | |
parent | 08db0e4d745472adc9c30de407304713c78e950e (diff) | |
download | FreeBSD-src-61e519ea39ae3e7da7754ac55be8c0443ae420e2.zip FreeBSD-src-61e519ea39ae3e7da7754ac55be8c0443ae420e2.tar.gz |
This commit was generated by cvs2svn to compensate for changes in r119256,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib/gcc/config')
-rw-r--r-- | contrib/gcc/config/darwin.c | 63 | ||||
-rw-r--r-- | contrib/gcc/config/i386/gthr-win32.c | 2 | ||||
-rw-r--r-- | contrib/gcc/config/i386/winnt.c | 194 | ||||
-rw-r--r-- | contrib/gcc/config/ia64/ia64.c | 32 | ||||
-rw-r--r-- | contrib/gcc/config/ia64/ia64.md | 16 | ||||
-rw-r--r-- | contrib/gcc/config/rs6000/rs6000.c | 17 | ||||
-rw-r--r-- | contrib/gcc/config/sparc/sparc.c | 14 |
7 files changed, 199 insertions, 139 deletions
diff --git a/contrib/gcc/config/darwin.c b/contrib/gcc/config/darwin.c index 3722950..8efd8cd 100644 --- a/contrib/gcc/config/darwin.c +++ b/contrib/gcc/config/darwin.c @@ -1091,18 +1091,21 @@ machopic_select_section (exp, reloc, align) int reloc; unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED; { - if (TREE_CODE (exp) == STRING_CST) - { - if (flag_writable_strings) - data_section (); - else if (TREE_STRING_LENGTH (exp) != - strlen (TREE_STRING_POINTER (exp)) + 1) - readonly_data_section (); - else - cstring_section (); - } - else if (TREE_CODE (exp) == INTEGER_CST - || TREE_CODE (exp) == REAL_CST) + void (*base_function)(void); + + if (decl_readonly_section (exp, reloc)) + base_function = readonly_data_section; + else if (TREE_READONLY (exp) || TREE_CONSTANT (exp)) + base_function = const_data_section; + else + base_function = data_section; + + if (TREE_CODE (exp) == STRING_CST + && TREE_STRING_LENGTH (exp) == strlen (TREE_STRING_POINTER (exp)) + 1 + && ! flag_writable_strings) + cstring_section (); + else if ((TREE_CODE (exp) == INTEGER_CST || TREE_CODE (exp) == REAL_CST) + && flag_merge_constants) { tree size = TYPE_SIZE (TREE_TYPE (exp)); @@ -1115,7 +1118,7 @@ machopic_select_section (exp, reloc, align) TREE_INT_CST_HIGH (size) == 0) literal8_section (); else - readonly_data_section (); + base_function (); } else if (TREE_CODE (exp) == CONSTRUCTOR && TREE_TYPE (exp) @@ -1129,15 +1132,8 @@ machopic_select_section (exp, reloc, align) objc_constant_string_object_section (); else if (!strcmp (IDENTIFIER_POINTER (name), "NXConstantString")) objc_string_object_section (); - else if (TREE_READONLY (exp) || TREE_CONSTANT (exp)) - { - if (TREE_SIDE_EFFECTS (exp) || (flag_pic && reloc)) - const_data_section (); - else - readonly_data_section (); - } - else - data_section (); + else + base_function (); } else if (TREE_CODE (exp) == VAR_DECL && DECL_NAME (exp) && @@ -1191,26 +1187,11 @@ machopic_select_section (exp, reloc, align) objc_cat_cls_meth_section (); else if (!strncmp (name, "_OBJC_PROTOCOL_", 15)) objc_protocol_section (); - else if ((TREE_READONLY (exp) || TREE_CONSTANT (exp)) - && !TREE_SIDE_EFFECTS (exp)) - { - if (flag_pic && reloc) - const_data_section (); - else - readonly_data_section (); - } - else - data_section (); - } - else if (TREE_READONLY (exp) || TREE_CONSTANT (exp)) - { - if (TREE_SIDE_EFFECTS (exp) || (flag_pic && reloc)) - const_data_section (); - else - readonly_data_section (); + else + base_function (); } - else - data_section (); + else + base_function (); } /* This can be called with address expressions as "rtx". diff --git a/contrib/gcc/config/i386/gthr-win32.c b/contrib/gcc/config/i386/gthr-win32.c index 06dc204..5510f10 100644 --- a/contrib/gcc/config/i386/gthr-win32.c +++ b/contrib/gcc/config/i386/gthr-win32.c @@ -32,7 +32,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #ifndef __GTHREAD_HIDE_WIN32API -# define __GTHREAD_HIDE_WIN32API +# define __GTHREAD_HIDE_WIN32API 1 #endif #include <gthr-win32.h> #include <windows.h> diff --git a/contrib/gcc/config/i386/winnt.c b/contrib/gcc/config/i386/winnt.c index 00b3dfd..01493a2 100644 --- a/contrib/gcc/config/i386/winnt.c +++ b/contrib/gcc/config/i386/winnt.c @@ -1,24 +1,24 @@ /* Subroutines for insn-output.c for Windows NT. Contributed by Douglas Rupp (drupp@cs.washington.edu) - Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002 + Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -This file is part of GNU CC. +This file is part of GCC. -GNU CC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +along with GCC; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. */ #include "config.h" #include "system.h" @@ -54,16 +54,18 @@ void i386_pe_mark_dllimport PARAMS ((tree)); /* Handle a "dllimport" or "dllexport" attribute; arguments as in struct attribute_spec.handler. */ tree -ix86_handle_dll_attribute (node, name, args, flags, no_add_attrs) - tree *node; +ix86_handle_dll_attribute (pnode, name, args, flags, no_add_attrs) + tree * pnode; tree name; tree args; int flags; bool *no_add_attrs; { + tree node = *pnode; + /* These attributes may apply to structure and union types being created, but otherwise should pass to the declaration involved. */ - if (!DECL_P (*node)) + if (!DECL_P (node)) { if (flags & ((int) ATTR_FLAG_DECL_NEXT | (int) ATTR_FLAG_FUNCTION_NEXT | (int) ATTR_FLAG_ARRAY_NEXT)) @@ -71,20 +73,56 @@ ix86_handle_dll_attribute (node, name, args, flags, no_add_attrs) *no_add_attrs = true; return tree_cons (name, args, NULL_TREE); } - if (TREE_CODE (*node) != RECORD_TYPE && TREE_CODE (*node) != UNION_TYPE) + if (TREE_CODE (node) != RECORD_TYPE && TREE_CODE (node) != UNION_TYPE) { warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); *no_add_attrs = true; } + + return NULL_TREE; + } + + /* Report error on dllimport ambiguities seen now before they cause + any damage. */ + else if (is_attribute_p ("dllimport", name)) + { + /* Like MS, treat definition of dllimported variables and + non-inlined functions on declaration as syntax errors. + We allow the attribute for function definitions if declared + inline, but just ignore it in i386_pe_dllimport_p. */ + if (TREE_CODE (node) == FUNCTION_DECL && DECL_INITIAL (node) + && !DECL_INLINE (node)) + { + error_with_decl (node, "function `%s' definition is marked dllimport."); + *no_add_attrs = true; + } + + else if (TREE_CODE (node) == VAR_DECL) + { + if (DECL_INITIAL (node)) + { + error_with_decl (node,"variable `%s' definition is marked dllimport."); + *no_add_attrs = true; + } + + /* `extern' needn't be specified with dllimport. + Specify `extern' now and hope for the best. Sigh. */ + DECL_EXTERNAL (node) = 1; + /* Also, implicitly give dllimport'd variables declared within + a function global scope, unless declared static. */ + if (current_function_decl != NULL_TREE && !TREE_STATIC (node)) + TREE_PUBLIC (node) = 1; + } } - /* `extern' needn't be specified with dllimport. - Specify `extern' now and hope for the best. Sigh. */ - else if (TREE_CODE (*node) == VAR_DECL - && is_attribute_p ("dllimport", name)) + /* Report error if symbol is not accessible at global scope. */ + if (!TREE_PUBLIC (node) + && (TREE_CODE (node) == VAR_DECL + || TREE_CODE (node) == FUNCTION_DECL)) { - DECL_EXTERNAL (*node) = 1; - TREE_PUBLIC (*node) = 1; + error_with_decl (node, "external linkage required for symbol '%s' because of '%s' attribute.", + IDENTIFIER_POINTER (name)); + *no_add_attrs = true; } return NULL_TREE; @@ -169,6 +207,7 @@ i386_pe_dllimport_p (decl) tree decl; { tree imp; + int context_imp = 0; if (TREE_CODE (decl) == FUNCTION_DECL && TARGET_NOP_FUN_DLLIMPORT) @@ -177,17 +216,62 @@ i386_pe_dllimport_p (decl) if (TREE_CODE (decl) != VAR_DECL && TREE_CODE (decl) != FUNCTION_DECL) return 0; + imp = lookup_attribute ("dllimport", DECL_ATTRIBUTES (decl)); - if (imp) - return 1; /* Class members get the dllimport status of their class. */ - if (associated_type (decl)) + if (!imp && associated_type (decl)) { imp = lookup_attribute ("dllimport", TYPE_ATTRIBUTES (associated_type (decl))); if (imp) - return 1; + context_imp = 1; + } + + if (imp) + { + /* Don't mark defined functions as dllimport. If the definition + itself was marked with dllimport, than ix86_handle_dll_attribute + reports an error. This handles the case when the definition + overrides an earlier declaration. */ + if (TREE_CODE (decl) == FUNCTION_DECL && DECL_INITIAL (decl) + && !DECL_INLINE (decl)) + { + /* Don't warn about artificial methods. */ + if (!DECL_ARTIFICIAL (decl)) + warning_with_decl (decl,"function '%s' is defined after prior declaration as dllimport: attribute ignored."); + return 0; + } + + /* We ignore the dllimport attribute for inline member functions. + This differs from MSVC behaviour which treats it like GNUC + 'extern inline' extension. */ + else if (TREE_CODE (decl) == FUNCTION_DECL && DECL_INLINE (decl)) + { + if (extra_warnings) + warning_with_decl (decl, "inline function '%s' is declared as dllimport: attribute ignored."); + return 0; + } + + /* Don't allow definitions of static data members in dllimport class, + Just ignore attribute for vtable data. */ + else if (TREE_CODE (decl) == VAR_DECL + && TREE_STATIC (decl) && TREE_PUBLIC (decl) + && !DECL_EXTERNAL (decl) && context_imp) + { + if (!DECL_VIRTUAL_P (decl)) + error_with_decl (decl, "definition of static data member '%s' of dllimport'd class."); + return 0; + } + + /* Since we can't treat a pointer to a dllimport'd symbol as a + constant address, we turn off the attribute on C++ virtual + methods to allow creation of vtables using thunks. */ + else if (TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE + && (DECL_VIRTUAL_P (decl))) + return 0; + + return 1; } return 0; @@ -234,7 +318,12 @@ i386_pe_mark_dllexport (decl) else abort (); if (i386_pe_dllimport_name_p (oldname)) - oldname += 9; + { + warning_with_decl (decl,"inconsistent dll linkage for '%s': dllexport assumed."); + /* Remove DLL_IMPORT_PREFIX. */ + oldname += 9; + DECL_NON_ADDR_CONST_P (decl) = 0; + } else if (i386_pe_dllexport_name_p (oldname)) return; /* already done */ @@ -278,39 +367,13 @@ i386_pe_mark_dllimport (decl) } else if (i386_pe_dllimport_name_p (oldname)) { - /* Already done, but force correct linkage since the redeclaration - might have omitted explicit extern. Sigh. */ - if (TREE_CODE (decl) == VAR_DECL - /* ??? Is this test for vtables needed? */ - && !DECL_VIRTUAL_P (decl)) + /* Already done, but do a sanity check to prevent assembler errors. */ + if (!DECL_EXTERNAL (decl) || !TREE_PUBLIC (decl)) { - DECL_EXTERNAL (decl) = 1; - TREE_PUBLIC (decl) = 1; + error_with_decl (decl, "failure in redeclaration of '%s': dllimport'd symbol lacks external linkage."); + abort(); } - return; - } - - /* ??? One can well ask why we're making these checks here, - and that would be a good question. */ - - /* Imported variables can't be initialized. Note that C++ classes - are marked initial, so we need to check. */ - if (TREE_CODE (decl) == VAR_DECL - && !DECL_VIRTUAL_P (decl) - && (DECL_INITIAL (decl) - && ! TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl)))) - { - error_with_decl (decl, "initialized variable `%s' is marked dllimport"); - return; - } - /* Nor can they be static. */ - if (TREE_CODE (decl) == VAR_DECL - /* ??? Is this test for vtables needed? */ - && !DECL_VIRTUAL_P (decl) - && 0 /*???*/) - { - error_with_decl (decl, "static variable `%s' is marked dllimport"); - return; + return; } newname = alloca (strlen (oldname) + 11); @@ -372,11 +435,8 @@ gen_stdcall_suffix (decl) void i386_pe_encode_section_info (decl, first) tree decl; - int first; + int first ATTRIBUTE_UNUSED; { - if (!first) - return; - /* This bit is copied from i386.h. */ if (optimize > 0 && TREE_CONSTANT (decl) && (!flag_writable_strings || TREE_CODE (decl) != STRING_CST)) @@ -393,7 +453,8 @@ i386_pe_encode_section_info (decl, first) gen_rtx (SYMBOL_REF, Pmode, gen_stdcall_suffix (decl)); /* Mark the decl so we can tell from the rtl whether the object is - dllexport'd or dllimport'd. */ + dllexport'd or dllimport'd. This also handles dllexport/dllimport + override semantics. */ if (i386_pe_dllexport_p (decl)) i386_pe_mark_dllexport (decl); @@ -415,6 +476,10 @@ i386_pe_encode_section_info (decl, first) tree idp = get_identifier (oldname + 9); rtx newrtl = gen_rtx (SYMBOL_REF, Pmode, IDENTIFIER_POINTER (idp)); + warning_with_decl (decl, "'%s' %s after being referenced with dllimport linkage.", + (DECL_INITIAL (decl) || !DECL_EXTERNAL (decl)) + ? "defined locally" : "redeclared without dllimport attribute"); + XEXP (DECL_RTL (decl), 0) = newrtl; DECL_NON_ADDR_CONST_P (decl) = 0; @@ -698,4 +763,3 @@ i386_pe_asm_file_end (file) } } } - diff --git a/contrib/gcc/config/ia64/ia64.c b/contrib/gcc/config/ia64/ia64.c index a8b13f9..0f34d8f 100644 --- a/contrib/gcc/config/ia64/ia64.c +++ b/contrib/gcc/config/ia64/ia64.c @@ -1467,11 +1467,7 @@ ia64_expand_call (retval, addr, nextarg, sibcall_p) } if (sibcall_p) - { - use_reg (&CALL_INSN_FUNCTION_USAGE (insn), b0); - use_reg (&CALL_INSN_FUNCTION_USAGE (insn), - gen_rtx_REG (DImode, AR_PFS_REGNUM)); - } + use_reg (&CALL_INSN_FUNCTION_USAGE (insn), b0); } void ia64_reload_gp () @@ -1524,7 +1520,7 @@ ia64_split_call (retval, addr, retaddr, scratch_r, scratch_b, /* If we find we're calling through a register, then we're actually calling through a descriptor, so load up the values. */ - if (REG_P (addr)) + if (REG_P (addr) && GR_REGNO_P (REGNO (addr))) { rtx tmp; bool addr_dead_p; @@ -2746,7 +2742,7 @@ ia64_expand_epilogue (sibcall_p) reg = gen_rtx_REG (DImode, AR_PFS_REGNUM); emit_move_insn (reg, alt_reg); } - else if (! current_function_is_leaf) + else if (TEST_HARD_REG_BIT (current_frame_info.mask, AR_PFS_REGNUM)) { alt_regno = next_scratch_gr_reg (); alt_reg = gen_rtx_REG (DImode, alt_regno); @@ -7162,12 +7158,11 @@ ia64_epilogue_uses (regno) switch (regno) { case R_GR (1): - /* When a function makes a call through a function descriptor, we - will write a (potentially) new value to "gp". After returning - from such a call, we need to make sure the function restores the - original gp-value, even if the function itself does not use the - gp anymore. */ - return (TARGET_CONST_GP && !(TARGET_AUTO_PIC || TARGET_NO_PIC)); + /* With a call to a function in another module, we will write a new + value to "gp". After returning from such a call, we need to make + sure the function restores the original gp-value, even if the + function itself does not use the gp anymore. */ + return !(TARGET_AUTO_PIC || TARGET_NO_PIC); case IN_REG (0): case IN_REG (1): case IN_REG (2): case IN_REG (3): case IN_REG (4): case IN_REG (5): case IN_REG (6): case IN_REG (7): @@ -7349,14 +7344,9 @@ bool ia64_function_ok_for_sibcall (decl) tree decl; { - /* Direct calls are always ok. */ - if (decl) - return true; - - /* If TARGET_CONST_GP is in effect, then our caller expects us to - return with our current GP. This means that we'll always have - a GP reload after an indirect call. */ - return !ia64_epilogue_uses (R_GR (1)); + /* We must always return with our current GP. This means we can + only sibcall to functions defined in the current module. */ + return decl && (*targetm.binds_local_p) (decl); } /* Output assembly directives for prologue regions. */ diff --git a/contrib/gcc/config/ia64/ia64.md b/contrib/gcc/config/ia64/ia64.md index 4d177c2..4baa5d3 100644 --- a/contrib/gcc/config/ia64/ia64.md +++ b/contrib/gcc/config/ia64/ia64.md @@ -5280,16 +5280,16 @@ { static const char * const alt[2][4] = { { - "lfetch.nta [%0]", - "lfetch.nt1 [%0]", - "lfetch.nt2 [%0]", - "lfetch [%0]" + "%,lfetch.nta [%0]", + "%,lfetch.nt1 [%0]", + "%,lfetch.nt2 [%0]", + "%,lfetch [%0]" }, { - "lfetch.excl.nta [%0]", - "lfetch.excl.nt1 [%0]", - "lfetch.excl.nt2 [%0]", - "lfetch.excl [%0]" + "%,lfetch.excl.nta [%0]", + "%,lfetch.excl.nt1 [%0]", + "%,lfetch.excl.nt2 [%0]", + "%,lfetch.excl [%0]" } }; int i = (INTVAL (operands[1])); diff --git a/contrib/gcc/config/rs6000/rs6000.c b/contrib/gcc/config/rs6000/rs6000.c index 591f77d..3c17f21 100644 --- a/contrib/gcc/config/rs6000/rs6000.c +++ b/contrib/gcc/config/rs6000/rs6000.c @@ -11110,6 +11110,23 @@ rs6000_output_function_epilogue (file, size) } } +#if TARGET_OBJECT_FORMAT == OBJECT_MACHO + /* Mach-O doesn't support labels at the end of objects, so if + it looks like we might want one, insert a NOP. */ + { + rtx insn = get_last_insn (); + while (insn + && NOTE_P (insn) + && NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED_LABEL) + insn = PREV_INSN (insn); + if (insn + && (LABEL_P (insn) + || (NOTE_P (insn) + && NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED_LABEL))) + fputs ("\tnop\n", file); + } +#endif + /* Output a traceback table here. See /usr/include/sys/debug.h for info on its format. diff --git a/contrib/gcc/config/sparc/sparc.c b/contrib/gcc/config/sparc/sparc.c index 7c25bc5..5b03f05 100644 --- a/contrib/gcc/config/sparc/sparc.c +++ b/contrib/gcc/config/sparc/sparc.c @@ -4037,11 +4037,19 @@ sparc_nonflat_function_epilogue (file, size, leaf_function) of a function were call foo; dslot; this can make the return PC of foo (ie. address of call instruction plus 8) point to the first instruction in the next function. */ - rtx insn; - - fputs("\tnop\n", file); + rtx insn, last_real_insn; insn = get_last_insn (); + + last_real_insn = prev_real_insn (insn); + if (last_real_insn + && GET_CODE (last_real_insn) == INSN + && GET_CODE (PATTERN (last_real_insn)) == SEQUENCE) + last_real_insn = XVECEXP (PATTERN (last_real_insn), 0, 0); + + if (last_real_insn && GET_CODE (last_real_insn) == CALL_INSN) + fputs("\tnop\n", file); + if (GET_CODE (insn) == NOTE) insn = prev_nonnote_insn (insn); if (insn && GET_CODE (insn) == BARRIER) |