Revert previous changes until we can test them better.

This commit is contained in:
christos 2016-03-23 15:51:36 +00:00
parent 0db9e20bfb
commit 214b89d952
5 changed files with 73 additions and 33 deletions

View File

@ -45,8 +45,18 @@ along with GCC; see the file COPYING3. If not see
count pushed by the CALLS and before the start of the saved registers. */
#define INCOMING_FRAME_SP_OFFSET 0
/* We use R2-R3 (call-clobbered) registers for exceptions. */
#define EH_RETURN_DATA_REGNO(N) ((N) < 2 ? (N) + 2 : INVALID_REGNUM)
/* Offset from the frame pointer register value to the top of the stack. */
#define FRAME_POINTER_CFA_OFFSET(FNDECL) 0
/* We use R2-R5 (call-clobbered) registers for exceptions. */
#define EH_RETURN_DATA_REGNO(N) ((N) < 4 ? (N) + 2 : INVALID_REGNUM)
/* Place the top of the stack for the DWARF2 EH stackadj value. */
#define EH_RETURN_STACKADJ_RTX \
gen_rtx_MEM (SImode, \
plus_constant (Pmode, \
gen_rtx_REG (Pmode, FRAME_POINTER_REGNUM),\
-4))
/* Simple store the return handler into the call frame. */
#define EH_RETURN_HANDLER_RTX \
@ -56,6 +66,10 @@ along with GCC; see the file COPYING3. If not see
16))
/* Reserve the top of the stack for exception handler stackadj value. */
#undef STARTING_FRAME_OFFSET
#define STARTING_FRAME_OFFSET -4
/* The VAX wants no space between the case instruction and the jump table. */
#undef ASM_OUTPUT_BEFORE_CASE_LABEL
#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE, PREFIX, NUM, TABLE)

View File

