Commit 84804c5b by Claudiu Zissulescu Committed by Claudiu Zissulescu

[ARC] Save/restore blink when in ISR.

gcc/
2017-03-27  Claudiu Zissulescu  <claziss@synopsys.com>

	* config/arc/arc.c (arc_epilogue_uses): BLINK should be also
	restored when in interrupt.
	* config/arc/arc.md (simple_return): ARCv2 rtie instruction
	doesn't have delay slot.

2017-03-27  Claudiu Zissulescu  <claziss@synopsys.com>

	* testsuite/gcc.target/arc/interrupt-4.c: New file.

From-SVN: r246495
parent c5e5f5f6
2017-03-27 Claudiu Zissulescu <claziss@synopsys.com>
* config/arc/arc.c (arc_epilogue_uses): BLINK should be also
restored when in interrupt.
* config/arc/arc.md (simple_return): ARCv2 rtie instruction
doesn't have delay slot.
2017-03-27 Richard Biener <rguenther@suse.de> 2017-03-27 Richard Biener <rguenther@suse.de>
PR ipa/79776 PR ipa/79776
......
...@@ -9381,9 +9381,10 @@ arc_can_follow_jump (const rtx_insn *follower, const rtx_insn *followee) ...@@ -9381,9 +9381,10 @@ arc_can_follow_jump (const rtx_insn *follower, const rtx_insn *followee)
Return true if REGNO should be added to the deemed uses of the epilogue. Return true if REGNO should be added to the deemed uses of the epilogue.
We use the return address We use the return address
arc_return_address_regs[arc_compute_function_type (cfun)] . arc_return_address_regs[arc_compute_function_type (cfun)]. But
But also, we have to make sure all the register restore instructions also, we have to make sure all the register restore instructions
are known to be live in interrupt functions. */ are known to be live in interrupt functions, plus the blink
register if it is clobbered by the isr. */
bool bool
arc_epilogue_uses (int regno) arc_epilogue_uses (int regno)
...@@ -9396,7 +9397,8 @@ arc_epilogue_uses (int regno) ...@@ -9396,7 +9397,8 @@ arc_epilogue_uses (int regno)
{ {
if (!fixed_regs[regno]) if (!fixed_regs[regno])
return true; return true;
return regno == arc_return_address_regs[cfun->machine->fn_type]; return ((regno == arc_return_address_regs[cfun->machine->fn_type])
|| (regno == RETURN_ADDR_REGNUM));
} }
else else
return regno == RETURN_ADDR_REGNUM; return regno == RETURN_ADDR_REGNUM;
......
...@@ -4748,7 +4748,12 @@ ...@@ -4748,7 +4748,12 @@
output_asm_insn (\"j%!%* [%0]%&\", &reg); output_asm_insn (\"j%!%* [%0]%&\", &reg);
return \"\"; return \"\";
} }
[(set_attr "type" "return") [(set (attr "type")
(cond [(and (eq (symbol_ref "arc_compute_function_type (cfun)")
(symbol_ref "ARC_FUNCTION_ILINK1"))
(match_test "TARGET_V2"))
(const_string "brcc_no_delay_slot")]
(const_string "return")))
; predicable won't help here since the canonical rtl looks different ; predicable won't help here since the canonical rtl looks different
; for branches. ; for branches.
(set (attr "cond") (set (attr "cond")
......
2017-03-27 Claudiu Zissulescu <claziss@synopsys.com>
* testsuite/gcc.target/arc/interrupt-4.c: New file.
2017-03-27 Richard Biener <rguenther@suse.de> 2017-03-27 Richard Biener <rguenther@suse.de>
PR ipa/79776 PR ipa/79776
......
#if defined (__ARCHS__) || defined (__ARCEM__)
#define RILINK "ilink"
#else
#define RILINK "ilink1"
#endif
extern int gpio_int;
extern int read_reg (int);
void __attribute__ ((interrupt(RILINK)))
isr_handler (void)
{
gpio_int = read_reg (1);
}
/* { dg-final { scan-assembler-times "blink" 2 } } */
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