winnt.c revision 18334
1/* Subroutines for insn-output.c for Windows NT.
2   Contributed by Douglas Rupp (drupp@cs.washington.edu)
3   Copyright (C) 1995 Free Software Foundation, Inc.
4
5This file is part of GNU CC.
6
7GNU CC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GNU CC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU CC; see the file COPYING.  If not, write to
19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA.  */
21
22#include <stdio.h>
23#include "config.h"
24#include "rtl.h"
25#include "regs.h"
26#include "hard-reg-set.h"
27#include "output.h"
28#include "tree.h"
29#include "flags.h"
30
31/* Return string which is the former assembler name modified with a
32   suffix consisting of an atsign (@) followed by the number of bytes of
33   arguments */
34
35char *
36gen_stdcall_suffix (decl)
37  tree decl;
38{
39  int total = 0;
40  char *asmname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
41  char *newsym;
42
43  if (TYPE_ARG_TYPES (TREE_TYPE (decl)))
44    if (TREE_VALUE (tree_last (TYPE_ARG_TYPES (TREE_TYPE (decl))))
45        == void_type_node)
46      {
47        tree formal_type = TYPE_ARG_TYPES (TREE_TYPE (decl));
48
49        while (TREE_VALUE (formal_type) != void_type_node)
50          {
51            total += TREE_INT_CST_LOW (TYPE_SIZE (TREE_VALUE (formal_type)));
52            formal_type = TREE_CHAIN (formal_type);
53          }
54      }
55
56  newsym = xmalloc (strlen (asmname) + 10);
57  sprintf (newsym, "%s@%d", asmname, total/BITS_PER_UNIT);
58  return IDENTIFIER_POINTER (get_identifier (newsym));
59}
60
61