Commit 9fc023cc by Bernd Schmidt Committed by Bernd Schmidt

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
parent 127203ac
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> 2005-12-09 Diego Novillo <dnovillo@redhat.com>
* tree.c (recompute_tree_invariant_for_addr_expr): Rename from * tree.c (recompute_tree_invariant_for_addr_expr): Rename from
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include "recog.h" #include "recog.h"
#include "ggc.h" #include "ggc.h"
#include "integrate.h" #include "integrate.h"
#include "cgraph.h"
#include "langhooks.h" #include "langhooks.h"
#include "bfin-protos.h" #include "bfin-protos.h"
#include "tm-preds.h" #include "tm-preds.h"
...@@ -863,10 +864,19 @@ expand_interrupt_handler_epilogue (rtx spreg, e_funkind fkind) ...@@ -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 /* Used while emitting the prologue to generate code to load the correct value
into the PIC register, which is passed in DEST. */ into the PIC register, which is passed in DEST. */
static void static rtx
bfin_load_pic_reg (rtx dest) bfin_load_pic_reg (rtx dest)
{ {
struct cgraph_local_info *i = NULL;
rtx addr, insn; 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) if (bfin_lib_id_given)
addr = plus_constant (pic_offset_table_rtx, -4 - bfin_library_id * 4); addr = plus_constant (pic_offset_table_rtx, -4 - bfin_library_id * 4);
...@@ -876,6 +886,7 @@ bfin_load_pic_reg (rtx dest) ...@@ -876,6 +886,7 @@ bfin_load_pic_reg (rtx dest)
UNSPEC_LIBRARY_OFFSET)); UNSPEC_LIBRARY_OFFSET));
insn = emit_insn (gen_movsi (dest, gen_rtx_MEM (Pmode, addr))); insn = emit_insn (gen_movsi (dest, gen_rtx_MEM (Pmode, addr)));
REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_MAYBE_DEAD, const0_rtx, NULL); REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_MAYBE_DEAD, const0_rtx, NULL);
return dest;
} }
/* Generate RTL for the prologue of the current function. */ /* Generate RTL for the prologue of the current function. */
...@@ -908,11 +919,10 @@ bfin_expand_prologue (void) ...@@ -908,11 +919,10 @@ bfin_expand_prologue (void)
if (TARGET_ID_SHARED_LIBRARY) if (TARGET_ID_SHARED_LIBRARY)
{ {
rtx p1reg = gen_rtx_REG (Pmode, REG_P1); rtx p1reg = gen_rtx_REG (Pmode, REG_P1);
rtx r3reg = gen_rtx_REG (Pmode, REG_R3);
rtx val; rtx val;
pic_reg_loaded = p2reg; pic_reg_loaded = bfin_load_pic_reg (p2reg);
bfin_load_pic_reg (pic_reg_loaded); val = legitimize_pic_address (stack_limit_rtx, p1reg,
val = legitimize_pic_address (stack_limit_rtx, p1reg, p2reg); pic_reg_loaded);
emit_move_insn (p1reg, val); emit_move_insn (p1reg, val);
frame_related_constant_load (p2reg, offset, FALSE); frame_related_constant_load (p2reg, offset, FALSE);
emit_insn (gen_addsi3 (p2reg, p2reg, p1reg)); emit_insn (gen_addsi3 (p2reg, p2reg, p1reg));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment