(promote_mode): New function.
authorRichard Kenner <kenner@gcc.gnu.org>
Mon, 18 Apr 1994 18:50:18 +0000 (14:50 -0400)
committerRichard Kenner <kenner@gcc.gnu.org>
Mon, 18 Apr 1994 18:50:18 +0000 (14:50 -0400)
From-SVN: r7066

gcc/explow.c

index 914abc8a7be8c37ca5f5e88c87b81f64af027215..b047dff386fd28d6b34bb25cc0d49b2b542da117 100644 (file)
@@ -633,6 +633,44 @@ copy_to_suggested_reg (x, target, mode)
   return temp;
 }
 \f
+/* Return the mode to use to store a scalar of TYPE and MODE.
+   PUNSIGNEDP points to the signedness of the type and may be adjusted
+   to show what signedness to use on extension operations.
+
+   FOR_CALL is non-zero if this call is promoting args for a call.  */
+
+enum machine_mode
+promote_mode (type, mode, punsignedp, for_call)
+     tree type;
+     enum machine_mode mode;
+     int *punsignedp;
+     int for_call;
+{
+  enum tree_code code = TREE_CODE (type);
+  int unsignedp = *punsignedp;
+
+#ifdef PROMOTE_FOR_CALL_ONLY
+  if (! for_call)
+    return mode;
+#endif
+
+  switch (code)
+    {
+#ifdef PROMOTE_MODE
+    case INTEGER_TYPE:   case ENUMERAL_TYPE:   case BOOLEAN_TYPE:
+    case CHAR_TYPE:      case REAL_TYPE:       case OFFSET_TYPE:
+      PROMOTE_MODE (mode, unsignedp, type);
+      break;
+#endif
+
+    case POINTER_TYPE:
+      break;
+    }
+
+  *punsignedp = unsignedp;
+  return mode;
+}
+\f
 /* Adjust the stack pointer by ADJUST (an rtx for a number of bytes).
    This pops when ADJUST is positive.  ADJUST need not be constant.  */