diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-01-28 18:29:50 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-01-28 18:29:50 +0000 |
commit | c8306b9c0c49be84b69c83c83da442953240ef73 (patch) | |
tree | 16bd0f056625bcd2864f21c5591d24f60437d748 /gcc/config | |
parent | 48efb0bb390457104c643dc2d7bb8c6b766e3104 (diff) | |
download | gcc-c8306b9c0c49be84b69c83c83da442953240ef73.tar.gz |
2010-01-28 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 156327
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@156329 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/arm/arm.md | 101 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 18 | ||||
-rw-r--r-- | gcc/config/mips/iris.h | 36 | ||||
-rw-r--r-- | gcc/config/mn10300/mn10300.c | 79 | ||||
-rw-r--r-- | gcc/config/mn10300/mn10300.h | 7 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 39 | ||||
-rw-r--r-- | gcc/config/s390/s390.c | 4 | ||||
-rw-r--r-- | gcc/config/sh/sh.c | 8 | ||||
-rw-r--r-- | gcc/config/sparc/sparc.c | 4 | ||||
-rw-r--r-- | gcc/config/sparc/sysv4.h | 2 |
10 files changed, 271 insertions, 27 deletions
diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index cbb0a1bdf14..f50bf0bd263 100644 --- a/gcc/config/arm/arm.md +++ b/gcc/config/arm/arm.md @@ -11194,6 +11194,107 @@ (set_attr "length" "4")] ) +(define_insn "arm_rev" + [(set (match_operand:SI 0 "s_register_operand" "=r") + (bswap:SI (match_operand:SI 1 "s_register_operand" "r")))] + "TARGET_EITHER && arm_arch6" + "rev\t%0, %1" + [(set (attr "length") + (if_then_else (eq_attr "is_thumb" "yes") + (const_int 2) + (const_int 4)))] +) + +(define_expand "arm_legacy_rev" + [(set (match_operand:SI 2 "s_register_operand" "") + (xor:SI (rotatert:SI (match_operand:SI 1 "s_register_operand" "") + (const_int 16)) + (match_dup 1))) + (set (match_dup 2) + (lshiftrt:SI (match_dup 2) + (const_int 8))) + (set (match_operand:SI 3 "s_register_operand" "") + (rotatert:SI (match_dup 1) + (const_int 8))) + (set (match_dup 2) + (and:SI (match_dup 2) + (const_int -65281))) + (set (match_operand:SI 0 "s_register_operand" "") + (xor:SI (match_dup 3) + (match_dup 2)))] + "TARGET_32BIT" + "" +) + +;; Reuse temporaries to keep register pressure down. +(define_expand "thumb_legacy_rev" + [(set (match_operand:SI 2 "s_register_operand" "") + (ashift:SI (match_operand:SI 1 "s_register_operand" "") + (const_int 24))) + (set (match_operand:SI 3 "s_register_operand" "") + (lshiftrt:SI (match_dup 1) + (const_int 24))) + (set (match_dup 3) + (ior:SI (match_dup 3) + (match_dup 2))) + (set (match_operand:SI 4 "s_register_operand" "") + (const_int 16)) + (set (match_operand:SI 5 "s_register_operand" "") + (rotatert:SI (match_dup 1) + (match_dup 4))) + (set (match_dup 2) + (ashift:SI (match_dup 5) + (const_int 24))) + (set (match_dup 5) + (lshiftrt:SI (match_dup 5) + (const_int 24))) + (set (match_dup 5) + (ior:SI (match_dup 5) + (match_dup 2))) + (set (match_dup 5) + (rotatert:SI (match_dup 5) + (match_dup 4))) + (set (match_operand:SI 0 "s_register_operand" "") + (ior:SI (match_dup 5) + (match_dup 3)))] + "TARGET_THUMB" + "" +) + +(define_expand "bswapsi2" + [(set (match_operand:SI 0 "s_register_operand" "=r") + (bswap:SI (match_operand:SI 1 "s_register_operand" "r")))] +"TARGET_EITHER" +" + if (!arm_arch6) + { + if (!optimize_size) + { + rtx op2 = gen_reg_rtx (SImode); + rtx op3 = gen_reg_rtx (SImode); + + if (TARGET_THUMB) + { + rtx op4 = gen_reg_rtx (SImode); + rtx op5 = gen_reg_rtx (SImode); + + emit_insn (gen_thumb_legacy_rev (operands[0], operands[1], + op2, op3, op4, op5)); + } + else + { + emit_insn (gen_arm_legacy_rev (operands[0], operands[1], + op2, op3)); + } + + DONE; + } + else + FAIL; + } + " +) + ;; Load the FPA co-processor patterns (include "fpa.md") ;; Load the Maverick co-processor patterns diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 6b1c9b9c61f..5bc4a64a29d 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -15381,7 +15381,7 @@ ix86_expand_int_movcc (rtx operands[]) enum rtx_code code = GET_CODE (operands[1]), compare_code; rtx compare_seq, compare_op; enum machine_mode mode = GET_MODE (operands[0]); - bool sign_bit_compare_p = false;; + bool sign_bit_compare_p = false; start_sequence (); ix86_compare_op0 = XEXP (operands[1], 0); @@ -15422,7 +15422,6 @@ ix86_expand_int_movcc (rtx operands[]) if (!sign_bit_compare_p) { rtx flags; - rtx (*insn)(rtx, rtx, rtx); bool fpcmp = false; compare_code = GET_CODE (compare_op); @@ -15463,11 +15462,10 @@ ix86_expand_int_movcc (rtx operands[]) tmp = gen_reg_rtx (mode); if (mode == DImode) - insn = gen_x86_movdicc_0_m1; + emit_insn (gen_x86_movdicc_0_m1 (tmp, flags, compare_op)); else - insn = gen_x86_movsicc_0_m1; - - emit_insn (insn (tmp, flags, compare_op)); + emit_insn (gen_x86_movsicc_0_m1 (gen_lowpart (SImode, tmp), + flags, compare_op)); } else { @@ -26644,8 +26642,16 @@ ix86_expand_vector_init_duplicate (bool mmx_ok, enum machine_mode mode, insn = emit_insn (gen_rtx_SET (VOIDmode, target, dup)); if (recog_memoized (insn) < 0) { + rtx seq; /* If that fails, force VAL into a register. */ + + start_sequence (); XEXP (dup, 0) = force_reg (GET_MODE_INNER (mode), val); + seq = get_insns (); + end_sequence (); + if (seq) + emit_insn_before (seq, insn); + ok = recog_memoized (insn) >= 0; gcc_assert (ok); } diff --git a/gcc/config/mips/iris.h b/gcc/config/mips/iris.h index 24431937f23..f22f3cda639 100644 --- a/gcc/config/mips/iris.h +++ b/gcc/config/mips/iris.h @@ -78,6 +78,42 @@ along with GCC; see the file COPYING3. If not see #undef WINT_TYPE_SIZE #define WINT_TYPE_SIZE 32 +/* C99 stdint.h types. */ +#define INT8_TYPE "signed char" +#define INT16_TYPE "short int" +#define INT32_TYPE "int" +#define INT64_TYPE "long long int" +#define UINT8_TYPE "unsigned char" +#define UINT16_TYPE "short unsigned int" +#define UINT32_TYPE "unsigned int" +#define UINT64_TYPE "long long unsigned int" + +#define INT_LEAST8_TYPE "signed char" +#define INT_LEAST16_TYPE "short int" +#define INT_LEAST32_TYPE "int" +#define INT_LEAST64_TYPE "long long int" +#define UINT_LEAST8_TYPE "unsigned char" +#define UINT_LEAST16_TYPE "short unsigned int" +#define UINT_LEAST32_TYPE "unsigned int" +#define UINT_LEAST64_TYPE "long long unsigned int" + +#define INT_FAST8_TYPE "signed char" +#define INT_FAST16_TYPE "short int" +#define INT_FAST32_TYPE "int" +#define INT_FAST64_TYPE "long long int" +#define UINT_FAST8_TYPE "unsigned char" +#define UINT_FAST16_TYPE "short unsigned int" +#define UINT_FAST32_TYPE "unsigned int" +#define UINT_FAST64_TYPE "long long unsigned int" + +#define INTMAX_TYPE "long long int" +#define UINTMAX_TYPE "long long unsigned int" + +#define INTPTR_TYPE "long int" +#define UINTPTR_TYPE "long unsigned int" + +#define SIG_ATOMIC_TYPE "int" + /* Plain char is unsigned in the SGI compiler. */ #undef DEFAULT_SIGNED_CHAR #define DEFAULT_SIGNED_CHAR 0 diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c index 8f69dd0d995..c9c3c133c96 100644 --- a/gcc/config/mn10300/mn10300.c +++ b/gcc/config/mn10300/mn10300.c @@ -88,6 +88,8 @@ static void mn10300_asm_trampoline_template (FILE *); static void mn10300_trampoline_init (rtx, tree, rtx); static rtx mn10300_function_value (const_tree, const_tree, bool); static rtx mn10300_libcall_value (enum machine_mode, const_rtx); +static void mn10300_asm_output_mi_thunk (FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT, tree); +static bool mn10300_can_output_mi_thunk (const_tree, HOST_WIDE_INT, HOST_WIDE_INT, const_tree); /* Initialize the GCC target structure. */ #undef TARGET_ASM_ALIGNED_HI_OP @@ -146,6 +148,11 @@ static rtx mn10300_libcall_value (enum machine_mode, const_rtx); #undef TARGET_LIBCALL_VALUE #define TARGET_LIBCALL_VALUE mn10300_libcall_value +#undef TARGET_ASM_OUTPUT_MI_THUNK +#define TARGET_ASM_OUTPUT_MI_THUNK mn10300_asm_output_mi_thunk +#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK +#define TARGET_ASM_CAN_OUTPUT_MI_THUNK mn10300_can_output_mi_thunk + struct gcc_target targetm = TARGET_INITIALIZER; /* Implement TARGET_HANDLE_OPTION. */ @@ -1536,13 +1543,13 @@ mn10300_pass_by_reference (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED, } /* Return an RTX to represent where a value with mode MODE will be returned - from a function. If the result is 0, the argument is pushed. */ + from a function. If the result is NULL_RTX, the argument is pushed. */ rtx function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type, int named ATTRIBUTE_UNUSED) { - rtx result = 0; + rtx result = NULL_RTX; int size, align; /* We only support using 2 data registers as argument registers. */ @@ -1562,24 +1569,24 @@ function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, /* Don't pass this arg via a register if all the argument registers are used up. */ if (cum->nbytes > nregs * UNITS_PER_WORD) - return 0; + return result; /* Don't pass this arg via a register if it would be split between registers and memory. */ if (type == NULL_TREE && cum->nbytes + size > nregs * UNITS_PER_WORD) - return 0; + return result; switch (cum->nbytes / UNITS_PER_WORD) { case 0: - result = gen_rtx_REG (mode, 0); + result = gen_rtx_REG (mode, FIRST_ARGUMENT_REGNUM); break; case 1: - result = gen_rtx_REG (mode, 1); + result = gen_rtx_REG (mode, FIRST_ARGUMENT_REGNUM + 1); break; default: - result = 0; + break; } return result; @@ -2231,3 +2238,61 @@ mn10300_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value) mem = adjust_address (m_tramp, SImode, 0x18); emit_move_insn (mem, fnaddr); } + +/* Output the assembler code for a C++ thunk function. + THUNK_DECL is the declaration for the thunk function itself, FUNCTION + is the decl for the target function. DELTA is an immediate constant + offset to be added to the THIS parameter. If VCALL_OFFSET is nonzero + the word at the adjusted address *(*THIS' + VCALL_OFFSET) should be + additionally added to THIS. Finally jump to the entry point of + FUNCTION. */ + +static void +mn10300_asm_output_mi_thunk (FILE * file, + tree thunk_fndecl ATTRIBUTE_UNUSED, + HOST_WIDE_INT delta, + HOST_WIDE_INT vcall_offset, + tree function) +{ + const char * _this; + + /* Get the register holding the THIS parameter. Handle the case + where there is a hidden first argument for a returned structure. */ + if (aggregate_value_p (TREE_TYPE (TREE_TYPE (function)), function)) + _this = reg_names [FIRST_ARGUMENT_REGNUM + 1]; + else + _this = reg_names [FIRST_ARGUMENT_REGNUM]; + + fprintf (file, "\t%s Thunk Entry Point:\n", ASM_COMMENT_START); + + if (delta) + fprintf (file, "\tadd %d, %s\n", (int) delta, _this); + + if (vcall_offset) + { + const char * scratch = reg_names [FIRST_ADDRESS_REGNUM + 1]; + + fprintf (file, "\tmov %s, %s\n", _this, scratch); + fprintf (file, "\tmov (%s), %s\n", scratch, scratch); + fprintf (file, "\tadd %d, %s\n", (int) vcall_offset, scratch); + fprintf (file, "\tmov (%s), %s\n", scratch, scratch); + fprintf (file, "\tadd %s, %s\n", scratch, _this); + } + + fputs ("\tjmp ", file); + assemble_name (file, XSTR (XEXP (DECL_RTL (function), 0), 0)); + putc ('\n', file); +} + +/* Return true if mn10300_output_mi_thunk would be able to output the + assembler code for the thunk function specified by the arguments + it is passed, and false otherwise. */ + +static bool +mn10300_can_output_mi_thunk (const_tree thunk_fndecl ATTRIBUTE_UNUSED, + HOST_WIDE_INT delta ATTRIBUTE_UNUSED, + HOST_WIDE_INT vcall_offset ATTRIBUTE_UNUSED, + const_tree function ATTRIBUTE_UNUSED) +{ + return true; +} diff --git a/gcc/config/mn10300/mn10300.h b/gcc/config/mn10300/mn10300.h index c732aa07180..5547d4e17e5 100644 --- a/gcc/config/mn10300/mn10300.h +++ b/gcc/config/mn10300/mn10300.h @@ -130,6 +130,7 @@ extern enum processor_type mn10300_processor; #define LAST_EXTENDED_REGNUM 17 #define FIRST_FP_REGNUM 18 #define LAST_FP_REGNUM 49 +#define FIRST_ARGUMENT_REGNUM 0 /* Specify the registers used for certain standard purposes. The values of these macros are register numbers. */ @@ -511,9 +512,9 @@ enum reg_class { #define STACK_POINTER_OFFSET 4 /* 1 if N is a possible register number for function argument passing. - On the MN10300, no registers are used in this way. */ + On the MN10300, d0 and d1 are used in this way. */ -#define FUNCTION_ARG_REGNO_P(N) ((N) <= 1) +#define FUNCTION_ARG_REGNO_P(N) ((N) <= 2) /* Define a data type for recording info about an argument list @@ -559,8 +560,6 @@ struct cum_arg {int nbytes; }; NAMED is nonzero if this argument is a named parameter (otherwise it is an extra parameter matching an ellipsis). */ -/* On the MN10300 all args are pushed. */ - #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ function_arg (&CUM, MODE, TYPE, NAMED) diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 639e71fdc1f..ee4eff6bb34 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -1059,6 +1059,7 @@ static rtx rs6000_legitimize_address (rtx, rtx, enum machine_mode); static rtx rs6000_debug_legitimize_address (rtx, rtx, enum machine_mode); static rtx rs6000_legitimize_tls_address (rtx, enum tls_model); static void rs6000_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED; +static rtx rs6000_delegitimize_address (rtx); static rtx rs6000_tls_get_addr (void); static rtx rs6000_got_sym (void); static int rs6000_tls_symbol_ref_1 (rtx *, void *); @@ -1326,6 +1327,9 @@ static const struct attribute_spec rs6000_attribute_table[] = #undef TARGET_CANNOT_FORCE_CONST_MEM #define TARGET_CANNOT_FORCE_CONST_MEM rs6000_tls_referenced_p +#undef TARGET_DELEGITIMIZE_ADDRESS +#define TARGET_DELEGITIMIZE_ADDRESS rs6000_delegitimize_address + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE rs6000_output_function_prologue #undef TARGET_ASM_FUNCTION_EPILOGUE @@ -5262,6 +5266,41 @@ rs6000_output_dwarf_dtprel (FILE *file, int size, rtx x) fputs ("@dtprel+0x8000", file); } +/* In the name of slightly smaller debug output, and to cater to + general assembler lossage, recognize various UNSPEC sequences + and turn them back into a direct symbol reference. */ + +static rtx +rs6000_delegitimize_address (rtx orig_x) +{ + rtx x, y; + + orig_x = delegitimize_mem_from_attrs (orig_x); + x = orig_x; + if (MEM_P (x)) + x = XEXP (x, 0); + + if (GET_CODE (x) == PLUS + && GET_CODE (XEXP (x, 1)) == CONST + && GET_CODE (XEXP (x, 0)) == REG + && REGNO (XEXP (x, 0)) == TOC_REGISTER) + { + y = XEXP (XEXP (x, 1), 0); + if (GET_CODE (y) == UNSPEC + && XINT (y, 1) == UNSPEC_TOCREL) + { + y = XVECEXP (y, 0, 0); + if (!MEM_P (orig_x)) + return y; + else + return replace_equiv_address_nv (orig_x, y); + } + return orig_x; + } + + return orig_x; +} + /* Construct the SYMBOL_REF for the tls_get_addr function. */ static GTY(()) rtx rs6000_tls_symbol; diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 28cf2eb92a0..17c6a23d853 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -4762,8 +4762,10 @@ s390_mangle_type (const_tree type) static rtx s390_delegitimize_address (rtx orig_x) { - rtx x = orig_x, y; + rtx x, y; + orig_x = delegitimize_mem_from_attrs (orig_x); + x = orig_x; if (GET_CODE (x) != MEM) return orig_x; diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index aaa745dbbb9..cec17b8fc90 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -9271,9 +9271,7 @@ sh_insn_length_adjustment (rtx insn) && GET_CODE (PATTERN (insn)) != USE && GET_CODE (PATTERN (insn)) != CLOBBER) || CALL_P (insn) - || (JUMP_P (insn) - && GET_CODE (PATTERN (insn)) != ADDR_DIFF_VEC - && GET_CODE (PATTERN (insn)) != ADDR_VEC)) + || (JUMP_P (insn) && !JUMP_TABLE_DATA_P (insn))) && GET_CODE (PATTERN (NEXT_INSN (PREV_INSN (insn)))) != SEQUENCE && get_attr_needs_delay_slot (insn) == NEEDS_DELAY_SLOT_YES) return 2; @@ -9281,9 +9279,7 @@ sh_insn_length_adjustment (rtx insn) /* SH2e has a bug that prevents the use of annulled branches, so if the delay slot is not filled, we'll have to put a NOP in it. */ if (sh_cpu_attr == CPU_SH2E - && JUMP_P (insn) - && GET_CODE (PATTERN (insn)) != ADDR_DIFF_VEC - && GET_CODE (PATTERN (insn)) != ADDR_VEC + && JUMP_P (insn) && !JUMP_TABLE_DATA_P (insn) && get_attr_type (insn) == TYPE_CBRANCH && GET_CODE (PATTERN (NEXT_INSN (PREV_INSN (insn)))) != SEQUENCE) return 2; diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index d0a5d2bb8fd..42fbb9e9014 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -368,7 +368,7 @@ static int save_or_restore_regs (int, int, rtx, int, int); static void emit_save_or_restore_regs (int); static void sparc_asm_function_prologue (FILE *, HOST_WIDE_INT); static void sparc_asm_function_epilogue (FILE *, HOST_WIDE_INT); -#if defined (OBJECT_FORMAT_ELF) && !defined (HAVE_GNU_AS) +#if defined (OBJECT_FORMAT_ELF) && !HAVE_GNU_AS static void sparc_elf_asm_named_section (const char *, unsigned int, tree); #endif @@ -7986,7 +7986,7 @@ sparc_profile_hook (int labelno) } } -#if defined (OBJECT_FORMAT_ELF) && !defined (HAVE_GNU_AS) +#if defined (OBJECT_FORMAT_ELF) && !HAVE_GNU_AS static void sparc_elf_asm_named_section (const char *name, unsigned int flags, tree decl) diff --git a/gcc/config/sparc/sysv4.h b/gcc/config/sparc/sysv4.h index fa0498508a2..d1fdb0e32ea 100644 --- a/gcc/config/sparc/sysv4.h +++ b/gcc/config/sparc/sysv4.h @@ -127,7 +127,7 @@ do { ASM_OUTPUT_ALIGN ((FILE), Pmode == SImode ? 2 : 3); \ #undef DTORS_SECTION_ASM_OP #define DTORS_SECTION_ASM_OP "\t.section\t\".dtors\",#alloc,#write" -#ifndef HAVE_GNU_AS +#if !HAVE_GNU_AS /* Switch into a generic section. */ #undef TARGET_ASM_NAMED_SECTION #define TARGET_ASM_NAMED_SECTION sparc_elf_asm_named_section |