+2019-04-16 Claudiu Zissulescu <claziss@synopsys.com>
+
+ * config/arc/arc.c (arc_expand_prologue): Emit blockage regardless
+ to avoid delay slot scheduling.
+ (arc_must_save_register): Don't save SP.
+ * config/arc/arc.md (stack_tie): Remove.
+ (UNSPEC_ARC_STKTIE): Likewise.
+
2019-04-16 Kito Cheng <kito.cheng@gmail.com>
Shiva Chen <shiva0217@gmail.com>
#define FRAME_POINTER_MASK (1 << (FRAME_POINTER_REGNUM))
#define RETURN_ADDR_MASK (1 << (RETURN_ADDR_REGNUM))
-/* Tell prologue and epilogue if register REGNO should be saved / restored.
- The return address and frame pointer are treated separately.
- Don't consider them here.
- Addition for pic: The gp register needs to be saved if the current
- function changes it to access gotoff variables.
- FIXME: This will not be needed if we used some arbitrary register
- instead of r26. */
+/* Tell prologue and epilogue if register REGNO should be saved /
+ restored. The return address, stack pointer and frame pointer are
+ treated separately. Don't consider them here. Addition for pic:
+ The gp register needs to be saved if the current function changes
+ it to access gotoff variables. FIXME: This will not be needed if
+ we used some arbitrary register instead of r26. */
static bool
arc_must_save_register (int regno, struct function *func)
if ((regno) != RETURN_ADDR_REGNUM
&& (regno) != FRAME_POINTER_REGNUM
+ && (regno) != STACK_POINTER_REGNUM
&& df_regs_ever_live_p (regno)
&& (!call_used_regs[regno]
|| ARC_INTERRUPT_P (fn_type))
/* Allocate the stack frame. */
if (frame_size_to_allocate > 0)
- {
- frame_stack_add ((HOST_WIDE_INT) 0 - frame_size_to_allocate);
- /* If the frame pointer is needed, emit a special barrier that
- will prevent the scheduler from moving stores to the frame
- before the stack adjustment. */
- if (arc_frame_pointer_needed ())
- emit_insn (gen_stack_tie (stack_pointer_rtx, hard_frame_pointer_rtx));
- }
+ frame_stack_add ((HOST_WIDE_INT) 0 - frame_size_to_allocate);
+
+ /* Emit a blockage to avoid delay slot scheduling. */
+ emit_insn (gen_blockage ());
}
/* Do any necessary cleanup after a function to restore stack, frame,
if (!can_trust_sp_p)
gcc_assert (arc_frame_pointer_needed ());
+ /* Emit a blockage to avoid/flush all pending sp operations. */
+ if (size)
+ emit_insn (gen_blockage ());
+
if (TARGET_CODE_DENSITY
&& TARGET_CODE_DENSITY_FRAME
&& !ARC_AUTOFP_IRQ_P (fn_type)
UNSPEC_ARC_VMAC2HU
UNSPEC_ARC_VMPY2H
UNSPEC_ARC_VMPY2HU
- UNSPEC_ARC_STKTIE
VUNSPEC_ARC_RTIE
VUNSPEC_ARC_SYNC
(set_attr "predicable" "yes,no,no,yes,no")
(set_attr "cond" "canuse,nocond,nocond,canuse_limm,nocond")])
-(define_insn "stack_tie"
- [(set (mem:BLK (scratch))
- (unspec:BLK [(match_operand:SI 0 "register_operand" "r")
- (match_operand:SI 1 "register_operand" "r")]
- UNSPEC_ARC_STKTIE))]
- ""
- ""
- [(set_attr "length" "0")
- (set_attr "iscompact" "false")
- (set_attr "type" "block")]
- )
-
(define_insn "*add_shift"
[(set (match_operand:SI 0 "register_operand" "=q,r,r")
(plus:SI (ashift:SI (match_operand:SI 1 "register_operand" "q,r,r")