From fc3ffe83097fb810cac84d2b2007a25833684d74 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Thu, 16 Apr 1992 22:05:56 -0400 Subject: [PATCH] *** empty log message *** From-SVN: r754 --- gcc/c-decl.c | 27 ++++++++++++++---- gcc/config/a29k/a29k.c | 14 ++++++---- gcc/config/m68k/3b1.h | 18 +++++++++--- gcc/config/m68k/amix.h | 7 +++-- gcc/config/m68k/m68k.md | 6 ++-- gcc/config/rs6000/rs6000.h | 23 ++++------------ gcc/cse.c | 56 ++++++++++++++++++++++++++++++-------- gcc/objc/objc-act.c | 22 +++++++-------- 8 files changed, 114 insertions(+), 59 deletions(-) diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 4890d8871b6..0a12aac86dc 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -399,10 +399,15 @@ int flag_short_double; int flag_no_asm; -/* Nonzero means don't recognize the non-ANSI builtin functions. */ +/* Nonzero means don't recognize any builtin functions. */ int flag_no_builtin; +/* Nonzero means don't recognize the non-ANSI builtin functions. + -ansi sets this. */ + +int flag_no_nonansi_builtin; + /* Nonzero means do some things the same way PCC does. */ int flag_traditional; @@ -547,7 +552,7 @@ c_decode_option (p) else if (!strcmp (p, "-fident")) flag_no_ident = 0; else if (!strcmp (p, "-ansi")) - flag_no_asm = 1, flag_no_builtin = 1, dollars_in_ident = 0; + flag_no_asm = 1, flag_no_nonansi_builtin = 1, dollars_in_ident = 0; else if (!strcmp (p, "-Wimplicit")) warn_implicit = 1; else if (!strcmp (p, "-Wno-implicit")) @@ -612,6 +617,10 @@ c_decode_option (p) ; /* cpp handles this one. */ else if (!strcmp (p, "-Wno-trigraphs")) ; /* cpp handles this one. */ + else if (!strcmp (p, "-Wimport")) + ; /* cpp handles this one. */ + else if (!strcmp (p, "-Wno-import")) + ; /* cpp handles this one. */ else if (!strcmp (p, "-Wall")) { extra_warnings = 1; @@ -1325,7 +1334,8 @@ duplicate_decls (newdecl, olddecl) warning_with_decl (newdecl, "`%s' declared inline after being called"); if (TREE_CODE (olddecl) == FUNCTION_DECL - && TREE_INLINE (olddecl) != TREE_INLINE (newdecl)) + && TREE_INLINE (olddecl) != TREE_INLINE (newdecl) + && ! (TREE_EXTERNAL (olddecl) && TREE_EXTERNAL (newdecl))) warning_with_decl (newdecl, "`%s' declarations disagree about `inline'"); /* It is nice to warn when a function is declared @@ -2474,7 +2484,7 @@ init_decl_processing () sizetype, endlink)), BUILT_IN_ALLOCA, "alloca"); - if (! flag_no_builtin) + if (! flag_no_builtin && !flag_no_nonansi_builtin) { tree exit_type; temp = builtin_function ("alloca", @@ -4177,11 +4187,18 @@ get_parm_info (void_at_end) saveable_tree_cons (NULL_TREE, void_type_node, NULL_TREE)); } - /* Extract enumerator values and other non-parms declared with the parms. */ + /* Extract enumerator values and other non-parms declared with the parms. + Likewise any forward parm decls that didn't have real parm decls. */ for (decl = parms; decl; ) { tree next = TREE_CHAIN (decl); + if (TREE_ASM_WRITTEN (decl)) + { + error_with_decl (decl, "no real declaration for parameter `%s'"); + TREE_CHAIN (decl) = new_parms; + new_parms = decl; + } if (TREE_CODE (decl) != PARM_DECL) { TREE_CHAIN (decl) = new_parms; diff --git a/gcc/config/a29k/a29k.c b/gcc/config/a29k/a29k.c index d770a3ff0b5..fdf73dc0288 100644 --- a/gcc/config/a29k/a29k.c +++ b/gcc/config/a29k/a29k.c @@ -876,11 +876,15 @@ print_operand (file, x, code) case 'F': output_addr_const (file, x); - if (! strcmp (XSTR (x, 0), current_function_name) - && dbr_sequence_length () == 0) - fprintf (file, "+4\n\t%s,%d", - a29k_regstack_size >= 64 ? "const gr121" : "sub gr1,gr1", - a29k_regstack_size * 4); + if (dbr_sequence_length () == 0) + { + if (! strcmp (XSTR (x, 0), current_function_name)) + fprintf (file, "+4\n\t%s,%d", + a29k_regstack_size >= 64 ? "const gr121" : "sub gr1,gr1", + a29k_regstack_size * 4); + else + fprintf (file, "\n\tnop"); + } return; case 'L': diff --git a/gcc/config/m68k/3b1.h b/gcc/config/m68k/3b1.h index e308aa03f86..727e1002b07 100644 --- a/gcc/config/m68k/3b1.h +++ b/gcc/config/m68k/3b1.h @@ -369,10 +369,20 @@ do { union { float f; long l;} tem; \ XVECLEN (PATTERN (TABLE), 1) + 1, (PREFIX), (NUM), \ (PREFIX), (NUM), (PREFIX), (NUM)) -/* At end of a switch table, define LD%n iff the symbol LI%n was defined. */ -#define ASM_OUTPUT_CASE_END(FILE,NUM,TABLE) \ - if (RTX_INTEGRATED_P (TABLE)) \ - fprintf (FILE, "\tset LD%%%d,L%%%d-LI%%%d\n", (NUM), (NUM), (NUM)) +/* At end of a switch table, define LDnnn iff the symbol LInnn was defined. + Some SGS assemblers have a bug such that "Lnnn-LInnn-2.b(pc,d0.l*2)" + fails to assemble. Luckily "LDnnn(pc,d0.l*2)" produces the results + we want. This difference can be accommodated by making the assembler + define such "LDnnn" to be either "Lnnn-LInnn-2.b", "Lnnn", or any other + string, as necessary. This is accomplished via the ASM_OUTPUT_CASE_END + macro. */ + +#define ASM_OUTPUT_CASE_END(FILE,NUM,TABLE) \ +{ if (switch_table_difference_label_flag) \ + fprintf (FILE, "\tset LD%%%d,L%%%d-LI%%%d\n", (NUM), (NUM), (NUM)) \ + switch_table_difference_label_flag = 0; } + +int switch_table_difference_label_flag; #define ASM_OUTPUT_OPCODE(FILE, PTR) \ { if ((PTR)[0] == 'j' && (PTR)[1] == 'b') \ diff --git a/gcc/config/m68k/amix.h b/gcc/config/m68k/amix.h index 71efc924bb0..38ac17da67d 100644 --- a/gcc/config/m68k/amix.h +++ b/gcc/config/m68k/amix.h @@ -43,7 +43,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ /* At end of a switch table, define LDnnn iff the symbol LInnn was defined. Some SGS assemblers have a bug such that "Lnnn-LInnn-2.b(pc,d0.l*2)" fails to assemble. Luckily "Lnnn(pc,d0.l*2)" produces the results - we want. This difference can be accommodated by using an assembler + we want. This difference can be accommodated by making the assembler define such "LDnnn" to be either "Lnnn-LInnn-2.b", "Lnnn", or any other string, as necessary. This is accomplished via the ASM_OUTPUT_CASE_END macro. (the Amiga assembler has this bug) */ @@ -51,10 +51,13 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #undef ASM_OUTPUT_CASE_END #define ASM_OUTPUT_CASE_END(FILE,NUM,TABLE) \ do { \ - if (RTX_INTEGRATED_P (TABLE)) \ + if (switch_table_difference_label_flag) \ asm_fprintf ((FILE), "%s %LLD%d,%LL%d\n", SET_ASM_OP, (NUM), (NUM));\ + switch_table_difference_label_flag = 0; } while (0) +int switch_table_difference_label_flag; + /* This says how to output assembler code to declare an uninitialized external linkage data object. Under SVR4, the linker seems to want the alignment of data objects diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md index 69b9b436dff..3c016dc0647 100644 --- a/gcc/config/m68k/m68k.md +++ b/gcc/config/m68k/m68k.md @@ -872,9 +872,9 @@ #else /* SGS_SWITCH_TABLES or not MOTOROLA */ ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"LI\", CODE_LABEL_NUMBER (XEXP (labelref, 0))); - /* For sake of 3b1, set flag saying we need to define the symbol - LD%n (with value L%n-LI%n) at the end of the switch table. */ - RTX_INTEGRATED_P (next_real_insn (XEXP (labelref, 0))) = 1; + /* Set flag saying we need to define the symbol + LD%n (with value L%n-LI%n) at the end of the switch table. */ + switch_table_difference_label_flag = 1; #endif /* SGS_SWITCH_TABLES or not MOTOROLA */ } #endif /* SGS_NO_LI */ diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 6a56c93b6c9..2177083dc3b 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -1307,7 +1307,6 @@ extern int rs6000_trunc_used; main_input_filename, ".ro_"); \ \ toc_section (); \ - bss_section (); \ if (write_symbols != NO_DEBUG) \ private_data_section (); \ } @@ -1401,18 +1400,7 @@ toc_section () \ fprintf (asm_out_file, "\t.toc\n"); \ \ in_section = toc; \ -} \ - \ -void \ -bss_section () \ -{ \ - if (in_section != bss) \ - { \ - fprintf (asm_out_file, "\t.csect %s[BS]\n", \ - xcoff_bss_section_name); \ - in_section = bss; \ - } \ -} \ +} /* This macro produces the initial definition of a function name. On the RS/6000, we need to place an extra '.' in the function name and @@ -1637,7 +1625,8 @@ bss_section () \ "fr28", 60, "fr29", 61, "fr30", 62, "fr31", 63, \ /* no additional names for: mq, lr, ctr, ap */ \ "cr0", 68, "cr1", 69, "cr2", 70, "cr3", 71, \ - "cr4", 72, "cr5", 73, "cr6", 74, "cr7", 75 } + "cr4", 72, "cr5", 73, "cr6", 74, "cr7", 75, \ + "cc", 68 } /* How to renumber registers for dbx and gdb. */ @@ -1761,8 +1750,7 @@ bss_section () \ to define a global common symbol. */ #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ - do { bss_section (); \ - fputs (".comm ", (FILE)); \ + do { fputs (".comm ", (FILE)); \ RS6000_OUTPUT_BASENAME ((FILE), (NAME)); \ fprintf ((FILE), ",%d\n", (SIZE)); } while (0) @@ -1770,8 +1758,7 @@ bss_section () \ to define a local common symbol. */ #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE,ROUNDED) \ - do { bss_section (); \ - fputs (".lcomm ", (FILE)); \ + do { fputs (".lcomm ", (FILE)); \ RS6000_OUTPUT_BASENAME ((FILE), (NAME)); \ fprintf ((FILE), ",%d,%s\n", (SIZE), xcoff_bss_section_name); \ } while (0) diff --git a/gcc/cse.c b/gcc/cse.c index 4552cacb2a4..790696be2fb 100644 --- a/gcc/cse.c +++ b/gcc/cse.c @@ -620,6 +620,11 @@ rtx_cost (x) case REG: return 1; case SUBREG: + /* If we can't tie these modes, make this expensive. The larger + the mode, the more expensive it is. */ + if (! MODES_TIEABLE_P (GET_MODE (x), GET_MODE (SUBREG_REG (x)))) + return COSTS_N_INSNS (2 + + GET_MODE_SIZE (GET_MODE (x)) / UNITS_PER_WORD); return 2; #ifdef RTX_COSTS RTX_COSTS (x, code); @@ -4036,7 +4041,7 @@ simplify_ternary_operation (code, mode, op0_mode, op0, op1, op2) val &= (1 << INTVAL (op1)) - 1; /* If desired, propagate sign bit. */ if (code == SIGN_EXTRACT && (val & (1 << (INTVAL (op1) - 1)))) - val |= ~ (1 << INTVAL (op1)); + val |= ~ ((1 << INTVAL (op1)) - 1); } /* Clear the bits that don't belong in our mode, @@ -4760,6 +4765,28 @@ equiv_constant (x) if (x != 0 && CONSTANT_P (x)) return x; + /* If X is a MEM, try to fold it outside the context of any insn to see if + it might be equivalent to a constant. That handles the case where it + is a constant-pool reference. Then try to look it up in the hash table + in case it is something whose value we have seen before. */ + + if (GET_CODE (x) == MEM) + { + struct table_elt *elt; + + x = fold_rtx (x, 0); + if (CONSTANT_P (x)) + return x; + + elt = lookup (x, safe_hash (x, GET_MODE (x)) % NBUCKETS, GET_MODE (x)); + if (elt == 0) + return 0; + + for (elt = elt->first_same_value; elt; elt = elt->next_same_value) + if (elt->is_const && CONSTANT_P (elt->exp)) + return elt->exp; + } + return 0; } @@ -6191,10 +6218,10 @@ cse_insn (insn, in_libcall_block) || sets[i].inner_dest != SET_DEST (sets[i].rtl)); } - /* If we have (set (subreg:m1 (reg:m2 foo) 0) (bar:m1)), M1 is wider - than M2, and both M1 and M2 are a single word, we are also doing - (set (reg:m2 foo) (subreg:m2 (bar:m1 0))) so make that equivalence - as well. + /* If we have (set (subreg:m1 (reg:m2 foo) 0) (bar:m1)), M1 is no + narrower than M2, and both M1 and M2 are the same number of words, + we are also doing (set (reg:m2 foo) (subreg:m2 (bar:m1) 0)) so + make that equivalence as well. However, BAR may have equivalences for which gen_lowpart_if_possible will produce a simpler value than gen_lowpart_if_possible applied to @@ -6207,8 +6234,8 @@ cse_insn (insn, in_libcall_block) already entered SRC and DEST of the SET in the table. */ if (GET_CODE (dest) == SUBREG - && GET_MODE_SIZE (GET_MODE (dest)) <= UNITS_PER_WORD - && GET_MODE_SIZE (GET_MODE (SUBREG_REG (dest))) <= UNITS_PER_WORD + && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (dest))) / UNITS_PER_WORD + == GET_MODE_SIZE (GET_MODE (dest)) / UNITS_PER_WORD) && (GET_MODE_SIZE (GET_MODE (dest)) >= GET_MODE_SIZE (GET_MODE (SUBREG_REG (dest)))) && sets[i].src_elt != 0) @@ -6813,6 +6840,7 @@ cse_end_of_basic_block (insn, data, follow_jumps, after_loop, skip_blocks) rtx p = insn, q; int nsets = 0; int low_cuid = INSN_CUID (insn), high_cuid = INSN_CUID (insn); + rtx next = GET_RTX_CLASS (GET_CODE (insn)) == 'i' ? insn : next_real_insn (insn); int path_size = data->path_size; int path_entry = 0; int i; @@ -6913,8 +6941,11 @@ cse_end_of_basic_block (insn, data, follow_jumps, after_loop, skip_blocks) { /* Don't allow ourself to keep walking around an always-executed loop. */ - if (next_real_insn (q) == next_real_insn (insn)) - break; + if (next_real_insn (q) == next) + { + p = NEXT_INSN (p); + continue; + } /* Similarly, don't put a branch in our path more than once. */ for (i = 0; i < path_entry; i++) @@ -6942,8 +6973,11 @@ cse_end_of_basic_block (insn, data, follow_jumps, after_loop, skip_blocks) { register rtx tmp; - if (next_real_insn (q) == next_real_insn (insn)) - break; + if (next_real_insn (q) == next) + { + p = NEXT_INSN (p); + continue; + } for (i = 0; i < path_entry; i++) if (data->path[i].branch == p) diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 943024c74d4..c6b0f286ead 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -36,7 +36,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ * * code generation `options': * - * - OBJC_INT_SELECTORS, OBJC_NONUNIQUE_SELECTORS, NEXT_OBJC_RUNTIME + * - OBJC_INT_SELECTORS, OBJC_SELECTORS_WITHOUT_LABELS, NEXT_OBJC_RUNTIME */ #include @@ -238,7 +238,7 @@ static tree _OBJC_SYMBOLS_decl; static tree _OBJC_INSTANCE_VARIABLES_decl, _OBJC_CLASS_VARIABLES_decl; static tree _OBJC_INSTANCE_METHODS_decl, _OBJC_CLASS_METHODS_decl; static tree _OBJC_CLASS_decl, _OBJC_METACLASS_decl; -#ifdef OBJC_NONUNIQUE_SELECTORS +#ifdef OBJC_SELECTORS_WITHOUT_LABELS static tree _OBJC_SELECTOR_REFERENCES_decl; #endif static tree _OBJC_MODULES_decl; @@ -565,7 +565,7 @@ synth_module_prologue () /* extern SEL _OBJC_SELECTOR_REFERENCES[]; */ -#ifdef OBJC_NONUNIQUE_SELECTORS +#ifdef OBJC_SELECTORS_WITHOUT_LABELS _OBJC_SELECTOR_REFERENCES_decl = create_builtin_decl (VAR_DECL, build_array_type (selector_type, NULLT), "_OBJC_SELECTOR_REFERENCES"); @@ -703,7 +703,7 @@ init_objc_symtab () /* refs = { ..., _OBJC_SELECTOR_REFERENCES, ... } */ -#ifndef OBJC_NONUNIQUE_SELECTORS +#ifndef OBJC_SELECTORS_WITHOUT_LABELS initlist = tree_cons (NULLT, build_int_2 (0, 0), initlist); #else if (sel_ref_chain) @@ -1050,7 +1050,7 @@ build_msg_pool_reference (offset) return expr; } -#ifndef OBJC_NONUNIQUE_SELECTORS +#ifndef OBJC_SELECTORS_WITHOUT_LABELS static tree build_selector_reference (idx) int idx; @@ -1100,7 +1100,7 @@ build_selector_translation_table () tree sc_spec, decl_specs, expr_decl; tree chain, initlist = NULLT; int offset = 0; -#ifndef OBJC_NONUNIQUE_SELECTORS +#ifndef OBJC_SELECTORS_WITHOUT_LABELS tree decl, var_decl; int idx = 0; char buf[256]; @@ -1114,7 +1114,7 @@ build_selector_translation_table () { tree expr; -#ifndef OBJC_NONUNIQUE_SELECTORS +#ifndef OBJC_SELECTORS_WITHOUT_LABELS sprintf (buf, "_OBJC_SELECTOR_REFERENCES_%d", idx); sc_spec = build_tree_list (NULLT, ridpointers[(int) RID_STATIC]); @@ -1133,7 +1133,7 @@ build_selector_translation_table () /* add one for the '\0' character */ offset += IDENTIFIER_LENGTH (TREE_VALUE (chain)) + 1; -#ifndef OBJC_NONUNIQUE_SELECTORS +#ifndef OBJC_SELECTORS_WITHOUT_LABELS finish_decl (decl, expr, NULLT); idx++; #else @@ -1141,7 +1141,7 @@ build_selector_translation_table () #endif } -#ifdef OBJC_NONUNIQUE_SELECTORS +#ifdef OBJC_SELECTORS_WITHOUT_LABELS DECL_INITIAL (_OBJC_SELECTOR_REFERENCES_decl) = (tree) 1; initlist = build_nt (CONSTRUCTOR, NULLT, nreverse (initlist)); finish_decl (_OBJC_SELECTOR_REFERENCES_decl, initlist, NULLT); @@ -2623,7 +2623,7 @@ build_message_expr (mess) /* Build the parameters list for looking up the method. These are the object itself and the selector. */ -#ifndef OBJC_NONUNIQUE_SELECTORS +#ifndef OBJC_SELECTORS_WITHOUT_LABELS selector = build_selector_reference (selTransTbl_index); #else selector = build_array_ref (_OBJC_SELECTOR_REFERENCES_decl, @@ -2895,7 +2895,7 @@ build_selector_expr (selnamelist) selTransTbl_index = add_selector_reference (selname); -#ifndef OBJC_NONUNIQUE_SELECTORS +#ifndef OBJC_SELECTORS_WITHOUT_LABELS return build_selector_reference (selTransTbl_index); #else /* synthesize a reference into the selector translation table */ -- 2.30.2