@ -195,8 +195,7 @@ vax_expand_prologue (void)
offset = 20;
for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
if ((df_regs_ever_live_p (regno) && !call_used_regs[regno])
|| (crtl->calls_eh_return && regno >= 2 && regno < 4))
if (df_regs_ever_live_p (regno) && !call_used_regs[regno])
{
mask |= 1 << regno;
offset += 4;

View File

@ -169,12 +169,12 @@ along with GCC; see the file COPYING3. If not see
/* Base register for access to local variables of the function. */
#define FRAME_POINTER_REGNUM VAX_FP_REGNUM
/* Offset from the frame pointer register value to the top of stack. */
#define FRAME_POINTER_CFA_OFFSET(FNDECL) 0
/* Base register for access to arguments of the function. */
#define ARG_POINTER_REGNUM VAX_AP_REGNUM
/* Offset from the argument pointer register value to the CFA. */
#define ARG_POINTER_CFA_OFFSET(FNDECL) 0
/* Register in which static-chain is passed to a function. */
#define STATIC_CHAIN_REGNUM 0

View File

@ -18,11 +18,6 @@
;; <http://www.gnu.org/licenses/>.
;; Note that operand 1 is total size of args, in bytes,
;; and what the call insn wants is the number of words.
;; It is used in the call instruction as a byte, but in the addl2 as
;; a word. Since the only time we actually use it in the call instruction
;; is when it is a constant, SImode (for addl2) is the proper mode.
;;- Instruction patterns. When multiple patterns apply,
;;- the first one in the file is chosen.
;;-
@ -1314,11 +1309,6 @@
""
"decl %0\;jgequ %l1")
;; Note that operand 1 is total size of args, in bytes,
;; and what the call insn wants is the number of words.
;; It is used in the call instruction as a byte, but in the addl2 as
;; a word. Since the only time we actually use it in the call instruction
;; is when it is a constant, SImode (for addl2) is the proper mode.
(define_expand "call_pop"
[(parallel [(call (match_operand:QI 0 "memory_operand" "")
(match_operand:SI 1 "const_int_operand" ""))
@ -1327,8 +1317,12 @@
(match_operand:SI 3 "immediate_operand" "")))])]
""
{
gcc_assert (INTVAL (operands[1]) <= 255 * 4);
operands[1] = GEN_INT ((INTVAL (operands[1]) + 3) / 4);
gcc_assert (INTVAL (operands[3]) <= 255 * 4 && INTVAL (operands[3]) % 4 == 0);
/* Operand 1 is the number of bytes to be popped by DW_CFA_GNU_args_size
during EH unwinding. We must include the argument count pushed by
the calls instruction. */
operands[1] = GEN_INT (INTVAL (operands[3]) + 4);
})
(define_insn "*call_pop"
@ -1337,7 +1331,10 @@
(set (reg:SI VAX_SP_REGNUM) (plus:SI (reg:SI VAX_SP_REGNUM)
(match_operand:SI 2 "immediate_operand" "i")))]
""
"calls %1,%0")
{
operands[1] = GEN_INT ((INTVAL (operands[1]) - 4) / 4);
return "calls %1,%0";
})
(define_expand "call_value_pop"
[(parallel [(set (match_operand 0 "" "")
@ -1348,8 +1345,12 @@
(match_operand:SI 4 "immediate_operand" "")))])]
""
{
gcc_assert (INTVAL (operands[2]) <= 255 * 4);
operands[2] = GEN_INT ((INTVAL (operands[2]) + 3) / 4);
gcc_assert (INTVAL (operands[4]) <= 255 * 4 && INTVAL (operands[4]) % 4 == 0);
/* Operand 2 is the number of bytes to be popped by DW_CFA_GNU_args_size
during EH unwinding. We must include the argument count pushed by
the calls instruction. */
operands[2] = GEN_INT (INTVAL (operands[4]) + 4);
})
(define_insn "*call_value_pop"
@ -1359,20 +1360,47 @@
(set (reg:SI VAX_SP_REGNUM) (plus:SI (reg:SI VAX_SP_REGNUM)
(match_operand:SI 3 "immediate_operand" "i")))]
""
"calls %2,%1")
"*
{
operands[2] = GEN_INT ((INTVAL (operands[2]) - 4) / 4);
return \"calls %2,%1\";
}")
;; Define another set of these for the case of functions with no operands.
;; These will allow the optimizers to do a slightly better job.
(define_insn "call"
(define_expand "call"
[(call (match_operand:QI 0 "memory_operand" "")
(match_operand:SI 1 "const_int_operand" ""))]
""
"
{
/* Operand 1 is the number of bytes to be popped by DW_CFA_GNU_args_size
during EH unwinding. We must include the argument count pushed by
the calls instruction. */
operands[1] = GEN_INT (INTVAL (operands[1]) + 4);
}")
(define_insn "*call"
[(call (match_operand:QI 0 "memory_operand" "m")
(const_int 0))]
(match_operand:SI 1 "const_int_operand" ""))]
""
"calls $0,%0")
(define_insn "call_value"
(define_expand "call_value"
[(set (match_operand 0 "" "")
(call (match_operand:QI 1 "memory_operand" "")
(match_operand:SI 2 "const_int_operand" "")))]
""
"
{
/* Operand 2 is the number of bytes to be popped by DW_CFA_GNU_args_size
during EH unwinding. We must include the argument count pushed by
the calls instruction. */
operands[2] = GEN_INT (INTVAL (operands[2]) + 4);
}")
(define_insn "*call_value"
[(set (match_operand 0 "" "")
(call (match_operand:QI 1 "memory_operand" "m")
(const_int 0)))]
(match_operand:SI 2 "const_int_operand" "")))]
""
"calls $0,%1")

View File

@ -2288,8 +2288,7 @@ expand_eh_return (void)
#endif
{
#ifdef EH_RETURN_HANDLER_RTX
rtx insn = emit_move_insn (EH_RETURN_HANDLER_RTX, crtl->eh.ehr_handler);
RTX_FRAME_RELATED_P (insn) = 1;
emit_move_insn (EH_RETURN_HANDLER_RTX, crtl->eh.ehr_handler);
#else
error ("__builtin_eh_return not supported on this target");
#endif