Add support for win32's stdcall functions.
authorRichard Kenner <kenner@gcc.gnu.org>
Sun, 7 May 1995 21:28:23 +0000 (17:28 -0400)
committerRichard Kenner <kenner@gcc.gnu.org>
Sun, 7 May 1995 21:28:23 +0000 (17:28 -0400)
From-SVN: r9588

gcc/config/i386/go32.h

index 5618a0dd0fba293ed3b982c92300e1c604ea5624..9d4097748cfdefa920568a537272231c14824c3b 100644 (file)
@@ -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