aboutsummaryrefslogtreecommitdiff
path: root/gcc/explow.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1994-04-18 14:50:18 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1994-04-18 14:50:18 -0400
commit9ff6578970fce27e1f14cd3d47bb372150992d2c (patch)
tree7937e44d8f271ce394af0df8eec8f14cceebdfed /gcc/explow.c
parent9d69b7c803ff2b471a7be02aabadbaac4f81f5f2 (diff)
downloadgcc-9ff6578970fce27e1f14cd3d47bb372150992d2c.zip
gcc-9ff6578970fce27e1f14cd3d47bb372150992d2c.tar.gz
gcc-9ff6578970fce27e1f14cd3d47bb372150992d2c.tar.bz2
(promote_mode): New function.
From-SVN: r7066
Diffstat (limited to 'gcc/explow.c')
-rw-r--r--gcc/explow.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/gcc/explow.c b/gcc/explow.c
index 914abc8..b047dff 100644
--- a/gcc/explow.c
+++ b/gcc/explow.c
@@ -633,6 +633,44 @@ copy_to_suggested_reg (x, target, mode)
return temp;
}
+/* 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;
+}
+
/* Adjust the stack pointer by ADJUST (an rtx for a number of bytes).
This pops when ADJUST is positive. ADJUST need not be constant. */