S/390: Prohibit SYMBOL_REF in UNSPECV_CAS
[gcc.git] / gcc / combine-stack-adj.c
index 8fe4bcd0fbbf5909d68f535f9816d26ddb2c2f92..bd7f5d0d2eceaaf9049d3a38bfb15dbddabadff9 100644 (file)
@@ -1,5 +1,5 @@
 /* Combine stack adjustments.
-   Copyright (C) 1987-2015 Free Software Foundation, Inc.
+   Copyright (C) 1987-2018 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -41,41 +41,18 @@ along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
-#include "tm.h"
+#include "backend.h"
 #include "rtl.h"
-#include "tm_p.h"
+#include "df.h"
 #include "insn-config.h"
+#include "memmodel.h"
+#include "emit-rtl.h"
 #include "recog.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "flags.h"
-#include "hashtab.h"
-#include "hash-set.h"
-#include "vec.h"
-#include "machmode.h"
-#include "input.h"
-#include "function.h"
-#include "expr.h"
-#include "predict.h"
-#include "dominance.h"
-#include "cfg.h"
 #include "cfgrtl.h"
-#include "basic-block.h"
-#include "df.h"
-#include "except.h"
-#include "reload.h"
 #include "tree-pass.h"
 #include "rtl-iter.h"
 
 \f
-/* Turn STACK_GROWS_DOWNWARD into a boolean.  */
-#ifdef STACK_GROWS_DOWNWARD
-#undef STACK_GROWS_DOWNWARD
-#define STACK_GROWS_DOWNWARD 1
-#else
-#define STACK_GROWS_DOWNWARD 0
-#endif
-
 /* This structure records two kinds of stack references between stack
    adjusting instructions: stack references in memory addresses for
    regular insns and all stack references for debug insns.  */
@@ -156,6 +133,7 @@ single_set_for_csa (rtx_insn *insn)
          && SET_SRC (this_rtx) == SET_DEST (this_rtx))
        ;
       else if (GET_CODE (this_rtx) != CLOBBER
+              && GET_CODE (this_rtx) != CLOBBER_HIGH
               && GET_CODE (this_rtx) != USE)
        return NULL_RTX;
     }
@@ -231,6 +209,7 @@ no_unhandled_cfa (rtx_insn *insn)
       case REG_CFA_SET_VDRAP:
       case REG_CFA_WINDOW_SAVE:
       case REG_CFA_FLUSH_QUEUE:
+      case REG_CFA_TOGGLE_RA_MANGLE:
        return false;
       }
 
@@ -530,6 +509,8 @@ combine_stack_adjustments_for_block (basic_block bb)
        continue;
 
       set = single_set_for_csa (insn);
+      if (set && find_reg_note (insn, REG_STACK_CHECK, NULL_RTX))
+       set = NULL_RTX;
       if (set)
        {
          rtx dest = SET_DEST (set);
@@ -642,11 +623,11 @@ combine_stack_adjustments_for_block (basic_block bb)
          if (MEM_P (dest)
              && ((STACK_GROWS_DOWNWARD
                   ? (GET_CODE (XEXP (dest, 0)) == PRE_DEC
-                     && last_sp_adjust
-                        == (HOST_WIDE_INT) GET_MODE_SIZE (GET_MODE (dest)))
+                     && known_eq (last_sp_adjust,
+                                  GET_MODE_SIZE (GET_MODE (dest))))
                   : (GET_CODE (XEXP (dest, 0)) == PRE_INC
-                     && last_sp_adjust
-                        == -(HOST_WIDE_INT) GET_MODE_SIZE (GET_MODE (dest))))
+                     && known_eq (-last_sp_adjust,
+                                  GET_MODE_SIZE (GET_MODE (dest)))))
                  || ((STACK_GROWS_DOWNWARD
                       ? last_sp_adjust >= 0 : last_sp_adjust <= 0)
                      && GET_CODE (XEXP (dest, 0)) == PRE_MODIFY