diff options
author | Bernd Schmidt <bernd.schmidt@analog.com> | 2005-12-09 22:44:23 +0000 |
---|---|---|
committer | Bernd Schmidt <bernds@gcc.gnu.org> | 2005-12-09 22:44:23 +0000 |
commit | 9fc023cc8de6df11cad28dfa88f5e4f60d3f68e3 (patch) | |
tree | e5e9fd55901f905fd347c014a772abffabbea651 | |
parent | 127203ac0cf1ef32fd2c4da5f6f9f7eda1f80cac (diff) | |
download | gcc-9fc023cc8de6df11cad28dfa88f5e4f60d3f68e3.zip gcc-9fc023cc8de6df11cad28dfa88f5e4f60d3f68e3.tar.gz gcc-9fc023cc8de6df11cad28dfa88f5e4f60d3f68e3.tar.bz2 |
bfin.c: Include "cgraph.h".
* config/bfin/bfin.c: Include "cgraph.h".
(bfin_load_pic_reg): Omit loading pic reg if in a local function.
Return the reg that holds the pointer to the GOT.
(bfin_expand_prologue): Use return value of bfin_load_pic_reg when
doing stack checking.
From-SVN: r108318
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/config/bfin/bfin.c | 20 |
2 files changed, 23 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 75d2090..fe7abdc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2005-12-09 Bernd Schmidt <bernd.schmidt@analog.com> + + * config/bfin/bfin.c: Include "cgraph.h". + (bfin_load_pic_reg): Omit loading pic reg if in a local function. + Return the reg that holds the pointer to the GOT. + (bfin_expand_prologue): Use return value of bfin_load_pic_reg when + doing stack checking. + 2005-12-09 Diego Novillo <dnovillo@redhat.com> * tree.c (recompute_tree_invariant_for_addr_expr): Rename from diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c index c635c97..b60716d 100644 --- a/gcc/config/bfin/bfin.c +++ b/gcc/config/bfin/bfin.c @@ -45,6 +45,7 @@ #include "recog.h" #include "ggc.h" #include "integrate.h" +#include "cgraph.h" #include "langhooks.h" #include "bfin-protos.h" #include "tm-preds.h" @@ -863,10 +864,19 @@ expand_interrupt_handler_epilogue (rtx spreg, e_funkind fkind) /* Used while emitting the prologue to generate code to load the correct value into the PIC register, which is passed in DEST. */ -static void +static rtx bfin_load_pic_reg (rtx dest) { + struct cgraph_local_info *i = NULL; rtx addr, insn; + + if (flag_unit_at_a_time) + i = cgraph_local_info (current_function_decl); + + /* Functions local to the translation unit don't need to reload the + pic reg, since the caller always passes a usable one. */ + if (i && i->local) + return pic_offset_table_rtx; if (bfin_lib_id_given) addr = plus_constant (pic_offset_table_rtx, -4 - bfin_library_id * 4); @@ -876,6 +886,7 @@ bfin_load_pic_reg (rtx dest) UNSPEC_LIBRARY_OFFSET)); insn = emit_insn (gen_movsi (dest, gen_rtx_MEM (Pmode, addr))); REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_MAYBE_DEAD, const0_rtx, NULL); + return dest; } /* Generate RTL for the prologue of the current function. */ @@ -908,11 +919,10 @@ bfin_expand_prologue (void) if (TARGET_ID_SHARED_LIBRARY) { rtx p1reg = gen_rtx_REG (Pmode, REG_P1); - rtx r3reg = gen_rtx_REG (Pmode, REG_R3); rtx val; - pic_reg_loaded = p2reg; - bfin_load_pic_reg (pic_reg_loaded); - val = legitimize_pic_address (stack_limit_rtx, p1reg, p2reg); + pic_reg_loaded = bfin_load_pic_reg (p2reg); + val = legitimize_pic_address (stack_limit_rtx, p1reg, + pic_reg_loaded); emit_move_insn (p1reg, val); frame_related_constant_load (p2reg, offset, FALSE); emit_insn (gen_addsi3 (p2reg, p2reg, p1reg)); |