OSDN Git Service

(fold, COND_EXPR case): All simplified results
[pf3gnuchains/gcc-fork.git] / gcc / explow.c
index d2519c6..f13129f 100644 (file)
@@ -267,7 +267,7 @@ break_out_memory_refs (x)
      register rtx x;
 {
   if (GET_CODE (x) == MEM
-      || (CONSTANT_P (x) && LEGITIMATE_CONSTANT_P (x)
+      || (CONSTANT_P (x) && CONSTANT_ADDRESS_P (x)
          && GET_MODE (x) != VOIDmode))
     {
       register rtx temp = force_reg (GET_MODE (x), x);
@@ -333,7 +333,7 @@ memory_address (mode, x)
 
   /* By passing constant addresses thru registers
      we get a chance to cse them.  */
-  if (! cse_not_expected && CONSTANT_P (x) && LEGITIMATE_CONSTANT_P (x))
+  if (! cse_not_expected && CONSTANT_P (x) && CONSTANT_ADDRESS_P (x))
     return force_reg (Pmode, x);
 
   /* Accept a QUEUED that refers to a REG
@@ -748,21 +748,26 @@ emit_stack_save (save_level, psave, after)
        abort ();
     }
 
-  if (sa != 0)
-    sa = validize_mem (sa);
-
   if (after)
     {
       rtx seq;
 
       start_sequence ();
+      /* We must validize inside the sequence, to ensure that any instructions
+        created by the validize call also get moved to the right place.  */
+      if (sa != 0)
+       sa = validize_mem (sa);
       emit_insn (fcn (sa, stack_pointer_rtx));
       seq = gen_sequence ();
       end_sequence ();
       emit_insn_after (seq, after);
     }
   else
-    emit_insn (fcn (sa, stack_pointer_rtx));
+    {
+      if (sa != 0)
+       sa = validize_mem (sa);
+      emit_insn (fcn (sa, stack_pointer_rtx));
+    }
 }
 
 /* Restore the stack pointer for the purpose in SAVE_LEVEL.  SA is the save
@@ -1010,3 +1015,41 @@ hard_libcall_value (mode)
 {
   return LIBCALL_VALUE (mode);
 }
+
+/* Look up the tree code for a given rtx code
+   to provide the arithmetic operation for REAL_ARITHMETIC.
+   The function returns an int because the caller may not know
+   what `enum tree_code' means.  */
+
+int
+rtx_to_tree_code (code)
+     enum rtx_code code;
+{
+  enum tree_code tcode;
+
+  switch (code)
+    {
+    case PLUS:
+      tcode = PLUS_EXPR;
+      break;
+    case MINUS:
+      tcode = MINUS_EXPR;
+      break;
+    case MULT:
+      tcode = MULT_EXPR;
+      break;
+    case DIV:
+      tcode = RDIV_EXPR;
+      break;
+    case SMIN:
+      tcode = MIN_EXPR;
+      break;
+    case SMAX:
+      tcode = MAX_EXPR;
+      break;
+    default:
+      tcode = LAST_AND_UNUSED_TREE_CODE;
+      break;
+    }
+  return ((int) tcode);
+}