--- gcc/config/rs6000.h 2018/04/24 17:51:31 1.1 +++ gcc/config/rs6000.h 2018/04/24 17:58:37 1.1.1.3 @@ -30,8 +30,12 @@ the Free Software Foundation, 675 Mass A /* Print subsidiary information on the compiler version in use. */ #define TARGET_VERSION ; -/* Tell the assembler to assume that all undefined names are external. Don't - do this until the fixed IBM assembler is more generally available. */ +/* Tell the assembler to assume that all undefined names are external. + + Don't do this until the fixed IBM assembler is more generally available. + When this becomes permanently defined, the ASM_OUTPUT_EXTERNAL, + ASM_OUTPUT_EXTERNAL_LIBCALL, and RS6000_OUTPUT_BASENAME macros will no + longer be needed. */ /* #define ASM_SPEC "-u" */ @@ -47,8 +51,9 @@ the Free Software Foundation, 675 Mass A #define LINK_SPEC "-T512 -H512 -btextro -bhalt:4 -bnodelcsect" -/* Add -lfp_p when running with -p or -pg. */ -#define LIB_SPEC "%{pg:-lfp_p}%{p:-lfp_p} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}" +/* Profiled library versions are used by linking with special directories. */ +#define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\ + %{p:-L/lib/profiled -L/usr/lib/profiled} %{g*:-lg} -lc" /* gcc must do the search itself to find libgcc.a, not use -l. */ #define LINK_LIBGCC_SPECIAL @@ -89,13 +94,11 @@ extern int target_flags; } \ } -/* Define this to modify the options specified by the user. - - We turn off profiling because we don't know how to do it. */ +/* Define this to modify the options specified by the user. */ #define OVERRIDE_OPTIONS \ { \ - profile_flag = profile_block_flag = 0; \ + profile_block_flag = 0; \ } /* target machine storage layout */ @@ -116,7 +119,7 @@ extern int target_flags; instructions for them. Might as well be consistent with bits and bytes. */ #define WORDS_BIG_ENDIAN 1 -/* number of bits in an addressible storage unit */ +/* number of bits in an addressable storage unit */ #define BITS_PER_UNIT 8 /* Width in bits of a "word", which is the contents of a machine register. @@ -128,6 +131,9 @@ extern int target_flags; /* Width of a word, in units (bytes). */ #define UNITS_PER_WORD 4 +/* Type used for ptrdiff_t, as a string used in a declaration. */ +#define PTRDIFF_TYPE "int" + /* Type used for wchar_t, as a string used in a declaration. */ #define WCHAR_TYPE "short unsigned int" @@ -170,9 +176,9 @@ extern int target_flags; && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \ && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN)) -/* Define this if move instructions will actually fail to work +/* Non-zero if move instructions will actually fail to work when given unaligned data. */ -/* #define STRICT_ALIGNMENT */ +#define STRICT_ALIGNMENT 0 /* Standard register usage. */ @@ -708,7 +714,8 @@ struct rs6000_args {int words, fregno, n #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ (! (NAMED) ? 0 \ - : USE_FP_FOR_ARG_P (CUM, MODE, TYPE) \ + : ((TYPE) != 0 && TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST) ? 0 \ + : USE_FP_FOR_ARG_P (CUM, MODE, TYPE) \ ? ((CUM).nargs_prototype > 0 \ ? gen_rtx (REG, MODE, (CUM).fregno) \ : ((CUM).words < 8 \ @@ -777,12 +784,10 @@ struct rs6000_args {int words, fregno, n #define FUNCTION_PROLOGUE(FILE, SIZE) output_prolog (FILE, SIZE) /* Output assembler code to FILE to increment profiler label # LABELNO - for profiling a function entry. - - I have no real idea what r3 should point to here. */ + for profiling a function entry. */ #define FUNCTION_PROFILER(FILE, LABELNO) \ - fprintf(FILE, "\tbl mcount\n"); + output_function_profiler ((FILE), (LABELNO)); /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, the stack pointer does not matter. No definition is equivalent to @@ -1076,11 +1081,15 @@ struct rs6000_args {int words, fregno, n gen_rtx (CONST_INT, VOIDmode, \ high_int << 16)), 0),\ gen_rtx (CONST_INT, VOIDmode, low_int)); \ + goto WIN; \ } \ else if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == REG \ && GET_CODE (XEXP (X, 1)) != CONST_INT) \ - (X) = gen_rtx (PLUS, SImode, XEXP (X, 0), \ - force_operand (XEXP (X, 1), 0)); \ + { \ + (X) = gen_rtx (PLUS, SImode, XEXP (X, 0), \ + force_reg (SImode, force_operand (XEXP (X, 1), 0))); \ + goto WIN; \ + } \ } /* Go to LABEL if ADDR (a legitimate address expression) @@ -1143,25 +1152,19 @@ struct rs6000_args {int words, fregno, n /* Define if normal loads of shorter-than-word items from memory clears the rest of the bigs in the register. */ #define BYTE_LOADS_ZERO_EXTEND + +/* The RS/6000 uses the XCOFF format. */ -/* We can't support any debugging info on the RS/6000 since it has its - own format. */ -/* #define DBX_DEBUGGING_INFO */ -/* #define SDB_DEBUGGING_INFO */ +#define XCOFF_DEBUGGING_INFO + +/* Define if the object format being used is COFF or a superset. */ +#define OBJECT_FORMAT_COFF /* We don't have GAS for the RS/6000 yet, so don't write out special .stabs in cc1plus. */ #define FASCIST_ASSEMBLER -/* Do not break .stabs pseudos into continuations. */ -#define DBX_CONTIN_LENGTH 0 - -/* Don't try to use the `x' type-cross-reference character in DBX data. - Also has the consequence of putting each struct, union or enum - into a separate .stabs, containing only cross-refs to the others. */ -#define DBX_NO_XREFS - /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits is done just by pretending it is already truncated. */ #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1 @@ -1198,7 +1201,7 @@ struct rs6000_args {int words, fregno, n On the RS/6000, if it is legal in the insn, it is free. So this always returns 0. */ -#define CONST_COSTS(RTX,CODE) \ +#define CONST_COSTS(RTX,CODE,OUTER_CODE) \ case CONST_INT: \ case CONST: \ case LABEL_REF: \ @@ -1209,7 +1212,7 @@ struct rs6000_args {int words, fregno, n /* Provide the costs of a rtl expression. This is in the body of a switch on CODE. */ -#define RTX_COSTS(X,CODE) \ +#define RTX_COSTS(X,CODE,OUTER_CODE) \ case MULT: \ return (GET_CODE (XEXP (X, 1)) != CONST_INT \ ? COSTS_N_INSNS (5) \ @@ -1250,22 +1253,26 @@ struct rs6000_args {int words, fregno, n /* Add any extra modes needed to represent the condition code. For the RS/6000, we need separate modes when unsigned (logical) comparisons - are being done and we need a separate mode for floating-point. */ + are being done and we need a separate mode for floating-point. We also + use a mode for the case when we are comparing the results of two + comparisons. */ -#define EXTRA_CC_MODES CCUNSmode, CCFPmode +#define EXTRA_CC_MODES CCUNSmode, CCFPmode, CCEQmode /* Define the names for the modes specified above. */ -#define EXTRA_CC_NAMES "CCUNS", "CCFP" +#define EXTRA_CC_NAMES "CCUNS", "CCFP", "CCEQ" /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE, return the mode to be used for the comparison. For floating-point, CCFPmode - should be used. CC_NOOVmode should be used when the first operand is a - PLUS, MINUS, or NEG. CCmode should be used when no special processing is - needed. */ + should be used. CCUNSmode should be used for unsigned comparisons. + CCEQmode should be used when we are doing an inequality comparison on + the result of a comparison. CCmode should be used in all other cases. */ + #define SELECT_CC_MODE(OP,X) \ (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT ? CCFPmode \ - : ((OP) == GTU || (OP) == LTU || (OP) == GEU || (OP) == LEU \ - ? CCUNSmode : CCmode)) + : (OP) == GTU || (OP) == LTU || (OP) == GEU || (OP) == LEU ? CCUNSmode \ + : (((OP) == EQ || (OP) == NE) && GET_RTX_CLASS (GET_CODE (X)) == '<' \ + ? CCEQmode : CCmode)) /* Define the information needed to generate branch and scc insns. This is stored from the compare operation. Note that we can't use "rtx" here @@ -1286,19 +1293,23 @@ extern int rs6000_trunc_used; On the RS/6000, we want to go into the TOC section so at least one .toc will be emitted. - Also initialize the section names for the RS/6000 at this point. */ + Also initialize the section names for the RS/6000 at this point. + + Also, in order to output proper .bs/.es pairs, we need at least one static + [RW] section emitted. */ #define ASM_FILE_START(FILE) \ { \ - rs6000_gen_section_name (&rs6000_bss_section_name, \ + rs6000_gen_section_name (&xcoff_bss_section_name, \ main_input_filename, ".bss_"); \ - rs6000_gen_section_name (&rs6000_private_data_section_name, \ + rs6000_gen_section_name (&xcoff_private_data_section_name, \ main_input_filename, ".rw_"); \ - rs6000_gen_section_name (&rs6000_read_only_section_name, \ + rs6000_gen_section_name (&xcoff_read_only_section_name, \ main_input_filename, ".ro_"); \ \ toc_section (); \ - bss_section (); \ + if (write_symbols != NO_DEBUG) \ + private_data_section (); \ } /* Output at end of assembler file. @@ -1313,13 +1324,6 @@ extern int rs6000_trunc_used; fprintf (FILE, "\t.long _section_.text\n"); \ } -/* Names of bss and data sections. These should be unique names for each - compilation unit. */ - -extern char *rs6000_bss_section_name; -extern char *rs6000_private_data_section_name; -extern char *rs6000_read_only_section_name; - /* We define this to prevent the name mangler from putting dollar signs into function names. */ @@ -1331,6 +1335,10 @@ extern char *rs6000_read_only_section_na #define DOLLARS_IN_IDENTIFIERS 0 +/* Implicit library calls should use memcpy, not bcopy, etc. */ + +#define TARGET_MEM_FUNCTIONS + /* Define the extra sections we need. We define three: one is the read-only data section which is used for constants. This is a csect whose name is derived from the name of the input file. The second is for initialized @@ -1357,8 +1365,8 @@ read_only_data_section () \ { \ if (in_section != read_only_data) \ { \ - fprintf (asm_out_file, "\t.csect\t%s[RO]\n", \ - rs6000_read_only_section_name); \ + fprintf (asm_out_file, "\t.csect %s[RO]\n", \ + xcoff_read_only_section_name); \ in_section = read_only_data; \ } \ } \ @@ -1369,7 +1377,7 @@ private_data_section () \ if (in_section != private_data) \ { \ fprintf (asm_out_file, "\t.csect %s[RW]\n", \ - rs6000_private_data_section_name); \ + xcoff_private_data_section_name); \ \ in_section = private_data; \ } \ @@ -1380,8 +1388,8 @@ read_only_private_data_section () \ { \ if (in_section != read_only_private_data) \ { \ - fprintf (asm_out_file, "\t.csect\t%s[RO]\n", \ - rs6000_private_data_section_name); \ + fprintf (asm_out_file, "\t.csect %s[RO]\n", \ + xcoff_private_data_section_name); \ in_section = read_only_private_data; \ } \ } \ @@ -1393,18 +1401,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\t%s[BS]\n", \ - rs6000_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 @@ -1414,12 +1411,20 @@ bss_section () \ `text_section' call previously done. We do have to go back to that csect, however. */ +/* ??? What do the 16 and 044 in the .function line really mean? */ + #define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \ { if (TREE_PUBLIC (DECL)) \ { \ fprintf (FILE, "\t.globl ."); \ RS6000_OUTPUT_BASENAME (FILE, NAME); \ - fprintf (FILE,"\n"); \ + fprintf (FILE, "\n"); \ + } \ + else if (write_symbols == XCOFF_DEBUG) \ + { \ + fprintf (FILE, "\t.lglobl ."); \ + RS6000_OUTPUT_BASENAME (FILE, NAME); \ + fprintf (FILE, "\n"); \ } \ fprintf (FILE, "\t.csect "); \ RS6000_OUTPUT_BASENAME (FILE, NAME); \ @@ -1428,10 +1433,12 @@ bss_section () \ fprintf (FILE, ":\n"); \ fprintf (FILE, "\t.long ."); \ RS6000_OUTPUT_BASENAME (FILE, NAME); \ - fprintf (FILE, ", TOC[tc0], 0\n"); \ + fprintf (FILE, ", TOC[tc0], 0\n"); \ fprintf (FILE, "\t.csect [PR]\n."); \ RS6000_OUTPUT_BASENAME (FILE, NAME); \ fprintf (FILE, ":\n"); \ + if (write_symbols == XCOFF_DEBUG) \ + xcoffout_declare_function (FILE, DECL, NAME); \ } /* Return non-zero if this entry is to be written into the constant pool @@ -1566,11 +1573,11 @@ bss_section () \ /* Output before instructions. */ -#define TEXT_SECTION_ASM_OP "\t.csect [PR]" +#define TEXT_SECTION_ASM_OP ".csect [PR]" /* Output before writable data. */ -#define DATA_SECTION_ASM_OP "\t.csect .data[RW]" +#define DATA_SECTION_ASM_OP ".csect .data[RW]" /* How to refer to registers in assembler output. This sequence is indexed by compiler's hard-register-number (see above). */ @@ -1608,7 +1615,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. */ @@ -1742,7 +1750,7 @@ bss_section () \ #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE,ROUNDED) \ do { fputs (".lcomm ", (FILE)); \ RS6000_OUTPUT_BASENAME ((FILE), (NAME)); \ - fprintf ((FILE), ",%d,%s\n", (SIZE), rs6000_bss_section_name); \ + fprintf ((FILE), ",%d,%s\n", (SIZE), xcoff_bss_section_name); \ } while (0) /* Store in OUTPUT a string (made with alloca) containing @@ -1787,7 +1795,8 @@ bss_section () \ #define PREDICATE_CODES \ {"short_cint_operand", {CONST_INT}}, \ {"u_short_cint_operand", {CONST_INT}}, \ - {"gen_reg_operand", {SUBREG, REG}}, \ + {"non_short_cint_operand", {CONST_INT}}, \ + {"gpc_reg_operand", {SUBREG, REG}}, \ {"cc_reg_operand", {SUBREG, REG}}, \ {"reg_or_short_operand", {SUBREG, REG, CONST_INT}}, \ {"reg_or_neg_short_operand", {SUBREG, REG, CONST_INT}}, \ @@ -1798,8 +1807,11 @@ bss_section () \ {"fp_reg_or_mem_operand", {SUBREG, MEM, REG}}, \ {"mem_or_easy_const_operand", {SUBREG, MEM, CONST_DOUBLE}}, \ {"add_operand", {SUBREG, REG, CONST_INT}}, \ + {"non_add_cint_operand", {CONST_INT}}, \ {"and_operand", {SUBREG, REG, CONST_INT}}, \ + {"non_and_cint_operand", {CONST_INT}}, \ {"logical_operand", {SUBREG, REG, CONST_INT}}, \ + {"non_logical_cint_operand", {CONST_INT}}, \ {"mask_operand", {CONST_INT}}, \ {"call_operand", {SYMBOL_REF, REG}}, \ {"input_operand", {SUBREG, MEM, REG, CONST_INT}}, \