summaryrefslogtreecommitdiffstats
path: root/gcc/config/rl78/rl78.c
diff options
context:
space:
mode:
authordj <dj@138bc75d-0d04-0410-961f-82ee72b054a4>2013-09-16 21:15:46 +0000
committerdj <dj@138bc75d-0d04-0410-961f-82ee72b054a4>2013-09-16 21:15:46 +0000
commitc5a0ae5e13c60a19a053a901e505ac71c05f5a82 (patch)
treeca39e481d4043f5d69add06ef190a5ec3d62d059 /gcc/config/rl78/rl78.c
parent043115ec2d2ce23d00b19598983d622d2d921e9c (diff)
downloadppe42-gcc-c5a0ae5e13c60a19a053a901e505ac71c05f5a82.tar.gz
ppe42-gcc-c5a0ae5e13c60a19a053a901e505ac71c05f5a82.zip
* config/rl78/rl78.c (rl78_asm_file_start): Specify alternate
vregs location for RL78/G10. (rl78_expand_prologue): Avoid SEL on G10. (rl78_expand_epilogue): Likewise. (rl78_peep_movhi_p): Can't move a constant to memory in HImode. * config/rl78/rl78.h (TARGET_CPU_CPP_BUILTINS): Define __RL78_G10__ when appropriate. (ASM_SPEC): Pass -mg10 along to the assembler. * config/rl78/rl78.md (sel_rb): Disable for G10. * config/rl78/rl78.opt: Add -mg10 option. * config/rl78/t-rl78: Add -mg10 multilib. * config/rl78/lib2mul.c: Enable for RL78/G10. * config/rl78/lib2div.c: Likewise. * config/rl78/lshrsi3.S: Use vregs.h. * config/rl78/cmpsi2.S: Likewise. * config/rl78/trampoline.S: Likewise. * config/rl78/mulsi2.S: Likewise. Disable for RL78/G10. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202637 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/rl78/rl78.c')
-rw-r--r--gcc/config/rl78/rl78.c65
1 files changed, 50 insertions, 15 deletions
diff --git a/gcc/config/rl78/rl78.c b/gcc/config/rl78/rl78.c
index 3f13955d896..d99cecfbff1 100644
--- a/gcc/config/rl78/rl78.c
+++ b/gcc/config/rl78/rl78.c
@@ -259,10 +259,20 @@ rl78_asm_file_start (void)
{
int i;
- for (i = 0; i < 8; i++)
+ if (TARGET_G10)
{
- fprintf (asm_out_file, "r%d\t=\t0x%x\n", 8 + i, 0xffef0 + i);
- fprintf (asm_out_file, "r%d\t=\t0x%x\n", 16 + i, 0xffee8 + i);
+ /* The memory used is 0xffec8 to 0xffedf; real registers are in
+ 0xffee0 to 0xffee7. */
+ for (i = 8; i < 32; i++)
+ fprintf (asm_out_file, "r%d\t=\t0x%x\n", i, 0xffec0 + i);
+ }
+ else
+ {
+ for (i = 0; i < 8; i++)
+ {
+ fprintf (asm_out_file, "r%d\t=\t0x%x\n", 8 + i, 0xffef0 + i);
+ fprintf (asm_out_file, "r%d\t=\t0x%x\n", 16 + i, 0xffee8 + i);
+ }
}
opt_pass *rl78_devirt_pass = make_pass_rl78_devirt (g);
@@ -1018,19 +1028,26 @@ rl78_expand_prologue (void)
if (flag_stack_usage_info)
current_function_static_stack_size = cfun->machine->framesize;
- if (is_interrupt_func (cfun->decl))
+ if (is_interrupt_func (cfun->decl) && !TARGET_G10)
emit_insn (gen_sel_rb (GEN_INT (0)));
for (i = 0; i < 16; i++)
if (cfun->machine->need_to_push [i])
{
- int need_bank = i/4;
- if (need_bank != rb)
+ if (TARGET_G10)
{
- emit_insn (gen_sel_rb (GEN_INT (need_bank)));
- rb = need_bank;
+ emit_move_insn (gen_rtx_REG (HImode, 0), gen_rtx_REG (HImode, i*2));
+ F (emit_insn (gen_push (gen_rtx_REG (HImode, 0))));
}
- F (emit_insn (gen_push (gen_rtx_REG (HImode, i*2))));
+ else {
+ int need_bank = i/4;
+ if (need_bank != rb)
+ {
+ emit_insn (gen_sel_rb (GEN_INT (need_bank)));
+ rb = need_bank;
+ }
+ F (emit_insn (gen_push (gen_rtx_REG (HImode, i*2))));
+ }
}
if (rb != 0)
emit_insn (gen_sel_rb (GEN_INT (0)));
@@ -1085,14 +1102,22 @@ rl78_expand_epilogue (void)
for (i = 15; i >= 0; i--)
if (cfun->machine->need_to_push [i])
{
- int need_bank = i / 4;
-
- if (need_bank != rb)
+ if (TARGET_G10)
{
- emit_insn (gen_sel_rb (GEN_INT (need_bank)));
- rb = need_bank;
+ emit_insn (gen_pop (gen_rtx_REG (HImode, 0)));
+ emit_move_insn (gen_rtx_REG (HImode, i*2), gen_rtx_REG (HImode, 0));
+ }
+ else
+ {
+ int need_bank = i / 4;
+
+ if (need_bank != rb)
+ {
+ emit_insn (gen_sel_rb (GEN_INT (need_bank)));
+ rb = need_bank;
+ }
+ emit_insn (gen_pop (gen_rtx_REG (HImode, i * 2)));
}
- emit_insn (gen_pop (gen_rtx_REG (HImode, i * 2)));
}
if (rb != 0)
@@ -1630,6 +1655,16 @@ rl78_peep_movhi_p (rtx *operands)
fprintf (stderr, "\033[0m");
#endif
+ /* You can move a constant to memory as QImode, but not HImode. */
+ if (GET_CODE (operands[0]) == MEM
+ && GET_CODE (operands[1]) != REG)
+ {
+#if DEBUG_PEEP
+ fprintf (stderr, "no peep: move constant to memory\n");
+#endif
+ return false;
+ }
+
if (rtx_equal_p (operands[0], operands[3]))
{
#if DEBUG_PEEP
OpenPOWER on IntegriCloud