211fcd3212401eaab4b7117a07d163cdcbb83fc6
[platform/upstream/gcc.git] / gcc / config / rs6000 / aix31.h
1 /* Definitions of target machine for GNU compiler,
2    for IBM RS/6000 running AIX version 3.1.
3    Copyright (C) 1993,1997, 2000, 2001, 2003 Free Software Foundation, Inc.
4    Contributed by Richard Kenner (kenner@nyu.edu)
5
6    This file is part of GCC.
7
8    GCC is free software; you can redistribute it and/or modify it
9    under the terms of the GNU General Public License as published
10    by the Free Software Foundation; either version 2, or (at your
11    option) any later version.
12
13    GCC is distributed in the hope that it will be useful, but WITHOUT
14    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
16    License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with GCC; see the file COPYING.  If not, write to the
20    Free Software Foundation, 59 Temple Place - Suite 330, Boston,
21    MA 02111-1307, USA.  */
22
23 /* Output something to declare an external symbol to the assembler.  Most
24    assemblers don't need this.
25
26    If we haven't already, add "[RW]" (or "[DS]" for a function) to the
27    name.  Normally we write this out along with the name.  In the few cases
28    where we can't, it gets stripped off.  */
29
30 #undef ASM_OUTPUT_EXTERNAL
31 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME)                           \
32 { rtx _symref = XEXP (DECL_RTL (DECL), 0);                              \
33   if ((TREE_CODE (DECL) == VAR_DECL                                     \
34        || TREE_CODE (DECL) == FUNCTION_DECL)                            \
35       && (NAME)[strlen (NAME) - 1] != ']')                              \
36     {                                                                   \
37       XSTR (_symref, 0) = concat (XSTR (_symref, 0),                    \
38                                   (TREE_CODE (DECL) == FUNCTION_DECL    \
39                                    ? "[DS]" : "[RW]"),                  \
40                                   NULL);                                \
41     }                                                                   \
42   fputs ("\t.extern ", FILE);                                           \
43   assemble_name (FILE, XSTR (_symref, 0));                              \
44   if (TREE_CODE (DECL) == FUNCTION_DECL)                                \
45     {                                                                   \
46       fputs ("\n\t.extern .", FILE);                                    \
47       RS6000_OUTPUT_BASENAME (FILE, XSTR (_symref, 0));                 \
48     }                                                                   \
49   putc ('\n', FILE);                                                    \
50 }
51
52 /* Similar, but for libcall.  We only have to worry about the function name,
53    not that of the descriptor.  */
54
55 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN)  \
56 { fputs ("\t.extern .", FILE);                  \
57   assemble_name (FILE, XSTR (FUN, 0));          \
58   putc ('\n', FILE);                            \
59 }
60
61 /* AIX 3.2 defined _AIX32, but older versions do not.  */
62 #undef TARGET_OS_CPP_BUILTINS
63 #define TARGET_OS_CPP_BUILTINS()         \
64   do                                     \
65     {                                    \
66       builtin_define ("_IBMR2");         \
67       builtin_define ("_AIX");           \
68       builtin_assert ("system=unix");    \
69       builtin_assert ("system=aix");     \
70       builtin_assert ("cpu=rs6000");     \
71       builtin_assert ("machine=rs6000"); \
72     }                                    \
73   while (0)
74
75 /* AIX 3.1 uses bit 15 in CROR as the magic nop.  */
76 #undef RS6000_CALL_GLUE
77 #define RS6000_CALL_GLUE "cror 15,15,15"
78
79 /* AIX 3.1 does not prepend underscores to itrunc, uitrunc, or mcount.  */
80 #undef RS6000_ITRUNC
81 #define RS6000_ITRUNC "itrunc"
82 #undef RS6000_UITRUNC
83 #define RS6000_UITRUNC "uitrunc"
84 #undef RS6000_MCOUNT
85 #define RS6000_MCOUNT ".mcount"
86