diff options
author | kan <kan@FreeBSD.org> | 2005-06-03 03:28:44 +0000 |
---|---|---|
committer | kan <kan@FreeBSD.org> | 2005-06-03 03:28:44 +0000 |
commit | 2156e40a831a8e0ab68e4bc091c2940bf46ca6df (patch) | |
tree | f0dc8ad34f9fcaf27052e24e893a4284b5fee6e9 /contrib/gcc/config/alpha | |
parent | 0a20abcc95340c9d2bb59421bac84eca4fb43b0c (diff) | |
download | FreeBSD-src-2156e40a831a8e0ab68e4bc091c2940bf46ca6df.zip FreeBSD-src-2156e40a831a8e0ab68e4bc091c2940bf46ca6df.tar.gz |
Gcc 3.4.4 release.
Diffstat (limited to 'contrib/gcc/config/alpha')
-rw-r--r-- | contrib/gcc/config/alpha/alpha.c | 139 | ||||
-rw-r--r-- | contrib/gcc/config/alpha/alpha.h | 2 | ||||
-rw-r--r-- | contrib/gcc/config/alpha/alpha.md | 124 | ||||
-rw-r--r-- | contrib/gcc/config/alpha/qrnnd.asm | 4 | ||||
-rw-r--r-- | contrib/gcc/config/alpha/t-osf4 | 6 |
5 files changed, 150 insertions, 125 deletions
diff --git a/contrib/gcc/config/alpha/alpha.c b/contrib/gcc/config/alpha/alpha.c index 0086968..fbaeabe 100644 --- a/contrib/gcc/config/alpha/alpha.c +++ b/contrib/gcc/config/alpha/alpha.c @@ -1947,6 +1947,17 @@ alpha_legitimize_address (rtx x, rtx scratch, } } +/* Primarily this is required for TLS symbols, but given that our move + patterns *ought* to be able to handle any symbol at any time, we + should never be spilling symbolic operands to the constant pool, ever. */ + +static bool +alpha_cannot_force_const_mem (rtx x) +{ + enum rtx_code code = GET_CODE (x); + return code == SYMBOL_REF || code == LABEL_REF || code == CONST; +} + /* We do not allow indirect calls to be optimized into sibling calls, nor can we allow a call to a function with a different GP to be optimized into a sibcall. */ @@ -3186,7 +3197,13 @@ alpha_emit_conditional_branch (enum rtx_code code) /* If the constants doesn't fit into an immediate, but can be generated by lda/ldah, we adjust the argument and compare against zero, so we can use beq/bne directly. */ - else if (GET_CODE (op1) == CONST_INT && (code == EQ || code == NE)) + /* ??? Don't do this when comparing against symbols, otherwise + we'll reduce (&x == 0x1234) to (&x-0x1234 == 0), which will + be declared false out of hand (at least for non-weak). */ + else if (GET_CODE (op1) == CONST_INT + && (code == EQ || code == NE) + && !(symbolic_operand (op0, VOIDmode) + || (GET_CODE (op0) == REG && REG_POINTER (op0)))) { HOST_WIDE_INT v = INTVAL (op1), n = -v; @@ -6786,11 +6803,6 @@ alpha_sa_mask (unsigned long *imaskP, unsigned long *fmaskP) break; imask |= 1UL << regno; } - - /* Glibc likes to use $31 as an unwind stopper for crt0. To - avoid hackery in unwind-dw2.c, we need to actively store a - zero in the prologue of _Unwind_RaiseException et al. */ - imask |= 1UL << 31; } /* If any register spilled, then spill the return address also. */ @@ -7046,6 +7058,48 @@ set_frame_related_p (void) #define FRP(exp) (start_sequence (), exp, set_frame_related_p ()) +/* Generates a store with the proper unwind info attached. VALUE is + stored at BASE_REG+BASE_OFS. If FRAME_BIAS is non-zero, then BASE_REG + contains SP+FRAME_BIAS, and that is the unwind info that should be + generated. If FRAME_REG != VALUE, then VALUE is being stored on + behalf of FRAME_REG, and FRAME_REG should be present in the unwind. */ + +static void +emit_frame_store_1 (rtx value, rtx base_reg, HOST_WIDE_INT frame_bias, + HOST_WIDE_INT base_ofs, rtx frame_reg) +{ + rtx addr, mem, insn; + + addr = plus_constant (base_reg, base_ofs); + mem = gen_rtx_MEM (DImode, addr); + set_mem_alias_set (mem, alpha_sr_alias_set); + + insn = emit_move_insn (mem, value); + RTX_FRAME_RELATED_P (insn) = 1; + + if (frame_bias || value != frame_reg) + { + if (frame_bias) + { + addr = plus_constant (stack_pointer_rtx, frame_bias + base_ofs); + mem = gen_rtx_MEM (DImode, addr); + } + + REG_NOTES (insn) + = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, + gen_rtx_SET (VOIDmode, mem, frame_reg), + REG_NOTES (insn)); + } +} + +static void +emit_frame_store (unsigned int regno, rtx base_reg, + HOST_WIDE_INT frame_bias, HOST_WIDE_INT base_ofs) +{ + rtx reg = gen_rtx_REG (DImode, regno); + emit_frame_store_1 (reg, base_reg, frame_bias, base_ofs, reg); +} + /* Write function prologue. */ /* On vms we have two kinds of functions: @@ -7075,7 +7129,7 @@ alpha_expand_prologue (void) HOST_WIDE_INT frame_size; /* Offset from base reg to register save area. */ HOST_WIDE_INT reg_offset; - rtx sa_reg, mem; + rtx sa_reg; int i; sa_size = alpha_sa_size (); @@ -7225,37 +7279,40 @@ alpha_expand_prologue (void) if (!TARGET_ABI_UNICOSMK) { + HOST_WIDE_INT sa_bias = 0; + /* Cope with very large offsets to the register save area. */ sa_reg = stack_pointer_rtx; if (reg_offset + sa_size > 0x8000) { int low = ((reg_offset & 0xffff) ^ 0x8000) - 0x8000; - HOST_WIDE_INT bias; + rtx sa_bias_rtx; if (low + sa_size <= 0x8000) - bias = reg_offset - low, reg_offset = low; + sa_bias = reg_offset - low, reg_offset = low; else - bias = reg_offset, reg_offset = 0; + sa_bias = reg_offset, reg_offset = 0; sa_reg = gen_rtx_REG (DImode, 24); - FRP (emit_insn (gen_adddi3 (sa_reg, stack_pointer_rtx, - GEN_INT (bias)))); + sa_bias_rtx = GEN_INT (sa_bias); + + if (add_operand (sa_bias_rtx, DImode)) + emit_insn (gen_adddi3 (sa_reg, stack_pointer_rtx, sa_bias_rtx)); + else + { + emit_move_insn (sa_reg, sa_bias_rtx); + emit_insn (gen_adddi3 (sa_reg, stack_pointer_rtx, sa_reg)); + } } /* Save regs in stack order. Beginning with VMS PV. */ if (TARGET_ABI_OPEN_VMS && alpha_procedure_type == PT_STACK) - { - mem = gen_rtx_MEM (DImode, stack_pointer_rtx); - set_mem_alias_set (mem, alpha_sr_alias_set); - FRP (emit_move_insn (mem, gen_rtx_REG (DImode, REG_PV))); - } + emit_frame_store (REG_PV, stack_pointer_rtx, 0, 0); /* Save register RA next. */ if (imask & (1UL << REG_RA)) { - mem = gen_rtx_MEM (DImode, plus_constant (sa_reg, reg_offset)); - set_mem_alias_set (mem, alpha_sr_alias_set); - FRP (emit_move_insn (mem, gen_rtx_REG (DImode, REG_RA))); + emit_frame_store (REG_RA, sa_reg, sa_bias, reg_offset); imask &= ~(1UL << REG_RA); reg_offset += 8; } @@ -7264,36 +7321,14 @@ alpha_expand_prologue (void) for (i = 0; i < 31; i++) if (imask & (1UL << i)) { - mem = gen_rtx_MEM (DImode, plus_constant (sa_reg, reg_offset)); - set_mem_alias_set (mem, alpha_sr_alias_set); - FRP (emit_move_insn (mem, gen_rtx_REG (DImode, i))); + emit_frame_store (i, sa_reg, sa_bias, reg_offset); reg_offset += 8; } - /* Store a zero if requested for unwinding. */ - if (imask & (1UL << 31)) - { - rtx insn, t; - - mem = gen_rtx_MEM (DImode, plus_constant (sa_reg, reg_offset)); - set_mem_alias_set (mem, alpha_sr_alias_set); - insn = emit_move_insn (mem, const0_rtx); - - RTX_FRAME_RELATED_P (insn) = 1; - t = gen_rtx_REG (Pmode, 31); - t = gen_rtx_SET (VOIDmode, mem, t); - t = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, t, REG_NOTES (insn)); - REG_NOTES (insn) = t; - - reg_offset += 8; - } - for (i = 0; i < 31; i++) if (fmask & (1UL << i)) { - mem = gen_rtx_MEM (DFmode, plus_constant (sa_reg, reg_offset)); - set_mem_alias_set (mem, alpha_sr_alias_set); - FRP (emit_move_insn (mem, gen_rtx_REG (DFmode, i+32))); + emit_frame_store (i+32, sa_reg, sa_bias, reg_offset); reg_offset += 8; } } @@ -7307,19 +7342,13 @@ alpha_expand_prologue (void) for (i = 9; i < 15; i++) if (imask & (1UL << i)) { - mem = gen_rtx_MEM (DImode, plus_constant(hard_frame_pointer_rtx, - reg_offset)); - set_mem_alias_set (mem, alpha_sr_alias_set); - FRP (emit_move_insn (mem, gen_rtx_REG (DImode, i))); + emit_frame_store (i, hard_frame_pointer_rtx, 0, reg_offset); reg_offset -= 8; } for (i = 2; i < 10; i++) if (fmask & (1UL << i)) { - mem = gen_rtx_MEM (DFmode, plus_constant (hard_frame_pointer_rtx, - reg_offset)); - set_mem_alias_set (mem, alpha_sr_alias_set); - FRP (emit_move_insn (mem, gen_rtx_REG (DFmode, i+32))); + emit_frame_store (i+32, hard_frame_pointer_rtx, 0, reg_offset); reg_offset -= 8; } } @@ -7713,9 +7742,6 @@ alpha_expand_epilogue (void) reg_offset += 8; } - if (imask & (1UL << 31)) - reg_offset += 8; - for (i = 0; i < 31; ++i) if (fmask & (1UL << i)) { @@ -10215,6 +10241,8 @@ alpha_init_libfuncs (void) #define TARGET_FUNCTION_OK_FOR_SIBCALL alpha_function_ok_for_sibcall #undef TARGET_CANNOT_COPY_INSN_P #define TARGET_CANNOT_COPY_INSN_P alpha_cannot_copy_insn_p +#undef TARGET_CANNOT_FORCE_CONST_MEM +#define TARGET_CANNOT_FORCE_CONST_MEM alpha_cannot_force_const_mem #if TARGET_ABI_OSF #undef TARGET_ASM_OUTPUT_MI_THUNK @@ -10257,4 +10285,3 @@ struct gcc_target targetm = TARGET_INITIALIZER; #include "gt-alpha.h" - diff --git a/contrib/gcc/config/alpha/alpha.h b/contrib/gcc/config/alpha/alpha.h index d59797c..ae3a349 100644 --- a/contrib/gcc/config/alpha/alpha.h +++ b/contrib/gcc/config/alpha/alpha.h @@ -641,6 +641,7 @@ extern const char *alpha_tls_size_string; /* For -mtls-size= */ #define HARD_REGNO_MODE_OK(REGNO, MODE) \ ((REGNO) >= 32 && (REGNO) <= 62 \ ? (MODE) == SFmode || (MODE) == DFmode || (MODE) == DImode \ + || (MODE) == SCmode || (MODE) == DCmode \ : 1) /* Value is 1 if MODE is a supported vector mode. */ @@ -1189,6 +1190,7 @@ do { \ #define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, 26) #define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (26) #define DWARF_ALT_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (64) +#define DWARF_ZERO_REG 31 /* Describe how we implement __builtin_eh_return. */ #define EH_RETURN_DATA_REGNO(N) ((N) < 4 ? (N) + 16 : INVALID_REGNUM) diff --git a/contrib/gcc/config/alpha/alpha.md b/contrib/gcc/config/alpha/alpha.md index 998e300..c008e1b 100644 --- a/contrib/gcc/config/alpha/alpha.md +++ b/contrib/gcc/config/alpha/alpha.md @@ -77,6 +77,7 @@ (UNSPECV_PLDGP2 11) ; prologue ldgp (UNSPECV_SET_TP 12) (UNSPECV_RPCC 13) + (UNSPECV_SETJMPR_ER 14) ; builtin_setjmp_receiver fragment ]) ;; Where necessary, the suffixes _le and _be are used to distinguish between @@ -438,9 +439,9 @@ ;; and if we split before reload, we will require additional instructions. (define_insn "*adddi_fp_hack" - [(set (match_operand:DI 0 "register_operand" "=r") - (plus:DI (match_operand:DI 1 "reg_no_subreg_operand" "r") - (match_operand:DI 2 "const_int_operand" "n")))] + [(set (match_operand:DI 0 "register_operand" "=r,r,r") + (plus:DI (match_operand:DI 1 "reg_no_subreg_operand" "r,r,r") + (match_operand:DI 2 "const_int_operand" "K,L,n")))] "NONSTRICT_REG_OK_FP_BASE_P (operands[1]) && INTVAL (operands[2]) >= 0 /* This is the largest constant an lda+ldah pair can add, minus @@ -454,7 +455,10 @@ + max_reg_num () * UNITS_PER_WORD + current_function_pretend_args_size) - current_function_pretend_args_size))" - "#") + "@ + lda %0,%2(%1) + ldah %0,%h2(%1) + #") ;; Don't do this if we are adjusting SP since we don't want to do it ;; in two steps. Don't split FP sources for the reason listed above. @@ -6897,70 +6901,44 @@ "jmp $31,(%0),0" [(set_attr "type" "ibr")]) -(define_insn "*builtin_setjmp_receiver_er_sl_1" - [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)] - "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && TARGET_AS_CAN_SUBTRACT_LABELS" - "lda $27,$LSJ%=-%l0($27)\n$LSJ%=:") - -(define_insn "*builtin_setjmp_receiver_er_1" - [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)] - "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF" - "br $27,$LSJ%=\n$LSJ%=:" - [(set_attr "type" "ibr")]) - -(define_split - [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)] - "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF - && prev_nonnote_insn (insn) == operands[0]" - [(const_int 0)] - " -{ - emit_note (NOTE_INSN_DELETED); - DONE; -}") - -(define_insn "*builtin_setjmp_receiver_1" +(define_expand "builtin_setjmp_receiver" [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)] "TARGET_ABI_OSF" - "br $27,$LSJ%=\n$LSJ%=:\;ldgp $29,0($27)" - [(set_attr "length" "12") - (set_attr "type" "multi")]) + "") -(define_expand "builtin_setjmp_receiver_er" - [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR) +(define_insn_and_split "*builtin_setjmp_receiver_1" + [(unspec_volatile [(match_operand 0 "" "")] UNSPECV_SETJMPR)] + "TARGET_ABI_OSF" +{ + if (TARGET_EXPLICIT_RELOCS) + return "#"; + else + return "br $27,$LSJ%=\n$LSJ%=:\;ldgp $29,0($27)"; +} + "&& TARGET_EXPLICIT_RELOCS && reload_completed" + [(unspec_volatile [(match_dup 0)] UNSPECV_SETJMPR_ER) (set (match_dup 1) (unspec_volatile:DI [(match_dup 2) (match_dup 3)] UNSPECV_LDGP1)) (set (match_dup 1) (unspec:DI [(match_dup 1) (match_dup 3)] UNSPEC_LDGP2))] - "" { operands[1] = pic_offset_table_rtx; operands[2] = gen_rtx_REG (Pmode, 27); operands[3] = GEN_INT (alpha_next_sequence_number++); -}) +} + [(set_attr "length" "12") + (set_attr "type" "multi")]) -(define_expand "builtin_setjmp_receiver" - [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)] - "TARGET_ABI_OSF" -{ - if (TARGET_EXPLICIT_RELOCS) - { - emit_insn (gen_builtin_setjmp_receiver_er (operands[0])); - DONE; - } -}) +(define_insn "*builtin_setjmp_receiver_er_sl_1" + [(unspec_volatile [(match_operand 0 "" "")] UNSPECV_SETJMPR_ER)] + "TARGET_ABI_OSF && TARGET_EXPLICIT_RELOCS && TARGET_AS_CAN_SUBTRACT_LABELS" + "lda $27,$LSJ%=-%l0($27)\n$LSJ%=:") -(define_expand "exception_receiver_er" - [(set (match_dup 0) - (unspec_volatile:DI [(match_dup 1) (match_dup 2)] UNSPECV_LDGP1)) - (set (match_dup 0) - (unspec:DI [(match_dup 0) (match_dup 2)] UNSPEC_LDGP2))] - "" -{ - operands[0] = pic_offset_table_rtx; - operands[1] = gen_rtx_REG (Pmode, 26); - operands[2] = GEN_INT (alpha_next_sequence_number++); -}) +(define_insn "*builtin_setjmp_receiver_er_1" + [(unspec_volatile [(match_operand 0 "" "")] UNSPECV_SETJMPR_ER)] + "TARGET_ABI_OSF && TARGET_EXPLICIT_RELOCS" + "br $27,$LSJ%=\n$LSJ%=:" + [(set_attr "type" "ibr")]) (define_expand "exception_receiver" [(unspec_volatile [(match_dup 0)] UNSPECV_EHR)] @@ -6968,28 +6946,38 @@ { if (TARGET_LD_BUGGY_LDGP) operands[0] = alpha_gp_save_rtx (); - else if (TARGET_EXPLICIT_RELOCS) - { - emit_insn (gen_exception_receiver_er ()); - DONE; - } else operands[0] = const0_rtx; }) -(define_insn "*exception_receiver_1" - [(unspec_volatile [(const_int 0)] UNSPECV_EHR)] - "! TARGET_LD_BUGGY_LDGP" - "ldgp $29,0($26)" - [(set_attr "length" "8") - (set_attr "type" "multi")]) - (define_insn "*exception_receiver_2" [(unspec_volatile [(match_operand:DI 0 "memory_operand" "m")] UNSPECV_EHR)] - "TARGET_LD_BUGGY_LDGP" + "TARGET_ABI_OSF && TARGET_LD_BUGGY_LDGP" "ldq $29,%0" [(set_attr "type" "ild")]) +(define_insn_and_split "*exception_receiver_1" + [(unspec_volatile [(const_int 0)] UNSPECV_EHR)] + "TARGET_ABI_OSF" +{ + if (TARGET_EXPLICIT_RELOCS) + return "ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*"; + else + return "ldgp $29,0($26)"; +} + "&& TARGET_EXPLICIT_RELOCS && reload_completed" + [(set (match_dup 0) + (unspec_volatile:DI [(match_dup 1) (match_dup 2)] UNSPECV_LDGP1)) + (set (match_dup 0) + (unspec:DI [(match_dup 0) (match_dup 2)] UNSPEC_LDGP2))] +{ + operands[0] = pic_offset_table_rtx; + operands[1] = gen_rtx_REG (Pmode, 26); + operands[2] = GEN_INT (alpha_next_sequence_number++); +} + [(set_attr "length" "8") + (set_attr "type" "multi")]) + (define_expand "nonlocal_goto_receiver" [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE) (set (reg:DI 27) (mem:DI (reg:DI 29))) diff --git a/contrib/gcc/config/alpha/qrnnd.asm b/contrib/gcc/config/alpha/qrnnd.asm index d6373ec..da9c4bc 100644 --- a/contrib/gcc/config/alpha/qrnnd.asm +++ b/contrib/gcc/config/alpha/qrnnd.asm @@ -26,6 +26,10 @@ # Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, # MA 02111-1307, USA. +#ifdef __ELF__ +.section .note.GNU-stack,"" +#endif + .set noreorder .set noat diff --git a/contrib/gcc/config/alpha/t-osf4 b/contrib/gcc/config/alpha/t-osf4 index fe747a3..58ce6c2 100644 --- a/contrib/gcc/config/alpha/t-osf4 +++ b/contrib/gcc/config/alpha/t-osf4 @@ -16,8 +16,12 @@ SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \ -Wl,-hidden_symbol,pthread\* -Wl,-hidden_symbol,__pthread\* \ -Wl,-hidden_symbol,sched_get_\* -Wl,-hidden_symbol,sched_yield \ -Wl,-msym -Wl,-set_version,gcc.1 -Wl,-soname,$(SHLIB_SONAME) \ - -o $(SHLIB_NAME) @multilib_flags@ $(SHLIB_OBJS) -lc && \ + -o $(SHLIB_NAME).tmp @multilib_flags@ $(SHLIB_OBJS) -lc && \ rm -f $(SHLIB_SONAME) && \ + if [ -f $(SHLIB_NAME) ]; then \ + mv -f $(SHLIB_NAME) $(SHLIB_NAME).backup; \ + else true; fi && \ + mv $(SHLIB_NAME).tmp $(SHLIB_NAME) && \ $(LN_S) $(SHLIB_NAME) $(SHLIB_SONAME) # $(slibdir) double quoted to protect it from expansion while building # libgcc.mk. We want this delayed until actual install time. |