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/TargetInfo.h" |
Anders Carlsson | 7dd1c95 | 2007-11-24 23:38:12 +0000 | [diff] [blame] | 18 | #include "llvm/ADT/STLExtras.h" |
Eli Friedman | d401189 | 2008-05-20 14:27:34 +0000 | [diff] [blame] | 19 | #include "llvm/ADT/APFloat.h" |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 20 | using namespace clang; |
| 21 | |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 22 | //===----------------------------------------------------------------------===// |
| 23 | // Common code shared among targets. |
| 24 | //===----------------------------------------------------------------------===// |
| 25 | |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 26 | static void Define(std::vector<char> &Buf, const char *Macro, |
| 27 | const char *Val = "1") { |
| 28 | const char *Def = "#define "; |
| 29 | Buf.insert(Buf.end(), Def, Def+strlen(Def)); |
| 30 | Buf.insert(Buf.end(), Macro, Macro+strlen(Macro)); |
| 31 | Buf.push_back(' '); |
| 32 | Buf.insert(Buf.end(), Val, Val+strlen(Val)); |
| 33 | Buf.push_back('\n'); |
| 34 | } |
| 35 | |
Chris Lattner | bd00eb8 | 2008-10-05 21:50:58 +0000 | [diff] [blame] | 36 | //===----------------------------------------------------------------------===// |
| 37 | // Defines specific to certain operating systems. |
| 38 | //===----------------------------------------------------------------------===// |
| 39 | |
Eli Friedman | ff158dd | 2008-08-20 07:28:14 +0000 | [diff] [blame] | 40 | static void getSolarisDefines(std::vector<char> &Defs) { |
| 41 | Define(Defs, "__SUN__"); |
| 42 | Define(Defs, "__SOLARIS__"); |
| 43 | } |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 44 | |
Chris Lattner | 98cb2a2 | 2008-10-16 17:04:31 +0000 | [diff] [blame] | 45 | static void getFreeBSDDefines(std::vector<char> &Defs, bool is64Bit, const char *Triple) { |
| 46 | // FreeBSD defines; list based off of gcc output |
| 47 | |
| 48 | const char *FreeBSD = strstr(Triple, "-freebsd"); |
| 49 | FreeBSD += strlen("-freebsd"); |
| 50 | char release[] = "X"; |
| 51 | release[0] = FreeBSD[0]; |
| 52 | char version[] = "X00001"; |
| 53 | version[0] = FreeBSD[0]; |
| 54 | |
| 55 | Define(Defs, "__FreeBSD__", release); |
| 56 | Define(Defs, "__FreeBSD_cc_version", version); |
| 57 | Define(Defs, "__KPRINTF_ATTRIBUTE__"); |
| 58 | Define(Defs, "unix"); |
| 59 | Define(Defs, "bsd"); |
| 60 | if (is64Bit) { |
| 61 | Define(Defs, "__LP64__"); |
| 62 | } |
| 63 | } |
| 64 | |
Chris Lattner | bd00eb8 | 2008-10-05 21:50:58 +0000 | [diff] [blame] | 65 | static void getDragonFlyDefines(std::vector<char> &Defs) { |
| 66 | // DragonFly defines; list based off of gcc output |
| 67 | Define(Defs, "__DragonFly__"); |
| 68 | Define(Defs, "__DragonFly_cc_version", "100001"); |
| 69 | Define(Defs, "__ELF__"); |
| 70 | Define(Defs, "__KPRINTF_ATTRIBUTE__"); |
| 71 | Define(Defs, "__tune_i386__"); |
| 72 | Define(Defs, "unix"); |
| 73 | Define(Defs, "__unix"); |
| 74 | Define(Defs, "__unix__"); |
| 75 | } |
| 76 | |
| 77 | static void getLinuxDefines(std::vector<char> &Defs) { |
| 78 | // Linux defines; list based off of gcc output |
| 79 | Define(Defs, "__unix__"); |
| 80 | Define(Defs, "__unix"); |
| 81 | Define(Defs, "unix"); |
| 82 | Define(Defs, "__linux__"); |
| 83 | Define(Defs, "__linux"); |
| 84 | Define(Defs, "linux"); |
| 85 | Define(Defs, "__gnu_linux__"); |
| 86 | } |
| 87 | |
Chris Lattner | c5dc8eb | 2008-09-30 01:00:25 +0000 | [diff] [blame] | 88 | static void getDarwinDefines(std::vector<char> &Defs, const char *Triple) { |
Eli Friedman | 872996c | 2008-08-20 02:34:37 +0000 | [diff] [blame] | 89 | Define(Defs, "__APPLE__"); |
| 90 | Define(Defs, "__MACH__"); |
Chris Lattner | c5dc8eb | 2008-09-30 01:00:25 +0000 | [diff] [blame] | 91 | |
| 92 | // Figure out which "darwin number" the target triple is. "darwin9" -> 10.5. |
| 93 | const char *Darwin = strstr(Triple, "-darwin"); |
| 94 | if (Darwin) { |
Chris Lattner | d376f6d | 2008-09-30 20:30:12 +0000 | [diff] [blame] | 95 | char DarwinStr[] = "1000"; |
Chris Lattner | c5dc8eb | 2008-09-30 01:00:25 +0000 | [diff] [blame] | 96 | Darwin += strlen("-darwin"); |
Chris Lattner | d376f6d | 2008-09-30 20:30:12 +0000 | [diff] [blame] | 97 | if (Darwin[0] >= '0' && Darwin[0] <= '9') { |
| 98 | unsigned DarwinNo = Darwin[0]-'0'; |
| 99 | ++Darwin; |
| 100 | |
| 101 | // Handle "darwin11". |
| 102 | if (DarwinNo == 1 && Darwin[0] >= '0' && Darwin[0] <= '9') { |
| 103 | DarwinNo = 10+Darwin[0]-'0'; |
| 104 | ++Darwin; |
| 105 | } |
| 106 | |
| 107 | if (DarwinNo >= 4 && DarwinNo <= 13) { // 10.0-10.9 |
Chris Lattner | c5dc8eb | 2008-09-30 01:00:25 +0000 | [diff] [blame] | 108 | // darwin7 -> 1030, darwin8 -> 1040, darwin9 -> 1050, etc. |
| 109 | DarwinStr[2] = '0' + DarwinNo-4; |
Chris Lattner | c5dc8eb | 2008-09-30 01:00:25 +0000 | [diff] [blame] | 110 | } |
Chris Lattner | d376f6d | 2008-09-30 20:30:12 +0000 | [diff] [blame] | 111 | |
| 112 | // Handle minor version: 10.4.9 -> darwin8.9 -> "1049" |
| 113 | if (Darwin[0] == '.' && Darwin[1] >= '0' && Darwin[1] <= '9' && |
| 114 | Darwin[2] == '\0') |
| 115 | DarwinStr[3] = Darwin[1]; |
| 116 | |
Chris Lattner | c5dc8eb | 2008-09-30 01:00:25 +0000 | [diff] [blame] | 117 | } |
Chris Lattner | d376f6d | 2008-09-30 20:30:12 +0000 | [diff] [blame] | 118 | Define(Defs, "__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__", DarwinStr); |
Chris Lattner | c5dc8eb | 2008-09-30 01:00:25 +0000 | [diff] [blame] | 119 | } |
Eli Friedman | 872996c | 2008-08-20 02:34:37 +0000 | [diff] [blame] | 120 | } |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 121 | |
Chris Lattner | bd00eb8 | 2008-10-05 21:50:58 +0000 | [diff] [blame] | 122 | //===----------------------------------------------------------------------===// |
| 123 | // Defines specific to certain architectures. |
| 124 | //===----------------------------------------------------------------------===// |
Eli Friedman | 5fb0a02 | 2008-08-21 00:24:02 +0000 | [diff] [blame] | 125 | |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 126 | /// getPowerPCDefines - Return a set of the PowerPC-specific #defines that are |
| 127 | /// not tied to a specific subtarget. |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 128 | static void getPowerPCDefines(std::vector<char> &Defs, bool is64Bit) { |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 129 | // Target identification. |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 130 | Define(Defs, "__ppc__"); |
| 131 | Define(Defs, "_ARCH_PPC"); |
| 132 | Define(Defs, "__POWERPC__"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 133 | if (is64Bit) { |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 134 | Define(Defs, "_ARCH_PPC64"); |
| 135 | Define(Defs, "_LP64"); |
| 136 | Define(Defs, "__LP64__"); |
| 137 | Define(Defs, "__ppc64__"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 138 | } else { |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 139 | Define(Defs, "__ppc__"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 140 | } |
| 141 | |
| 142 | // Target properties. |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 143 | Define(Defs, "_BIG_ENDIAN"); |
| 144 | Define(Defs, "__BIG_ENDIAN__"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 145 | |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 146 | // Subtarget options. |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 147 | Define(Defs, "__NATURAL_ALIGNMENT__"); |
| 148 | Define(Defs, "__REGISTER_PREFIX__", ""); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 149 | |
Chris Lattner | 3da3568 | 2008-10-05 21:49:27 +0000 | [diff] [blame] | 150 | // FIXME: Should be controlled by command line option. |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 151 | Define(Defs, "__LONG_DOUBLE_128__"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 152 | } |
| 153 | |
| 154 | /// getX86Defines - Return a set of the X86-specific #defines that are |
| 155 | /// not tied to a specific subtarget. |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 156 | static void getX86Defines(std::vector<char> &Defs, bool is64Bit) { |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 157 | // Target identification. |
| 158 | if (is64Bit) { |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 159 | Define(Defs, "_LP64"); |
| 160 | Define(Defs, "__LP64__"); |
| 161 | Define(Defs, "__amd64__"); |
| 162 | Define(Defs, "__amd64"); |
| 163 | Define(Defs, "__x86_64"); |
| 164 | Define(Defs, "__x86_64__"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 165 | } else { |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 166 | Define(Defs, "__i386__"); |
| 167 | Define(Defs, "__i386"); |
| 168 | Define(Defs, "i386"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 169 | } |
| 170 | |
| 171 | // Target properties. |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 172 | Define(Defs, "__LITTLE_ENDIAN__"); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 173 | |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 174 | // Subtarget options. |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 175 | Define(Defs, "__nocona"); |
| 176 | Define(Defs, "__nocona__"); |
| 177 | Define(Defs, "__tune_nocona__"); |
| 178 | Define(Defs, "__SSE2_MATH__"); |
| 179 | Define(Defs, "__SSE2__"); |
| 180 | Define(Defs, "__SSE_MATH__"); |
| 181 | Define(Defs, "__SSE__"); |
| 182 | Define(Defs, "__MMX__"); |
| 183 | Define(Defs, "__REGISTER_PREFIX__", ""); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 184 | } |
| 185 | |
Chris Lattner | b644405 | 2008-04-21 20:19:54 +0000 | [diff] [blame] | 186 | /// getARMDefines - Return a set of the ARM-specific #defines that are |
Chris Lattner | 9fd7361 | 2008-04-21 18:56:49 +0000 | [diff] [blame] | 187 | /// not tied to a specific subtarget. |
| 188 | static void getARMDefines(std::vector<char> &Defs) { |
| 189 | // Target identification. |
| 190 | Define(Defs, "__arm"); |
| 191 | Define(Defs, "__arm__"); |
| 192 | |
| 193 | // Target properties. |
| 194 | Define(Defs, "__LITTLE_ENDIAN__"); |
| 195 | |
Chris Lattner | 9fd7361 | 2008-04-21 18:56:49 +0000 | [diff] [blame] | 196 | // Subtarget options. [hard coded to v6 for now] |
| 197 | Define(Defs, "__ARM_ARCH_6K__"); |
| 198 | Define(Defs, "__ARMEL__"); |
| 199 | Define(Defs, "__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__", "20000"); |
Chris Lattner | 9fd7361 | 2008-04-21 18:56:49 +0000 | [diff] [blame] | 200 | } |
| 201 | |
Eli Friedman | fd5a412 | 2008-08-20 23:11:40 +0000 | [diff] [blame] | 202 | //===----------------------------------------------------------------------===// |
| 203 | // Specific target implementations. |
| 204 | //===----------------------------------------------------------------------===// |
Anders Carlsson | 8b58e8a | 2007-10-13 00:45:48 +0000 | [diff] [blame] | 205 | |
Eli Friedman | fd5a412 | 2008-08-20 23:11:40 +0000 | [diff] [blame] | 206 | namespace { |
| 207 | // PPC abstract base class |
| 208 | class PPCTargetInfo : public TargetInfo { |
| 209 | static const Builtin::Info BuiltinInfo[]; |
| 210 | static const char * const GCCRegNames[]; |
| 211 | static const TargetInfo::GCCRegAlias GCCRegAliases[]; |
| 212 | |
| 213 | public: |
| 214 | PPCTargetInfo(const std::string& triple) : TargetInfo(triple) { |
| 215 | CharIsSigned = false; |
| 216 | } |
| 217 | virtual void getTargetBuiltins(const Builtin::Info *&Records, |
| 218 | unsigned &NumRecords) const { |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 219 | Records = BuiltinInfo; |
Eli Friedman | fd5a412 | 2008-08-20 23:11:40 +0000 | [diff] [blame] | 220 | NumRecords = clang::PPC::LastTSBuiltin-Builtin::FirstTSBuiltin; |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 221 | } |
Eli Friedman | fd5a412 | 2008-08-20 23:11:40 +0000 | [diff] [blame] | 222 | virtual const char *getVAListDeclaration() const { |
Chris Lattner | a07708f | 2008-10-27 01:11:29 +0000 | [diff] [blame^] | 223 | return "typedef char* __builtin_va_list;"; |
| 224 | // This is the right definition for ABI/V4: System V.4/eabi. |
| 225 | /*return "typedef struct __va_list_tag {" |
Eli Friedman | fd5a412 | 2008-08-20 23:11:40 +0000 | [diff] [blame] | 226 | " unsigned char gpr;" |
| 227 | " unsigned char fpr;" |
| 228 | " unsigned short reserved;" |
| 229 | " void* overflow_arg_area;" |
| 230 | " void* reg_save_area;" |
Chris Lattner | a07708f | 2008-10-27 01:11:29 +0000 | [diff] [blame^] | 231 | "} __builtin_va_list[1];";*/ |
Anders Carlsson | 7dd1c95 | 2007-11-24 23:38:12 +0000 | [diff] [blame] | 232 | } |
Eli Friedman | fd5a412 | 2008-08-20 23:11:40 +0000 | [diff] [blame] | 233 | virtual const char *getTargetPrefix() const { |
| 234 | return "ppc"; |
Anders Carlsson | 4ce4230 | 2007-11-27 04:11:28 +0000 | [diff] [blame] | 235 | } |
Eli Friedman | fd5a412 | 2008-08-20 23:11:40 +0000 | [diff] [blame] | 236 | virtual void getGCCRegNames(const char * const *&Names, |
| 237 | unsigned &NumNames) const; |
| 238 | virtual void getGCCRegAliases(const GCCRegAlias *&Aliases, |
| 239 | unsigned &NumAliases) const; |
| 240 | virtual bool validateAsmConstraint(char c, |
| 241 | TargetInfo::ConstraintInfo &info) const { |
Anders Carlsson | 4ce4230 | 2007-11-27 04:11:28 +0000 | [diff] [blame] | 242 | switch (c) { |
| 243 | default: return false; |
| 244 | case 'O': // Zero |
| 245 | return true; |
| 246 | case 'b': // Base register |
| 247 | case 'f': // Floating point register |
| 248 | info = (TargetInfo::ConstraintInfo)(info|TargetInfo::CI_AllowsRegister); |
| 249 | return true; |
| 250 | } |
| 251 | } |
Eli Friedman | fd5a412 | 2008-08-20 23:11:40 +0000 | [diff] [blame] | 252 | virtual const char *getClobbers() const { |
| 253 | return ""; |
Anders Carlsson | 4ce4230 | 2007-11-27 04:11:28 +0000 | [diff] [blame] | 254 | } |
Eli Friedman | fd5a412 | 2008-08-20 23:11:40 +0000 | [diff] [blame] | 255 | }; |
Anders Carlsson | 4ce4230 | 2007-11-27 04:11:28 +0000 | [diff] [blame] | 256 | |
Eli Friedman | fd5a412 | 2008-08-20 23:11:40 +0000 | [diff] [blame] | 257 | const Builtin::Info PPCTargetInfo::BuiltinInfo[] = { |
| 258 | #define BUILTIN(ID, TYPE, ATTRS) { #ID, TYPE, ATTRS }, |
| 259 | #include "clang/AST/PPCBuiltins.def" |
| 260 | }; |
Chris Lattner | 9fd7361 | 2008-04-21 18:56:49 +0000 | [diff] [blame] | 261 | |
Eli Friedman | fd5a412 | 2008-08-20 23:11:40 +0000 | [diff] [blame] | 262 | const char * const PPCTargetInfo::GCCRegNames[] = { |
| 263 | "0", "1", "2", "3", "4", "5", "6", "7", |
| 264 | "8", "9", "10", "11", "12", "13", "14", "15", |
| 265 | "16", "17", "18", "19", "20", "21", "22", "23", |
| 266 | "24", "25", "26", "27", "28", "29", "30", "31", |
| 267 | "0", "1", "2", "3", "4", "5", "6", "7", |
| 268 | "8", "9", "10", "11", "12", "13", "14", "15", |
| 269 | "16", "17", "18", "19", "20", "21", "22", "23", |
| 270 | "24", "25", "26", "27", "28", "29", "30", "31", |
| 271 | "mq", "lr", "ctr", "ap", |
| 272 | "0", "1", "2", "3", "4", "5", "6", "7", |
| 273 | "xer", |
| 274 | "0", "1", "2", "3", "4", "5", "6", "7", |
| 275 | "8", "9", "10", "11", "12", "13", "14", "15", |
| 276 | "16", "17", "18", "19", "20", "21", "22", "23", |
| 277 | "24", "25", "26", "27", "28", "29", "30", "31", |
| 278 | "vrsave", "vscr", |
| 279 | "spe_acc", "spefscr", |
| 280 | "sfp" |
| 281 | }; |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 282 | |
Eli Friedman | fd5a412 | 2008-08-20 23:11:40 +0000 | [diff] [blame] | 283 | void PPCTargetInfo::getGCCRegNames(const char * const *&Names, |
| 284 | unsigned &NumNames) const { |
| 285 | Names = GCCRegNames; |
| 286 | NumNames = llvm::array_lengthof(GCCRegNames); |
| 287 | } |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 288 | |
Eli Friedman | fd5a412 | 2008-08-20 23:11:40 +0000 | [diff] [blame] | 289 | const TargetInfo::GCCRegAlias PPCTargetInfo::GCCRegAliases[] = { |
| 290 | // While some of these aliases do map to different registers |
| 291 | // they still share the same register name. |
| 292 | { { "cc", "cr0", "fr0", "r0", "v0"}, "0" }, |
| 293 | { { "cr1", "fr1", "r1", "sp", "v1"}, "1" }, |
| 294 | { { "cr2", "fr2", "r2", "toc", "v2"}, "2" }, |
| 295 | { { "cr3", "fr3", "r3", "v3"}, "3" }, |
| 296 | { { "cr4", "fr4", "r4", "v4"}, "4" }, |
| 297 | { { "cr5", "fr5", "r5", "v5"}, "5" }, |
| 298 | { { "cr6", "fr6", "r6", "v6"}, "6" }, |
| 299 | { { "cr7", "fr7", "r7", "v7"}, "7" }, |
| 300 | { { "fr8", "r8", "v8"}, "8" }, |
| 301 | { { "fr9", "r9", "v9"}, "9" }, |
| 302 | { { "fr10", "r10", "v10"}, "10" }, |
| 303 | { { "fr11", "r11", "v11"}, "11" }, |
| 304 | { { "fr12", "r12", "v12"}, "12" }, |
| 305 | { { "fr13", "r13", "v13"}, "13" }, |
| 306 | { { "fr14", "r14", "v14"}, "14" }, |
| 307 | { { "fr15", "r15", "v15"}, "15" }, |
| 308 | { { "fr16", "r16", "v16"}, "16" }, |
| 309 | { { "fr17", "r17", "v17"}, "17" }, |
| 310 | { { "fr18", "r18", "v18"}, "18" }, |
| 311 | { { "fr19", "r19", "v19"}, "19" }, |
| 312 | { { "fr20", "r20", "v20"}, "20" }, |
| 313 | { { "fr21", "r21", "v21"}, "21" }, |
| 314 | { { "fr22", "r22", "v22"}, "22" }, |
| 315 | { { "fr23", "r23", "v23"}, "23" }, |
| 316 | { { "fr24", "r24", "v24"}, "24" }, |
| 317 | { { "fr25", "r25", "v25"}, "25" }, |
| 318 | { { "fr26", "r26", "v26"}, "26" }, |
| 319 | { { "fr27", "r27", "v27"}, "27" }, |
| 320 | { { "fr28", "r28", "v28"}, "28" }, |
| 321 | { { "fr29", "r29", "v29"}, "29" }, |
| 322 | { { "fr30", "r30", "v30"}, "30" }, |
| 323 | { { "fr31", "r31", "v31"}, "31" }, |
| 324 | }; |
| 325 | |
| 326 | void PPCTargetInfo::getGCCRegAliases(const GCCRegAlias *&Aliases, |
| 327 | unsigned &NumAliases) const { |
| 328 | Aliases = GCCRegAliases; |
| 329 | NumAliases = llvm::array_lengthof(GCCRegAliases); |
| 330 | } |
| 331 | } // end anonymous namespace. |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 332 | |
| 333 | namespace { |
Eli Friedman | fd5a412 | 2008-08-20 23:11:40 +0000 | [diff] [blame] | 334 | class PPC32TargetInfo : public PPCTargetInfo { |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 335 | public: |
Eli Friedman | 2b16165 | 2008-08-21 00:13:15 +0000 | [diff] [blame] | 336 | PPC32TargetInfo(const std::string& triple) : PPCTargetInfo(triple) { |
| 337 | DescriptionString = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-" |
| 338 | "i64:64:64-f32:32:32-f64:64:64-v128:128:128"; |
| 339 | } |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 340 | virtual void getTargetDefines(std::vector<char> &Defines) const { |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 341 | getPowerPCDefines(Defines, false); |
| 342 | } |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 343 | }; |
| 344 | } // end anonymous namespace. |
| 345 | |
| 346 | namespace { |
Eli Friedman | fd5a412 | 2008-08-20 23:11:40 +0000 | [diff] [blame] | 347 | class PPC64TargetInfo : public PPCTargetInfo { |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 348 | public: |
Eli Friedman | fd5a412 | 2008-08-20 23:11:40 +0000 | [diff] [blame] | 349 | PPC64TargetInfo(const std::string& triple) : PPCTargetInfo(triple) { |
Chris Lattner | e5fde95 | 2008-05-09 06:17:04 +0000 | [diff] [blame] | 350 | LongWidth = LongAlign = PointerWidth = PointerAlign = 64; |
Eli Friedman | 2b16165 | 2008-08-21 00:13:15 +0000 | [diff] [blame] | 351 | DescriptionString = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-" |
| 352 | "i64:64:64-f32:32:32-f64:64:64-v128:128:128"; |
Chris Lattner | e5fde95 | 2008-05-09 06:17:04 +0000 | [diff] [blame] | 353 | } |
Chris Lattner | 0db667a | 2007-10-06 06:57:34 +0000 | [diff] [blame] | 354 | virtual void getTargetDefines(std::vector<char> &Defines) const { |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 355 | getPowerPCDefines(Defines, true); |
| 356 | } |
Eli Friedman | fd5a412 | 2008-08-20 23:11:40 +0000 | [diff] [blame] | 357 | }; |
| 358 | } // end anonymous namespace. |
| 359 | |
| 360 | namespace { |
| 361 | class DarwinPPCTargetInfo : public PPC32TargetInfo { |
| 362 | public: |
| 363 | DarwinPPCTargetInfo(const std::string& triple) : PPC32TargetInfo(triple) {} |
| 364 | virtual void getTargetDefines(std::vector<char> &Defines) const { |
| 365 | PPC32TargetInfo::getTargetDefines(Defines); |
Chris Lattner | c5dc8eb | 2008-09-30 01:00:25 +0000 | [diff] [blame] | 366 | getDarwinDefines(Defines, getTargetTriple()); |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 367 | } |
Daniel Dunbar | 3454295 | 2008-08-23 08:43:39 +0000 | [diff] [blame] | 368 | |
| 369 | virtual bool useNeXTRuntimeAsDefault() const { return true; } |
Eli Friedman | fd5a412 | 2008-08-20 23:11:40 +0000 | [diff] [blame] | 370 | }; |
| 371 | } // end anonymous namespace. |
| 372 | |
| 373 | namespace { |
| 374 | class DarwinPPC64TargetInfo : public PPC64TargetInfo { |
| 375 | public: |
| 376 | DarwinPPC64TargetInfo(const std::string& triple) : PPC64TargetInfo(triple) {} |
| 377 | virtual void getTargetDefines(std::vector<char> &Defines) const { |
| 378 | PPC64TargetInfo::getTargetDefines(Defines); |
Chris Lattner | c5dc8eb | 2008-09-30 01:00:25 +0000 | [diff] [blame] | 379 | getDarwinDefines(Defines, getTargetTriple()); |
Anders Carlsson | 7dd1c95 | 2007-11-24 23:38:12 +0000 | [diff] [blame] | 380 | } |
Daniel Dunbar | 3454295 | 2008-08-23 08:43:39 +0000 | [diff] [blame] | 381 | |
| 382 | virtual bool useNeXTRuntimeAsDefault() const { return true; } |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 383 | }; |
| 384 | } // end anonymous namespace. |
| 385 | |
| 386 | namespace { |
Eli Friedman | 872996c | 2008-08-20 02:34:37 +0000 | [diff] [blame] | 387 | // Namespace for x86 abstract base class |
| 388 | const Builtin::Info BuiltinInfo[] = { |
| 389 | #define BUILTIN(ID, TYPE, ATTRS) { #ID, TYPE, ATTRS }, |
| 390 | #include "clang/AST/X86Builtins.def" |
| 391 | }; |
Eli Friedman | 0b7b1cb | 2008-05-20 14:21:01 +0000 | [diff] [blame] | 392 | |
Eli Friedman | 872996c | 2008-08-20 02:34:37 +0000 | [diff] [blame] | 393 | const char *GCCRegNames[] = { |
| 394 | "ax", "dx", "cx", "bx", "si", "di", "bp", "sp", |
| 395 | "st", "st(1)", "st(2)", "st(3)", "st(4)", "st(5)", "st(6)", "st(7)", |
| 396 | "argp", "flags", "fspr", "dirflag", "frame", |
| 397 | "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7", |
| 398 | "mm0", "mm1", "mm2", "mm3", "mm4", "mm5", "mm6", "mm7", |
| 399 | "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", |
| 400 | "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15" |
| 401 | }; |
| 402 | |
| 403 | const TargetInfo::GCCRegAlias GCCRegAliases[] = { |
| 404 | { { "al", "ah", "eax", "rax" }, "ax" }, |
| 405 | { { "bl", "bh", "ebx", "rbx" }, "bx" }, |
| 406 | { { "cl", "ch", "ecx", "rcx" }, "cx" }, |
| 407 | { { "dl", "dh", "edx", "rdx" }, "dx" }, |
| 408 | { { "esi", "rsi" }, "si" }, |
| 409 | { { "edi", "rdi" }, "di" }, |
| 410 | { { "esp", "rsp" }, "sp" }, |
| 411 | { { "ebp", "rbp" }, "bp" }, |
| 412 | }; |
| 413 | |
| 414 | // X86 target abstract base class; x86-32 and x86-64 are very close, so |
| 415 | // most of the implementation can be shared. |
| 416 | class X86TargetInfo : public TargetInfo { |
| 417 | public: |
| 418 | X86TargetInfo(const std::string& triple) : TargetInfo(triple) { |
| 419 | LongDoubleFormat = &llvm::APFloat::x87DoubleExtended; |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 420 | } |
| 421 | virtual void getTargetBuiltins(const Builtin::Info *&Records, |
| 422 | unsigned &NumRecords) const { |
Eli Friedman | 872996c | 2008-08-20 02:34:37 +0000 | [diff] [blame] | 423 | Records = BuiltinInfo; |
| 424 | NumRecords = clang::X86::LastTSBuiltin-Builtin::FirstTSBuiltin; |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 425 | } |
Anders Carlsson | 333052c | 2007-12-08 19:32:57 +0000 | [diff] [blame] | 426 | virtual const char *getTargetPrefix() const { |
Eli Friedman | 872996c | 2008-08-20 02:34:37 +0000 | [diff] [blame] | 427 | return "x86"; |
Anders Carlsson | 333052c | 2007-12-08 19:32:57 +0000 | [diff] [blame] | 428 | } |
Anders Carlsson | 7dd1c95 | 2007-11-24 23:38:12 +0000 | [diff] [blame] | 429 | virtual void getGCCRegNames(const char * const *&Names, |
Eli Friedman | 872996c | 2008-08-20 02:34:37 +0000 | [diff] [blame] | 430 | unsigned &NumNames) const { |
| 431 | Names = GCCRegNames; |
| 432 | NumNames = llvm::array_lengthof(GCCRegNames); |
Anders Carlsson | 7dd1c95 | 2007-11-24 23:38:12 +0000 | [diff] [blame] | 433 | } |
| 434 | virtual void getGCCRegAliases(const GCCRegAlias *&Aliases, |
| 435 | unsigned &NumAliases) const { |
Eli Friedman | 872996c | 2008-08-20 02:34:37 +0000 | [diff] [blame] | 436 | Aliases = GCCRegAliases; |
| 437 | NumAliases = llvm::array_lengthof(GCCRegAliases); |
Anders Carlsson | 8b58e8a | 2007-10-13 00:45:48 +0000 | [diff] [blame] | 438 | } |
Anders Carlsson | 4ce4230 | 2007-11-27 04:11:28 +0000 | [diff] [blame] | 439 | virtual bool validateAsmConstraint(char c, |
Eli Friedman | 872996c | 2008-08-20 02:34:37 +0000 | [diff] [blame] | 440 | TargetInfo::ConstraintInfo &info) const; |
| 441 | virtual std::string convertConstraint(const char Constraint) const; |
Anders Carlsson | 4ce4230 | 2007-11-27 04:11:28 +0000 | [diff] [blame] | 442 | virtual const char *getClobbers() const { |
Eli Friedman | 872996c | 2008-08-20 02:34:37 +0000 | [diff] [blame] | 443 | return "~{dirflag},~{fpsr},~{flags}"; |
| 444 | } |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 445 | }; |
Eli Friedman | 872996c | 2008-08-20 02:34:37 +0000 | [diff] [blame] | 446 | |
| 447 | bool |
| 448 | X86TargetInfo::validateAsmConstraint(char c, |
| 449 | TargetInfo::ConstraintInfo &info) const { |
| 450 | switch (c) { |
| 451 | default: return false; |
| 452 | case 'a': // eax. |
| 453 | case 'b': // ebx. |
| 454 | case 'c': // ecx. |
| 455 | case 'd': // edx. |
| 456 | case 'S': // esi. |
| 457 | case 'D': // edi. |
| 458 | case 'A': // edx:eax. |
| 459 | case 't': // top of floating point stack. |
| 460 | case 'u': // second from top of floating point stack. |
| 461 | case 'q': // Any register accessible as [r]l: a, b, c, and d. |
Anders Carlsson | 2285e62 | 2008-10-06 00:41:45 +0000 | [diff] [blame] | 462 | case 'y': // Any MMX register. |
Anders Carlsson | d2459f9 | 2008-10-06 19:17:39 +0000 | [diff] [blame] | 463 | case 'x': // Any SSE register. |
Eli Friedman | 872996c | 2008-08-20 02:34:37 +0000 | [diff] [blame] | 464 | case 'Q': // Any register accessible as [r]h: a, b, c, and d. |
| 465 | case 'Z': // 32-bit integer constant for use with zero-extending x86_64 |
| 466 | // instructions. |
| 467 | case 'N': // unsigned 8-bit integer constant for use with in and out |
| 468 | // instructions. |
| 469 | info = (TargetInfo::ConstraintInfo)(info|TargetInfo::CI_AllowsRegister); |
| 470 | return true; |
| 471 | } |
| 472 | } |
| 473 | |
| 474 | std::string |
| 475 | X86TargetInfo::convertConstraint(const char Constraint) const { |
| 476 | switch (Constraint) { |
| 477 | case 'a': return std::string("{ax}"); |
| 478 | case 'b': return std::string("{bx}"); |
| 479 | case 'c': return std::string("{cx}"); |
| 480 | case 'd': return std::string("{dx}"); |
| 481 | case 'S': return std::string("{si}"); |
| 482 | case 'D': return std::string("{di}"); |
| 483 | case 't': // top of floating point stack. |
| 484 | return std::string("{st}"); |
| 485 | case 'u': // second from top of floating point stack. |
| 486 | return std::string("{st(1)}"); // second from top of floating point stack. |
| 487 | default: |
| 488 | return std::string(1, Constraint); |
| 489 | } |
| 490 | } |
Eli Friedman | 872996c | 2008-08-20 02:34:37 +0000 | [diff] [blame] | 491 | } // end anonymous namespace |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 492 | |
| 493 | namespace { |
Eli Friedman | 872996c | 2008-08-20 02:34:37 +0000 | [diff] [blame] | 494 | // X86-32 generic target |
| 495 | class X86_32TargetInfo : public X86TargetInfo { |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 496 | public: |
Eli Friedman | 872996c | 2008-08-20 02:34:37 +0000 | [diff] [blame] | 497 | X86_32TargetInfo(const std::string& triple) : X86TargetInfo(triple) { |
| 498 | DoubleAlign = LongLongAlign = 32; |
| 499 | LongDoubleWidth = 96; |
| 500 | LongDoubleAlign = 32; |
Eli Friedman | 2b16165 | 2008-08-21 00:13:15 +0000 | [diff] [blame] | 501 | DescriptionString = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-" |
| 502 | "i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-" |
| 503 | "a0:0:64-f80:32:32"; |
Eli Friedman | 872996c | 2008-08-20 02:34:37 +0000 | [diff] [blame] | 504 | } |
| 505 | virtual const char *getVAListDeclaration() const { |
Eli Friedman | ff158dd | 2008-08-20 07:28:14 +0000 | [diff] [blame] | 506 | return "typedef char* __builtin_va_list;"; |
Eli Friedman | 872996c | 2008-08-20 02:34:37 +0000 | [diff] [blame] | 507 | } |
| 508 | virtual void getTargetDefines(std::vector<char> &Defines) const { |
| 509 | getX86Defines(Defines, false); |
| 510 | } |
| 511 | }; |
| 512 | } // end anonymous namespace |
| 513 | |
| 514 | namespace { |
| 515 | // x86-32 Darwin (OS X) target |
| 516 | class DarwinI386TargetInfo : public X86_32TargetInfo { |
| 517 | public: |
| 518 | DarwinI386TargetInfo(const std::string& triple) : X86_32TargetInfo(triple) { |
| 519 | LongDoubleWidth = 128; |
| 520 | LongDoubleAlign = 128; |
Eli Friedman | 2b16165 | 2008-08-21 00:13:15 +0000 | [diff] [blame] | 521 | DescriptionString = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-" |
| 522 | "i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-" |
| 523 | "a0:0:64-f80:128:128"; |
Eli Friedman | 872996c | 2008-08-20 02:34:37 +0000 | [diff] [blame] | 524 | } |
| 525 | virtual void getTargetDefines(std::vector<char> &Defines) const { |
| 526 | X86_32TargetInfo::getTargetDefines(Defines); |
Chris Lattner | c5dc8eb | 2008-09-30 01:00:25 +0000 | [diff] [blame] | 527 | getDarwinDefines(Defines, getTargetTriple()); |
Eli Friedman | 872996c | 2008-08-20 02:34:37 +0000 | [diff] [blame] | 528 | } |
Daniel Dunbar | 3454295 | 2008-08-23 08:43:39 +0000 | [diff] [blame] | 529 | virtual bool useNeXTRuntimeAsDefault() const { return true; } |
Eli Friedman | 872996c | 2008-08-20 02:34:37 +0000 | [diff] [blame] | 530 | }; |
| 531 | } // end anonymous namespace |
| 532 | |
| 533 | namespace { |
Chris Lattner | 98cb2a2 | 2008-10-16 17:04:31 +0000 | [diff] [blame] | 534 | // x86-32 FreeBSD target |
| 535 | class FreeBSDX86_32TargetInfo : public X86_32TargetInfo { |
| 536 | public: |
| 537 | FreeBSDX86_32TargetInfo(const std::string& triple) : X86_32TargetInfo(triple) { |
| 538 | } |
| 539 | virtual void getTargetDefines(std::vector<char> &Defines) const { |
| 540 | X86_32TargetInfo::getTargetDefines(Defines); |
| 541 | getFreeBSDDefines(Defines, 0, getTargetTriple()); |
| 542 | } |
| 543 | }; |
| 544 | } // end anonymous namespace |
| 545 | |
| 546 | namespace { |
Chris Lattner | d4faca4 | 2008-08-23 18:23:14 +0000 | [diff] [blame] | 547 | // x86-32 DragonFly target |
| 548 | class DragonFlyX86_32TargetInfo : public X86_32TargetInfo { |
| 549 | public: |
| 550 | DragonFlyX86_32TargetInfo(const std::string& triple) : X86_32TargetInfo(triple) { |
| 551 | } |
| 552 | virtual void getTargetDefines(std::vector<char> &Defines) const { |
| 553 | X86_32TargetInfo::getTargetDefines(Defines); |
| 554 | getDragonFlyDefines(Defines); |
| 555 | } |
| 556 | }; |
| 557 | } // end anonymous namespace |
| 558 | |
| 559 | namespace { |
Eli Friedman | 5fb0a02 | 2008-08-21 00:24:02 +0000 | [diff] [blame] | 560 | // x86-32 Linux target |
| 561 | class LinuxX86_32TargetInfo : public X86_32TargetInfo { |
| 562 | public: |
| 563 | LinuxX86_32TargetInfo(const std::string& triple) : X86_32TargetInfo(triple) { |
Chris Lattner | 5edfe01 | 2008-10-05 19:44:25 +0000 | [diff] [blame] | 564 | UserLabelPrefix = ""; |
Eli Friedman | 5fb0a02 | 2008-08-21 00:24:02 +0000 | [diff] [blame] | 565 | } |
| 566 | virtual void getTargetDefines(std::vector<char> &Defines) const { |
| 567 | X86_32TargetInfo::getTargetDefines(Defines); |
| 568 | getLinuxDefines(Defines); |
| 569 | } |
| 570 | }; |
| 571 | } // end anonymous namespace |
| 572 | |
| 573 | namespace { |
Eli Friedman | 23cb791 | 2008-08-21 01:40:19 +0000 | [diff] [blame] | 574 | // x86-32 Windows target |
| 575 | class WindowsX86_32TargetInfo : public X86_32TargetInfo { |
| 576 | public: |
| 577 | WindowsX86_32TargetInfo(const std::string& triple) |
| 578 | : X86_32TargetInfo(triple) { |
| 579 | // FIXME: Fix wchar_t. |
| 580 | // FIXME: We should probably enable -fms-extensions by default for |
| 581 | // this target. |
| 582 | } |
| 583 | virtual void getTargetDefines(std::vector<char> &Defines) const { |
| 584 | X86_32TargetInfo::getTargetDefines(Defines); |
| 585 | // This list is based off of the the list of things MingW defines |
| 586 | Define(Defines, "__WIN32__"); |
| 587 | Define(Defines, "__WIN32"); |
| 588 | Define(Defines, "_WIN32"); |
| 589 | Define(Defines, "WIN32"); |
| 590 | Define(Defines, "__WINNT__"); |
| 591 | Define(Defines, "__WINNT"); |
| 592 | Define(Defines, "WINNT"); |
Eli Friedman | 23cb791 | 2008-08-21 01:40:19 +0000 | [diff] [blame] | 593 | Define(Defines, "_X86_"); |
| 594 | Define(Defines, "__MSVCRT__"); |
| 595 | } |
| 596 | }; |
| 597 | } // end anonymous namespace |
| 598 | |
| 599 | namespace { |
Eli Friedman | 872996c | 2008-08-20 02:34:37 +0000 | [diff] [blame] | 600 | // x86-64 generic target |
| 601 | class X86_64TargetInfo : public X86TargetInfo { |
| 602 | public: |
| 603 | X86_64TargetInfo(const std::string& triple) : X86TargetInfo(triple) { |
Chris Lattner | e5fde95 | 2008-05-09 06:17:04 +0000 | [diff] [blame] | 604 | LongWidth = LongAlign = PointerWidth = PointerAlign = 64; |
Eli Friedman | 0b7b1cb | 2008-05-20 14:21:01 +0000 | [diff] [blame] | 605 | LongDoubleWidth = 128; |
| 606 | LongDoubleAlign = 128; |
Eli Friedman | 2b16165 | 2008-08-21 00:13:15 +0000 | [diff] [blame] | 607 | DescriptionString = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-" |
| 608 | "i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-" |
| 609 | "a0:0:64-f80:128:128"; |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 610 | } |
Anders Carlsson | 8b58e8a | 2007-10-13 00:45:48 +0000 | [diff] [blame] | 611 | virtual const char *getVAListDeclaration() const { |
Eli Friedman | ff158dd | 2008-08-20 07:28:14 +0000 | [diff] [blame] | 612 | return "typedef struct __va_list_tag {" |
| 613 | " unsigned gp_offset;" |
| 614 | " unsigned fp_offset;" |
| 615 | " void* overflow_arg_area;" |
| 616 | " void* reg_save_area;" |
| 617 | "} __builtin_va_list[1];"; |
Anders Carlsson | 7dd1c95 | 2007-11-24 23:38:12 +0000 | [diff] [blame] | 618 | } |
Eli Friedman | 872996c | 2008-08-20 02:34:37 +0000 | [diff] [blame] | 619 | virtual void getTargetDefines(std::vector<char> &Defines) const { |
| 620 | getX86Defines(Defines, true); |
Anders Carlsson | 333052c | 2007-12-08 19:32:57 +0000 | [diff] [blame] | 621 | } |
Eli Friedman | 872996c | 2008-08-20 02:34:37 +0000 | [diff] [blame] | 622 | }; |
| 623 | } // end anonymous namespace |
| 624 | |
| 625 | namespace { |
Chris Lattner | 98cb2a2 | 2008-10-16 17:04:31 +0000 | [diff] [blame] | 626 | // x86-64 FreeBSD target |
| 627 | class FreeBSDX86_64TargetInfo : public X86_64TargetInfo { |
| 628 | public: |
| 629 | FreeBSDX86_64TargetInfo(const std::string& triple) : X86_64TargetInfo(triple) { |
| 630 | } |
| 631 | virtual void getTargetDefines(std::vector<char> &Defines) const { |
| 632 | X86_64TargetInfo::getTargetDefines(Defines); |
| 633 | getFreeBSDDefines(Defines, 1, getTargetTriple()); |
| 634 | } |
| 635 | }; |
| 636 | } // end anonymous namespace |
| 637 | |
| 638 | namespace { |
Daniel Dunbar | e5a80f2 | 2008-09-23 17:37:57 +0000 | [diff] [blame] | 639 | // x86-64 Linux target |
| 640 | class LinuxX86_64TargetInfo : public X86_64TargetInfo { |
| 641 | public: |
| 642 | LinuxX86_64TargetInfo(const std::string& triple) : X86_64TargetInfo(triple) { |
Chris Lattner | 5edfe01 | 2008-10-05 19:44:25 +0000 | [diff] [blame] | 643 | UserLabelPrefix = ""; |
Daniel Dunbar | e5a80f2 | 2008-09-23 17:37:57 +0000 | [diff] [blame] | 644 | } |
| 645 | virtual void getTargetDefines(std::vector<char> &Defines) const { |
| 646 | X86_64TargetInfo::getTargetDefines(Defines); |
| 647 | getLinuxDefines(Defines); |
Daniel Dunbar | e5a80f2 | 2008-09-23 17:37:57 +0000 | [diff] [blame] | 648 | } |
| 649 | }; |
| 650 | } // end anonymous namespace |
| 651 | |
| 652 | namespace { |
Eli Friedman | 872996c | 2008-08-20 02:34:37 +0000 | [diff] [blame] | 653 | // x86-64 Darwin (OS X) target |
| 654 | class DarwinX86_64TargetInfo : public X86_64TargetInfo { |
| 655 | public: |
| 656 | DarwinX86_64TargetInfo(const std::string& triple) : |
| 657 | X86_64TargetInfo(triple) {} |
| 658 | |
| 659 | virtual void getTargetDefines(std::vector<char> &Defines) const { |
| 660 | X86_64TargetInfo::getTargetDefines(Defines); |
Chris Lattner | c5dc8eb | 2008-09-30 01:00:25 +0000 | [diff] [blame] | 661 | getDarwinDefines(Defines, getTargetTriple()); |
Anders Carlsson | 7dd1c95 | 2007-11-24 23:38:12 +0000 | [diff] [blame] | 662 | } |
Daniel Dunbar | 3454295 | 2008-08-23 08:43:39 +0000 | [diff] [blame] | 663 | |
| 664 | virtual bool useNeXTRuntimeAsDefault() const { return true; } |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 665 | }; |
| 666 | } // end anonymous namespace. |
| 667 | |
Chris Lattner | 9fd7361 | 2008-04-21 18:56:49 +0000 | [diff] [blame] | 668 | namespace { |
Eli Friedman | be727fe | 2008-08-20 07:44:10 +0000 | [diff] [blame] | 669 | class ARMTargetInfo : public TargetInfo { |
Chris Lattner | 9fd7361 | 2008-04-21 18:56:49 +0000 | [diff] [blame] | 670 | public: |
Eli Friedman | be727fe | 2008-08-20 07:44:10 +0000 | [diff] [blame] | 671 | ARMTargetInfo(const std::string& triple) : TargetInfo(triple) { |
| 672 | // FIXME: Are the defaults correct for ARM? |
Eli Friedman | 2b16165 | 2008-08-21 00:13:15 +0000 | [diff] [blame] | 673 | DescriptionString = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-" |
| 674 | "i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:64:64"; |
Eli Friedman | 0b7b1cb | 2008-05-20 14:21:01 +0000 | [diff] [blame] | 675 | } |
Chris Lattner | 9fd7361 | 2008-04-21 18:56:49 +0000 | [diff] [blame] | 676 | virtual void getTargetDefines(std::vector<char> &Defines) const { |
Chris Lattner | 9fd7361 | 2008-04-21 18:56:49 +0000 | [diff] [blame] | 677 | getARMDefines(Defines); |
| 678 | } |
| 679 | virtual void getTargetBuiltins(const Builtin::Info *&Records, |
| 680 | unsigned &NumRecords) const { |
Eli Friedman | be727fe | 2008-08-20 07:44:10 +0000 | [diff] [blame] | 681 | // FIXME: Implement. |
| 682 | Records = 0; |
Chris Lattner | 9fd7361 | 2008-04-21 18:56:49 +0000 | [diff] [blame] | 683 | NumRecords = 0; |
| 684 | } |
| 685 | virtual const char *getVAListDeclaration() const { |
Eli Friedman | be727fe | 2008-08-20 07:44:10 +0000 | [diff] [blame] | 686 | return "typedef char* __builtin_va_list;"; |
Chris Lattner | 9fd7361 | 2008-04-21 18:56:49 +0000 | [diff] [blame] | 687 | } |
| 688 | virtual const char *getTargetPrefix() const { |
Eli Friedman | be727fe | 2008-08-20 07:44:10 +0000 | [diff] [blame] | 689 | return "arm"; |
Chris Lattner | 9fd7361 | 2008-04-21 18:56:49 +0000 | [diff] [blame] | 690 | } |
Chris Lattner | 9fd7361 | 2008-04-21 18:56:49 +0000 | [diff] [blame] | 691 | virtual void getGCCRegNames(const char * const *&Names, |
| 692 | unsigned &NumNames) const { |
Eli Friedman | be727fe | 2008-08-20 07:44:10 +0000 | [diff] [blame] | 693 | // FIXME: Implement. |
| 694 | Names = 0; |
Chris Lattner | 9fd7361 | 2008-04-21 18:56:49 +0000 | [diff] [blame] | 695 | NumNames = 0; |
| 696 | } |
| 697 | virtual void getGCCRegAliases(const GCCRegAlias *&Aliases, |
| 698 | unsigned &NumAliases) const { |
Eli Friedman | be727fe | 2008-08-20 07:44:10 +0000 | [diff] [blame] | 699 | // FIXME: Implement. |
| 700 | Aliases = 0; |
Chris Lattner | 9fd7361 | 2008-04-21 18:56:49 +0000 | [diff] [blame] | 701 | NumAliases = 0; |
| 702 | } |
| 703 | virtual bool validateAsmConstraint(char c, |
Nate Begeman | 222823a | 2008-04-22 05:03:19 +0000 | [diff] [blame] | 704 | TargetInfo::ConstraintInfo &info) const { |
Eli Friedman | be727fe | 2008-08-20 07:44:10 +0000 | [diff] [blame] | 705 | // FIXME: Check if this is complete |
Nate Begeman | 222823a | 2008-04-22 05:03:19 +0000 | [diff] [blame] | 706 | switch (c) { |
Eli Friedman | be727fe | 2008-08-20 07:44:10 +0000 | [diff] [blame] | 707 | default: |
Nate Begeman | 222823a | 2008-04-22 05:03:19 +0000 | [diff] [blame] | 708 | case 'l': // r0-r7 |
| 709 | case 'h': // r8-r15 |
| 710 | case 'w': // VFP Floating point register single precision |
| 711 | case 'P': // VFP Floating point register double precision |
| 712 | info = (TargetInfo::ConstraintInfo)(info|TargetInfo::CI_AllowsRegister); |
| 713 | return true; |
| 714 | } |
Chris Lattner | 9fd7361 | 2008-04-21 18:56:49 +0000 | [diff] [blame] | 715 | return false; |
| 716 | } |
| 717 | virtual const char *getClobbers() const { |
Eli Friedman | be727fe | 2008-08-20 07:44:10 +0000 | [diff] [blame] | 718 | // FIXME: Is this really right? |
Chris Lattner | 9fd7361 | 2008-04-21 18:56:49 +0000 | [diff] [blame] | 719 | return ""; |
| 720 | } |
| 721 | }; |
| 722 | } // end anonymous namespace. |
| 723 | |
Eli Friedman | be727fe | 2008-08-20 07:44:10 +0000 | [diff] [blame] | 724 | |
| 725 | namespace { |
| 726 | class DarwinARMTargetInfo : public ARMTargetInfo { |
| 727 | public: |
| 728 | DarwinARMTargetInfo(const std::string& triple) : ARMTargetInfo(triple) {} |
| 729 | |
| 730 | virtual void getTargetDefines(std::vector<char> &Defines) const { |
| 731 | ARMTargetInfo::getTargetDefines(Defines); |
Chris Lattner | c5dc8eb | 2008-09-30 01:00:25 +0000 | [diff] [blame] | 732 | getDarwinDefines(Defines, getTargetTriple()); |
Eli Friedman | be727fe | 2008-08-20 07:44:10 +0000 | [diff] [blame] | 733 | } |
| 734 | }; |
| 735 | } // end anonymous namespace. |
| 736 | |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 737 | namespace { |
Eli Friedman | ff158dd | 2008-08-20 07:28:14 +0000 | [diff] [blame] | 738 | class SparcV8TargetInfo : public TargetInfo { |
Gabor Greif | 8a3ff0d | 2008-02-21 16:29:08 +0000 | [diff] [blame] | 739 | public: |
Eli Friedman | ff158dd | 2008-08-20 07:28:14 +0000 | [diff] [blame] | 740 | SparcV8TargetInfo(const std::string& triple) : TargetInfo(triple) { |
| 741 | // FIXME: Support Sparc quad-precision long double? |
Eli Friedman | 2b16165 | 2008-08-21 00:13:15 +0000 | [diff] [blame] | 742 | DescriptionString = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-" |
| 743 | "i64:64:64-f32:32:32-f64:64:64-v64:64:64"; |
Eli Friedman | ff158dd | 2008-08-20 07:28:14 +0000 | [diff] [blame] | 744 | } |
Gabor Greif | 8a3ff0d | 2008-02-21 16:29:08 +0000 | [diff] [blame] | 745 | virtual void getTargetDefines(std::vector<char> &Defines) const { |
Eli Friedman | ff158dd | 2008-08-20 07:28:14 +0000 | [diff] [blame] | 746 | // FIXME: This is missing a lot of important defines; some of the |
| 747 | // missing stuff is likely to break system headers. |
Gabor Greif | 8a3ff0d | 2008-02-21 16:29:08 +0000 | [diff] [blame] | 748 | Define(Defines, "__sparc"); |
Eli Friedman | 1dee5c5 | 2008-05-25 05:26:09 +0000 | [diff] [blame] | 749 | Define(Defines, "__sparc__"); |
Gabor Greif | 8a3ff0d | 2008-02-21 16:29:08 +0000 | [diff] [blame] | 750 | Define(Defines, "__sparcv8"); |
| 751 | } |
| 752 | virtual void getTargetBuiltins(const Builtin::Info *&Records, |
| 753 | unsigned &NumRecords) const { |
Eli Friedman | ff158dd | 2008-08-20 07:28:14 +0000 | [diff] [blame] | 754 | // FIXME: Implement! |
Gabor Greif | 8a3ff0d | 2008-02-21 16:29:08 +0000 | [diff] [blame] | 755 | } |
| 756 | virtual const char *getVAListDeclaration() const { |
Eli Friedman | ff158dd | 2008-08-20 07:28:14 +0000 | [diff] [blame] | 757 | return "typedef void* __builtin_va_list;"; |
Gabor Greif | 8a3ff0d | 2008-02-21 16:29:08 +0000 | [diff] [blame] | 758 | } |
| 759 | virtual const char *getTargetPrefix() const { |
Eli Friedman | ff158dd | 2008-08-20 07:28:14 +0000 | [diff] [blame] | 760 | return "sparc"; |
Gabor Greif | 8a3ff0d | 2008-02-21 16:29:08 +0000 | [diff] [blame] | 761 | } |
| 762 | virtual void getGCCRegNames(const char * const *&Names, |
| 763 | unsigned &NumNames) const { |
Eli Friedman | ff158dd | 2008-08-20 07:28:14 +0000 | [diff] [blame] | 764 | // FIXME: Implement! |
| 765 | Names = 0; |
| 766 | NumNames = 0; |
Gabor Greif | 8a3ff0d | 2008-02-21 16:29:08 +0000 | [diff] [blame] | 767 | } |
| 768 | virtual void getGCCRegAliases(const GCCRegAlias *&Aliases, |
| 769 | unsigned &NumAliases) const { |
Eli Friedman | ff158dd | 2008-08-20 07:28:14 +0000 | [diff] [blame] | 770 | // FIXME: Implement! |
| 771 | Aliases = 0; |
| 772 | NumAliases = 0; |
Gabor Greif | 8a3ff0d | 2008-02-21 16:29:08 +0000 | [diff] [blame] | 773 | } |
| 774 | virtual bool validateAsmConstraint(char c, |
| 775 | TargetInfo::ConstraintInfo &info) const { |
Eli Friedman | ff158dd | 2008-08-20 07:28:14 +0000 | [diff] [blame] | 776 | // FIXME: Implement! |
| 777 | return false; |
Gabor Greif | 8a3ff0d | 2008-02-21 16:29:08 +0000 | [diff] [blame] | 778 | } |
| 779 | virtual const char *getClobbers() const { |
Eli Friedman | ff158dd | 2008-08-20 07:28:14 +0000 | [diff] [blame] | 780 | // FIXME: Implement! |
| 781 | return ""; |
Gabor Greif | 8a3ff0d | 2008-02-21 16:29:08 +0000 | [diff] [blame] | 782 | } |
| 783 | }; |
| 784 | |
| 785 | } // end anonymous namespace. |
| 786 | |
Eli Friedman | ff158dd | 2008-08-20 07:28:14 +0000 | [diff] [blame] | 787 | namespace { |
| 788 | class SolarisSparcV8TargetInfo : public SparcV8TargetInfo { |
| 789 | public: |
| 790 | SolarisSparcV8TargetInfo(const std::string& triple) : |
| 791 | SparcV8TargetInfo(triple) {} |
| 792 | |
| 793 | virtual void getTargetDefines(std::vector<char> &Defines) const { |
| 794 | SparcV8TargetInfo::getTargetDefines(Defines); |
| 795 | getSolarisDefines(Defines); |
| 796 | } |
| 797 | }; |
| 798 | } // end anonymous namespace. |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 799 | |
Chris Lattner | 85970f3 | 2008-05-08 05:58:21 +0000 | [diff] [blame] | 800 | namespace { |
| 801 | class PIC16TargetInfo : public TargetInfo{ |
| 802 | public: |
| 803 | PIC16TargetInfo(const std::string& triple) : TargetInfo(triple) { |
Eli Friedman | 0b7b1cb | 2008-05-20 14:21:01 +0000 | [diff] [blame] | 804 | // FIXME: Is IntAlign really supposed to be 16? There seems |
| 805 | // little point on a platform with 8-bit loads. |
| 806 | IntWidth = IntAlign = LongAlign = LongLongAlign = PointerWidth = 16; |
Chris Lattner | 1be8bb9 | 2008-10-05 20:06:37 +0000 | [diff] [blame] | 807 | LongWidth = 16; |
Eli Friedman | 0b7b1cb | 2008-05-20 14:21:01 +0000 | [diff] [blame] | 808 | PointerAlign = 8; |
Sanjiv Gupta | ebd8f0f | 2008-08-18 10:05:22 +0000 | [diff] [blame] | 809 | DescriptionString = "e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8"; |
Chris Lattner | 85970f3 | 2008-05-08 05:58:21 +0000 | [diff] [blame] | 810 | } |
Chris Lattner | 727b3c4 | 2008-05-09 06:08:39 +0000 | [diff] [blame] | 811 | virtual uint64_t getPointerWidthV(unsigned AddrSpace) const { return 16; } |
| 812 | virtual uint64_t getPointerAlignV(unsigned AddrSpace) const { return 8; } |
Chris Lattner | 85970f3 | 2008-05-08 05:58:21 +0000 | [diff] [blame] | 813 | virtual void getTargetDefines(std::vector<char> &Defines) const { |
| 814 | Define(Defines, "__pic16"); |
| 815 | } |
| 816 | virtual void getTargetBuiltins(const Builtin::Info *&Records, |
| 817 | unsigned &NumRecords) const {} |
| 818 | virtual const char *getVAListDeclaration() const { return "";} |
| 819 | virtual const char *getClobbers() const {return "";} |
| 820 | virtual const char *getTargetPrefix() const {return "";} |
| 821 | virtual void getGCCRegNames(const char * const *&Names, |
| 822 | unsigned &NumNames) const {} |
| 823 | virtual bool validateAsmConstraint(char c, |
| 824 | TargetInfo::ConstraintInfo &info) const { |
| 825 | return true; |
| 826 | } |
| 827 | virtual void getGCCRegAliases(const GCCRegAlias *&Aliases, |
| 828 | unsigned &NumAliases) const {} |
| 829 | virtual bool useGlobalsForAutomaticVariables() const {return true;} |
| 830 | }; |
| 831 | } |
| 832 | |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 833 | //===----------------------------------------------------------------------===// |
| 834 | // Driver code |
| 835 | //===----------------------------------------------------------------------===// |
| 836 | |
Ted Kremenek | b97d767 | 2007-12-04 17:07:35 +0000 | [diff] [blame] | 837 | static inline bool IsX86(const std::string& TT) { |
Ted Kremenek | 4049948 | 2007-12-03 22:06:55 +0000 | [diff] [blame] | 838 | return (TT.size() >= 5 && TT[0] == 'i' && TT[2] == '8' && TT[3] == '6' && |
| 839 | TT[4] == '-' && TT[1] - '3' < 6); |
| 840 | } |
| 841 | |
Chris Lattner | fc45700 | 2008-03-05 01:18:20 +0000 | [diff] [blame] | 842 | /// CreateTargetInfo - Return the target info object for the specified target |
| 843 | /// triple. |
| 844 | TargetInfo* TargetInfo::CreateTargetInfo(const std::string &T) { |
Eli Friedman | 2b16165 | 2008-08-21 00:13:15 +0000 | [diff] [blame] | 845 | // OS detection; this isn't really anywhere near complete. |
| 846 | // Additions and corrections are welcome. |
| 847 | bool isDarwin = T.find("-darwin") != std::string::npos; |
Chris Lattner | d4faca4 | 2008-08-23 18:23:14 +0000 | [diff] [blame] | 848 | bool isDragonFly = T.find("-dragonfly") != std::string::npos; |
Chris Lattner | 98cb2a2 | 2008-10-16 17:04:31 +0000 | [diff] [blame] | 849 | bool isFreeBSD = T.find("-freebsd") != std::string::npos; |
Eli Friedman | 2b16165 | 2008-08-21 00:13:15 +0000 | [diff] [blame] | 850 | bool isSolaris = T.find("-solaris") != std::string::npos; |
| 851 | bool isLinux = T.find("-linux") != std::string::npos; |
| 852 | bool isWindows = T.find("-windows") != std::string::npos || |
| 853 | T.find("-win32") != std::string::npos || |
| 854 | T.find("-mingw") != std::string::npos; |
Eli Friedman | 0b7b1cb | 2008-05-20 14:21:01 +0000 | [diff] [blame] | 855 | |
Eli Friedman | 2b16165 | 2008-08-21 00:13:15 +0000 | [diff] [blame] | 856 | if (T.find("ppc-") == 0 || T.find("powerpc-") == 0) { |
| 857 | if (isDarwin) |
| 858 | return new DarwinPPCTargetInfo(T); |
| 859 | return new PPC32TargetInfo(T); |
| 860 | } |
Eli Friedman | 0b7b1cb | 2008-05-20 14:21:01 +0000 | [diff] [blame] | 861 | |
Eli Friedman | 2b16165 | 2008-08-21 00:13:15 +0000 | [diff] [blame] | 862 | if (T.find("ppc64-") == 0 || T.find("powerpc64-") == 0) { |
| 863 | if (isDarwin) |
| 864 | return new DarwinPPC64TargetInfo(T); |
| 865 | return new PPC64TargetInfo(T); |
| 866 | } |
Chris Lattner | 9fd7361 | 2008-04-21 18:56:49 +0000 | [diff] [blame] | 867 | |
Eli Friedman | 2b16165 | 2008-08-21 00:13:15 +0000 | [diff] [blame] | 868 | if (T.find("armv6-") == 0 || T.find("arm-") == 0) { |
| 869 | if (isDarwin) |
| 870 | return new DarwinARMTargetInfo(T); |
| 871 | return new ARMTargetInfo(T); |
| 872 | } |
Eli Friedman | 0b7b1cb | 2008-05-20 14:21:01 +0000 | [diff] [blame] | 873 | |
Eli Friedman | 2b16165 | 2008-08-21 00:13:15 +0000 | [diff] [blame] | 874 | if (T.find("sparc-") == 0) { |
| 875 | if (isSolaris) |
| 876 | return new SolarisSparcV8TargetInfo(T); |
| 877 | return new SparcV8TargetInfo(T); |
| 878 | } |
| 879 | |
| 880 | if (T.find("x86_64-") == 0) { |
| 881 | if (isDarwin) |
| 882 | return new DarwinX86_64TargetInfo(T); |
Daniel Dunbar | e5a80f2 | 2008-09-23 17:37:57 +0000 | [diff] [blame] | 883 | if (isLinux) |
| 884 | return new LinuxX86_64TargetInfo(T); |
Chris Lattner | 98cb2a2 | 2008-10-16 17:04:31 +0000 | [diff] [blame] | 885 | if (isFreeBSD) |
| 886 | return new FreeBSDX86_64TargetInfo(T); |
Eli Friedman | 2b16165 | 2008-08-21 00:13:15 +0000 | [diff] [blame] | 887 | return new X86_64TargetInfo(T); |
| 888 | } |
Eli Friedman | 0b7b1cb | 2008-05-20 14:21:01 +0000 | [diff] [blame] | 889 | |
Chris Lattner | 85970f3 | 2008-05-08 05:58:21 +0000 | [diff] [blame] | 890 | if (T.find("pic16-") == 0) |
| 891 | return new PIC16TargetInfo(T); |
| 892 | |
Eli Friedman | 2b16165 | 2008-08-21 00:13:15 +0000 | [diff] [blame] | 893 | if (IsX86(T)) { |
| 894 | if (isDarwin) |
| 895 | return new DarwinI386TargetInfo(T); |
Eli Friedman | 5fb0a02 | 2008-08-21 00:24:02 +0000 | [diff] [blame] | 896 | if (isLinux) |
| 897 | return new LinuxX86_32TargetInfo(T); |
Chris Lattner | d4faca4 | 2008-08-23 18:23:14 +0000 | [diff] [blame] | 898 | if (isDragonFly) |
| 899 | return new DragonFlyX86_32TargetInfo(T); |
Chris Lattner | 98cb2a2 | 2008-10-16 17:04:31 +0000 | [diff] [blame] | 900 | if (isFreeBSD) |
| 901 | return new FreeBSDX86_32TargetInfo(T); |
Eli Friedman | 23cb791 | 2008-08-21 01:40:19 +0000 | [diff] [blame] | 902 | if (isWindows) |
| 903 | return new WindowsX86_32TargetInfo(T); |
Eli Friedman | 2b16165 | 2008-08-21 00:13:15 +0000 | [diff] [blame] | 904 | return new X86_32TargetInfo(T); |
| 905 | } |
Eli Friedman | 0b7b1cb | 2008-05-20 14:21:01 +0000 | [diff] [blame] | 906 | |
Chris Lattner | fc45700 | 2008-03-05 01:18:20 +0000 | [diff] [blame] | 907 | return NULL; |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 908 | } |
Ted Kremenek | d507bab | 2008-03-04 17:47:18 +0000 | [diff] [blame] | 909 | |