Sync SH port with FSF; enable regmove for SH.
From-SVN: r16371
This commit is contained in:
parent
c64e3181fe
commit
1245df60c1
6 changed files with 2451 additions and 676 deletions
|
@ -1,3 +1,36 @@
|
|||
Sat Nov 8 18:20:21 1997 J"orn Rennecke <amylaar@cygnus.co.uk>
|
||||
|
||||
* sh.h (ENABLE_REGMOVE_PASS): Define.
|
||||
|
||||
Bring over from FSF:
|
||||
|
||||
Thu Oct 30 12:21:06 1997 J"orn Rennecke <amylaar@cygnus.co.uk>
|
||||
|
||||
* va-sh.h (__va_arg_sh1): Define.
|
||||
(va_arg): Use it.
|
||||
SH3E doesn't use any integer registers for subsequent arguments
|
||||
once a non-float value was passed in the stack.
|
||||
* sh.c (machine_dependent_reorg): If optimizing, put explicit
|
||||
alignment in front label for ADDR_DIFF_VEC.
|
||||
* sh.h (PASS_IN_REG_P): Fix SH3E case.
|
||||
(ADJUST_INSN_LENGTH): If not optimizing, add two extra bytes length.
|
||||
|
||||
Tue Oct 28 15:06:44 1997 J"orn Rennecke <amylaar@cygnus.co.uk>
|
||||
|
||||
* sh/elf.h (PREFERRED_DEBUGGING_TYPE): Undefine before including
|
||||
svr4.h.
|
||||
|
||||
Mon Oct 27 16:11:52 1997 J"orn Rennecke <amylaar@cygnus.co.uk>
|
||||
|
||||
* sh.c (machine_dependent_reorg): When -flag_delayed_branches,
|
||||
put an use_sfunc_addr before each sfunc.
|
||||
* sh.md (use_sfunc_addr, dummy_jump): New insns.
|
||||
(casesi): For TARGET_SH2, emit a dummy_jump after LAB.
|
||||
|
||||
Tue Oct 21 07:12:28 1997 J"orn Rennecke <amylaar@cygnus.co.uk>
|
||||
|
||||
* sh/elf.h (PREFERRED_DEBUGGING_TYPE): Don't redefine.
|
||||
|
||||
Fri Nov 7 10:22:24 1997 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* frame.c (add_fdes, count_fdes): Go back to checking pc_begin for
|
||||
|
|
|
@ -25,10 +25,6 @@ Boston, MA 02111-1307, USA. */
|
|||
/* No SDB debugging info. */
|
||||
#undef SDB_DEBUGGING_INFO
|
||||
|
||||
/* Prefer stabs. */
|
||||
#undef PREFERRED_DEBUGGING_TYPE
|
||||
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
|
||||
|
||||
/* Undefine some macros defined in both sh.h and svr4.h. */
|
||||
#undef IDENT_ASM_OP
|
||||
#undef ASM_FILE_END
|
||||
|
@ -40,10 +36,30 @@ Boston, MA 02111-1307, USA. */
|
|||
#undef ASM_OUTPUT_CONSTRUCTOR
|
||||
#undef ASM_OUTPUT_DESTRUCTOR
|
||||
#undef ASM_DECLARE_FUNCTION_NAME
|
||||
#undef PREFERRED_DEBUGGING_TYPE
|
||||
|
||||
/* Be ELF-like. */
|
||||
#include "svr4.h"
|
||||
|
||||
/* The prefix to add to user-visible assembler symbols.
|
||||
Note that svr4.h redefined it from the original value (that we want)
|
||||
in sh.h */
|
||||
|
||||
#undef USER_LABEL_PREFIX
|
||||
#define USER_LABEL_PREFIX "_"
|
||||
|
||||
#undef LOCAL_LABEL_PREFIX
|
||||
#define LOCAL_LABEL_PREFIX "."
|
||||
|
||||
#undef ASM_FILE_START
|
||||
#define ASM_FILE_START(FILE) do { \
|
||||
output_file_directive ((FILE), main_input_filename); \
|
||||
if (TARGET_LITTLE_ENDIAN) \
|
||||
fprintf ((FILE), "\t.little\n"); \
|
||||
} while (0)
|
||||
|
||||
|
||||
|
||||
/* Let code know that this is ELF. */
|
||||
#define CPP_PREDEFINES "-D__sh__ -D__ELF__ -Acpu(sh) -Amachine(sh)"
|
||||
|
||||
|
@ -52,7 +68,7 @@ Boston, MA 02111-1307, USA. */
|
|||
#define ASM_SPEC "%{ml:-little} %{mrelax:-relax}"
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "%{ml:-m shl} %{mrelax:-relax}"
|
||||
#define LINK_SPEC "%{ml:-m shlelf} %{mrelax:-relax}"
|
||||
|
||||
/* svr4.h undefined DBX_REGISTER_NUMBER, so we need to define it
|
||||
again. */
|
||||
|
@ -63,29 +79,26 @@ Boston, MA 02111-1307, USA. */
|
|||
symbol names. */
|
||||
#undef ASM_OUTPUT_LABELREF
|
||||
#define ASM_OUTPUT_LABELREF(STREAM,NAME) \
|
||||
fprintf (STREAM, "_%s", NAME)
|
||||
|
||||
/* Because SH ELF uses underscores, we don't put a '.' before local
|
||||
labels, for easy compatibility with the COFF implementation. */
|
||||
asm_fprintf (STREAM, "%U%s", NAME)
|
||||
|
||||
#undef ASM_GENERATE_INTERNAL_LABEL
|
||||
#define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \
|
||||
sprintf (STRING, "*%s%d", PREFIX, NUM)
|
||||
sprintf ((STRING), "*%s%s%d", LOCAL_LABEL_PREFIX, (PREFIX), (NUM))
|
||||
|
||||
#undef ASM_OUTPUT_INTERNAL_LABEL
|
||||
#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
|
||||
fprintf (FILE, "%s%d:\n", PREFIX, NUM)
|
||||
asm_fprintf ((FILE), "%L%s%d:\n", (PREFIX), (NUM))
|
||||
|
||||
#undef ASM_OUTPUT_SOURCE_LINE
|
||||
#define ASM_OUTPUT_SOURCE_LINE(file, line) \
|
||||
do \
|
||||
{ \
|
||||
static int sym_lineno = 1; \
|
||||
fprintf (file, ".stabn 68,0,%d,LM%d-", \
|
||||
line, sym_lineno); \
|
||||
assemble_name (file, \
|
||||
asm_fprintf ((file), ".stabn 68,0,%d,%LLM%d-", \
|
||||
(line), sym_lineno); \
|
||||
assemble_name ((file), \
|
||||
XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));\
|
||||
fprintf (file, "\nLM%d:\n", sym_lineno); \
|
||||
asm_fprintf ((file), "\n%LLM%d:\n", sym_lineno); \
|
||||
sym_lineno += 1; \
|
||||
} \
|
||||
while (0)
|
||||
|
@ -94,7 +107,7 @@ while (0)
|
|||
#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
|
||||
do { \
|
||||
text_section (); \
|
||||
fprintf (FILE, "\t.stabs \"\",%d,0,0,Letext\nLetext:\n", N_SO); \
|
||||
fprintf ((FILE), "\t.stabs \"\",%d,0,0,Letext\nLetext:\n", N_SO); \
|
||||
} while (0)
|
||||
|
||||
/* Arrange to call __main, rather than using crtbegin.o and crtend.o
|
||||
|
@ -103,3 +116,7 @@ do { \
|
|||
#undef FINI_SECTION_ASM_OP
|
||||
#undef STARTFILE_SPEC
|
||||
#undef ENDFILE_SPEC
|
||||
|
||||
/* HANDLE_SYSV_PRAGMA (defined by svr4.h) takes precedence over HANDLE_PRAGMA.
|
||||
We want to use the HANDLE_PRAGMA from sh.h. */
|
||||
#undef HANDLE_SYSV_PRAGMA
|
||||
|
|
1759
gcc/config/sh/sh.c
1759
gcc/config/sh/sh.c
File diff suppressed because it is too large
Load diff
|
@ -804,9 +804,16 @@ struct sh_args {
|
|||
This macro is only used in this file. */
|
||||
|
||||
#define PASS_IN_REG_P(CUM, MODE, TYPE) \
|
||||
(ROUND_REG ((CUM), (MODE)) < NPARM_REGS (MODE) \
|
||||
&& ((TYPE) == 0 || ! TREE_ADDRESSABLE ((tree)(TYPE))) \
|
||||
&& (! TARGET_SH3E || (ROUND_REG((CUM), (MODE)) + (GET_MODE_SIZE(MODE)/4) <= NPARM_REGS (MODE))))
|
||||
(((TYPE) == 0 || ! TREE_ADDRESSABLE ((tree)(TYPE))) \
|
||||
&& (TARGET_SH3E \
|
||||
? ((MODE) == BLKmode \
|
||||
? (((CUM).arg_count[(int) SH_ARG_INT] * UNITS_PER_WORD \
|
||||
+ int_size_in_bytes (TYPE)) \
|
||||
<= NPARM_REGS (SImode) * UNITS_PER_WORD) \
|
||||
: ((ROUND_REG((CUM), (MODE)) \
|
||||
+ HARD_REGNO_NREGS (BASE_ARG_REG (MODE), (MODE))) \
|
||||
<= NPARM_REGS (MODE))) \
|
||||
: ROUND_REG ((CUM), (MODE)) < NPARM_REGS (MODE)))
|
||||
|
||||
/* Define where to put the arguments to a function.
|
||||
Value is zero to push the argument on the stack,
|
||||
|
@ -1755,9 +1762,14 @@ sh_valid_machine_decl_attribute (DECL, ATTRIBUTES, IDENTIFIER, ARGS)
|
|||
(LENGTH) = align_length (X); \
|
||||
if (GET_CODE (X) == JUMP_INSN \
|
||||
&& GET_CODE (PATTERN (X)) == ADDR_DIFF_VEC) \
|
||||
/* The code before an ADDR_DIFF_VEC is even aligned, thus \
|
||||
any odd estimate is wrong. */ \
|
||||
(LENGTH) &= ~1;
|
||||
{ \
|
||||
/* The code before an ADDR_DIFF_VEC is even aligned, \
|
||||
thus any odd estimate is wrong. */ \
|
||||
(LENGTH) &= ~1; \
|
||||
/* If not optimizing, the alignment is implicit. */ \
|
||||
if (! optimize) \
|
||||
(LENGTH) += 2; \
|
||||
}
|
||||
|
||||
/* Enable a bug fix for the shorten_branches pass. */
|
||||
#define SHORTEN_WITH_ADJUST_INSN_LENGTH
|
||||
|
@ -1859,4 +1871,7 @@ do { \
|
|||
/* For the sake of libgcc2.c, indicate target supports atexit. */
|
||||
#define HAVE_ATEXIT
|
||||
|
||||
/* Enable the register move pass to improve code. */
|
||||
#define ENABLE_REGMOVE_PASS
|
||||
|
||||
#define SH_DYNAMIC_SHIFT_COST (TARGET_SH3 ? (TARGET_SMALLCODE ? 1 : 2) : 20)
|
||||
|
|
1131
gcc/config/sh/sh.md
1131
gcc/config/sh/sh.md
File diff suppressed because it is too large
Load diff
|
@ -23,9 +23,6 @@ typedef struct {
|
|||
|
||||
typedef void *__gnuc_va_list;
|
||||
|
||||
#define __va_rounded_size(TYPE) \
|
||||
(((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
|
||||
|
||||
#endif /* ! SH3E */
|
||||
|
||||
#endif /* __GNUC_VA_LIST */
|
||||
|
@ -116,104 +113,83 @@ enum __va_type_classes {
|
|||
#endif
|
||||
#define va_end(pvar) ((void)0)
|
||||
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
#define __LITTLE_ENDIAN_P 1
|
||||
#else
|
||||
#define __LITTLE_ENDIAN_P 0
|
||||
#endif
|
||||
|
||||
#define __SCALAR_TYPE(TYPE) \
|
||||
((TYPE) == __integer_type_class \
|
||||
|| (TYPE) == __char_type_class \
|
||||
|| (TYPE) == __enumeral_type_class)
|
||||
|
||||
/* RECORD_TYPE args passed using the C calling convention are
|
||||
passed by invisible reference. ??? RECORD_TYPE args passed
|
||||
in the stack are made to be word-aligned; for an aggregate that is
|
||||
not word-aligned, we advance the pointer to the first non-reg slot. */
|
||||
|
||||
/* When this is a smaller-than-int integer, using
|
||||
auto-increment in the promoted (SImode) is fastest;
|
||||
however, there is no way to express that is C. Therefore,
|
||||
we use an asm.
|
||||
We want the MEM_IN_STRUCT_P bit set in the emitted RTL, therefore we
|
||||
use unions even when it would otherwise be unnecessary. */
|
||||
|
||||
#define __va_arg_sh1(AP, TYPE) __extension__ \
|
||||
__extension__ \
|
||||
({(sizeof (TYPE) == 1 \
|
||||
? ({union {TYPE t; char c;} __t; \
|
||||
asm("" \
|
||||
: "=r" (__t.c) \
|
||||
: "0" ((((union { int i, j; } *) (AP))++)->i)); \
|
||||
__t.t;}) \
|
||||
: sizeof (TYPE) == 2 \
|
||||
? ({union {TYPE t; short s;} __t; \
|
||||
asm("" \
|
||||
: "=r" (__t.s) \
|
||||
: "0" ((((union { int i, j; } *) (AP))++)->i)); \
|
||||
__t.t;}) \
|
||||
: sizeof (TYPE) >= 4 || __LITTLE_ENDIAN_P \
|
||||
? (((union { TYPE t; int i;} *) (AP))++)->t \
|
||||
: ((union {TYPE t;TYPE u;}*) ((char *)++(int *)(AP) - sizeof (TYPE)))->t);})
|
||||
|
||||
#ifdef __SH3E__
|
||||
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
#define __PASS_AS_FLOAT(TYPE_CLASS,SIZE) \
|
||||
(TYPE_CLASS == __real_type_class && SIZE == 4)
|
||||
|
||||
#define va_arg(pvar,TYPE) \
|
||||
__extension__ \
|
||||
(*({int __type = __builtin_classify_type (* (TYPE *) 0); \
|
||||
void * __result; \
|
||||
if (__type == __real_type_class && sizeof(TYPE) == 4) \
|
||||
/* float? */ \
|
||||
({int __type = __builtin_classify_type (* (TYPE *) 0); \
|
||||
void * __result_p; \
|
||||
if (__PASS_AS_FLOAT (__type, sizeof(TYPE))) \
|
||||
{ \
|
||||
__va_freg *__r; \
|
||||
if (pvar.__va_next_fp < pvar.__va_next_fp_limit) \
|
||||
__r = (__va_freg *) pvar.__va_next_fp++; \
|
||||
{ \
|
||||
__result_p = &pvar.__va_next_fp; \
|
||||
} \
|
||||
else \
|
||||
__r = (__va_freg *) pvar.__va_next_stack++; \
|
||||
__result = (char *) __r; \
|
||||
__result_p = &pvar.__va_next_stack; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
__va_greg *_r; \
|
||||
if (pvar.__va_next_o + ((sizeof (TYPE) + 3) / 4) \
|
||||
<= pvar.__va_next_o_limit) \
|
||||
{ \
|
||||
_r = pvar.__va_next_o; \
|
||||
pvar.__va_next_o += (sizeof (TYPE) + 3) / 4; \
|
||||
} \
|
||||
__result_p = &pvar.__va_next_o; \
|
||||
else \
|
||||
{ \
|
||||
_r = pvar.__va_next_stack; \
|
||||
pvar.__va_next_stack += (sizeof (TYPE) + 3) / 4; \
|
||||
if (sizeof (TYPE) > 4) \
|
||||
pvar.__va_next_o = pvar.__va_next_o_limit; \
|
||||
\
|
||||
__result_p = &pvar.__va_next_stack; \
|
||||
} \
|
||||
__result = (char *) _r; \
|
||||
} \
|
||||
(TYPE *) __result;}))
|
||||
|
||||
#else /* ! __LITTLE_ENDIAN__ */
|
||||
|
||||
#define va_arg(pvar,TYPE) \
|
||||
__extension__ \
|
||||
(*({int __type = __builtin_classify_type (* (TYPE *) 0); \
|
||||
void * __result; \
|
||||
if (__type == __real_type_class && sizeof(TYPE) == 4) \
|
||||
/* float? */ \
|
||||
{ \
|
||||
__va_freg *__r; \
|
||||
if (pvar.__va_next_fp < pvar.__va_next_fp_limit) \
|
||||
__r = (__va_freg *) pvar.__va_next_fp++; \
|
||||
else \
|
||||
__r = (__va_freg *) pvar.__va_next_stack++; \
|
||||
__result = (char *) __r; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
__va_greg *_r; \
|
||||
if (pvar.__va_next_o + ((sizeof (TYPE) + 3) / 4) \
|
||||
<= pvar.__va_next_o_limit) \
|
||||
{ \
|
||||
pvar.__va_next_o += (sizeof (TYPE) + 3) / 4; \
|
||||
_r = pvar.__va_next_o; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
pvar.__va_next_stack += (sizeof (TYPE) + 3) / 4; \
|
||||
_r = pvar.__va_next_stack; \
|
||||
} \
|
||||
__result = ((char *) _r \
|
||||
- (sizeof (TYPE) < 4 ? sizeof (TYPE) \
|
||||
: ((sizeof (TYPE) + 3) / 4) * 4)); \
|
||||
} \
|
||||
(TYPE *) __result;}))
|
||||
|
||||
#endif /* __LITTLE_ENDIAN__ */
|
||||
__va_arg_sh1(*(void **)__result_p, TYPE);})
|
||||
|
||||
#else /* ! SH3E */
|
||||
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
|
||||
/* This is for little-endian machines; small args are padded upward. */
|
||||
#define va_arg(AP, TYPE) \
|
||||
(AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
|
||||
*((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
|
||||
|
||||
#else /* ! __LITTLE_ENDIAN__ */
|
||||
|
||||
/* This is for big-endian machines; small args are padded downward. */
|
||||
#define va_arg(AP, TYPE) \
|
||||
(AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
|
||||
*((TYPE *) (void *) ((char *) (AP) \
|
||||
- ((sizeof (TYPE) < __va_rounded_size (char) \
|
||||
? sizeof (TYPE) : __va_rounded_size (TYPE))))))
|
||||
|
||||
#endif /* __LITTLE_ENDIAN__ */
|
||||
#define va_arg(AP, TYPE) __va_arg_sh1((AP), TYPE)
|
||||
|
||||
#endif /* SH3E */
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue