aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1995-05-07 17:28:23 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1995-05-07 17:28:23 -0400
commitb377f1cdae22f549852fcdd2cde23143b5fcfce7 (patch)
treeaa09f9a42159d197dca64177b60e5376a5d8905e
parent53fd9c9a740f9584b8c4112d12cc80a55185c77f (diff)
downloadgcc-b377f1cdae22f549852fcdd2cde23143b5fcfce7.zip
gcc-b377f1cdae22f549852fcdd2cde23143b5fcfce7.tar.gz
gcc-b377f1cdae22f549852fcdd2cde23143b5fcfce7.tar.bz2
Add support for win32's stdcall functions.
From-SVN: r9588
-rw-r--r--gcc/config/i386/go32.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/gcc/config/i386/go32.h b/gcc/config/i386/go32.h
index 5618a0d..9d40977 100644
--- a/gcc/config/i386/go32.h
+++ b/gcc/config/i386/go32.h
@@ -9,6 +9,60 @@
#include "i386/gas.h"
+/* Value is the number of bytes of arguments automatically
+ popped when returning from a subroutine call.
+ FUNDECL is the declaration node of the function (as a tree),
+ FUNTYPE is the data type of the function (as a tree),
+ or for a library call it is an identifier node for the subroutine name.
+ SIZE is the number of bytes of arguments passed on the stack.
+
+ This only happens if the function declaration has the STDCALL attribute and
+ the number of arguments is not variable */
+
+#undef RETURN_POPS_ARGS
+#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
+ ( \
+ TREE_CODE (FUNTYPE) == IDENTIFIER_NODE \
+ ? \
+ 0 \
+ : \
+ ( \
+ ((FUNDECL && (TREE_CODE_CLASS (TREE_CODE (FUNDECL)) == 'd') \
+ ? \
+ lookup_attribute ("stdcall", \
+ DECL_MACHINE_ATTRIBUTES (FUNDECL)) != NULL_TREE \
+ : 0 \
+ ) \
+ ) \
+ && \
+ ( \
+ TYPE_ARG_TYPES (FUNTYPE) == 0 \
+ || \
+ TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \
+ == void_type_node \
+ ) \
+ ) \
+ ? \
+ (SIZE) \
+ : \
+ (aggregate_value_p (TREE_TYPE (FUNTYPE))) \
+ ? \
+ GET_MODE_SIZE (Pmode) \
+ : \
+ 0 \
+ )
+
+/* Value is 1 if the declaration has either of the attributes: CDECL or
+ STDCALL and 0 otherwise */
+
+#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTR, NAME, ARGS) \
+ (((TREE_CODE(DECL) == FUNCTION_DECL) \
+ || (TREE_CODE(DECL) == FIELD_DECL) \
+ || (TREE_CODE(DECL) == TYPE_DECL)) \
+ && (is_attribute_p ("stdcall", (NAME)) \
+ || is_attribute_p ("cdecl", (NAME))) \
+ && (ARGS) == NULL)
+
#ifdef CPP_PREDEFINES
#undef CPP_PREDEFINES
#endif