Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 1 | //===--- Targets.cpp - Implement -arch option and targets -----------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 959e5be | 2007-12-29 19:59:25 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
Ted Kremenek | 38591a2 | 2007-12-12 18:05:32 +0000 | [diff] [blame] | 10 | // This file implements construction of a TargetInfo object from a |
| 11 | // target triple. |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 15 | #include "clang/AST/Builtins.h" |
Anders Carlsson | e1449c1 | 2007-12-09 23:17:02 +0000 | [diff] [blame] | 16 | #include "clang/AST/TargetBuiltins.h" |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 17 | #include "clang/Basic/Diagnostic.h" |
| 18 | #include "clang/Basic/TargetInfo.h" |
Anders Carlsson | 7dd1c95 | 2007-11-24 23:38:12 +0000 | [diff] [blame] | 19 | #include "llvm/ADT/STLExtras.h" |
Eli Friedman | d401189 | 2008-05-20 14:27:34 +0000 | [diff] [blame] | 20 | #include "llvm/ADT/APFloat.h" |
Ted Kremenek | 4049948 | 2007-12-03 22:06:55 +0000 | [diff] [blame] | 21 | |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 22 | using namespace clang; |
| 23 | |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 24 | //===----------------------------------------------------------------------===// |
| 25 | // Common code shared among targets. |
| 26 | //===----------------------------------------------------------------------===// |
| 27 | |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 28 | static void Define(std::vector<char> &Buf, const char *Macro, |
| 29 | const char *Val = "1") { |
| 30 | const char *Def = "#define "; |
| 31 | Buf.insert(Buf.end(), Def, Def+strlen(Def)); |
| 32 | Buf.insert(Buf.end(), Macro, Macro+strlen(Macro)); |
| 33 | Buf.push_back(' '); |
| 34 | Buf.insert(Buf.end(), Val, Val+strlen(Val)); |
| 35 | Buf.push_back('\n'); |
| 36 | } |
| 37 | |
| 38 | |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 39 | namespace { |
Chris Lattner | 0fb8d85 | 2008-03-08 08:24:01 +0000 | [diff] [blame] | 40 | class DarwinTargetInfo : public TargetInfo { |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 41 | public: |
Chris Lattner | 0fb8d85 | 2008-03-08 08:24:01 +0000 | [diff] [blame] | 42 | DarwinTargetInfo(const std::string& triple) : TargetInfo(triple) {} |
Ted Kremenek | 4049948 | 2007-12-03 22:06:55 +0000 | [diff] [blame] | 43 | |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 44 | virtual void getTargetDefines(std::vector<char> &Defs) const { |
Chris Lattner | 1ed172d | 2007-10-17 06:04:46 +0000 | [diff] [blame] | 45 | // FIXME: we need a real target configuration system. For now, only define |
| 46 | // __APPLE__ if the host has it. |
| 47 | #ifdef __APPLE__ |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 48 | Define(Defs, "__APPLE__"); |
| 49 | Define(Defs, "__MACH__"); |
Chris Lattner | 1ed172d | 2007-10-17 06:04:46 +0000 | [diff] [blame] | 50 | #endif |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 51 | |
| 52 | if (1) {// -fobjc-gc controls this. |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 53 | Define(Defs, "__weak", ""); |
| 54 | Define(Defs, "__strong", ""); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 55 | } else { |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 56 | Define(Defs, "__weak", "__attribute__((objc_gc(weak)))"); |
| 57 | Define(Defs, "__strong", "__attribute__((objc_gc(strong)))"); |
| 58 | Define(Defs, "__OBJC_GC__"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 59 | } |
| 60 | |
| 61 | // darwin_constant_cfstrings controls this. |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 62 | Define(Defs, "__CONSTANT_CFSTRINGS__"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 63 | |
| 64 | if (0) // darwin_pascal_strings |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 65 | Define(Defs, "__PASCAL_STRINGS__"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 66 | } |
| 67 | |
| 68 | }; |
Gabor Greif | 8a3ff0d | 2008-02-21 16:29:08 +0000 | [diff] [blame] | 69 | |
| 70 | |
Chris Lattner | 0fb8d85 | 2008-03-08 08:24:01 +0000 | [diff] [blame] | 71 | class SolarisTargetInfo : public TargetInfo { |
Gabor Greif | 8a3ff0d | 2008-02-21 16:29:08 +0000 | [diff] [blame] | 72 | public: |
Chris Lattner | 0fb8d85 | 2008-03-08 08:24:01 +0000 | [diff] [blame] | 73 | SolarisTargetInfo(const std::string& triple) : TargetInfo(triple) {} |
Gabor Greif | 8a3ff0d | 2008-02-21 16:29:08 +0000 | [diff] [blame] | 74 | |
| 75 | virtual void getTargetDefines(std::vector<char> &Defs) const { |
| 76 | // FIXME: we need a real target configuration system. For now, only define |
| 77 | // __SUN__ if the host has it. |
| 78 | #ifdef __SUN__ |
| 79 | Define(Defs, "__SUN__"); |
| 80 | Define(Defs, "__SOLARIS__"); |
| 81 | #endif |
| 82 | |
| 83 | if (1) {// -fobjc-gc controls this. |
| 84 | Define(Defs, "__weak", ""); |
| 85 | Define(Defs, "__strong", ""); |
| 86 | } else { |
| 87 | Define(Defs, "__weak", "__attribute__((objc_gc(weak)))"); |
| 88 | Define(Defs, "__strong", "__attribute__((objc_gc(strong)))"); |
| 89 | Define(Defs, "__OBJC_GC__"); |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | }; |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 94 | } // end anonymous namespace. |
| 95 | |
| 96 | |
| 97 | /// getPowerPCDefines - Return a set of the PowerPC-specific #defines that are |
| 98 | /// not tied to a specific subtarget. |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 99 | static void getPowerPCDefines(std::vector<char> &Defs, bool is64Bit) { |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 100 | // Target identification. |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 101 | Define(Defs, "__ppc__"); |
| 102 | Define(Defs, "_ARCH_PPC"); |
| 103 | Define(Defs, "__POWERPC__"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 104 | if (is64Bit) { |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 105 | Define(Defs, "_ARCH_PPC64"); |
| 106 | Define(Defs, "_LP64"); |
| 107 | Define(Defs, "__LP64__"); |
| 108 | Define(Defs, "__ppc64__"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 109 | } else { |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 110 | Define(Defs, "__ppc__"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 111 | } |
| 112 | |
| 113 | // Target properties. |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 114 | Define(Defs, "_BIG_ENDIAN"); |
| 115 | Define(Defs, "__BIG_ENDIAN__"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 116 | |
| 117 | if (is64Bit) { |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 118 | Define(Defs, "__INTMAX_MAX__", "9223372036854775807L"); |
| 119 | Define(Defs, "__INTMAX_TYPE__", "long int"); |
| 120 | Define(Defs, "__LONG_MAX__", "9223372036854775807L"); |
| 121 | Define(Defs, "__PTRDIFF_TYPE__", "long int"); |
| 122 | Define(Defs, "__UINTMAX_TYPE__", "long unsigned int"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 123 | } else { |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 124 | Define(Defs, "__INTMAX_MAX__", "9223372036854775807LL"); |
| 125 | Define(Defs, "__INTMAX_TYPE__", "long long int"); |
| 126 | Define(Defs, "__LONG_MAX__", "2147483647L"); |
| 127 | Define(Defs, "__PTRDIFF_TYPE__", "int"); |
| 128 | Define(Defs, "__UINTMAX_TYPE__", "long long unsigned int"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 129 | } |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 130 | Define(Defs, "__INT_MAX__", "2147483647"); |
| 131 | Define(Defs, "__LONG_LONG_MAX__", "9223372036854775807LL"); |
| 132 | Define(Defs, "__CHAR_BIT__", "8"); |
| 133 | Define(Defs, "__SCHAR_MAX__", "127"); |
| 134 | Define(Defs, "__SHRT_MAX__", "32767"); |
| 135 | Define(Defs, "__SIZE_TYPE__", "long unsigned int"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 136 | |
| 137 | // Subtarget options. |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 138 | Define(Defs, "__USER_LABEL_PREFIX__", "_"); |
| 139 | Define(Defs, "__NATURAL_ALIGNMENT__"); |
| 140 | Define(Defs, "__REGISTER_PREFIX__", ""); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 141 | |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 142 | Define(Defs, "__WCHAR_MAX__", "2147483647"); |
| 143 | Define(Defs, "__WCHAR_TYPE__", "int"); |
| 144 | Define(Defs, "__WINT_TYPE__", "int"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 145 | |
| 146 | // Float macros. |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 147 | Define(Defs, "__FLT_DENORM_MIN__", "1.40129846e-45F"); |
| 148 | Define(Defs, "__FLT_DIG__", "6"); |
| 149 | Define(Defs, "__FLT_EPSILON__", "1.19209290e-7F"); |
| 150 | Define(Defs, "__FLT_EVAL_METHOD__", "0"); |
| 151 | Define(Defs, "__FLT_HAS_INFINITY__"); |
| 152 | Define(Defs, "__FLT_HAS_QUIET_NAN__"); |
| 153 | Define(Defs, "__FLT_MANT_DIG__", "24"); |
| 154 | Define(Defs, "__FLT_MAX_10_EXP__", "38"); |
| 155 | Define(Defs, "__FLT_MAX_EXP__", "128"); |
| 156 | Define(Defs, "__FLT_MAX__", "3.40282347e+38F"); |
| 157 | Define(Defs, "__FLT_MIN_10_EXP__", "(-37)"); |
| 158 | Define(Defs, "__FLT_MIN_EXP__", "(-125)"); |
| 159 | Define(Defs, "__FLT_MIN__", "1.17549435e-38F"); |
| 160 | Define(Defs, "__FLT_RADIX__", "2"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 161 | |
| 162 | // double macros. |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 163 | Define(Defs, "__DBL_DENORM_MIN__", "4.9406564584124654e-324"); |
| 164 | Define(Defs, "__DBL_DIG__", "15"); |
| 165 | Define(Defs, "__DBL_EPSILON__", "2.2204460492503131e-16"); |
| 166 | Define(Defs, "__DBL_HAS_INFINITY__"); |
| 167 | Define(Defs, "__DBL_HAS_QUIET_NAN__"); |
| 168 | Define(Defs, "__DBL_MANT_DIG__", "53"); |
| 169 | Define(Defs, "__DBL_MAX_10_EXP__", "308"); |
| 170 | Define(Defs, "__DBL_MAX_EXP__", "1024"); |
| 171 | Define(Defs, "__DBL_MAX__", "1.7976931348623157e+308"); |
| 172 | Define(Defs, "__DBL_MIN_10_EXP__", "(-307)"); |
| 173 | Define(Defs, "__DBL_MIN_EXP__", "(-1021)"); |
| 174 | Define(Defs, "__DBL_MIN__", "2.2250738585072014e-308"); |
| 175 | Define(Defs, "__DECIMAL_DIG__", "33"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 176 | |
| 177 | // 128-bit long double macros. |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 178 | Define(Defs, "__LDBL_DENORM_MIN__", |
| 179 | "4.94065645841246544176568792868221e-324L"); |
| 180 | Define(Defs, "__LDBL_DIG__", "31"); |
| 181 | Define(Defs, "__LDBL_EPSILON__", |
| 182 | "4.94065645841246544176568792868221e-324L"); |
| 183 | Define(Defs, "__LDBL_HAS_INFINITY__"); |
| 184 | Define(Defs, "__LDBL_HAS_QUIET_NAN__"); |
| 185 | Define(Defs, "__LDBL_MANT_DIG__", "106"); |
| 186 | Define(Defs, "__LDBL_MAX_10_EXP__", "308"); |
| 187 | Define(Defs, "__LDBL_MAX_EXP__", "1024"); |
| 188 | Define(Defs, "__LDBL_MAX__", |
| 189 | "1.79769313486231580793728971405301e+308L"); |
| 190 | Define(Defs, "__LDBL_MIN_10_EXP__", "(-291)"); |
| 191 | Define(Defs, "__LDBL_MIN_EXP__", "(-968)"); |
| 192 | Define(Defs, "__LDBL_MIN__", |
| 193 | "2.00416836000897277799610805135016e-292L"); |
| 194 | Define(Defs, "__LONG_DOUBLE_128__"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 195 | } |
| 196 | |
| 197 | /// getX86Defines - Return a set of the X86-specific #defines that are |
| 198 | /// not tied to a specific subtarget. |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 199 | static void getX86Defines(std::vector<char> &Defs, bool is64Bit) { |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 200 | // Target identification. |
| 201 | if (is64Bit) { |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 202 | Define(Defs, "_LP64"); |
| 203 | Define(Defs, "__LP64__"); |
| 204 | Define(Defs, "__amd64__"); |
| 205 | Define(Defs, "__amd64"); |
| 206 | Define(Defs, "__x86_64"); |
| 207 | Define(Defs, "__x86_64__"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 208 | } else { |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 209 | Define(Defs, "__i386__"); |
| 210 | Define(Defs, "__i386"); |
| 211 | Define(Defs, "i386"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 212 | } |
| 213 | |
| 214 | // Target properties. |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 215 | Define(Defs, "__LITTLE_ENDIAN__"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 216 | |
| 217 | if (is64Bit) { |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 218 | Define(Defs, "__INTMAX_MAX__", "9223372036854775807L"); |
| 219 | Define(Defs, "__INTMAX_TYPE__", "long int"); |
| 220 | Define(Defs, "__LONG_MAX__", "9223372036854775807L"); |
| 221 | Define(Defs, "__PTRDIFF_TYPE__", "long int"); |
| 222 | Define(Defs, "__UINTMAX_TYPE__", "long unsigned int"); |
Lauro Ramos Venancio | dcf0a4a | 2008-01-20 04:02:16 +0000 | [diff] [blame] | 223 | Define(Defs, "__SIZE_TYPE__", "long unsigned int"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 224 | } else { |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 225 | Define(Defs, "__INTMAX_MAX__", "9223372036854775807LL"); |
| 226 | Define(Defs, "__INTMAX_TYPE__", "long long int"); |
| 227 | Define(Defs, "__LONG_MAX__", "2147483647L"); |
| 228 | Define(Defs, "__PTRDIFF_TYPE__", "int"); |
| 229 | Define(Defs, "__UINTMAX_TYPE__", "long long unsigned int"); |
Lauro Ramos Venancio | dcf0a4a | 2008-01-20 04:02:16 +0000 | [diff] [blame] | 230 | Define(Defs, "__SIZE_TYPE__", "unsigned int"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 231 | } |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 232 | Define(Defs, "__CHAR_BIT__", "8"); |
| 233 | Define(Defs, "__INT_MAX__", "2147483647"); |
| 234 | Define(Defs, "__LONG_LONG_MAX__", "9223372036854775807LL"); |
| 235 | Define(Defs, "__SCHAR_MAX__", "127"); |
| 236 | Define(Defs, "__SHRT_MAX__", "32767"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 237 | |
| 238 | // Subtarget options. |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 239 | Define(Defs, "__nocona"); |
| 240 | Define(Defs, "__nocona__"); |
| 241 | Define(Defs, "__tune_nocona__"); |
| 242 | Define(Defs, "__SSE2_MATH__"); |
| 243 | Define(Defs, "__SSE2__"); |
| 244 | Define(Defs, "__SSE_MATH__"); |
| 245 | Define(Defs, "__SSE__"); |
| 246 | Define(Defs, "__MMX__"); |
| 247 | Define(Defs, "__REGISTER_PREFIX__", ""); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 248 | |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 249 | Define(Defs, "__WCHAR_MAX__", "2147483647"); |
| 250 | Define(Defs, "__WCHAR_TYPE__", "int"); |
| 251 | Define(Defs, "__WINT_TYPE__", "int"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 252 | |
| 253 | // Float macros. |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 254 | Define(Defs, "__FLT_DENORM_MIN__", "1.40129846e-45F"); |
| 255 | Define(Defs, "__FLT_DIG__", "6"); |
| 256 | Define(Defs, "__FLT_EPSILON__", "1.19209290e-7F"); |
| 257 | Define(Defs, "__FLT_EVAL_METHOD__", "0"); |
| 258 | Define(Defs, "__FLT_HAS_INFINITY__"); |
| 259 | Define(Defs, "__FLT_HAS_QUIET_NAN__"); |
| 260 | Define(Defs, "__FLT_MANT_DIG__", "24"); |
| 261 | Define(Defs, "__FLT_MAX_10_EXP__", "38"); |
| 262 | Define(Defs, "__FLT_MAX_EXP__", "128"); |
| 263 | Define(Defs, "__FLT_MAX__", "3.40282347e+38F"); |
| 264 | Define(Defs, "__FLT_MIN_10_EXP__", "(-37)"); |
| 265 | Define(Defs, "__FLT_MIN_EXP__", "(-125)"); |
| 266 | Define(Defs, "__FLT_MIN__", "1.17549435e-38F"); |
| 267 | Define(Defs, "__FLT_RADIX__", "2"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 268 | |
| 269 | // Double macros. |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 270 | Define(Defs, "__DBL_DENORM_MIN__", "4.9406564584124654e-324"); |
| 271 | Define(Defs, "__DBL_DIG__", "15"); |
| 272 | Define(Defs, "__DBL_EPSILON__", "2.2204460492503131e-16"); |
| 273 | Define(Defs, "__DBL_HAS_INFINITY__"); |
| 274 | Define(Defs, "__DBL_HAS_QUIET_NAN__"); |
| 275 | Define(Defs, "__DBL_MANT_DIG__", "53"); |
| 276 | Define(Defs, "__DBL_MAX_10_EXP__", "308"); |
| 277 | Define(Defs, "__DBL_MAX_EXP__", "1024"); |
| 278 | Define(Defs, "__DBL_MAX__", "1.7976931348623157e+308"); |
| 279 | Define(Defs, "__DBL_MIN_10_EXP__", "(-307)"); |
| 280 | Define(Defs, "__DBL_MIN_EXP__", "(-1021)"); |
| 281 | Define(Defs, "__DBL_MIN__", "2.2250738585072014e-308"); |
| 282 | Define(Defs, "__DECIMAL_DIG__", "21"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 283 | |
| 284 | // 80-bit Long double macros. |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 285 | Define(Defs, "__LDBL_DENORM_MIN__", "3.64519953188247460253e-4951L"); |
| 286 | Define(Defs, "__LDBL_DIG__", "18"); |
| 287 | Define(Defs, "__LDBL_EPSILON__", "1.08420217248550443401e-19L"); |
| 288 | Define(Defs, "__LDBL_HAS_INFINITY__"); |
| 289 | Define(Defs, "__LDBL_HAS_QUIET_NAN__"); |
| 290 | Define(Defs, "__LDBL_MANT_DIG__", "64"); |
| 291 | Define(Defs, "__LDBL_MAX_10_EXP__", "4932"); |
| 292 | Define(Defs, "__LDBL_MAX_EXP__", "16384"); |
| 293 | Define(Defs, "__LDBL_MAX__", "1.18973149535723176502e+4932L"); |
| 294 | Define(Defs, "__LDBL_MIN_10_EXP__", "(-4931)"); |
| 295 | Define(Defs, "__LDBL_MIN_EXP__", "(-16381)"); |
| 296 | Define(Defs, "__LDBL_MIN__", "3.36210314311209350626e-4932L"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 297 | } |
| 298 | |
Chris Lattner | b644405 | 2008-04-21 20:19:54 +0000 | [diff] [blame] | 299 | /// getARMDefines - Return a set of the ARM-specific #defines that are |
Chris Lattner | 9fd7361 | 2008-04-21 18:56:49 +0000 | [diff] [blame] | 300 | /// not tied to a specific subtarget. |
| 301 | static void getARMDefines(std::vector<char> &Defs) { |
| 302 | // Target identification. |
| 303 | Define(Defs, "__arm"); |
| 304 | Define(Defs, "__arm__"); |
| 305 | |
| 306 | // Target properties. |
| 307 | Define(Defs, "__LITTLE_ENDIAN__"); |
| 308 | |
| 309 | Define(Defs, "__INTMAX_MAX__", "9223372036854775807LL"); |
| 310 | Define(Defs, "__INTMAX_TYPE__", "long long int"); |
| 311 | Define(Defs, "__LONG_MAX__", "2147483647L"); |
| 312 | Define(Defs, "__PTRDIFF_TYPE__", "int"); |
| 313 | Define(Defs, "__UINTMAX_TYPE__", "long long unsigned int"); |
| 314 | Define(Defs, "__SIZE_TYPE__", "long unsigned int"); |
| 315 | |
| 316 | Define(Defs, "__CHAR_BIT__", "8"); |
| 317 | Define(Defs, "__INT_MAX__", "2147483647"); |
| 318 | Define(Defs, "__LONG_LONG_MAX__", "9223372036854775807LL"); |
| 319 | Define(Defs, "__SCHAR_MAX__", "127"); |
| 320 | Define(Defs, "__SHRT_MAX__", "32767"); |
| 321 | |
| 322 | // Subtarget options. [hard coded to v6 for now] |
| 323 | Define(Defs, "__ARM_ARCH_6K__"); |
| 324 | Define(Defs, "__ARMEL__"); |
| 325 | Define(Defs, "__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__", "20000"); |
| 326 | |
| 327 | Define(Defs, "__WCHAR_MAX__", "2147483647"); |
| 328 | Define(Defs, "__WCHAR_TYPE__", "int"); |
| 329 | Define(Defs, "__WINT_TYPE__", "int"); |
| 330 | Define(Defs, "__DECIMAL_DIG__", "17"); |
| 331 | Define(Defs, "__FLT_RADIX__", "2"); |
| 332 | |
| 333 | // Float macros. |
| 334 | Define(Defs, "__FLT_DENORM_MIN__", "1.40129846e-45F"); |
| 335 | Define(Defs, "__FLT_DIG__", "6"); |
| 336 | Define(Defs, "__FLT_EPSILON__", "1.19209290e-7F"); |
| 337 | Define(Defs, "__FLT_EVAL_METHOD__", "0"); |
| 338 | Define(Defs, "__FLT_HAS_INFINITY__"); |
| 339 | Define(Defs, "__FLT_HAS_QUIET_NAN__"); |
| 340 | Define(Defs, "__FLT_MANT_DIG__", "24"); |
| 341 | Define(Defs, "__FLT_MAX_10_EXP__", "38"); |
| 342 | Define(Defs, "__FLT_MAX_EXP__", "128"); |
| 343 | Define(Defs, "__FLT_MAX__", "3.40282347e+38F"); |
| 344 | Define(Defs, "__FLT_MIN_10_EXP__", "(-37)"); |
| 345 | Define(Defs, "__FLT_MIN_EXP__", "(-125)"); |
| 346 | Define(Defs, "__FLT_MIN__", "1.17549435e-38F"); |
| 347 | |
| 348 | // Double macros. |
| 349 | Define(Defs, "__DBL_DENORM_MIN__", "4.9406564584124654e-324"); |
| 350 | Define(Defs, "__DBL_DIG__", "15"); |
| 351 | Define(Defs, "__DBL_EPSILON__", "2.2204460492503131e-16"); |
| 352 | Define(Defs, "__DBL_HAS_INFINITY__"); |
| 353 | Define(Defs, "__DBL_HAS_QUIET_NAN__"); |
| 354 | Define(Defs, "__DBL_MANT_DIG__", "53"); |
| 355 | Define(Defs, "__DBL_MAX_10_EXP__", "308"); |
| 356 | Define(Defs, "__DBL_MAX_EXP__", "1024"); |
| 357 | Define(Defs, "__DBL_MAX__", "1.7976931348623157e+308"); |
| 358 | Define(Defs, "__DBL_MIN_10_EXP__", "(-307)"); |
| 359 | Define(Defs, "__DBL_MIN_EXP__", "(-1021)"); |
| 360 | Define(Defs, "__DBL_MIN__", "2.2250738585072014e-308"); |
| 361 | |
| 362 | // 64-bit Long double macros (same as double). |
| 363 | Define(Defs, "__LDBL_DENORM_MIN__", "4.9406564584124654e-324"); |
| 364 | Define(Defs, "__LDBL_DIG__", "15"); |
| 365 | Define(Defs, "__LDBL_EPSILON__", "2.2204460492503131e-16"); |
| 366 | Define(Defs, "__LDBL_HAS_INFINITY__"); |
| 367 | Define(Defs, "__LDBL_HAS_QUIET_NAN__"); |
| 368 | Define(Defs, "__LDBL_MANT_DIG__", "53"); |
| 369 | Define(Defs, "__LDBL_MAX_10_EXP__", "308"); |
| 370 | Define(Defs, "__LDBL_MAX_EXP__", "1024"); |
| 371 | Define(Defs, "__LDBL_MAX__", "1.7976931348623157e+308"); |
| 372 | Define(Defs, "__LDBL_MIN_10_EXP__", "(-307)"); |
| 373 | Define(Defs, "__LDBL_MIN_EXP__", "(-1021)"); |
| 374 | Define(Defs, "__LDBL_MIN__", "2.2250738585072014e-308"); |
| 375 | } |
| 376 | |
Anders Carlsson | 8b58e8a | 2007-10-13 00:45:48 +0000 | [diff] [blame] | 377 | static const char* getI386VAListDeclaration() { |
| 378 | return "typedef char* __builtin_va_list;"; |
| 379 | } |
| 380 | |
| 381 | static const char* getX86_64VAListDeclaration() { |
| 382 | return |
| 383 | "typedef struct __va_list_tag {" |
| 384 | " unsigned gp_offset;" |
| 385 | " unsigned fp_offset;" |
| 386 | " void* overflow_arg_area;" |
| 387 | " void* reg_save_area;" |
| 388 | "} __builtin_va_list[1];"; |
| 389 | } |
| 390 | |
| 391 | static const char* getPPCVAListDeclaration() { |
| 392 | return |
| 393 | "typedef struct __va_list_tag {" |
| 394 | " unsigned char gpr;" |
| 395 | " unsigned char fpr;" |
| 396 | " unsigned short reserved;" |
| 397 | " void* overflow_arg_area;" |
| 398 | " void* reg_save_area;" |
| 399 | "} __builtin_va_list[1];"; |
| 400 | } |
| 401 | |
Chris Lattner | 9fd7361 | 2008-04-21 18:56:49 +0000 | [diff] [blame] | 402 | static const char* getARMVAListDeclaration() { |
| 403 | return "typedef char* __builtin_va_list;"; |
| 404 | } |
Anders Carlsson | 8b58e8a | 2007-10-13 00:45:48 +0000 | [diff] [blame] | 405 | |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 406 | /// PPC builtin info. |
Chris Lattner | 9a3dedf | 2007-12-11 04:36:28 +0000 | [diff] [blame] | 407 | namespace clang { |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 408 | namespace PPC { |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 409 | |
| 410 | static const Builtin::Info BuiltinInfo[] = { |
| 411 | #define BUILTIN(ID, TYPE, ATTRS) { #ID, TYPE, ATTRS }, |
Anders Carlsson | e1449c1 | 2007-12-09 23:17:02 +0000 | [diff] [blame] | 412 | #include "clang/AST/PPCBuiltins.def" |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 413 | }; |
| 414 | |
| 415 | static void getBuiltins(const Builtin::Info *&Records, unsigned &NumRecords) { |
| 416 | Records = BuiltinInfo; |
| 417 | NumRecords = LastTSBuiltin-Builtin::FirstTSBuiltin; |
| 418 | } |
Anders Carlsson | 7dd1c95 | 2007-11-24 23:38:12 +0000 | [diff] [blame] | 419 | |
| 420 | static const char * const GCCRegNames[] = { |
| 421 | "0", "1", "2", "3", "4", "5", "6", "7", |
| 422 | "8", "9", "10", "11", "12", "13", "14", "15", |
| 423 | "16", "17", "18", "19", "20", "21", "22", "23", |
| 424 | "24", "25", "26", "27", "28", "29", "30", "31", |
| 425 | "0", "1", "2", "3", "4", "5", "6", "7", |
| 426 | "8", "9", "10", "11", "12", "13", "14", "15", |
| 427 | "16", "17", "18", "19", "20", "21", "22", "23", |
| 428 | "24", "25", "26", "27", "28", "29", "30", "31", |
| 429 | "mq", "lr", "ctr", "ap", |
| 430 | "0", "1", "2", "3", "4", "5", "6", "7", |
| 431 | "xer", |
| 432 | "0", "1", "2", "3", "4", "5", "6", "7", |
| 433 | "8", "9", "10", "11", "12", "13", "14", "15", |
| 434 | "16", "17", "18", "19", "20", "21", "22", "23", |
| 435 | "24", "25", "26", "27", "28", "29", "30", "31", |
| 436 | "vrsave", "vscr", |
| 437 | "spe_acc", "spefscr", |
| 438 | "sfp" |
| 439 | }; |
| 440 | |
| 441 | static void getGCCRegNames(const char * const *&Names, |
| 442 | unsigned &NumNames) { |
| 443 | Names = GCCRegNames; |
| 444 | NumNames = llvm::array_lengthof(GCCRegNames); |
| 445 | } |
| 446 | |
Chris Lattner | 0fb8d85 | 2008-03-08 08:24:01 +0000 | [diff] [blame] | 447 | static const TargetInfo::GCCRegAlias GCCRegAliases[] = { |
Anders Carlsson | 7dd1c95 | 2007-11-24 23:38:12 +0000 | [diff] [blame] | 448 | // While some of these aliases do map to different registers |
| 449 | // they still share the same register name. |
| 450 | { { "cc", "cr0", "fr0", "r0", "v0"}, "0" }, |
| 451 | { { "cr1", "fr1", "r1", "sp", "v1"}, "1" }, |
| 452 | { { "cr2", "fr2", "r2", "toc", "v2"}, "2" }, |
| 453 | { { "cr3", "fr3", "r3", "v3"}, "3" }, |
| 454 | { { "cr4", "fr4", "r4", "v4"}, "4" }, |
| 455 | { { "cr5", "fr5", "r5", "v5"}, "5" }, |
| 456 | { { "cr6", "fr6", "r6", "v6"}, "6" }, |
| 457 | { { "cr7", "fr7", "r7", "v7"}, "7" }, |
| 458 | { { "fr8", "r8", "v8"}, "8" }, |
| 459 | { { "fr9", "r9", "v9"}, "9" }, |
| 460 | { { "fr10", "r10", "v10"}, "10" }, |
| 461 | { { "fr11", "r11", "v11"}, "11" }, |
| 462 | { { "fr12", "r12", "v12"}, "12" }, |
| 463 | { { "fr13", "r13", "v13"}, "13" }, |
| 464 | { { "fr14", "r14", "v14"}, "14" }, |
| 465 | { { "fr15", "r15", "v15"}, "15" }, |
| 466 | { { "fr16", "r16", "v16"}, "16" }, |
| 467 | { { "fr17", "r17", "v17"}, "17" }, |
| 468 | { { "fr18", "r18", "v18"}, "18" }, |
| 469 | { { "fr19", "r19", "v19"}, "19" }, |
| 470 | { { "fr20", "r20", "v20"}, "20" }, |
| 471 | { { "fr21", "r21", "v21"}, "21" }, |
| 472 | { { "fr22", "r22", "v22"}, "22" }, |
| 473 | { { "fr23", "r23", "v23"}, "23" }, |
| 474 | { { "fr24", "r24", "v24"}, "24" }, |
| 475 | { { "fr25", "r25", "v25"}, "25" }, |
| 476 | { { "fr26", "r26", "v26"}, "26" }, |
| 477 | { { "fr27", "r27", "v27"}, "27" }, |
| 478 | { { "fr28", "r28", "v28"}, "28" }, |
| 479 | { { "fr29", "r29", "v29"}, "29" }, |
| 480 | { { "fr30", "r30", "v30"}, "30" }, |
| 481 | { { "fr31", "r31", "v31"}, "31" }, |
| 482 | }; |
| 483 | |
Chris Lattner | 0fb8d85 | 2008-03-08 08:24:01 +0000 | [diff] [blame] | 484 | static void getGCCRegAliases(const TargetInfo::GCCRegAlias *&Aliases, |
Anders Carlsson | 7dd1c95 | 2007-11-24 23:38:12 +0000 | [diff] [blame] | 485 | unsigned &NumAliases) { |
| 486 | Aliases = GCCRegAliases; |
| 487 | NumAliases = llvm::array_lengthof(GCCRegAliases); |
Anders Carlsson | 4ce4230 | 2007-11-27 04:11:28 +0000 | [diff] [blame] | 488 | } |
Anders Carlsson | 7dd1c95 | 2007-11-24 23:38:12 +0000 | [diff] [blame] | 489 | |
Anders Carlsson | 4ce4230 | 2007-11-27 04:11:28 +0000 | [diff] [blame] | 490 | static bool validateAsmConstraint(char c, |
| 491 | TargetInfo::ConstraintInfo &info) { |
| 492 | switch (c) { |
| 493 | default: return false; |
| 494 | case 'O': // Zero |
| 495 | return true; |
| 496 | case 'b': // Base register |
| 497 | case 'f': // Floating point register |
| 498 | info = (TargetInfo::ConstraintInfo)(info|TargetInfo::CI_AllowsRegister); |
| 499 | return true; |
| 500 | } |
| 501 | } |
| 502 | |
| 503 | const char *getClobbers() { |
| 504 | return 0; |
| 505 | } |
| 506 | |
Anders Carlsson | 333052c | 2007-12-08 19:32:57 +0000 | [diff] [blame] | 507 | const char *getTargetPrefix() { |
| 508 | return "ppc"; |
| 509 | } |
| 510 | |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 511 | } // End namespace PPC |
| 512 | |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 513 | /// X86 builtin info. |
| 514 | namespace X86 { |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 515 | static const Builtin::Info BuiltinInfo[] = { |
| 516 | #define BUILTIN(ID, TYPE, ATTRS) { #ID, TYPE, ATTRS }, |
Anders Carlsson | e1449c1 | 2007-12-09 23:17:02 +0000 | [diff] [blame] | 517 | #include "clang/AST/X86Builtins.def" |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 518 | }; |
| 519 | |
| 520 | static void getBuiltins(const Builtin::Info *&Records, unsigned &NumRecords) { |
| 521 | Records = BuiltinInfo; |
| 522 | NumRecords = LastTSBuiltin-Builtin::FirstTSBuiltin; |
| 523 | } |
Anders Carlsson | 7dd1c95 | 2007-11-24 23:38:12 +0000 | [diff] [blame] | 524 | |
| 525 | static const char *GCCRegNames[] = { |
| 526 | "ax", "dx", "cx", "bx", "si", "di", "bp", "sp", |
| 527 | "st", "st(1)", "st(2)", "st(3)", "st(4)", "st(5)", "st(6)", "st(7)", |
Anders Carlsson | c411b49 | 2007-11-25 00:23:10 +0000 | [diff] [blame] | 528 | "argp", "flags", "fspr", "dirflag", "frame", |
Anders Carlsson | 7dd1c95 | 2007-11-24 23:38:12 +0000 | [diff] [blame] | 529 | "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7", |
| 530 | "mm0", "mm1", "mm2", "mm3", "mm4", "mm5", "mm6", "mm7", |
| 531 | "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", |
| 532 | "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15" |
| 533 | }; |
| 534 | |
| 535 | static void getGCCRegNames(const char * const *&Names, |
| 536 | unsigned &NumNames) { |
| 537 | Names = GCCRegNames; |
| 538 | NumNames = llvm::array_lengthof(GCCRegNames); |
| 539 | } |
| 540 | |
Chris Lattner | 0fb8d85 | 2008-03-08 08:24:01 +0000 | [diff] [blame] | 541 | static const TargetInfo::GCCRegAlias GCCRegAliases[] = { |
Anders Carlsson | 7dd1c95 | 2007-11-24 23:38:12 +0000 | [diff] [blame] | 542 | { { "al", "ah", "eax", "rax" }, "ax" }, |
| 543 | { { "bl", "bh", "ebx", "rbx" }, "bx" }, |
| 544 | { { "cl", "ch", "ecx", "rcx" }, "cx" }, |
| 545 | { { "dl", "dh", "edx", "rdx" }, "dx" }, |
| 546 | { { "esi", "rsi" }, "si" }, |
| 547 | { { "esp", "rsp" }, "sp" }, |
| 548 | { { "ebp", "rbp" }, "bp" }, |
| 549 | }; |
| 550 | |
Chris Lattner | 0fb8d85 | 2008-03-08 08:24:01 +0000 | [diff] [blame] | 551 | static void getGCCRegAliases(const TargetInfo::GCCRegAlias *&Aliases, |
Anders Carlsson | 7dd1c95 | 2007-11-24 23:38:12 +0000 | [diff] [blame] | 552 | unsigned &NumAliases) { |
| 553 | Aliases = GCCRegAliases; |
| 554 | NumAliases = llvm::array_lengthof(GCCRegAliases); |
| 555 | } |
| 556 | |
Anders Carlsson | 4ce4230 | 2007-11-27 04:11:28 +0000 | [diff] [blame] | 557 | static bool validateAsmConstraint(char c, |
| 558 | TargetInfo::ConstraintInfo &info) { |
| 559 | switch (c) { |
| 560 | default: return false; |
| 561 | case 'a': // eax. |
| 562 | case 'b': // ebx. |
| 563 | case 'c': // ecx. |
| 564 | case 'd': // edx. |
| 565 | case 'S': // esi. |
| 566 | case 'D': // edi. |
| 567 | case 'A': // edx:eax. |
| 568 | case 't': // top of floating point stack. |
| 569 | case 'u': // second from top of floating point stack. |
| 570 | case 'q': // a, b, c, d registers or any integer register in 64-bit. |
Anders Carlsson | ae77fa0 | 2008-03-10 22:37:16 +0000 | [diff] [blame] | 571 | case 'Z': // 32-bit integer constant for use with zero-extending x86_64 |
| 572 | // instructions. |
| 573 | case 'N': // unsigned 8-bit integer constant for use with in and out |
Anders Carlsson | f8e50d9 | 2008-02-18 17:00:25 +0000 | [diff] [blame] | 574 | // instructions. |
Anders Carlsson | 4ce4230 | 2007-11-27 04:11:28 +0000 | [diff] [blame] | 575 | info = (TargetInfo::ConstraintInfo)(info|TargetInfo::CI_AllowsRegister); |
| 576 | return true; |
| 577 | } |
| 578 | } |
| 579 | |
Lauro Ramos Venancio | bb37a04 | 2008-02-26 18:33:46 +0000 | [diff] [blame] | 580 | static std::string convertConstraint(const char Constraint) { |
| 581 | switch (Constraint) { |
| 582 | case 'a': return std::string("{ax}"); |
| 583 | case 'b': return std::string("{bx}"); |
| 584 | case 'c': return std::string("{cx}"); |
| 585 | case 'd': return std::string("{dx}"); |
| 586 | case 'S': return std::string("{si}"); |
| 587 | case 'D': return std::string("{di}"); |
| 588 | case 't': // top of floating point stack. |
| 589 | return std::string("{st}"); |
| 590 | case 'u': // second from top of floating point stack. |
| 591 | return std::string("{st(1)}"); // second from top of floating point stack. |
Lauro Ramos Venancio | bb37a04 | 2008-02-26 18:33:46 +0000 | [diff] [blame] | 592 | default: |
| 593 | return std::string(1, Constraint); |
| 594 | } |
| 595 | } |
| 596 | |
Anders Carlsson | 4ce4230 | 2007-11-27 04:11:28 +0000 | [diff] [blame] | 597 | const char *getClobbers() { |
| 598 | return "~{dirflag},~{fpsr},~{flags}"; |
| 599 | } |
| 600 | |
Anders Carlsson | 333052c | 2007-12-08 19:32:57 +0000 | [diff] [blame] | 601 | const char *getTargetPrefix() { |
| 602 | return "x86"; |
| 603 | } |
| 604 | |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 605 | } // End namespace X86 |
Chris Lattner | 9fd7361 | 2008-04-21 18:56:49 +0000 | [diff] [blame] | 606 | |
| 607 | |
| 608 | /// ARM builtin info. |
| 609 | namespace ARM { |
| 610 | const char *getTargetPrefix() { |
| 611 | return "arm"; |
| 612 | } |
| 613 | } // End namespace ARM |
| 614 | |
Chris Lattner | 9a3dedf | 2007-12-11 04:36:28 +0000 | [diff] [blame] | 615 | } // end namespace clang. |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 616 | |
| 617 | //===----------------------------------------------------------------------===// |
| 618 | // Specific target implementations. |
| 619 | //===----------------------------------------------------------------------===// |
| 620 | |
| 621 | |
| 622 | namespace { |
| 623 | class DarwinPPCTargetInfo : public DarwinTargetInfo { |
| 624 | public: |
Eli Friedman | 2fde2a5 | 2008-05-20 14:25:01 +0000 | [diff] [blame] | 625 | DarwinPPCTargetInfo(const std::string& triple) : DarwinTargetInfo(triple) { |
| 626 | CharIsSigned = false; |
| 627 | } |
Ted Kremenek | 4049948 | 2007-12-03 22:06:55 +0000 | [diff] [blame] | 628 | |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 629 | virtual void getTargetDefines(std::vector<char> &Defines) const { |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 630 | DarwinTargetInfo::getTargetDefines(Defines); |
| 631 | getPowerPCDefines(Defines, false); |
| 632 | } |
| 633 | virtual void getTargetBuiltins(const Builtin::Info *&Records, |
| 634 | unsigned &NumRecords) const { |
| 635 | PPC::getBuiltins(Records, NumRecords); |
| 636 | } |
Anders Carlsson | 8b58e8a | 2007-10-13 00:45:48 +0000 | [diff] [blame] | 637 | virtual const char *getVAListDeclaration() const { |
| 638 | return getPPCVAListDeclaration(); |
Anders Carlsson | 7dd1c95 | 2007-11-24 23:38:12 +0000 | [diff] [blame] | 639 | } |
Anders Carlsson | 333052c | 2007-12-08 19:32:57 +0000 | [diff] [blame] | 640 | virtual const char *getTargetPrefix() const { |
| 641 | return PPC::getTargetPrefix(); |
| 642 | } |
Anders Carlsson | 7dd1c95 | 2007-11-24 23:38:12 +0000 | [diff] [blame] | 643 | virtual void getGCCRegNames(const char * const *&Names, |
| 644 | unsigned &NumNames) const { |
| 645 | PPC::getGCCRegNames(Names, NumNames); |
| 646 | } |
| 647 | virtual void getGCCRegAliases(const GCCRegAlias *&Aliases, |
| 648 | unsigned &NumAliases) const { |
| 649 | PPC::getGCCRegAliases(Aliases, NumAliases); |
| 650 | } |
Anders Carlsson | 4ce4230 | 2007-11-27 04:11:28 +0000 | [diff] [blame] | 651 | virtual bool validateAsmConstraint(char c, |
| 652 | TargetInfo::ConstraintInfo &info) const { |
| 653 | return PPC::validateAsmConstraint(c, info); |
| 654 | } |
| 655 | virtual const char *getClobbers() const { |
| 656 | return PPC::getClobbers(); |
| 657 | } |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 658 | }; |
| 659 | } // end anonymous namespace. |
| 660 | |
| 661 | namespace { |
| 662 | class DarwinPPC64TargetInfo : public DarwinTargetInfo { |
| 663 | public: |
Chris Lattner | e5fde95 | 2008-05-09 06:17:04 +0000 | [diff] [blame] | 664 | DarwinPPC64TargetInfo(const std::string& triple) : DarwinTargetInfo(triple) { |
Eli Friedman | 2fde2a5 | 2008-05-20 14:25:01 +0000 | [diff] [blame] | 665 | CharIsSigned = false; |
Chris Lattner | e5fde95 | 2008-05-09 06:17:04 +0000 | [diff] [blame] | 666 | LongWidth = LongAlign = PointerWidth = PointerAlign = 64; |
| 667 | } |
Ted Kremenek | 4049948 | 2007-12-03 22:06:55 +0000 | [diff] [blame] | 668 | |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 669 | virtual void getTargetDefines(std::vector<char> &Defines) const { |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 670 | DarwinTargetInfo::getTargetDefines(Defines); |
| 671 | getPowerPCDefines(Defines, true); |
| 672 | } |
| 673 | virtual void getTargetBuiltins(const Builtin::Info *&Records, |
| 674 | unsigned &NumRecords) const { |
| 675 | PPC::getBuiltins(Records, NumRecords); |
| 676 | } |
Anders Carlsson | 8b58e8a | 2007-10-13 00:45:48 +0000 | [diff] [blame] | 677 | virtual const char *getVAListDeclaration() const { |
| 678 | return getPPCVAListDeclaration(); |
| 679 | } |
Anders Carlsson | 333052c | 2007-12-08 19:32:57 +0000 | [diff] [blame] | 680 | virtual const char *getTargetPrefix() const { |
| 681 | return PPC::getTargetPrefix(); |
| 682 | } |
Anders Carlsson | 7dd1c95 | 2007-11-24 23:38:12 +0000 | [diff] [blame] | 683 | virtual void getGCCRegNames(const char * const *&Names, |
| 684 | unsigned &NumNames) const { |
| 685 | PPC::getGCCRegNames(Names, NumNames); |
| 686 | } |
| 687 | virtual void getGCCRegAliases(const GCCRegAlias *&Aliases, |
| 688 | unsigned &NumAliases) const { |
| 689 | PPC::getGCCRegAliases(Aliases, NumAliases); |
| 690 | } |
Anders Carlsson | 4ce4230 | 2007-11-27 04:11:28 +0000 | [diff] [blame] | 691 | virtual bool validateAsmConstraint(char c, |
| 692 | TargetInfo::ConstraintInfo &info) const { |
| 693 | return PPC::validateAsmConstraint(c, info); |
| 694 | } |
| 695 | virtual const char *getClobbers() const { |
| 696 | return PPC::getClobbers(); |
| 697 | } |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 698 | }; |
| 699 | } // end anonymous namespace. |
| 700 | |
| 701 | namespace { |
| 702 | class DarwinI386TargetInfo : public DarwinTargetInfo { |
| 703 | public: |
Eli Friedman | 0b7b1cb | 2008-05-20 14:21:01 +0000 | [diff] [blame] | 704 | DarwinI386TargetInfo(const std::string& triple) : DarwinTargetInfo(triple) { |
| 705 | DoubleAlign = LongLongAlign = 32; |
| 706 | LongDoubleWidth = 96; |
| 707 | LongDoubleAlign = 32; |
| 708 | LongDoubleFormat = &llvm::APFloat::x87DoubleExtended; |
| 709 | } |
| 710 | |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 711 | virtual void getTargetDefines(std::vector<char> &Defines) const { |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 712 | DarwinTargetInfo::getTargetDefines(Defines); |
| 713 | getX86Defines(Defines, false); |
| 714 | } |
| 715 | virtual void getTargetBuiltins(const Builtin::Info *&Records, |
| 716 | unsigned &NumRecords) const { |
| 717 | X86::getBuiltins(Records, NumRecords); |
| 718 | } |
Anders Carlsson | 8b58e8a | 2007-10-13 00:45:48 +0000 | [diff] [blame] | 719 | virtual const char *getVAListDeclaration() const { |
| 720 | return getI386VAListDeclaration(); |
Anders Carlsson | 7dd1c95 | 2007-11-24 23:38:12 +0000 | [diff] [blame] | 721 | } |
Anders Carlsson | 333052c | 2007-12-08 19:32:57 +0000 | [diff] [blame] | 722 | virtual const char *getTargetPrefix() const { |
| 723 | return X86::getTargetPrefix(); |
| 724 | } |
Anders Carlsson | 7dd1c95 | 2007-11-24 23:38:12 +0000 | [diff] [blame] | 725 | virtual void getGCCRegNames(const char * const *&Names, |
| 726 | unsigned &NumNames) const { |
| 727 | X86::getGCCRegNames(Names, NumNames); |
| 728 | } |
| 729 | virtual void getGCCRegAliases(const GCCRegAlias *&Aliases, |
| 730 | unsigned &NumAliases) const { |
| 731 | X86::getGCCRegAliases(Aliases, NumAliases); |
Anders Carlsson | 8b58e8a | 2007-10-13 00:45:48 +0000 | [diff] [blame] | 732 | } |
Anders Carlsson | 4ce4230 | 2007-11-27 04:11:28 +0000 | [diff] [blame] | 733 | virtual bool validateAsmConstraint(char c, |
| 734 | TargetInfo::ConstraintInfo &info) const { |
| 735 | return X86::validateAsmConstraint(c, info); |
| 736 | } |
Lauro Ramos Venancio | bb37a04 | 2008-02-26 18:33:46 +0000 | [diff] [blame] | 737 | |
| 738 | virtual std::string convertConstraint(const char Constraint) const { |
| 739 | return X86::convertConstraint(Constraint); |
| 740 | } |
| 741 | |
Anders Carlsson | 4ce4230 | 2007-11-27 04:11:28 +0000 | [diff] [blame] | 742 | virtual const char *getClobbers() const { |
| 743 | return X86::getClobbers(); |
| 744 | } |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 745 | }; |
| 746 | } // end anonymous namespace. |
| 747 | |
| 748 | namespace { |
| 749 | class DarwinX86_64TargetInfo : public DarwinTargetInfo { |
| 750 | public: |
Chris Lattner | e5fde95 | 2008-05-09 06:17:04 +0000 | [diff] [blame] | 751 | DarwinX86_64TargetInfo(const std::string& triple) : DarwinTargetInfo(triple) { |
| 752 | LongWidth = LongAlign = PointerWidth = PointerAlign = 64; |
Eli Friedman | 0b7b1cb | 2008-05-20 14:21:01 +0000 | [diff] [blame] | 753 | LongDoubleWidth = 128; |
| 754 | LongDoubleAlign = 128; |
| 755 | LongDoubleFormat = &llvm::APFloat::x87DoubleExtended; |
Chris Lattner | e5fde95 | 2008-05-09 06:17:04 +0000 | [diff] [blame] | 756 | } |
Ted Kremenek | 4049948 | 2007-12-03 22:06:55 +0000 | [diff] [blame] | 757 | |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 758 | virtual void getTargetDefines(std::vector<char> &Defines) const { |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 759 | DarwinTargetInfo::getTargetDefines(Defines); |
| 760 | getX86Defines(Defines, true); |
| 761 | } |
| 762 | virtual void getTargetBuiltins(const Builtin::Info *&Records, |
| 763 | unsigned &NumRecords) const { |
| 764 | X86::getBuiltins(Records, NumRecords); |
| 765 | } |
Anders Carlsson | 8b58e8a | 2007-10-13 00:45:48 +0000 | [diff] [blame] | 766 | virtual const char *getVAListDeclaration() const { |
| 767 | return getX86_64VAListDeclaration(); |
Anders Carlsson | 7dd1c95 | 2007-11-24 23:38:12 +0000 | [diff] [blame] | 768 | } |
Anders Carlsson | 333052c | 2007-12-08 19:32:57 +0000 | [diff] [blame] | 769 | virtual const char *getTargetPrefix() const { |
| 770 | return X86::getTargetPrefix(); |
| 771 | } |
Anders Carlsson | 7dd1c95 | 2007-11-24 23:38:12 +0000 | [diff] [blame] | 772 | virtual void getGCCRegNames(const char * const *&Names, |
| 773 | unsigned &NumNames) const { |
| 774 | X86::getGCCRegNames(Names, NumNames); |
Anders Carlsson | 8b58e8a | 2007-10-13 00:45:48 +0000 | [diff] [blame] | 775 | } |
Anders Carlsson | 7dd1c95 | 2007-11-24 23:38:12 +0000 | [diff] [blame] | 776 | virtual void getGCCRegAliases(const GCCRegAlias *&Aliases, |
| 777 | unsigned &NumAliases) const { |
| 778 | X86::getGCCRegAliases(Aliases, NumAliases); |
| 779 | } |
Anders Carlsson | 4ce4230 | 2007-11-27 04:11:28 +0000 | [diff] [blame] | 780 | virtual bool validateAsmConstraint(char c, |
| 781 | TargetInfo::ConstraintInfo &info) const { |
| 782 | return X86::validateAsmConstraint(c, info); |
Lauro Ramos Venancio | bb37a04 | 2008-02-26 18:33:46 +0000 | [diff] [blame] | 783 | } |
| 784 | virtual std::string convertConstraint(const char Constraint) const { |
| 785 | return X86::convertConstraint(Constraint); |
| 786 | } |
Anders Carlsson | 4ce4230 | 2007-11-27 04:11:28 +0000 | [diff] [blame] | 787 | virtual const char *getClobbers() const { |
| 788 | return X86::getClobbers(); |
| 789 | } |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 790 | }; |
| 791 | } // end anonymous namespace. |
| 792 | |
Chris Lattner | 9fd7361 | 2008-04-21 18:56:49 +0000 | [diff] [blame] | 793 | |
| 794 | namespace { |
| 795 | class DarwinARMTargetInfo : public DarwinTargetInfo { |
| 796 | public: |
Eli Friedman | 0b7b1cb | 2008-05-20 14:21:01 +0000 | [diff] [blame] | 797 | DarwinARMTargetInfo(const std::string& triple) :DarwinTargetInfo(triple) { |
| 798 | // FIXME: Are the defaults corrent for ARM? |
| 799 | } |
Chris Lattner | 9fd7361 | 2008-04-21 18:56:49 +0000 | [diff] [blame] | 800 | |
| 801 | virtual void getTargetDefines(std::vector<char> &Defines) const { |
| 802 | DarwinTargetInfo::getTargetDefines(Defines); |
| 803 | getARMDefines(Defines); |
| 804 | } |
| 805 | virtual void getTargetBuiltins(const Builtin::Info *&Records, |
| 806 | unsigned &NumRecords) const { |
| 807 | NumRecords = 0; |
| 808 | } |
| 809 | virtual const char *getVAListDeclaration() const { |
| 810 | return getARMVAListDeclaration(); |
| 811 | } |
| 812 | virtual const char *getTargetPrefix() const { |
| 813 | return ARM::getTargetPrefix(); |
| 814 | } |
| 815 | |
| 816 | virtual void getGCCRegNames(const char * const *&Names, |
| 817 | unsigned &NumNames) const { |
| 818 | NumNames = 0; |
| 819 | } |
| 820 | virtual void getGCCRegAliases(const GCCRegAlias *&Aliases, |
| 821 | unsigned &NumAliases) const { |
| 822 | NumAliases = 0; |
| 823 | } |
| 824 | virtual bool validateAsmConstraint(char c, |
Nate Begeman | 222823a | 2008-04-22 05:03:19 +0000 | [diff] [blame] | 825 | TargetInfo::ConstraintInfo &info) const { |
| 826 | switch (c) { |
| 827 | default: |
| 828 | case 'l': // r0-r7 |
| 829 | case 'h': // r8-r15 |
| 830 | case 'w': // VFP Floating point register single precision |
| 831 | case 'P': // VFP Floating point register double precision |
| 832 | info = (TargetInfo::ConstraintInfo)(info|TargetInfo::CI_AllowsRegister); |
| 833 | return true; |
| 834 | } |
Chris Lattner | 9fd7361 | 2008-04-21 18:56:49 +0000 | [diff] [blame] | 835 | return false; |
| 836 | } |
| 837 | virtual const char *getClobbers() const { |
| 838 | return ""; |
| 839 | } |
| 840 | }; |
| 841 | } // end anonymous namespace. |
| 842 | |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 843 | namespace { |
Gabor Greif | 8a3ff0d | 2008-02-21 16:29:08 +0000 | [diff] [blame] | 844 | class SolarisSparcV8TargetInfo : public SolarisTargetInfo { |
| 845 | public: |
| 846 | SolarisSparcV8TargetInfo(const std::string& triple) : SolarisTargetInfo(triple) {} |
| 847 | |
| 848 | virtual void getTargetDefines(std::vector<char> &Defines) const { |
| 849 | SolarisTargetInfo::getTargetDefines(Defines); |
| 850 | // getSparcDefines(Defines, false); |
| 851 | Define(Defines, "__sparc"); |
Eli Friedman | 1dee5c5 | 2008-05-25 05:26:09 +0000 | [diff] [blame^] | 852 | Define(Defines, "__sparc__"); |
Gabor Greif | 8a3ff0d | 2008-02-21 16:29:08 +0000 | [diff] [blame] | 853 | Define(Defines, "__sparcv8"); |
| 854 | } |
| 855 | virtual void getTargetBuiltins(const Builtin::Info *&Records, |
| 856 | unsigned &NumRecords) const { |
| 857 | PPC::getBuiltins(Records, NumRecords); |
| 858 | } |
| 859 | virtual const char *getVAListDeclaration() const { |
| 860 | return getPPCVAListDeclaration(); |
| 861 | } |
| 862 | virtual const char *getTargetPrefix() const { |
| 863 | return PPC::getTargetPrefix(); |
| 864 | } |
| 865 | virtual void getGCCRegNames(const char * const *&Names, |
| 866 | unsigned &NumNames) const { |
| 867 | PPC::getGCCRegNames(Names, NumNames); |
| 868 | } |
| 869 | virtual void getGCCRegAliases(const GCCRegAlias *&Aliases, |
| 870 | unsigned &NumAliases) const { |
| 871 | PPC::getGCCRegAliases(Aliases, NumAliases); |
| 872 | } |
| 873 | virtual bool validateAsmConstraint(char c, |
| 874 | TargetInfo::ConstraintInfo &info) const { |
| 875 | return PPC::validateAsmConstraint(c, info); |
| 876 | } |
| 877 | virtual const char *getClobbers() const { |
| 878 | return PPC::getClobbers(); |
| 879 | } |
| 880 | }; |
| 881 | |
| 882 | } // end anonymous namespace. |
| 883 | |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 884 | |
Chris Lattner | 85970f3 | 2008-05-08 05:58:21 +0000 | [diff] [blame] | 885 | namespace { |
| 886 | class PIC16TargetInfo : public TargetInfo{ |
| 887 | public: |
| 888 | PIC16TargetInfo(const std::string& triple) : TargetInfo(triple) { |
Eli Friedman | 0b7b1cb | 2008-05-20 14:21:01 +0000 | [diff] [blame] | 889 | // FIXME: Is IntAlign really supposed to be 16? There seems |
| 890 | // little point on a platform with 8-bit loads. |
| 891 | IntWidth = IntAlign = LongAlign = LongLongAlign = PointerWidth = 16; |
| 892 | PointerAlign = 8; |
Chris Lattner | 85970f3 | 2008-05-08 05:58:21 +0000 | [diff] [blame] | 893 | } |
Chris Lattner | 727b3c4 | 2008-05-09 06:08:39 +0000 | [diff] [blame] | 894 | virtual uint64_t getPointerWidthV(unsigned AddrSpace) const { return 16; } |
| 895 | virtual uint64_t getPointerAlignV(unsigned AddrSpace) const { return 8; } |
Chris Lattner | 85970f3 | 2008-05-08 05:58:21 +0000 | [diff] [blame] | 896 | virtual void getTargetDefines(std::vector<char> &Defines) const { |
| 897 | Define(Defines, "__pic16"); |
| 898 | } |
| 899 | virtual void getTargetBuiltins(const Builtin::Info *&Records, |
| 900 | unsigned &NumRecords) const {} |
| 901 | virtual const char *getVAListDeclaration() const { return "";} |
| 902 | virtual const char *getClobbers() const {return "";} |
| 903 | virtual const char *getTargetPrefix() const {return "";} |
| 904 | virtual void getGCCRegNames(const char * const *&Names, |
| 905 | unsigned &NumNames) const {} |
| 906 | virtual bool validateAsmConstraint(char c, |
| 907 | TargetInfo::ConstraintInfo &info) const { |
| 908 | return true; |
| 909 | } |
| 910 | virtual void getGCCRegAliases(const GCCRegAlias *&Aliases, |
| 911 | unsigned &NumAliases) const {} |
| 912 | virtual bool useGlobalsForAutomaticVariables() const {return true;} |
| 913 | }; |
| 914 | } |
| 915 | |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 916 | //===----------------------------------------------------------------------===// |
| 917 | // Driver code |
| 918 | //===----------------------------------------------------------------------===// |
| 919 | |
Ted Kremenek | b97d767 | 2007-12-04 17:07:35 +0000 | [diff] [blame] | 920 | static inline bool IsX86(const std::string& TT) { |
Ted Kremenek | 4049948 | 2007-12-03 22:06:55 +0000 | [diff] [blame] | 921 | return (TT.size() >= 5 && TT[0] == 'i' && TT[2] == '8' && TT[3] == '6' && |
| 922 | TT[4] == '-' && TT[1] - '3' < 6); |
| 923 | } |
| 924 | |
Chris Lattner | fc45700 | 2008-03-05 01:18:20 +0000 | [diff] [blame] | 925 | /// CreateTargetInfo - Return the target info object for the specified target |
| 926 | /// triple. |
| 927 | TargetInfo* TargetInfo::CreateTargetInfo(const std::string &T) { |
Chris Lattner | 2c63b9f | 2007-12-05 18:41:05 +0000 | [diff] [blame] | 928 | if (T.find("ppc-") == 0 || T.find("powerpc-") == 0) |
Chris Lattner | 0fb8d85 | 2008-03-08 08:24:01 +0000 | [diff] [blame] | 929 | return new DarwinPPCTargetInfo(T); |
Eli Friedman | 0b7b1cb | 2008-05-20 14:21:01 +0000 | [diff] [blame] | 930 | |
Chris Lattner | fc45700 | 2008-03-05 01:18:20 +0000 | [diff] [blame] | 931 | if (T.find("ppc64-") == 0 || T.find("powerpc64-") == 0) |
Chris Lattner | 0fb8d85 | 2008-03-08 08:24:01 +0000 | [diff] [blame] | 932 | return new DarwinPPC64TargetInfo(T); |
Eli Friedman | 0b7b1cb | 2008-05-20 14:21:01 +0000 | [diff] [blame] | 933 | |
Chris Lattner | 9fd7361 | 2008-04-21 18:56:49 +0000 | [diff] [blame] | 934 | if (T.find("armv6-") == 0 || T.find("arm-") == 0) |
| 935 | return new DarwinARMTargetInfo(T); |
| 936 | |
Chris Lattner | fc45700 | 2008-03-05 01:18:20 +0000 | [diff] [blame] | 937 | if (T.find("sparc-") == 0) |
Chris Lattner | 0fb8d85 | 2008-03-08 08:24:01 +0000 | [diff] [blame] | 938 | return new SolarisSparcV8TargetInfo(T); // ugly hack |
Eli Friedman | 0b7b1cb | 2008-05-20 14:21:01 +0000 | [diff] [blame] | 939 | |
Chris Lattner | fc45700 | 2008-03-05 01:18:20 +0000 | [diff] [blame] | 940 | if (T.find("x86_64-") == 0) |
Chris Lattner | 0fb8d85 | 2008-03-08 08:24:01 +0000 | [diff] [blame] | 941 | return new DarwinX86_64TargetInfo(T); |
Eli Friedman | 0b7b1cb | 2008-05-20 14:21:01 +0000 | [diff] [blame] | 942 | |
Chris Lattner | 85970f3 | 2008-05-08 05:58:21 +0000 | [diff] [blame] | 943 | if (T.find("pic16-") == 0) |
| 944 | return new PIC16TargetInfo(T); |
| 945 | |
Chris Lattner | fc45700 | 2008-03-05 01:18:20 +0000 | [diff] [blame] | 946 | if (IsX86(T)) |
Chris Lattner | 0fb8d85 | 2008-03-08 08:24:01 +0000 | [diff] [blame] | 947 | return new DarwinI386TargetInfo(T); |
Eli Friedman | 0b7b1cb | 2008-05-20 14:21:01 +0000 | [diff] [blame] | 948 | |
Chris Lattner | fc45700 | 2008-03-05 01:18:20 +0000 | [diff] [blame] | 949 | return NULL; |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 950 | } |
Ted Kremenek | d507bab | 2008-03-04 17:47:18 +0000 | [diff] [blame] | 951 | |