diff options
author | Dale Johannesen <dalej@apple.com> | 2005-06-04 21:32:40 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@gcc.gnu.org> | 2005-06-04 21:32:40 +0000 |
commit | 6d0a809119630fb9f86f9a88d0d3c64f57a50fc9 (patch) | |
tree | ccca894d71424c49311d2ee1f04b0a5f65066eb3 | |
parent | d71cc23f717aa36fdff3fd6591cb27acd0f09366 (diff) | |
download | gcc-6d0a809119630fb9f86f9a88d0d3c64f57a50fc9.zip gcc-6d0a809119630fb9f86f9a88d0d3c64f57a50fc9.tar.gz gcc-6d0a809119630fb9f86f9a88d0d3c64f57a50fc9.tar.bz2 |
rs6000.c (no_global_regs_above): New.
2005-06-04 Dale Johannesen <dalej@apple.com>
* config/rs6000/rs6000.c (no_global_regs_above): New.
(rs6000_emit_prologue): Use it; cosmetic formatting fixes.
(rs6000_emit_epilogue): Use it; cosmetic formatting fixes.
(rs6000_conditional_register_usage): Don't put Darwin PIC
register in global_regs.
(rs6000_stack_info): Don't set lr_save_p just because Darwin
PIC reg used.
(rs6000_emit_prologue): Save LR in R0 around Darwin PIC setup,
if not done by lr_save_p.
* config/rs6000/rs6000.md (insnv1_internal1): Back out 05-18 patch.
Use rotate instead of ashift.
(call_indirect_nonlocal_sysv): Prefer CTR to LR.
(call_value_indirect_nonlocal_sysv): Ditto.
From-SVN: r100601
-rw-r--r-- | gcc/ChangeLog | 16 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 49 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.md | 28 |
3 files changed, 64 insertions, 29 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b8f9496..2c628c7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2005-06-04 Dale Johannesen <dalej@apple.com> + + * config/rs6000/rs6000.c (no_global_regs_above): New. + (rs6000_emit_prologue): Use it; cosmetic formatting fixes. + (rs6000_emit_epilogue): Use it; cosmetic formatting fixes. + (rs6000_conditional_register_usage): Don't put Darwin PIC + register in global_regs. + (rs6000_stack_info): Don't set lr_save_p just because Darwin + PIC reg used. + (rs6000_emit_prologue): Save LR in R0 around Darwin PIC setup, + if not done by lr_save_p. + * config/rs6000/rs6000.md (insnv1_internal1): Back out 05-18 patch. + Use rotate instead of ashift. + (call_indirect_nonlocal_sysv): Prefer CTR to LR. + (call_value_indirect_nonlocal_sysv): Ditto. + 2005-06-04 Jan Hubicka <jh@suse.cz> * cgraphunit.c (cgraph_reset_node): Break out from ... diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index ce9164c..2506445 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -573,6 +573,7 @@ static bool legitimate_indexed_address_p (rtx, int); static bool legitimate_lo_sum_address_p (enum machine_mode, rtx, int); static struct machine_function * rs6000_init_machine_status (void); static bool rs6000_assemble_integer (rtx, unsigned int, int); +static bool no_global_regs_above (int); #ifdef HAVE_GAS_HIDDEN static void rs6000_assemble_visibility (tree, int); #endif @@ -3317,8 +3318,7 @@ rs6000_conditional_register_usage (void) if (DEFAULT_ABI == ABI_DARWIN && PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM) - global_regs[RS6000_PIC_OFFSET_TABLE_REGNUM] - = fixed_regs[RS6000_PIC_OFFSET_TABLE_REGNUM] + fixed_regs[RS6000_PIC_OFFSET_TABLE_REGNUM] = call_used_regs[RS6000_PIC_OFFSET_TABLE_REGNUM] = call_really_used_regs[RS6000_PIC_OFFSET_TABLE_REGNUM] = 1; @@ -12047,9 +12047,6 @@ rs6000_stack_info (void) && !FP_SAVE_INLINE (info_ptr->first_fp_reg_save)) || info_ptr->first_altivec_reg_save <= LAST_ALTIVEC_REGNO || (DEFAULT_ABI == ABI_V4 && current_function_calls_alloca) - || (DEFAULT_ABI == ABI_DARWIN - && flag_pic - && current_function_uses_pic_offset_table) || info_ptr->calls_p) { info_ptr->lr_save_p = 1; @@ -13229,6 +13226,19 @@ gen_frame_mem_offset (enum machine_mode mode, rtx reg, int offset) return gen_rtx_MEM (mode, gen_rtx_PLUS (Pmode, reg, offset_rtx)); } +/* Look for user-defined global regs. We should not save and restore these, + and cannot use stmw/lmw if there are any in its range. */ + +static bool +no_global_regs_above (int first_greg) +{ + int i; + for (i = 0; i < 32 - first_greg; i++) + if (global_regs[first_greg + i]) + return false; + return true; +} + #ifndef TARGET_FIX_AND_CONTINUE #define TARGET_FIX_AND_CONTINUE 0 #endif @@ -13273,7 +13283,8 @@ rs6000_emit_prologue (void) using_store_multiple = (TARGET_MULTIPLE && ! TARGET_POWERPC64 && (!TARGET_SPE_ABI || info->spe_64bit_regs_used == 0) - && info->first_gp_reg_save < 31); + && info->first_gp_reg_save < 31 + && no_global_regs_above (info->first_gp_reg_save)); saving_FPRs_inline = (info->first_fp_reg_save == 64 || FP_SAVE_INLINE (info->first_fp_reg_save) || current_function_calls_eh_return @@ -13597,12 +13608,12 @@ rs6000_emit_prologue (void) { int i; for (i = 0; i < 32 - info->first_gp_reg_save; i++) - if ((regs_ever_live[info->first_gp_reg_save+i] - && (! call_used_regs[info->first_gp_reg_save+i] - || (i+info->first_gp_reg_save + if ((regs_ever_live[info->first_gp_reg_save + i] + && (!call_used_regs[info->first_gp_reg_save + i] + || (i + info->first_gp_reg_save == RS6000_PIC_OFFSET_TABLE_REGNUM && TARGET_TOC && TARGET_MINIMAL_TOC))) - || (i+info->first_gp_reg_save == RS6000_PIC_OFFSET_TABLE_REGNUM + || (i + info->first_gp_reg_save == RS6000_PIC_OFFSET_TABLE_REGNUM && ((DEFAULT_ABI == ABI_V4 && flag_pic != 0) || (DEFAULT_ABI == ABI_DARWIN && flag_pic)))) { @@ -13787,12 +13798,19 @@ rs6000_emit_prologue (void) rtx lr = gen_rtx_REG (Pmode, LINK_REGISTER_REGNUM); rtx src = machopic_function_base_sym (); + /* Save and restore LR locally around this call (in R0). */ + if (!info->lr_save_p) + rs6000_maybe_dead (emit_move_insn (gen_rtx_REG (Pmode, 0), lr)); + rs6000_maybe_dead (emit_insn (gen_load_macho_picbase (lr, src))); insn = emit_move_insn (gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM), lr); rs6000_maybe_dead (insn); + + if (!info->lr_save_p) + rs6000_maybe_dead (emit_move_insn (lr, gen_rtx_REG (Pmode, 0))); } #endif } @@ -13892,7 +13910,8 @@ rs6000_emit_epilogue (int sibcall) using_load_multiple = (TARGET_MULTIPLE && ! TARGET_POWERPC64 && (!TARGET_SPE_ABI || info->spe_64bit_regs_used == 0) - && info->first_gp_reg_save < 31); + && info->first_gp_reg_save < 31 + && no_global_regs_above (info->first_gp_reg_save)); restoring_FPRs_inline = (sibcall || current_function_calls_eh_return || info->first_fp_reg_save == 64 @@ -14156,11 +14175,11 @@ rs6000_emit_epilogue (int sibcall) } else for (i = 0; i < 32 - info->first_gp_reg_save; i++) - if ((regs_ever_live[info->first_gp_reg_save+i] - && (! call_used_regs[info->first_gp_reg_save+i] - || (i+info->first_gp_reg_save == RS6000_PIC_OFFSET_TABLE_REGNUM + if ((regs_ever_live[info->first_gp_reg_save + i] + && (!call_used_regs[info->first_gp_reg_save + i] + || (i + info->first_gp_reg_save == RS6000_PIC_OFFSET_TABLE_REGNUM && TARGET_TOC && TARGET_MINIMAL_TOC))) - || (i+info->first_gp_reg_save == RS6000_PIC_OFFSET_TABLE_REGNUM + || (i + info->first_gp_reg_save == RS6000_PIC_OFFSET_TABLE_REGNUM && ((DEFAULT_ABI == ABI_V4 && flag_pic != 0) || (DEFAULT_ABI == ABI_DARWIN && flag_pic)))) { diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 15426d9..97ac84b 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -3004,7 +3004,7 @@ [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r") (match_operand:SI 1 "const_int_operand" "i") (match_operand:SI 2 "const_int_operand" "i")) - (ashift:SI (match_operand:SI 3 "gpc_reg_operand" "r") + (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r") (match_operand:SI 4 "const_int_operand" "i")))] "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])" "* @@ -3014,7 +3014,7 @@ int size = INTVAL (operands[1]) & 31; operands[4] = GEN_INT (shift - start - size); - operands[1] = GEN_INT (start + size - 1 - shift); + operands[1] = GEN_INT (start + size - 1); return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\"; }" [(set_attr "type" "insert_word")]) @@ -10328,10 +10328,10 @@ ;; which indicates how to set cr1 (define_insn "*call_indirect_nonlocal_sysv" - [(call (mem:SI (match_operand:SI 0 "register_operand" "cl,cl")) - (match_operand 1 "" "g,g")) - (use (match_operand:SI 2 "immediate_operand" "O,n")) - (clobber (match_scratch:SI 3 "=l,l"))] + [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l,c,*l")) + (match_operand 1 "" "g,g,g,g")) + (use (match_operand:SI 2 "immediate_operand" "O,O,n,n")) + (clobber (match_scratch:SI 3 "=l,l,l,l"))] "DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_DARWIN" { @@ -10343,8 +10343,8 @@ return "b%T0l"; } - [(set_attr "type" "jmpreg,jmpreg") - (set_attr "length" "4,8")]) + [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg") + (set_attr "length" "4,4,8,8")]) (define_insn "*call_nonlocal_sysv" [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s")) @@ -10383,10 +10383,10 @@ (define_insn "*call_value_indirect_nonlocal_sysv" [(set (match_operand 0 "" "") - (call (mem:SI (match_operand:SI 1 "register_operand" "cl,cl")) - (match_operand 2 "" "g,g"))) - (use (match_operand:SI 3 "immediate_operand" "O,n")) - (clobber (match_scratch:SI 4 "=l,l"))] + (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l,c,*l")) + (match_operand 2 "" "g,g,g,g"))) + (use (match_operand:SI 3 "immediate_operand" "O,O,n,n")) + (clobber (match_scratch:SI 4 "=l,l,l,l"))] "DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_DARWIN" { @@ -10398,8 +10398,8 @@ return "b%T1l"; } - [(set_attr "type" "jmpreg,jmpreg") - (set_attr "length" "4,8")]) + [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg") + (set_attr "length" "4,4,8,8")]) (define_insn "*call_value_nonlocal_sysv" [(set (match_operand 0 "" "") |