summaryrefslogtreecommitdiff
path: root/gcc/explow.c
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1994-04-18 18:50:18 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1994-04-18 18:50:18 +0000
commitf9aab3b67266026e7ce33c3b0c4e4e76143bad88 (patch)
tree7937e44d8f271ce394af0df8eec8f14cceebdfed /gcc/explow.c
parent42cc9be020ad487648d9edbc04d4b7bfc2bd6746 (diff)
downloadgcc-f9aab3b67266026e7ce33c3b0c4e4e76143bad88.tar.gz
(promote_mode): New function.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@7066 138bc75d-0d04-0410-961f-82ee72b054a4
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 914abc8a7be..b047dff386f 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. */