Module Name:    src
Committed By:   christos
Date:           Wed Mar 23 15:51:37 UTC 2016

Modified Files:
        src/external/gpl3/gcc/dist/gcc: except.c
        src/external/gpl3/gcc/dist/gcc/config/vax: elf.h vax.c vax.h vax.md

Log Message:
Revert previous changes until we can test them better.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/gpl3/gcc/dist/gcc/except.c
cvs rdiff -u -r1.5 -r1.6 src/external/gpl3/gcc/dist/gcc/config/vax/elf.h
cvs rdiff -u -r1.12 -r1.13 src/external/gpl3/gcc/dist/gcc/config/vax/vax.c
cvs rdiff -u -r1.6 -r1.7 src/external/gpl3/gcc/dist/gcc/config/vax/vax.h
cvs rdiff -u -r1.10 -r1.11 src/external/gpl3/gcc/dist/gcc/config/vax/vax.md

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/except.c
diff -u src/external/gpl3/gcc/dist/gcc/except.c:1.2 src/external/gpl3/gcc/dist/gcc/except.c:1.3
--- src/external/gpl3/gcc/dist/gcc/except.c:1.2	Wed Mar 23 08:52:43 2016
+++ src/external/gpl3/gcc/dist/gcc/except.c	Wed Mar 23 11:51:36 2016
@@ -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

Index: src/external/gpl3/gcc/dist/gcc/config/vax/elf.h
diff -u src/external/gpl3/gcc/dist/gcc/config/vax/elf.h:1.5 src/external/gpl3/gcc/dist/gcc/config/vax/elf.h:1.6
--- src/external/gpl3/gcc/dist/gcc/config/vax/elf.h:1.5	Wed Mar 23 08:52:43 2016
+++ src/external/gpl3/gcc/dist/gcc/config/vax/elf.h	Wed Mar 23 11:51:37 2016
@@ -45,8 +45,18 @@ along with GCC; see the file COPYING3.  
    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.  
 			      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)

Index: src/external/gpl3/gcc/dist/gcc/config/vax/vax.c
diff -u src/external/gpl3/gcc/dist/gcc/config/vax/vax.c:1.12 src/external/gpl3/gcc/dist/gcc/config/vax/vax.c:1.13
--- src/external/gpl3/gcc/dist/gcc/config/vax/vax.c:1.12	Wed Mar 23 08:52:43 2016
+++ src/external/gpl3/gcc/dist/gcc/config/vax/vax.c	Wed Mar 23 11:51:37 2016
@@ -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;

Index: src/external/gpl3/gcc/dist/gcc/config/vax/vax.h
diff -u src/external/gpl3/gcc/dist/gcc/config/vax/vax.h:1.6 src/external/gpl3/gcc/dist/gcc/config/vax/vax.h:1.7
--- src/external/gpl3/gcc/dist/gcc/config/vax/vax.h:1.6	Wed Mar 23 08:52:43 2016
+++ src/external/gpl3/gcc/dist/gcc/config/vax/vax.h	Wed Mar 23 11:51:37 2016
@@ -169,12 +169,12 @@ along with GCC; see the file COPYING3.  
 /* 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
 

Index: src/external/gpl3/gcc/dist/gcc/config/vax/vax.md
diff -u src/external/gpl3/gcc/dist/gcc/config/vax/vax.md:1.10 src/external/gpl3/gcc/dist/gcc/config/vax/vax.md:1.11
--- src/external/gpl3/gcc/dist/gcc/config/vax/vax.md:1.10	Wed Mar 23 08:52:43 2016
+++ src/external/gpl3/gcc/dist/gcc/config/vax/vax.md	Wed Mar 23 11:51:37 2016
@@ -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,17 +1317,24 @@
 			    (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"
   [(call (match_operand:QI 0 "memory_operand" "m")
 	 (match_operand:SI 1 "const_int_operand" "n"))
    (set (reg:SI VAX_SP_REGNUM) (plus:SI (reg:SI VAX_SP_REGNUM)
-			     (match_operand:SI 2 "immediate_operand" "i")))]
+					(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"
-  [(call (match_operand:QI 0 "memory_operand" "m")
-	 (const_int 0))]
+(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")
+	  (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")
 

Reply via email to