blob: c7036bfd049daa5fcf0c88298f48f18c9d78e4e5 [file] [log] [blame]
Reid Spencer5f016e22007-07-11 17:01:13 +00001//===--- TargetInfo.cpp - Information about Target machine ----------------===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner0bc735f2007-12-29 19:59:25 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Reid Spencer5f016e22007-07-11 17:01:13 +00007//
8//===----------------------------------------------------------------------===//
9//
10// This file implements the TargetInfo and TargetInfoImpl interfaces.
11//
12//===----------------------------------------------------------------------===//
13
14#include "clang/Basic/TargetInfo.h"
John Thompsona6fda122009-11-05 20:14:16 +000015#include "clang/Basic/LangOptions.h"
Chris Lattner525a0502007-09-22 18:29:59 +000016#include "llvm/ADT/APFloat.h"
Anders Carlsson6fa90862007-11-25 00:25:21 +000017#include "llvm/ADT/STLExtras.h"
Chris Lattner5483bdf2008-04-06 04:02:29 +000018#include <cstdlib>
Reid Spencer5f016e22007-07-11 17:01:13 +000019using namespace clang;
20
Chris Lattnercd4fc422008-03-08 08:59:43 +000021// TargetInfo Constructor.
22TargetInfo::TargetInfo(const std::string &T) : Triple(T) {
Daniel Dunbarb6a16932010-04-15 06:18:39 +000023 // Set defaults. Defaults are set for a 32-bit RISC platform, like PPC or
24 // SPARC. These should be overridden by concrete targets as needed.
Eli Friedmanb030f022009-04-19 21:38:35 +000025 TLSSupported = true;
Chris Lattner9bffb072010-04-23 16:29:58 +000026 NoAsmVariants = false;
Chris Lattner927686f2008-05-09 06:08:39 +000027 PointerWidth = PointerAlign = 32;
Chris Lattner2621fd12008-05-08 05:58:21 +000028 IntWidth = IntAlign = 32;
Chris Lattnerec10f582008-05-09 05:50:02 +000029 LongWidth = LongAlign = 32;
30 LongLongWidth = LongLongAlign = 64;
Eli Friedman61538a72008-05-20 14:21:01 +000031 FloatWidth = 32;
32 FloatAlign = 32;
Nate Begeman3d292062008-04-18 17:17:24 +000033 DoubleWidth = 64;
Eli Friedman61538a72008-05-20 14:21:01 +000034 DoubleAlign = 64;
35 LongDoubleWidth = 64;
36 LongDoubleAlign = 64;
Rafael Espindola6deecb02010-06-04 23:15:27 +000037 LargeArrayMinWidth = 0;
38 LargeArrayAlign = 0;
Anders Carlsson6a3615c2008-10-31 16:05:19 +000039 SizeType = UnsignedLong;
Eli Friedmanf509d732008-11-02 02:43:55 +000040 PtrDiffType = SignedLong;
Sanjiv Gupta31fc07d2008-10-31 09:52:39 +000041 IntMaxType = SignedLongLong;
42 UIntMaxType = UnsignedLongLong;
Chris Lattner6ad474f2009-02-13 22:28:55 +000043 IntPtrType = SignedLong;
Eli Friedmanf509d732008-11-02 02:43:55 +000044 WCharType = SignedInt;
Chris Lattnere64ef802009-10-21 04:59:34 +000045 WIntType = SignedInt;
Alisdair Meredithf5c209d2009-07-14 06:30:34 +000046 Char16Type = UnsignedShort;
47 Char32Type = UnsignedInt;
Eli Friedman3c7b6e42009-07-01 03:36:11 +000048 Int64Type = SignedLongLong;
Edward O'Callaghan9cf910e2009-11-21 00:49:54 +000049 SigAtomicType = SignedInt;
Daniel Dunbarb6830d62010-04-15 15:06:18 +000050 UseBitFieldTypeAlignment = true;
Chris Lattnercd4fc422008-03-08 08:59:43 +000051 FloatFormat = &llvm::APFloat::IEEEsingle;
52 DoubleFormat = &llvm::APFloat::IEEEdouble;
53 LongDoubleFormat = &llvm::APFloat::IEEEdouble;
Eli Friedmaned855cb2008-08-21 00:13:15 +000054 DescriptionString = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-"
Chris Lattner1932e122009-11-07 18:59:41 +000055 "i64:64:64-f32:32:32-f64:64:64-n32";
Chris Lattner3fdf4672008-10-05 19:22:37 +000056 UserLabelPrefix = "_";
Daniel Dunbar613fd672010-05-27 00:35:16 +000057 HasAlignMac68kSupport = false;
Daniel Dunbardacf9dd2010-07-14 23:39:36 +000058
59 // Default to no types using fpret.
60 RealTypeUsesObjCFPRet = 0;
John McCallee79a4c2010-08-21 22:46:04 +000061
62 // Default to using the Itanium ABI.
63 CXXABI = CXXABI_Itanium;
Chris Lattnercd4fc422008-03-08 08:59:43 +000064}
65
Chris Lattner0eaed122008-03-08 08:24:01 +000066// Out of line virtual dtor for TargetInfo.
67TargetInfo::~TargetInfo() {}
Reid Spencer5f016e22007-07-11 17:01:13 +000068
Chris Lattner2b5abf52009-02-06 05:04:11 +000069/// getTypeName - Return the user string for the specified integer type enum.
70/// For example, SignedShort -> "short".
71const char *TargetInfo::getTypeName(IntType T) {
72 switch (T) {
73 default: assert(0 && "not an integer!");
74 case SignedShort: return "short";
75 case UnsignedShort: return "unsigned short";
76 case SignedInt: return "int";
77 case UnsignedInt: return "unsigned int";
78 case SignedLong: return "long int";
79 case UnsignedLong: return "long unsigned int";
80 case SignedLongLong: return "long long int";
81 case UnsignedLongLong: return "long long unsigned int";
82 }
83}
84
Chris Lattnerb304f772009-10-21 06:24:21 +000085/// getTypeConstantSuffix - Return the constant suffix for the specified
86/// integer type enum. For example, SignedLong -> "L".
87const char *TargetInfo::getTypeConstantSuffix(IntType T) {
88 switch (T) {
89 default: assert(0 && "not an integer!");
90 case SignedShort:
91 case SignedInt: return "";
92 case SignedLong: return "L";
93 case SignedLongLong: return "LL";
94 case UnsignedShort:
95 case UnsignedInt: return "U";
96 case UnsignedLong: return "UL";
97 case UnsignedLongLong: return "ULL";
98 }
99}
100
101/// getTypeWidth - Return the width (in bits) of the specified integer type
102/// enum. For example, SignedInt -> getIntWidth().
103unsigned TargetInfo::getTypeWidth(IntType T) const {
104 switch (T) {
105 default: assert(0 && "not an integer!");
Chris Lattner9099e7b2009-11-05 21:21:32 +0000106 case SignedShort:
Chris Lattnerb304f772009-10-21 06:24:21 +0000107 case UnsignedShort: return getShortWidth();
Chris Lattner9099e7b2009-11-05 21:21:32 +0000108 case SignedInt:
Chris Lattnerb304f772009-10-21 06:24:21 +0000109 case UnsignedInt: return getIntWidth();
Chris Lattner9099e7b2009-11-05 21:21:32 +0000110 case SignedLong:
Chris Lattnerb304f772009-10-21 06:24:21 +0000111 case UnsignedLong: return getLongWidth();
Chris Lattner9099e7b2009-11-05 21:21:32 +0000112 case SignedLongLong:
Chris Lattnerb304f772009-10-21 06:24:21 +0000113 case UnsignedLongLong: return getLongLongWidth();
114 };
115}
116
Chris Lattner9099e7b2009-11-05 21:21:32 +0000117/// getTypeAlign - Return the alignment (in bits) of the specified integer type
118/// enum. For example, SignedInt -> getIntAlign().
119unsigned TargetInfo::getTypeAlign(IntType T) const {
120 switch (T) {
121 default: assert(0 && "not an integer!");
122 case SignedShort:
123 case UnsignedShort: return getShortAlign();
124 case SignedInt:
125 case UnsignedInt: return getIntAlign();
126 case SignedLong:
127 case UnsignedLong: return getLongAlign();
128 case SignedLongLong:
129 case UnsignedLongLong: return getLongLongAlign();
130 };
131}
132
Chris Lattner961f0702009-10-25 22:49:18 +0000133/// isTypeSigned - Return whether an integer types is signed. Returns true if
Chris Lattnerb304f772009-10-21 06:24:21 +0000134/// the type is signed; false otherwise.
Chris Lattner961f0702009-10-25 22:49:18 +0000135bool TargetInfo::isTypeSigned(IntType T) const {
Chris Lattnerb304f772009-10-21 06:24:21 +0000136 switch (T) {
137 default: assert(0 && "not an integer!");
138 case SignedShort:
139 case SignedInt:
140 case SignedLong:
141 case SignedLongLong:
142 return true;
143 case UnsignedShort:
144 case UnsignedInt:
145 case UnsignedLong:
146 case UnsignedLongLong:
147 return false;
148 };
149}
150
John Thompsona6fda122009-11-05 20:14:16 +0000151/// setForcedLangOptions - Set forced language options.
152/// Apply changes to the target information with respect to certain
153/// language options which change the target configuration.
154void TargetInfo::setForcedLangOptions(LangOptions &Opts) {
Daniel Dunbarfb937b82010-04-15 15:06:22 +0000155 if (Opts.NoBitFieldTypeAlign)
156 UseBitFieldTypeAlignment = false;
157 if (Opts.ShortWChar)
John Thompsona6fda122009-11-05 20:14:16 +0000158 WCharType = UnsignedShort;
John Thompsona6fda122009-11-05 20:14:16 +0000159}
Chris Lattnerb304f772009-10-21 06:24:21 +0000160
Chris Lattner525a0502007-09-22 18:29:59 +0000161//===----------------------------------------------------------------------===//
Chris Lattner525a0502007-09-22 18:29:59 +0000162
Reid Spencer5f016e22007-07-11 17:01:13 +0000163
Anders Carlsson83c021c2010-01-30 19:12:25 +0000164static llvm::StringRef removeGCCRegisterPrefix(llvm::StringRef Name) {
Anders Carlssonea041752008-02-06 00:11:32 +0000165 if (Name[0] == '%' || Name[0] == '#')
Anders Carlsson83c021c2010-01-30 19:12:25 +0000166 Name = Name.substr(1);
167
168 return Name;
Anders Carlssonea041752008-02-06 00:11:32 +0000169}
170
Anders Carlsson3346ae62007-11-24 23:38:12 +0000171/// isValidGCCRegisterName - Returns whether the passed in string
172/// is a valid register name according to GCC. This is used by Sema for
173/// inline asm statements.
Anders Carlsson83c021c2010-01-30 19:12:25 +0000174bool TargetInfo::isValidGCCRegisterName(llvm::StringRef Name) const {
175 if (Name.empty())
176 return false;
177
Anders Carlsson6fa90862007-11-25 00:25:21 +0000178 const char * const *Names;
179 unsigned NumNames;
Mike Stump1eb44332009-09-09 15:08:12 +0000180
Anders Carlsson6fa90862007-11-25 00:25:21 +0000181 // Get rid of any register prefix.
Anders Carlsson83c021c2010-01-30 19:12:25 +0000182 Name = removeGCCRegisterPrefix(Name);
Anders Carlssonea041752008-02-06 00:11:32 +0000183
Anders Carlsson83c021c2010-01-30 19:12:25 +0000184 if (Name == "memory" || Name == "cc")
Anders Carlsson6fa90862007-11-25 00:25:21 +0000185 return true;
Mike Stump1eb44332009-09-09 15:08:12 +0000186
Chris Lattner0eaed122008-03-08 08:24:01 +0000187 getGCCRegNames(Names, NumNames);
Mike Stump1eb44332009-09-09 15:08:12 +0000188
Anders Carlsson6fa90862007-11-25 00:25:21 +0000189 // If we have a number it maps to an entry in the register name array.
190 if (isdigit(Name[0])) {
Anders Carlsson83c021c2010-01-30 19:12:25 +0000191 int n;
192 if (!Name.getAsInteger(0, n))
Anders Carlsson6fa90862007-11-25 00:25:21 +0000193 return n >= 0 && (unsigned)n < NumNames;
194 }
195
196 // Check register names.
197 for (unsigned i = 0; i < NumNames; i++) {
Anders Carlsson83c021c2010-01-30 19:12:25 +0000198 if (Name == Names[i])
Anders Carlsson6fa90862007-11-25 00:25:21 +0000199 return true;
200 }
Mike Stump1eb44332009-09-09 15:08:12 +0000201
Anders Carlsson6fa90862007-11-25 00:25:21 +0000202 // Now check aliases.
Chris Lattner0eaed122008-03-08 08:24:01 +0000203 const GCCRegAlias *Aliases;
Anders Carlsson6fa90862007-11-25 00:25:21 +0000204 unsigned NumAliases;
Mike Stump1eb44332009-09-09 15:08:12 +0000205
Chris Lattner0eaed122008-03-08 08:24:01 +0000206 getGCCRegAliases(Aliases, NumAliases);
Anders Carlsson6fa90862007-11-25 00:25:21 +0000207 for (unsigned i = 0; i < NumAliases; i++) {
208 for (unsigned j = 0 ; j < llvm::array_lengthof(Aliases[i].Aliases); j++) {
209 if (!Aliases[i].Aliases[j])
210 break;
Anders Carlsson83c021c2010-01-30 19:12:25 +0000211 if (Aliases[i].Aliases[j] == Name)
Anders Carlsson6fa90862007-11-25 00:25:21 +0000212 return true;
213 }
214 }
Mike Stump1eb44332009-09-09 15:08:12 +0000215
Anders Carlsson3346ae62007-11-24 23:38:12 +0000216 return false;
217}
Anders Carlssond04c6e22007-11-27 04:11:28 +0000218
Anders Carlsson83c021c2010-01-30 19:12:25 +0000219llvm::StringRef
220TargetInfo::getNormalizedGCCRegisterName(llvm::StringRef Name) const {
Anders Carlssond04c6e22007-11-27 04:11:28 +0000221 assert(isValidGCCRegisterName(Name) && "Invalid register passed in");
Mike Stump1eb44332009-09-09 15:08:12 +0000222
Anders Carlsson83c021c2010-01-30 19:12:25 +0000223 // Get rid of any register prefix.
224 Name = removeGCCRegisterPrefix(Name);
Mike Stump1eb44332009-09-09 15:08:12 +0000225
Anders Carlssond04c6e22007-11-27 04:11:28 +0000226 const char * const *Names;
227 unsigned NumNames;
228
Chris Lattner0eaed122008-03-08 08:24:01 +0000229 getGCCRegNames(Names, NumNames);
Anders Carlssond04c6e22007-11-27 04:11:28 +0000230
231 // First, check if we have a number.
232 if (isdigit(Name[0])) {
Anders Carlsson83c021c2010-01-30 19:12:25 +0000233 int n;
234 if (!Name.getAsInteger(0, n)) {
Mike Stump1eb44332009-09-09 15:08:12 +0000235 assert(n >= 0 && (unsigned)n < NumNames &&
Anders Carlssond04c6e22007-11-27 04:11:28 +0000236 "Out of bounds register number!");
237 return Names[n];
238 }
239 }
Mike Stump1eb44332009-09-09 15:08:12 +0000240
Anders Carlssond04c6e22007-11-27 04:11:28 +0000241 // Now check aliases.
Chris Lattner0eaed122008-03-08 08:24:01 +0000242 const GCCRegAlias *Aliases;
Anders Carlssond04c6e22007-11-27 04:11:28 +0000243 unsigned NumAliases;
Mike Stump1eb44332009-09-09 15:08:12 +0000244
Chris Lattner0eaed122008-03-08 08:24:01 +0000245 getGCCRegAliases(Aliases, NumAliases);
Anders Carlssond04c6e22007-11-27 04:11:28 +0000246 for (unsigned i = 0; i < NumAliases; i++) {
247 for (unsigned j = 0 ; j < llvm::array_lengthof(Aliases[i].Aliases); j++) {
248 if (!Aliases[i].Aliases[j])
249 break;
Anders Carlsson83c021c2010-01-30 19:12:25 +0000250 if (Aliases[i].Aliases[j] == Name)
Anders Carlssond04c6e22007-11-27 04:11:28 +0000251 return Aliases[i].Register;
252 }
253 }
Mike Stump1eb44332009-09-09 15:08:12 +0000254
Anders Carlssond04c6e22007-11-27 04:11:28 +0000255 return Name;
256}
257
Chris Lattner432c8692009-04-26 17:19:08 +0000258bool TargetInfo::validateOutputConstraint(ConstraintInfo &Info) const {
259 const char *Name = Info.getConstraintStr().c_str();
Anders Carlssond04c6e22007-11-27 04:11:28 +0000260 // An output constraint must start with '=' or '+'
261 if (*Name != '=' && *Name != '+')
262 return false;
263
264 if (*Name == '+')
Chris Lattner44def072009-04-26 07:16:29 +0000265 Info.setIsReadWrite();
Anders Carlssond04c6e22007-11-27 04:11:28 +0000266
267 Name++;
268 while (*Name) {
269 switch (*Name) {
270 default:
Chris Lattner44def072009-04-26 07:16:29 +0000271 if (!validateAsmConstraint(Name, Info)) {
Ted Kremenek5ab201a2008-04-24 16:36:38 +0000272 // FIXME: We temporarily return false
Anders Carlssond04c6e22007-11-27 04:11:28 +0000273 // so we can add more constraints as we hit it.
274 // Eventually, an unknown constraint should just be treated as 'g'.
Ted Kremenek5ab201a2008-04-24 16:36:38 +0000275 return false;
Anders Carlssond04c6e22007-11-27 04:11:28 +0000276 }
277 case '&': // early clobber.
278 break;
Chris Lattner40539832009-10-13 04:32:07 +0000279 case '%': // commutative.
280 // FIXME: Check that there is a another register after this one.
281 break;
Anders Carlssond04c6e22007-11-27 04:11:28 +0000282 case 'r': // general register.
Chris Lattner44def072009-04-26 07:16:29 +0000283 Info.setAllowsRegister();
Anders Carlssond04c6e22007-11-27 04:11:28 +0000284 break;
285 case 'm': // memory operand.
Dale Johannesen0f048a42010-09-07 18:40:41 +0000286 case 'o': // offsetable memory operand.
287 case 'V': // non-offsetable memory operand.
288 case '<': // autodecrement memory operand.
289 case '>': // autoincrement memory operand.
Chris Lattner44def072009-04-26 07:16:29 +0000290 Info.setAllowsMemory();
Anders Carlssond04c6e22007-11-27 04:11:28 +0000291 break;
292 case 'g': // general register, memory operand or immediate integer.
Anders Carlsson775841f2009-01-18 02:12:04 +0000293 case 'X': // any operand.
Chris Lattner44def072009-04-26 07:16:29 +0000294 Info.setAllowsRegister();
295 Info.setAllowsMemory();
Anders Carlssond04c6e22007-11-27 04:11:28 +0000296 break;
John Thompsonef44e112010-08-10 19:20:14 +0000297 case ',': // multiple alternative constraint. Pass it.
298 Name++;
John Thompson6f158032010-08-11 00:58:20 +0000299 // Handle additional optional '=' or '+' modifiers.
300 if (*Name == '=' || *Name == '+')
301 Name++;
John Thompsonef44e112010-08-10 19:20:14 +0000302 break;
303 case '?': // Disparage slightly code.
Dale Johannesen0f048a42010-09-07 18:40:41 +0000304 case '!': // Disparage severely.
John Thompsonef44e112010-08-10 19:20:14 +0000305 break; // Pass them.
Anders Carlssond04c6e22007-11-27 04:11:28 +0000306 }
Mike Stump1eb44332009-09-09 15:08:12 +0000307
Anders Carlssond04c6e22007-11-27 04:11:28 +0000308 Name++;
309 }
Mike Stump1eb44332009-09-09 15:08:12 +0000310
Anders Carlssond04c6e22007-11-27 04:11:28 +0000311 return true;
312}
313
Anders Carlsson42e1ee02009-01-18 01:56:57 +0000314bool TargetInfo::resolveSymbolicName(const char *&Name,
Chris Lattner2819fa82009-04-26 17:57:12 +0000315 ConstraintInfo *OutputConstraints,
316 unsigned NumOutputs,
Chris Lattner44def072009-04-26 07:16:29 +0000317 unsigned &Index) const {
Anders Carlsson42e1ee02009-01-18 01:56:57 +0000318 assert(*Name == '[' && "Symbolic name did not start with '['");
Anders Carlsson42e1ee02009-01-18 01:56:57 +0000319 Name++;
320 const char *Start = Name;
321 while (*Name && *Name != ']')
322 Name++;
Mike Stump1eb44332009-09-09 15:08:12 +0000323
Anders Carlsson42e1ee02009-01-18 01:56:57 +0000324 if (!*Name) {
325 // Missing ']'
326 return false;
327 }
Mike Stump1eb44332009-09-09 15:08:12 +0000328
Anders Carlsson42e1ee02009-01-18 01:56:57 +0000329 std::string SymbolicName(Start, Name - Start);
Mike Stump1eb44332009-09-09 15:08:12 +0000330
Chris Lattner2819fa82009-04-26 17:57:12 +0000331 for (Index = 0; Index != NumOutputs; ++Index)
332 if (SymbolicName == OutputConstraints[Index].getName())
Anders Carlsson42e1ee02009-01-18 01:56:57 +0000333 return true;
Anders Carlsson42e1ee02009-01-18 01:56:57 +0000334
335 return false;
336}
337
Chris Lattner2819fa82009-04-26 17:57:12 +0000338bool TargetInfo::validateInputConstraint(ConstraintInfo *OutputConstraints,
339 unsigned NumOutputs,
Chris Lattner44def072009-04-26 07:16:29 +0000340 ConstraintInfo &Info) const {
Chris Lattner432c8692009-04-26 17:19:08 +0000341 const char *Name = Info.ConstraintStr.c_str();
342
Anders Carlssond04c6e22007-11-27 04:11:28 +0000343 while (*Name) {
344 switch (*Name) {
345 default:
346 // Check if we have a matching constraint
347 if (*Name >= '0' && *Name <= '9') {
348 unsigned i = *Name - '0';
Mike Stump1eb44332009-09-09 15:08:12 +0000349
Anders Carlssond04c6e22007-11-27 04:11:28 +0000350 // Check if matching constraint is out of bounds.
351 if (i >= NumOutputs)
352 return false;
Mike Stump1eb44332009-09-09 15:08:12 +0000353
354 // The constraint should have the same info as the respective
Anders Carlsson03eb5432009-01-27 20:38:24 +0000355 // output constraint.
Chris Lattnerd6887612009-04-26 18:05:25 +0000356 Info.setTiedOperand(i, OutputConstraints[i]);
Chris Lattner44def072009-04-26 07:16:29 +0000357 } else if (!validateAsmConstraint(Name, Info)) {
Daniel Dunbar302684c2008-08-25 09:46:27 +0000358 // FIXME: This error return is in place temporarily so we can
359 // add more constraints as we hit it. Eventually, an unknown
360 // constraint should just be treated as 'g'.
361 return false;
Anders Carlsson42e1ee02009-01-18 01:56:57 +0000362 }
363 break;
364 case '[': {
365 unsigned Index = 0;
Chris Lattner2819fa82009-04-26 17:57:12 +0000366 if (!resolveSymbolicName(Name, OutputConstraints, NumOutputs, Index))
Anders Carlsson42e1ee02009-01-18 01:56:57 +0000367 return false;
Mike Stump1eb44332009-09-09 15:08:12 +0000368
Eli Friedman0eff4e72010-08-11 23:03:37 +0000369 Info.setTiedOperand(Index, OutputConstraints[Index]);
Anders Carlsson42e1ee02009-01-18 01:56:57 +0000370 break;
Mike Stump1eb44332009-09-09 15:08:12 +0000371 }
Anders Carlsson44fe49c2007-12-08 19:32:57 +0000372 case '%': // commutative
373 // FIXME: Fail if % is used with the last operand.
374 break;
Anders Carlssond04c6e22007-11-27 04:11:28 +0000375 case 'i': // immediate integer.
Anders Carlssonefdfa772008-03-09 06:02:02 +0000376 case 'n': // immediate integer with a known value.
Anders Carlssond04c6e22007-11-27 04:11:28 +0000377 break;
Chris Lattner1d138792009-05-06 04:33:31 +0000378 case 'I': // Various constant constraints with target-specific meanings.
379 case 'J':
380 case 'K':
381 case 'L':
382 case 'M':
383 case 'N':
384 case 'O':
385 case 'P':
386 break;
Anders Carlssond04c6e22007-11-27 04:11:28 +0000387 case 'r': // general register.
Chris Lattner44def072009-04-26 07:16:29 +0000388 Info.setAllowsRegister();
Anders Carlssond04c6e22007-11-27 04:11:28 +0000389 break;
390 case 'm': // memory operand.
Dale Johannesen0f048a42010-09-07 18:40:41 +0000391 case 'o': // offsettable memory operand.
392 case 'V': // non-offsettable memory operand.
393 case '<': // autodecrement memory operand.
394 case '>': // autoincrement memory operand.
Chris Lattner44def072009-04-26 07:16:29 +0000395 Info.setAllowsMemory();
Anders Carlssond04c6e22007-11-27 04:11:28 +0000396 break;
397 case 'g': // general register, memory operand or immediate integer.
Anders Carlsson775841f2009-01-18 02:12:04 +0000398 case 'X': // any operand.
Chris Lattner44def072009-04-26 07:16:29 +0000399 Info.setAllowsRegister();
400 Info.setAllowsMemory();
Anders Carlssond04c6e22007-11-27 04:11:28 +0000401 break;
John Thompsonef44e112010-08-10 19:20:14 +0000402 case ',': // multiple alternative constraint. Ignore comma.
403 break;
404 case '?': // Disparage slightly code.
405 case '!': // Disparage severly.
406 break; // Pass them.
Anders Carlssond04c6e22007-11-27 04:11:28 +0000407 }
Mike Stump1eb44332009-09-09 15:08:12 +0000408
Anders Carlssond04c6e22007-11-27 04:11:28 +0000409 Name++;
410 }
Mike Stump1eb44332009-09-09 15:08:12 +0000411
Anders Carlssond04c6e22007-11-27 04:11:28 +0000412 return true;
413}