Anton Korobeynikov | 82d0a41 | 2010-01-10 12:58:08 +0000 | [diff] [blame] | 1 | //===-- TargetAttributesSema.cpp - Encapsulate target attributes-*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file contains semantic analysis implementation for target-specific |
| 11 | // attributes. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
Anton Korobeynikov | 82d0a41 | 2010-01-10 12:58:08 +0000 | [diff] [blame] | 15 | #include "TargetAttributesSema.h" |
John McCall | 384aff8 | 2010-08-25 07:42:41 +0000 | [diff] [blame] | 16 | #include "clang/AST/DeclCXX.h" |
Chandler Carruth | 55fc873 | 2012-12-04 09:13:33 +0000 | [diff] [blame] | 17 | #include "clang/Basic/TargetInfo.h" |
| 18 | #include "clang/Sema/SemaInternal.h" |
Anton Korobeynikov | 82d0a41 | 2010-01-10 12:58:08 +0000 | [diff] [blame] | 19 | #include "llvm/ADT/Triple.h" |
| 20 | |
| 21 | using namespace clang; |
| 22 | |
| 23 | TargetAttributesSema::~TargetAttributesSema() {} |
| 24 | bool TargetAttributesSema::ProcessDeclAttribute(Scope *scope, Decl *D, |
| 25 | const AttributeList &Attr, Sema &S) const { |
| 26 | return false; |
| 27 | } |
| 28 | |
| 29 | static void HandleMSP430InterruptAttr(Decl *d, |
| 30 | const AttributeList &Attr, Sema &S) { |
| 31 | // Check the attribute arguments. |
| 32 | if (Attr.getNumArgs() != 1) { |
Aaron Ballman | baec778 | 2013-07-23 19:30:11 +0000 | [diff] [blame] | 33 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) |
| 34 | << Attr.getName() << 1; |
Anton Korobeynikov | 82d0a41 | 2010-01-10 12:58:08 +0000 | [diff] [blame] | 35 | return; |
| 36 | } |
| 37 | |
| 38 | // FIXME: Check for decl - it should be void ()(void). |
| 39 | |
| 40 | Expr *NumParamsExpr = static_cast<Expr *>(Attr.getArg(0)); |
| 41 | llvm::APSInt NumParams(32); |
| 42 | if (!NumParamsExpr->isIntegerConstantExpr(NumParams, S.Context)) { |
Aaron Ballman | 9f939f7 | 2013-07-30 14:10:17 +0000 | [diff] [blame^] | 43 | S.Diag(Attr.getLoc(), diag::err_attribute_argument_type) |
| 44 | << Attr.getName() << AANT_ArgumentIntegerConstant |
| 45 | << NumParamsExpr->getSourceRange(); |
Anton Korobeynikov | 82d0a41 | 2010-01-10 12:58:08 +0000 | [diff] [blame] | 46 | return; |
| 47 | } |
| 48 | |
| 49 | unsigned Num = NumParams.getLimitedValue(255); |
| 50 | if ((Num & 1) || Num > 30) { |
| 51 | S.Diag(Attr.getLoc(), diag::err_attribute_argument_out_of_bounds) |
| 52 | << "interrupt" << (int)NumParams.getSExtValue() |
| 53 | << NumParamsExpr->getSourceRange(); |
| 54 | return; |
| 55 | } |
| 56 | |
Sean Hunt | cf807c4 | 2010-08-18 23:23:40 +0000 | [diff] [blame] | 57 | d->addAttr(::new (S.Context) MSP430InterruptAttr(Attr.getLoc(), S.Context, Num)); |
| 58 | d->addAttr(::new (S.Context) UsedAttr(Attr.getLoc(), S.Context)); |
Anton Korobeynikov | 82d0a41 | 2010-01-10 12:58:08 +0000 | [diff] [blame] | 59 | } |
| 60 | |
| 61 | namespace { |
| 62 | class MSP430AttributesSema : public TargetAttributesSema { |
| 63 | public: |
| 64 | MSP430AttributesSema() { } |
| 65 | bool ProcessDeclAttribute(Scope *scope, Decl *D, |
| 66 | const AttributeList &Attr, Sema &S) const { |
| 67 | if (Attr.getName()->getName() == "interrupt") { |
| 68 | HandleMSP430InterruptAttr(D, Attr, S); |
| 69 | return true; |
| 70 | } |
| 71 | return false; |
| 72 | } |
| 73 | }; |
| 74 | } |
| 75 | |
Charles Davis | 5a0164d | 2010-02-10 23:06:52 +0000 | [diff] [blame] | 76 | static void HandleX86ForceAlignArgPointerAttr(Decl *D, |
| 77 | const AttributeList& Attr, |
| 78 | Sema &S) { |
| 79 | // Check the attribute arguments. |
| 80 | if (Attr.getNumArgs() != 0) { |
Aaron Ballman | baec778 | 2013-07-23 19:30:11 +0000 | [diff] [blame] | 81 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) |
| 82 | << Attr.getName() << 0; |
Charles Davis | 5a0164d | 2010-02-10 23:06:52 +0000 | [diff] [blame] | 83 | return; |
| 84 | } |
| 85 | |
Charles Davis | ab44216 | 2010-02-17 00:44:47 +0000 | [diff] [blame] | 86 | // If we try to apply it to a function pointer, don't warn, but don't |
| 87 | // do anything, either. It doesn't matter anyway, because there's nothing |
| 88 | // special about calling a force_align_arg_pointer function. |
Charles Davis | beaf5ed | 2010-02-18 04:39:19 +0000 | [diff] [blame] | 89 | ValueDecl *VD = dyn_cast<ValueDecl>(D); |
Charles Davis | ab44216 | 2010-02-17 00:44:47 +0000 | [diff] [blame] | 90 | if (VD && VD->getType()->isFunctionPointerType()) |
Charles Davis | 5a0164d | 2010-02-10 23:06:52 +0000 | [diff] [blame] | 91 | return; |
Charles Davis | beaf5ed | 2010-02-18 04:39:19 +0000 | [diff] [blame] | 92 | // Also don't warn on function pointer typedefs. |
Richard Smith | 162e1c1 | 2011-04-15 14:24:37 +0000 | [diff] [blame] | 93 | TypedefNameDecl *TD = dyn_cast<TypedefNameDecl>(D); |
Charles Davis | e01c063 | 2010-02-18 04:56:59 +0000 | [diff] [blame] | 94 | if (TD && (TD->getUnderlyingType()->isFunctionPointerType() || |
| 95 | TD->getUnderlyingType()->isFunctionType())) |
Charles Davis | beaf5ed | 2010-02-18 04:39:19 +0000 | [diff] [blame] | 96 | return; |
Charles Davis | 5a0164d | 2010-02-10 23:06:52 +0000 | [diff] [blame] | 97 | // Attribute can only be applied to function types. |
Charles Davis | 9c00be5 | 2010-02-10 23:26:12 +0000 | [diff] [blame] | 98 | if (!isa<FunctionDecl>(D)) { |
Charles Davis | 5a0164d | 2010-02-10 23:06:52 +0000 | [diff] [blame] | 99 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) |
| 100 | << Attr.getName() << /* function */0; |
| 101 | return; |
| 102 | } |
| 103 | |
Argyrios Kyrtzidis | 768d6ca | 2011-09-13 16:05:58 +0000 | [diff] [blame] | 104 | D->addAttr(::new (S.Context) X86ForceAlignArgPointerAttr(Attr.getRange(), |
| 105 | S.Context)); |
Charles Davis | 5a0164d | 2010-02-10 23:06:52 +0000 | [diff] [blame] | 106 | } |
| 107 | |
Michael Han | 51d8c52 | 2013-01-24 16:46:58 +0000 | [diff] [blame] | 108 | DLLImportAttr *Sema::mergeDLLImportAttr(Decl *D, SourceRange Range, |
| 109 | unsigned AttrSpellingListIndex) { |
Rafael Espindola | 98ae834 | 2012-05-10 02:50:16 +0000 | [diff] [blame] | 110 | if (D->hasAttr<DLLExportAttr>()) { |
| 111 | Diag(Range.getBegin(), diag::warn_attribute_ignored) << "dllimport"; |
Rafael Espindola | 599f1b7 | 2012-05-13 03:25:18 +0000 | [diff] [blame] | 112 | return NULL; |
Rafael Espindola | 98ae834 | 2012-05-10 02:50:16 +0000 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | if (D->hasAttr<DLLImportAttr>()) |
Rafael Espindola | 599f1b7 | 2012-05-13 03:25:18 +0000 | [diff] [blame] | 116 | return NULL; |
Rafael Espindola | 98ae834 | 2012-05-10 02:50:16 +0000 | [diff] [blame] | 117 | |
Reid Kleckner | beba3e8 | 2013-05-20 21:53:29 +0000 | [diff] [blame] | 118 | if (VarDecl *VD = dyn_cast<VarDecl>(D)) { |
| 119 | if (VD->hasDefinition()) { |
| 120 | // dllimport cannot be applied to definitions. |
| 121 | Diag(D->getLocation(), diag::warn_attribute_invalid_on_definition) |
| 122 | << "dllimport"; |
| 123 | return NULL; |
| 124 | } |
| 125 | } |
| 126 | |
Michael Han | 51d8c52 | 2013-01-24 16:46:58 +0000 | [diff] [blame] | 127 | return ::new (Context) DLLImportAttr(Range, Context, |
| 128 | AttrSpellingListIndex); |
Rafael Espindola | 98ae834 | 2012-05-10 02:50:16 +0000 | [diff] [blame] | 129 | } |
| 130 | |
Charles Davis | f0122fe | 2010-02-16 18:27:26 +0000 | [diff] [blame] | 131 | static void HandleDLLImportAttr(Decl *D, const AttributeList &Attr, Sema &S) { |
| 132 | // check the attribute arguments. |
| 133 | if (Attr.getNumArgs() != 0) { |
Aaron Ballman | baec778 | 2013-07-23 19:30:11 +0000 | [diff] [blame] | 134 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) |
| 135 | << Attr.getName() << 0; |
Charles Davis | f0122fe | 2010-02-16 18:27:26 +0000 | [diff] [blame] | 136 | return; |
| 137 | } |
| 138 | |
| 139 | // Attribute can be applied only to functions or variables. |
Charles Davis | f0122fe | 2010-02-16 18:27:26 +0000 | [diff] [blame] | 140 | FunctionDecl *FD = dyn_cast<FunctionDecl>(D); |
Rafael Espindola | 98ae834 | 2012-05-10 02:50:16 +0000 | [diff] [blame] | 141 | if (!FD && !isa<VarDecl>(D)) { |
Ted Kremenek | 240670c | 2010-02-21 05:12:56 +0000 | [diff] [blame] | 142 | // Apparently Visual C++ thinks it is okay to not emit a warning |
| 143 | // in this case, so only emit a warning when -fms-extensions is not |
| 144 | // specified. |
David Blaikie | 4e4d084 | 2012-03-11 07:00:24 +0000 | [diff] [blame] | 145 | if (!S.getLangOpts().MicrosoftExt) |
Ted Kremenek | 240670c | 2010-02-21 05:12:56 +0000 | [diff] [blame] | 146 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) |
| 147 | << Attr.getName() << 2 /*variable and function*/; |
Charles Davis | f0122fe | 2010-02-16 18:27:26 +0000 | [diff] [blame] | 148 | return; |
| 149 | } |
| 150 | |
| 151 | // Currently, the dllimport attribute is ignored for inlined functions. |
| 152 | // Warning is emitted. |
Rafael Espindola | 98ae834 | 2012-05-10 02:50:16 +0000 | [diff] [blame] | 153 | if (FD && FD->isInlineSpecified()) { |
Charles Davis | f0122fe | 2010-02-16 18:27:26 +0000 | [diff] [blame] | 154 | S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "dllimport"; |
| 155 | return; |
| 156 | } |
| 157 | |
Michael Han | 51d8c52 | 2013-01-24 16:46:58 +0000 | [diff] [blame] | 158 | unsigned Index = Attr.getAttributeSpellingListIndex(); |
| 159 | DLLImportAttr *NewAttr = S.mergeDLLImportAttr(D, Attr.getRange(), Index); |
Rafael Espindola | 599f1b7 | 2012-05-13 03:25:18 +0000 | [diff] [blame] | 160 | if (NewAttr) |
| 161 | D->addAttr(NewAttr); |
Rafael Espindola | 98ae834 | 2012-05-10 02:50:16 +0000 | [diff] [blame] | 162 | } |
| 163 | |
Michael Han | 51d8c52 | 2013-01-24 16:46:58 +0000 | [diff] [blame] | 164 | DLLExportAttr *Sema::mergeDLLExportAttr(Decl *D, SourceRange Range, |
| 165 | unsigned AttrSpellingListIndex) { |
Rafael Espindola | 98ae834 | 2012-05-10 02:50:16 +0000 | [diff] [blame] | 166 | if (DLLImportAttr *Import = D->getAttr<DLLImportAttr>()) { |
| 167 | Diag(Import->getLocation(), diag::warn_attribute_ignored) << "dllimport"; |
| 168 | D->dropAttr<DLLImportAttr>(); |
Charles Davis | f0122fe | 2010-02-16 18:27:26 +0000 | [diff] [blame] | 169 | } |
| 170 | |
Rafael Espindola | 98ae834 | 2012-05-10 02:50:16 +0000 | [diff] [blame] | 171 | if (D->hasAttr<DLLExportAttr>()) |
Rafael Espindola | 599f1b7 | 2012-05-13 03:25:18 +0000 | [diff] [blame] | 172 | return NULL; |
Rafael Espindola | 98ae834 | 2012-05-10 02:50:16 +0000 | [diff] [blame] | 173 | |
Michael Han | 51d8c52 | 2013-01-24 16:46:58 +0000 | [diff] [blame] | 174 | return ::new (Context) DLLExportAttr(Range, Context, |
| 175 | AttrSpellingListIndex); |
Charles Davis | f0122fe | 2010-02-16 18:27:26 +0000 | [diff] [blame] | 176 | } |
| 177 | |
| 178 | static void HandleDLLExportAttr(Decl *D, const AttributeList &Attr, Sema &S) { |
| 179 | // check the attribute arguments. |
| 180 | if (Attr.getNumArgs() != 0) { |
Aaron Ballman | baec778 | 2013-07-23 19:30:11 +0000 | [diff] [blame] | 181 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) |
| 182 | << Attr.getName() << 0; |
Charles Davis | f0122fe | 2010-02-16 18:27:26 +0000 | [diff] [blame] | 183 | return; |
| 184 | } |
| 185 | |
| 186 | // Attribute can be applied only to functions or variables. |
Charles Davis | f0122fe | 2010-02-16 18:27:26 +0000 | [diff] [blame] | 187 | FunctionDecl *FD = dyn_cast<FunctionDecl>(D); |
Rafael Espindola | 98ae834 | 2012-05-10 02:50:16 +0000 | [diff] [blame] | 188 | if (!FD && !isa<VarDecl>(D)) { |
Charles Davis | f0122fe | 2010-02-16 18:27:26 +0000 | [diff] [blame] | 189 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) |
| 190 | << Attr.getName() << 2 /*variable and function*/; |
| 191 | return; |
| 192 | } |
| 193 | |
| 194 | // Currently, the dllexport attribute is ignored for inlined functions, unless |
| 195 | // the -fkeep-inline-functions flag has been used. Warning is emitted; |
Rafael Espindola | 98ae834 | 2012-05-10 02:50:16 +0000 | [diff] [blame] | 196 | if (FD && FD->isInlineSpecified()) { |
Charles Davis | f0122fe | 2010-02-16 18:27:26 +0000 | [diff] [blame] | 197 | // FIXME: ... unless the -fkeep-inline-functions flag has been used. |
| 198 | S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "dllexport"; |
| 199 | return; |
| 200 | } |
| 201 | |
Michael Han | 51d8c52 | 2013-01-24 16:46:58 +0000 | [diff] [blame] | 202 | unsigned Index = Attr.getAttributeSpellingListIndex(); |
| 203 | DLLExportAttr *NewAttr = S.mergeDLLExportAttr(D, Attr.getRange(), Index); |
Rafael Espindola | 599f1b7 | 2012-05-13 03:25:18 +0000 | [diff] [blame] | 204 | if (NewAttr) |
| 205 | D->addAttr(NewAttr); |
Charles Davis | f0122fe | 2010-02-16 18:27:26 +0000 | [diff] [blame] | 206 | } |
| 207 | |
Charles Davis | 5a0164d | 2010-02-10 23:06:52 +0000 | [diff] [blame] | 208 | namespace { |
| 209 | class X86AttributesSema : public TargetAttributesSema { |
| 210 | public: |
| 211 | X86AttributesSema() { } |
| 212 | bool ProcessDeclAttribute(Scope *scope, Decl *D, |
| 213 | const AttributeList &Attr, Sema &S) const { |
Douglas Gregor | bcfd1f5 | 2011-09-02 00:18:52 +0000 | [diff] [blame] | 214 | const llvm::Triple &Triple(S.Context.getTargetInfo().getTriple()); |
Charles Davis | f0122fe | 2010-02-16 18:27:26 +0000 | [diff] [blame] | 215 | if (Triple.getOS() == llvm::Triple::Win32 || |
NAKAMURA Takumi | 0aa2057 | 2011-02-17 08:51:38 +0000 | [diff] [blame] | 216 | Triple.getOS() == llvm::Triple::MinGW32) { |
Charles Davis | f0122fe | 2010-02-16 18:27:26 +0000 | [diff] [blame] | 217 | switch (Attr.getKind()) { |
Sean Hunt | 8e083e7 | 2012-06-19 23:57:03 +0000 | [diff] [blame] | 218 | case AttributeList::AT_DLLImport: HandleDLLImportAttr(D, Attr, S); |
Charles Davis | f0122fe | 2010-02-16 18:27:26 +0000 | [diff] [blame] | 219 | return true; |
Sean Hunt | 8e083e7 | 2012-06-19 23:57:03 +0000 | [diff] [blame] | 220 | case AttributeList::AT_DLLExport: HandleDLLExportAttr(D, Attr, S); |
Charles Davis | f0122fe | 2010-02-16 18:27:26 +0000 | [diff] [blame] | 221 | return true; |
| 222 | default: break; |
| 223 | } |
| 224 | } |
Eli Friedman | 9afbfbe | 2011-09-30 18:53:25 +0000 | [diff] [blame] | 225 | if (Triple.getArch() != llvm::Triple::x86_64 && |
Benjamin Kramer | f2cee5c | 2011-09-30 20:32:22 +0000 | [diff] [blame] | 226 | (Attr.getName()->getName() == "force_align_arg_pointer" || |
| 227 | Attr.getName()->getName() == "__force_align_arg_pointer__")) { |
Charles Davis | 5a0164d | 2010-02-10 23:06:52 +0000 | [diff] [blame] | 228 | HandleX86ForceAlignArgPointerAttr(D, Attr, S); |
| 229 | return true; |
| 230 | } |
| 231 | return false; |
| 232 | } |
| 233 | }; |
| 234 | } |
| 235 | |
Reed Kotler | 7dfd182 | 2013-01-16 17:10:28 +0000 | [diff] [blame] | 236 | static void HandleMips16Attr(Decl *D, const AttributeList &Attr, Sema &S) { |
| 237 | // check the attribute arguments. |
| 238 | if (Attr.hasParameterOrArguments()) { |
Aaron Ballman | baec778 | 2013-07-23 19:30:11 +0000 | [diff] [blame] | 239 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) |
| 240 | << Attr.getName() << 0; |
Reed Kotler | 7dfd182 | 2013-01-16 17:10:28 +0000 | [diff] [blame] | 241 | return; |
| 242 | } |
| 243 | // Attribute can only be applied to function types. |
| 244 | if (!isa<FunctionDecl>(D)) { |
| 245 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type) |
| 246 | << Attr.getName() << /* function */0; |
| 247 | return; |
| 248 | } |
Michael Han | 51d8c52 | 2013-01-24 16:46:58 +0000 | [diff] [blame] | 249 | D->addAttr(::new (S.Context) Mips16Attr(Attr.getRange(), S.Context, |
| 250 | Attr.getAttributeSpellingListIndex())); |
Reed Kotler | 7dfd182 | 2013-01-16 17:10:28 +0000 | [diff] [blame] | 251 | } |
| 252 | |
| 253 | static void HandleNoMips16Attr(Decl *D, const AttributeList &Attr, Sema &S) { |
| 254 | // check the attribute arguments. |
| 255 | if (Attr.hasParameterOrArguments()) { |
Aaron Ballman | baec778 | 2013-07-23 19:30:11 +0000 | [diff] [blame] | 256 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) |
| 257 | << Attr.getName() << 0; |
Reed Kotler | 7dfd182 | 2013-01-16 17:10:28 +0000 | [diff] [blame] | 258 | return; |
| 259 | } |
| 260 | // Attribute can only be applied to function types. |
| 261 | if (!isa<FunctionDecl>(D)) { |
| 262 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type) |
| 263 | << Attr.getName() << /* function */0; |
| 264 | return; |
| 265 | } |
Michael Han | 51d8c52 | 2013-01-24 16:46:58 +0000 | [diff] [blame] | 266 | D->addAttr(::new (S.Context) |
| 267 | NoMips16Attr(Attr.getRange(), S.Context, |
| 268 | Attr.getAttributeSpellingListIndex())); |
Reed Kotler | 7dfd182 | 2013-01-16 17:10:28 +0000 | [diff] [blame] | 269 | } |
| 270 | |
| 271 | namespace { |
| 272 | class MipsAttributesSema : public TargetAttributesSema { |
| 273 | public: |
| 274 | MipsAttributesSema() { } |
| 275 | bool ProcessDeclAttribute(Scope *scope, Decl *D, const AttributeList &Attr, |
| 276 | Sema &S) const { |
| 277 | if (Attr.getName()->getName() == "mips16") { |
| 278 | HandleMips16Attr(D, Attr, S); |
| 279 | return true; |
| 280 | } else if (Attr.getName()->getName() == "nomips16") { |
| 281 | HandleNoMips16Attr(D, Attr, S); |
| 282 | return true; |
| 283 | } |
| 284 | return false; |
| 285 | } |
| 286 | }; |
| 287 | } |
| 288 | |
Anton Korobeynikov | 82d0a41 | 2010-01-10 12:58:08 +0000 | [diff] [blame] | 289 | const TargetAttributesSema &Sema::getTargetAttributesSema() const { |
| 290 | if (TheTargetAttributesSema) |
| 291 | return *TheTargetAttributesSema; |
| 292 | |
Douglas Gregor | bcfd1f5 | 2011-09-02 00:18:52 +0000 | [diff] [blame] | 293 | const llvm::Triple &Triple(Context.getTargetInfo().getTriple()); |
Anton Korobeynikov | 82d0a41 | 2010-01-10 12:58:08 +0000 | [diff] [blame] | 294 | switch (Triple.getArch()) { |
Anton Korobeynikov | 82d0a41 | 2010-01-10 12:58:08 +0000 | [diff] [blame] | 295 | case llvm::Triple::msp430: |
| 296 | return *(TheTargetAttributesSema = new MSP430AttributesSema); |
Charles Davis | 5a0164d | 2010-02-10 23:06:52 +0000 | [diff] [blame] | 297 | case llvm::Triple::x86: |
Eli Friedman | 9afbfbe | 2011-09-30 18:53:25 +0000 | [diff] [blame] | 298 | case llvm::Triple::x86_64: |
Charles Davis | 5a0164d | 2010-02-10 23:06:52 +0000 | [diff] [blame] | 299 | return *(TheTargetAttributesSema = new X86AttributesSema); |
Reed Kotler | 7dfd182 | 2013-01-16 17:10:28 +0000 | [diff] [blame] | 300 | case llvm::Triple::mips: |
| 301 | case llvm::Triple::mipsel: |
| 302 | return *(TheTargetAttributesSema = new MipsAttributesSema); |
Eli Friedman | 9afbfbe | 2011-09-30 18:53:25 +0000 | [diff] [blame] | 303 | default: |
| 304 | return *(TheTargetAttributesSema = new TargetAttributesSema); |
Anton Korobeynikov | 82d0a41 | 2010-01-10 12:58:08 +0000 | [diff] [blame] | 305 | } |
| 306 | } |