aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2009-09-22 08:16:10 -0700
committerRichard Henderson <rth@gcc.gnu.org>2009-09-22 08:16:10 -0700
commita85b4c91b30eda2893ecf5efeeda4f9dbb518763 (patch)
tree948b3badef5ddaf8773b6791f1b07e4c706fcd76
parent809e78cc9049087eff6602114512b3f746834c8d (diff)
downloadgcc-a85b4c91b30eda2893ecf5efeeda4f9dbb518763.zip
gcc-a85b4c91b30eda2893ecf5efeeda4f9dbb518763.tar.gz
gcc-a85b4c91b30eda2893ecf5efeeda4f9dbb518763.tar.bz2
spu.c (TARGET_TRAMPOLINE_INIT): New.
* config/spu/spu.c (TARGET_TRAMPOLINE_INIT): New. (array_to_constant): Make ARR parameter const. (spu_trampoline_init): Rename from spu_initialize_trampoline; make static; update for hook parameters. * config/spu/spu-protos.h: Update decls. * config/spu/spu.h (INITIALIZE_TRAMPOLINE): Remove. From-SVN: r152013
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/spu/spu-protos.h3
-rw-r--r--gcc/config/spu/spu.c30
-rw-r--r--gcc/config/spu/spu.h4
4 files changed, 25 insertions, 19 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 507b309..9d8bd78 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -263,6 +263,13 @@
* config/sparc/sparc.h (INITIALIZE_TRAMPOLINE): Remove.
* config/sparc/sparc.md (nonlocal_goto): Don't use static_chain_rtx.
+ * config/spu/spu.c (TARGET_TRAMPOLINE_INIT): New.
+ (array_to_constant): Make ARR parameter const.
+ (spu_trampoline_init): Rename from spu_initialize_trampoline;
+ make static; update for hook parameters.
+ * config/spu/spu-protos.h: Update decls.
+ * config/spu/spu.h (INITIALIZE_TRAMPOLINE): Remove.
+
2009-09-22 Jakub Jelinek <jakub@redhat.com>
* config/rs6000/rs6000.c (bdesc_2arg): Fix CODE_FOR_vector_gt* codes
diff --git a/gcc/config/spu/spu-protos.h b/gcc/config/spu/spu-protos.h
index 65cdd07..a1f5d13 100644
--- a/gcc/config/spu/spu-protos.h
+++ b/gcc/config/spu/spu-protos.h
@@ -70,7 +70,7 @@ extern int cpat_const_p (rtx x, enum machine_mode mode);
extern rtx gen_cpat_const (rtx * ops);
extern void constant_to_array (enum machine_mode mode, rtx x,
unsigned char *arr);
-extern rtx array_to_constant (enum machine_mode mode, unsigned char *arr);
+extern rtx array_to_constant (enum machine_mode mode, const unsigned char *arr);
extern rtx spu_gen_exp2 (enum machine_mode mode, rtx x);
extern void spu_allocate_stack (rtx op0, rtx op1);
extern void spu_restore_stack_nonlocal (rtx op0, rtx op1);
@@ -81,7 +81,6 @@ extern void spu_builtin_splats (rtx ops[]);
extern void spu_builtin_extract (rtx ops[]);
extern void spu_builtin_insert (rtx ops[]);
extern void spu_builtin_promote (rtx ops[]);
-extern void spu_initialize_trampoline (rtx tramp, rtx fnaddr, rtx cxt);
extern void spu_expand_sign_extend (rtx ops[]);
extern void spu_expand_vector_init (rtx target, rtx vals);
extern void spu_init_expanders (void);
diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c
index 37488b2..b0b2fd2 100644
--- a/gcc/config/spu/spu.c
+++ b/gcc/config/spu/spu.c
@@ -212,6 +212,7 @@ static int spu_sms_res_mii (struct ddg *g);
static void asm_file_start (void);
static unsigned int spu_section_type_flags (tree, const char *, int);
static rtx spu_expand_load (rtx, rtx, rtx, int);
+static void spu_trampoline_init (rtx, tree, rtx);
extern const char *reg_names[];
@@ -411,6 +412,9 @@ static const struct attribute_spec spu_attribute_table[] =
#undef TARGET_LEGITIMATE_ADDRESS_P
#define TARGET_LEGITIMATE_ADDRESS_P spu_legitimate_address_p
+#undef TARGET_TRAMPOLINE_INIT
+#define TARGET_TRAMPOLINE_INIT spu_trampoline_init
+
struct gcc_target targetm = TARGET_INITIALIZER;
void
@@ -4876,7 +4880,7 @@ constant_to_array (enum machine_mode mode, rtx x, unsigned char arr[16])
smaller than 16 bytes, use the bytes that would represent that value
in a register, e.g., for QImode return the value of arr[3]. */
rtx
-array_to_constant (enum machine_mode mode, unsigned char arr[16])
+array_to_constant (enum machine_mode mode, const unsigned char arr[16])
{
enum machine_mode inner_mode;
rtvec v;
@@ -5580,9 +5584,10 @@ spu_builtin_promote (rtx ops[])
emit_insn (gen_rotqby_ti (rot, from, offset));
}
-void
-spu_initialize_trampoline (rtx tramp, rtx fnaddr, rtx cxt)
+static void
+spu_trampoline_init (rtx m_tramp, tree fndecl, rtx cxt)
{
+ rtx fnaddr = XEXP (DECL_RTL (fndecl), 0);
rtx shuf = gen_reg_rtx (V4SImode);
rtx insn = gen_reg_rtx (V4SImode);
rtx shufc;
@@ -5597,11 +5602,11 @@ spu_initialize_trampoline (rtx tramp, rtx fnaddr, rtx cxt)
rtx rotl = gen_reg_rtx (V4SImode);
rtx mask = gen_reg_rtx (V4SImode);
rtx bi = gen_reg_rtx (SImode);
- unsigned char shufa[16] = {
+ static unsigned char const shufa[16] = {
2, 3, 0, 1, 18, 19, 16, 17,
0, 1, 2, 3, 16, 17, 18, 19
};
- unsigned char insna[16] = {
+ static unsigned char const insna[16] = {
0x41, 0, 0, 79,
0x41, 0, 0, STATIC_CHAIN_REGNUM,
0x60, 0x80, 0, 79,
@@ -5616,18 +5621,18 @@ spu_initialize_trampoline (rtx tramp, rtx fnaddr, rtx cxt)
emit_insn (gen_movv4si (mask, spu_const (V4SImode, 0xffff << 7)));
emit_insn (gen_selb (insn, insnc, rotl, mask));
- mem = memory_address (Pmode, tramp);
- emit_move_insn (gen_rtx_MEM (V4SImode, mem), insn);
+ mem = adjust_address (m_tramp, V4SImode, 0);
+ emit_move_insn (mem, insn);
emit_move_insn (bi, GEN_INT (0x35000000 + (79 << 7)));
- mem = memory_address (Pmode, plus_constant (tramp, 16));
- emit_move_insn (gen_rtx_MEM (Pmode, mem), bi);
+ mem = adjust_address (m_tramp, Pmode, 16);
+ emit_move_insn (mem, bi);
}
else
{
rtx scxt = gen_reg_rtx (SImode);
rtx sfnaddr = gen_reg_rtx (SImode);
- unsigned char insna[16] = {
+ static unsigned char const insna[16] = {
0x42, 0, 0, STATIC_CHAIN_REGNUM,
0x30, 0, 0, 0,
0, 0, 0, 0,
@@ -5649,9 +5654,8 @@ spu_initialize_trampoline (rtx tramp, rtx fnaddr, rtx cxt)
emit_insn (gen_shufb (shuf, sfnaddr, scxt, shufc));
emit_insn (gen_iorv4si3 (insn, insnc, shuf));
- mem = memory_address (Pmode, tramp);
- emit_move_insn (gen_rtx_MEM (V4SImode, mem), insn);
-
+ mem = adjust_address (m_tramp, V4SImode, 0);
+ emit_move_insn (mem, insn);
}
emit_insn (gen_sync ());
}
diff --git a/gcc/config/spu/spu.h b/gcc/config/spu/spu.h
index 6b56a45..67011a6 100644
--- a/gcc/config/spu/spu.h
+++ b/gcc/config/spu/spu.h
@@ -403,10 +403,6 @@ targetm.resolve_overloaded_builtin = spu_resolve_overloaded_builtin; \
#define TRAMPOLINE_SIZE (TARGET_LARGE_MEM ? 20 : 16)
#define TRAMPOLINE_ALIGNMENT 128
-
-#define INITIALIZE_TRAMPOLINE(TRAMP,FNADDR,CXT) \
- spu_initialize_trampoline(TRAMP,FNADDR,CXT)
-
/* Addressing Modes */