00001 /* Subroutines for the C front end on the POWER and PowerPC architectures. 00002 Copyright (C) 2002, 2003, 2004 00003 Free Software Foundation, Inc. 00004 00005 Contributed by Zack Weinberg <zack@codesourcery.com> 00006 00007 This file is part of GCC. 00008 00009 GCC is free software; you can redistribute it and/or modify it 00010 under the terms of the GNU General Public License as published 00011 by the Free Software Foundation; either version 2, or (at your 00012 option) any later version. 00013 00014 GCC is distributed in the hope that it will be useful, but WITHOUT 00015 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 00016 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 00017 License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 along with GCC; see the file COPYING. If not, write to the 00021 Free Software Foundation, 59 Temple Place - Suite 330, Boston, 00022 MA 02111-1307, USA. */ 00023 00024 #include "config.h" 00025 #include "system.h" 00026 #include "coretypes.h" 00027 #include "tm.h" 00028 #include "cpplib.h" 00029 #include "tree.h" 00030 #include "c-pragma.h" 00031 #include "errors.h" 00032 #include "tm_p.h" 00033 00034 /* Handle the machine specific pragma longcall. Its syntax is 00035 00036 # pragma longcall ( TOGGLE ) 00037 00038 where TOGGLE is either 0 or 1. 00039 00040 rs6000_default_long_calls is set to the value of TOGGLE, changing 00041 whether or not new function declarations receive a longcall 00042 attribute by default. */ 00043 00044 #define SYNTAX_ERROR(gmsgid) do { \ 00045 warning (gmsgid); \ 00046 warning ("ignoring malformed #pragma longcall"); \ 00047 return; \ 00048 } while (0) 00049 00050 void 00051 rs6000_pragma_longcall (cpp_reader *pfile ATTRIBUTE_UNUSED) 00052 { 00053 tree x, n; 00054 00055 /* If we get here, generic code has already scanned the directive 00056 leader and the word "longcall". */ 00057 00058 if (c_lex (&x) != CPP_OPEN_PAREN) 00059 SYNTAX_ERROR ("missing open paren"); 00060 if (c_lex (&n) != CPP_NUMBER) 00061 SYNTAX_ERROR ("missing number"); 00062 if (c_lex (&x) != CPP_CLOSE_PAREN) 00063 SYNTAX_ERROR ("missing close paren"); 00064 00065 if (n != integer_zero_node && n != integer_one_node) 00066 SYNTAX_ERROR ("number must be 0 or 1"); 00067 00068 if (c_lex (&x) != CPP_EOF) 00069 warning ("junk at end of #pragma longcall"); 00070 00071 rs6000_default_long_calls = (n == integer_one_node); 00072 } 00073 00074 /* Handle defining many CPP flags based on TARGET_xxx. As a general 00075 policy, rather than trying to guess what flags a user might want a 00076 #define for, it's better to define a flag for everything. */ 00077 00078 #define builtin_define(TXT) cpp_define (pfile, TXT) 00079 #define builtin_assert(TXT) cpp_assert (pfile, TXT) 00080 00081 void 00082 rs6000_cpu_cpp_builtins (cpp_reader *pfile) 00083 { 00084 if (TARGET_POWER2) 00085 builtin_define ("_ARCH_PWR2"); 00086 else if (TARGET_POWER) 00087 builtin_define ("_ARCH_PWR"); 00088 if (TARGET_POWERPC) 00089 builtin_define ("_ARCH_PPC"); 00090 if (TARGET_POWERPC64) 00091 builtin_define ("_ARCH_PPC64"); 00092 if (! TARGET_POWER && ! TARGET_POWER2 && ! TARGET_POWERPC) 00093 builtin_define ("_ARCH_COM"); 00094 if (TARGET_ALTIVEC) 00095 { 00096 builtin_define ("__ALTIVEC__"); 00097 builtin_define ("__VEC__=10206"); 00098 00099 /* Define the AltiVec syntactic elements. */ 00100 builtin_define ("__vector=__attribute__((altivec(vector__)))"); 00101 builtin_define ("__pixel=__attribute__((altivec(pixel__))) unsigned short"); 00102 builtin_define ("__bool=__attribute__((altivec(bool__))) unsigned"); 00103 } 00104 if (TARGET_SPE) 00105 builtin_define ("__SPE__"); 00106 if (TARGET_SOFT_FLOAT) 00107 builtin_define ("_SOFT_FLOAT"); 00108 /* Used by lwarx/stwcx. errata work-around. */ 00109 if (rs6000_cpu == PROCESSOR_PPC405) 00110 builtin_define ("__PPC405__"); 00111 00112 /* May be overridden by target configuration. */ 00113 RS6000_CPU_CPP_ENDIAN_BUILTINS(); 00114 00115 if (TARGET_LONG_DOUBLE_128) 00116 builtin_define ("__LONG_DOUBLE_128__"); 00117 00118 switch (rs6000_current_abi) 00119 { 00120 case ABI_V4: 00121 builtin_define ("_CALL_SYSV"); 00122 break; 00123 case ABI_AIX: 00124 builtin_define ("_CALL_AIXDESC"); 00125 builtin_define ("_CALL_AIX"); 00126 break; 00127 case ABI_DARWIN: 00128 builtin_define ("_CALL_DARWIN"); 00129 break; 00130 default: 00131 break; 00132 } 00133 }
1.5.6