From b377f1cdae22f549852fcdd2cde23143b5fcfce7 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Sun, 7 May 1995 17:28:23 -0400 Subject: [PATCH] Add support for win32's stdcall functions. From-SVN: r9588 --- gcc/config/i386/go32.h | 54 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/gcc/config/i386/go32.h b/gcc/config/i386/go32.h index 5618a0dd0fb..9d4097748cf 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 -- 2.30.2