LLVM  7.0.0
LLLexer.cpp
Go to the documentation of this file.
1 //===- LLLexer.cpp - Lexer for .ll Files ----------------------------------===//
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 // Implement the Lexer for .ll files.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "LLLexer.h"
15 #include "llvm/ADT/APInt.h"
16 #include "llvm/ADT/STLExtras.h"
17 #include "llvm/ADT/StringExtras.h"
18 #include "llvm/ADT/Twine.h"
19 #include "llvm/IR/DerivedTypes.h"
20 #include "llvm/IR/Instruction.h"
22 #include "llvm/Support/SourceMgr.h"
23 #include <cassert>
24 #include <cctype>
25 #include <cstdio>
26 
27 using namespace llvm;
28 
29 bool LLLexer::Error(LocTy ErrorLoc, const Twine &Msg) const {
30  ErrorInfo = SM.GetMessage(ErrorLoc, SourceMgr::DK_Error, Msg);
31  return true;
32 }
33 
34 void LLLexer::Warning(LocTy WarningLoc, const Twine &Msg) const {
35  SM.PrintMessage(WarningLoc, SourceMgr::DK_Warning, Msg);
36 }
37 
38 //===----------------------------------------------------------------------===//
39 // Helper functions.
40 //===----------------------------------------------------------------------===//
41 
42 // atoull - Convert an ascii string of decimal digits into the unsigned long
43 // long representation... this does not have to do input error checking,
44 // because we know that the input will be matched by a suitable regex...
45 //
46 uint64_t LLLexer::atoull(const char *Buffer, const char *End) {
47  uint64_t Result = 0;
48  for (; Buffer != End; Buffer++) {
49  uint64_t OldRes = Result;
50  Result *= 10;
51  Result += *Buffer-'0';
52  if (Result < OldRes) { // Uh, oh, overflow detected!!!
53  Error("constant bigger than 64 bits detected!");
54  return 0;
55  }
56  }
57  return Result;
58 }
59 
60 uint64_t LLLexer::HexIntToVal(const char *Buffer, const char *End) {
61  uint64_t Result = 0;
62  for (; Buffer != End; ++Buffer) {
63  uint64_t OldRes = Result;
64  Result *= 16;
65  Result += hexDigitValue(*Buffer);
66 
67  if (Result < OldRes) { // Uh, oh, overflow detected!!!
68  Error("constant bigger than 64 bits detected!");
69  return 0;
70  }
71  }
72  return Result;
73 }
74 
75 void LLLexer::HexToIntPair(const char *Buffer, const char *End,
76  uint64_t Pair[2]) {
77  Pair[0] = 0;
78  if (End - Buffer >= 16) {
79  for (int i = 0; i < 16; i++, Buffer++) {
80  assert(Buffer != End);
81  Pair[0] *= 16;
82  Pair[0] += hexDigitValue(*Buffer);
83  }
84  }
85  Pair[1] = 0;
86  for (int i = 0; i < 16 && Buffer != End; i++, Buffer++) {
87  Pair[1] *= 16;
88  Pair[1] += hexDigitValue(*Buffer);
89  }
90  if (Buffer != End)
91  Error("constant bigger than 128 bits detected!");
92 }
93 
94 /// FP80HexToIntPair - translate an 80 bit FP80 number (20 hexits) into
95 /// { low64, high16 } as usual for an APInt.
96 void LLLexer::FP80HexToIntPair(const char *Buffer, const char *End,
97  uint64_t Pair[2]) {
98  Pair[1] = 0;
99  for (int i=0; i<4 && Buffer != End; i++, Buffer++) {
100  assert(Buffer != End);
101  Pair[1] *= 16;
102  Pair[1] += hexDigitValue(*Buffer);
103  }
104  Pair[0] = 0;
105  for (int i = 0; i < 16 && Buffer != End; i++, Buffer++) {
106  Pair[0] *= 16;
107  Pair[0] += hexDigitValue(*Buffer);
108  }
109  if (Buffer != End)
110  Error("constant bigger than 128 bits detected!");
111 }
112 
113 // UnEscapeLexed - Run through the specified buffer and change \xx codes to the
114 // appropriate character.
115 static void UnEscapeLexed(std::string &Str) {
116  if (Str.empty()) return;
117 
118  char *Buffer = &Str[0], *EndBuffer = Buffer+Str.size();
119  char *BOut = Buffer;
120  for (char *BIn = Buffer; BIn != EndBuffer; ) {
121  if (BIn[0] == '\\') {
122  if (BIn < EndBuffer-1 && BIn[1] == '\\') {
123  *BOut++ = '\\'; // Two \ becomes one
124  BIn += 2;
125  } else if (BIn < EndBuffer-2 &&
126  isxdigit(static_cast<unsigned char>(BIn[1])) &&
127  isxdigit(static_cast<unsigned char>(BIn[2]))) {
128  *BOut = hexDigitValue(BIn[1]) * 16 + hexDigitValue(BIn[2]);
129  BIn += 3; // Skip over handled chars
130  ++BOut;
131  } else {
132  *BOut++ = *BIn++;
133  }
134  } else {
135  *BOut++ = *BIn++;
136  }
137  }
138  Str.resize(BOut-Buffer);
139 }
140 
141 /// isLabelChar - Return true for [-a-zA-Z$._0-9].
142 static bool isLabelChar(char C) {
143  return isalnum(static_cast<unsigned char>(C)) || C == '-' || C == '$' ||
144  C == '.' || C == '_';
145 }
146 
147 /// isLabelTail - Return true if this pointer points to a valid end of a label.
148 static const char *isLabelTail(const char *CurPtr) {
149  while (true) {
150  if (CurPtr[0] == ':') return CurPtr+1;
151  if (!isLabelChar(CurPtr[0])) return nullptr;
152  ++CurPtr;
153  }
154 }
155 
156 //===----------------------------------------------------------------------===//
157 // Lexer definition.
158 //===----------------------------------------------------------------------===//
159 
161  LLVMContext &C)
162  : CurBuf(StartBuf), ErrorInfo(Err), SM(SM), Context(C), APFloatVal(0.0),
163  IgnoreColonInIdentifiers(false) {
164  CurPtr = CurBuf.begin();
165 }
166 
167 int LLLexer::getNextChar() {
168  char CurChar = *CurPtr++;
169  switch (CurChar) {
170  default: return (unsigned char)CurChar;
171  case 0:
172  // A nul character in the stream is either the end of the current buffer or
173  // a random nul in the file. Disambiguate that here.
174  if (CurPtr-1 != CurBuf.end())
175  return 0; // Just whitespace.
176 
177  // Otherwise, return end of file.
178  --CurPtr; // Another call to lex will return EOF again.
179  return EOF;
180  }
181 }
182 
183 lltok::Kind LLLexer::LexToken() {
184  while (true) {
185  TokStart = CurPtr;
186 
187  int CurChar = getNextChar();
188  switch (CurChar) {
189  default:
190  // Handle letters: [a-zA-Z_]
191  if (isalpha(static_cast<unsigned char>(CurChar)) || CurChar == '_')
192  return LexIdentifier();
193 
194  return lltok::Error;
195  case EOF: return lltok::Eof;
196  case 0:
197  case ' ':
198  case '\t':
199  case '\n':
200  case '\r':
201  // Ignore whitespace.
202  continue;
203  case '+': return LexPositive();
204  case '@': return LexAt();
205  case '$': return LexDollar();
206  case '%': return LexPercent();
207  case '"': return LexQuote();
208  case '.':
209  if (const char *Ptr = isLabelTail(CurPtr)) {
210  CurPtr = Ptr;
211  StrVal.assign(TokStart, CurPtr-1);
212  return lltok::LabelStr;
213  }
214  if (CurPtr[0] == '.' && CurPtr[1] == '.') {
215  CurPtr += 2;
216  return lltok::dotdotdot;
217  }
218  return lltok::Error;
219  case ';':
220  SkipLineComment();
221  continue;
222  case '!': return LexExclaim();
223  case '^':
224  return LexCaret();
225  case ':':
226  return lltok::colon;
227  case '#': return LexHash();
228  case '0': case '1': case '2': case '3': case '4':
229  case '5': case '6': case '7': case '8': case '9':
230  case '-':
231  return LexDigitOrNegative();
232  case '=': return lltok::equal;
233  case '[': return lltok::lsquare;
234  case ']': return lltok::rsquare;
235  case '{': return lltok::lbrace;
236  case '}': return lltok::rbrace;
237  case '<': return lltok::less;
238  case '>': return lltok::greater;
239  case '(': return lltok::lparen;
240  case ')': return lltok::rparen;
241  case ',': return lltok::comma;
242  case '*': return lltok::star;
243  case '|': return lltok::bar;
244  }
245  }
246 }
247 
248 void LLLexer::SkipLineComment() {
249  while (true) {
250  if (CurPtr[0] == '\n' || CurPtr[0] == '\r' || getNextChar() == EOF)
251  return;
252  }
253 }
254 
255 /// Lex all tokens that start with an @ character.
256 /// GlobalVar @\"[^\"]*\"
257 /// GlobalVar @[-a-zA-Z$._][-a-zA-Z$._0-9]*
258 /// GlobalVarID @[0-9]+
259 lltok::Kind LLLexer::LexAt() {
260  return LexVar(lltok::GlobalVar, lltok::GlobalID);
261 }
262 
263 lltok::Kind LLLexer::LexDollar() {
264  if (const char *Ptr = isLabelTail(TokStart)) {
265  CurPtr = Ptr;
266  StrVal.assign(TokStart, CurPtr - 1);
267  return lltok::LabelStr;
268  }
269 
270  // Handle DollarStringConstant: $\"[^\"]*\"
271  if (CurPtr[0] == '"') {
272  ++CurPtr;
273 
274  while (true) {
275  int CurChar = getNextChar();
276 
277  if (CurChar == EOF) {
278  Error("end of file in COMDAT variable name");
279  return lltok::Error;
280  }
281  if (CurChar == '"') {
282  StrVal.assign(TokStart + 2, CurPtr - 1);
283  UnEscapeLexed(StrVal);
284  if (StringRef(StrVal).find_first_of(0) != StringRef::npos) {
285  Error("Null bytes are not allowed in names");
286  return lltok::Error;
287  }
288  return lltok::ComdatVar;
289  }
290  }
291  }
292 
293  // Handle ComdatVarName: $[-a-zA-Z$._][-a-zA-Z$._0-9]*
294  if (ReadVarName())
295  return lltok::ComdatVar;
296 
297  return lltok::Error;
298 }
299 
300 /// ReadString - Read a string until the closing quote.
301 lltok::Kind LLLexer::ReadString(lltok::Kind kind) {
302  const char *Start = CurPtr;
303  while (true) {
304  int CurChar = getNextChar();
305 
306  if (CurChar == EOF) {
307  Error("end of file in string constant");
308  return lltok::Error;
309  }
310  if (CurChar == '"') {
311  StrVal.assign(Start, CurPtr-1);
312  UnEscapeLexed(StrVal);
313  return kind;
314  }
315  }
316 }
317 
318 /// ReadVarName - Read the rest of a token containing a variable name.
319 bool LLLexer::ReadVarName() {
320  const char *NameStart = CurPtr;
321  if (isalpha(static_cast<unsigned char>(CurPtr[0])) ||
322  CurPtr[0] == '-' || CurPtr[0] == '$' ||
323  CurPtr[0] == '.' || CurPtr[0] == '_') {
324  ++CurPtr;
325  while (isalnum(static_cast<unsigned char>(CurPtr[0])) ||
326  CurPtr[0] == '-' || CurPtr[0] == '$' ||
327  CurPtr[0] == '.' || CurPtr[0] == '_')
328  ++CurPtr;
329 
330  StrVal.assign(NameStart, CurPtr);
331  return true;
332  }
333  return false;
334 }
335 
336 // Lex an ID: [0-9]+. On success, the ID is stored in UIntVal and Token is
337 // returned, otherwise the Error token is returned.
338 lltok::Kind LLLexer::LexUIntID(lltok::Kind Token) {
339  if (!isdigit(static_cast<unsigned char>(CurPtr[0])))
340  return lltok::Error;
341 
342  for (++CurPtr; isdigit(static_cast<unsigned char>(CurPtr[0])); ++CurPtr)
343  /*empty*/;
344 
345  uint64_t Val = atoull(TokStart + 1, CurPtr);
346  if ((unsigned)Val != Val)
347  Error("invalid value number (too large)!");
348  UIntVal = unsigned(Val);
349  return Token;
350 }
351 
352 lltok::Kind LLLexer::LexVar(lltok::Kind Var, lltok::Kind VarID) {
353  // Handle StringConstant: \"[^\"]*\"
354  if (CurPtr[0] == '"') {
355  ++CurPtr;
356 
357  while (true) {
358  int CurChar = getNextChar();
359 
360  if (CurChar == EOF) {
361  Error("end of file in global variable name");
362  return lltok::Error;
363  }
364  if (CurChar == '"') {
365  StrVal.assign(TokStart+2, CurPtr-1);
366  UnEscapeLexed(StrVal);
367  if (StringRef(StrVal).find_first_of(0) != StringRef::npos) {
368  Error("Null bytes are not allowed in names");
369  return lltok::Error;
370  }
371  return Var;
372  }
373  }
374  }
375 
376  // Handle VarName: [-a-zA-Z$._][-a-zA-Z$._0-9]*
377  if (ReadVarName())
378  return Var;
379 
380  // Handle VarID: [0-9]+
381  return LexUIntID(VarID);
382 }
383 
384 /// Lex all tokens that start with a % character.
385 /// LocalVar ::= %\"[^\"]*\"
386 /// LocalVar ::= %[-a-zA-Z$._][-a-zA-Z$._0-9]*
387 /// LocalVarID ::= %[0-9]+
388 lltok::Kind LLLexer::LexPercent() {
389  return LexVar(lltok::LocalVar, lltok::LocalVarID);
390 }
391 
392 /// Lex all tokens that start with a " character.
393 /// QuoteLabel "[^"]+":
394 /// StringConstant "[^"]*"
395 lltok::Kind LLLexer::LexQuote() {
396  lltok::Kind kind = ReadString(lltok::StringConstant);
397  if (kind == lltok::Error || kind == lltok::Eof)
398  return kind;
399 
400  if (CurPtr[0] == ':') {
401  ++CurPtr;
402  if (StringRef(StrVal).find_first_of(0) != StringRef::npos) {
403  Error("Null bytes are not allowed in names");
404  kind = lltok::Error;
405  } else {
406  kind = lltok::LabelStr;
407  }
408  }
409 
410  return kind;
411 }
412 
413 /// Lex all tokens that start with a ! character.
414 /// !foo
415 /// !
416 lltok::Kind LLLexer::LexExclaim() {
417  // Lex a metadata name as a MetadataVar.
418  if (isalpha(static_cast<unsigned char>(CurPtr[0])) ||
419  CurPtr[0] == '-' || CurPtr[0] == '$' ||
420  CurPtr[0] == '.' || CurPtr[0] == '_' || CurPtr[0] == '\\') {
421  ++CurPtr;
422  while (isalnum(static_cast<unsigned char>(CurPtr[0])) ||
423  CurPtr[0] == '-' || CurPtr[0] == '$' ||
424  CurPtr[0] == '.' || CurPtr[0] == '_' || CurPtr[0] == '\\')
425  ++CurPtr;
426 
427  StrVal.assign(TokStart+1, CurPtr); // Skip !
428  UnEscapeLexed(StrVal);
429  return lltok::MetadataVar;
430  }
431  return lltok::exclaim;
432 }
433 
434 /// Lex all tokens that start with a ^ character.
435 /// SummaryID ::= ^[0-9]+
436 lltok::Kind LLLexer::LexCaret() {
437  // Handle SummaryID: ^[0-9]+
438  return LexUIntID(lltok::SummaryID);
439 }
440 
441 /// Lex all tokens that start with a # character.
442 /// AttrGrpID ::= #[0-9]+
443 lltok::Kind LLLexer::LexHash() {
444  // Handle AttrGrpID: #[0-9]+
445  return LexUIntID(lltok::AttrGrpID);
446 }
447 
448 /// Lex a label, integer type, keyword, or hexadecimal integer constant.
449 /// Label [-a-zA-Z$._0-9]+:
450 /// IntegerType i[0-9]+
451 /// Keyword sdiv, float, ...
452 /// HexIntConstant [us]0x[0-9A-Fa-f]+
453 lltok::Kind LLLexer::LexIdentifier() {
454  const char *StartChar = CurPtr;
455  const char *IntEnd = CurPtr[-1] == 'i' ? nullptr : StartChar;
456  const char *KeywordEnd = nullptr;
457 
458  for (; isLabelChar(*CurPtr); ++CurPtr) {
459  // If we decide this is an integer, remember the end of the sequence.
460  if (!IntEnd && !isdigit(static_cast<unsigned char>(*CurPtr)))
461  IntEnd = CurPtr;
462  if (!KeywordEnd && !isalnum(static_cast<unsigned char>(*CurPtr)) &&
463  *CurPtr != '_')
464  KeywordEnd = CurPtr;
465  }
466 
467  // If we stopped due to a colon, unless we were directed to ignore it,
468  // this really is a label.
469  if (!IgnoreColonInIdentifiers && *CurPtr == ':') {
470  StrVal.assign(StartChar-1, CurPtr++);
471  return lltok::LabelStr;
472  }
473 
474  // Otherwise, this wasn't a label. If this was valid as an integer type,
475  // return it.
476  if (!IntEnd) IntEnd = CurPtr;
477  if (IntEnd != StartChar) {
478  CurPtr = IntEnd;
479  uint64_t NumBits = atoull(StartChar, CurPtr);
480  if (NumBits < IntegerType::MIN_INT_BITS ||
481  NumBits > IntegerType::MAX_INT_BITS) {
482  Error("bitwidth for integer type out of range!");
483  return lltok::Error;
484  }
485  TyVal = IntegerType::get(Context, NumBits);
486  return lltok::Type;
487  }
488 
489  // Otherwise, this was a letter sequence. See which keyword this is.
490  if (!KeywordEnd) KeywordEnd = CurPtr;
491  CurPtr = KeywordEnd;
492  --StartChar;
493  StringRef Keyword(StartChar, CurPtr - StartChar);
494 
495 #define KEYWORD(STR) \
496  do { \
497  if (Keyword == #STR) \
498  return lltok::kw_##STR; \
499  } while (false)
500 
501  KEYWORD(true); KEYWORD(false);
502  KEYWORD(declare); KEYWORD(define);
503  KEYWORD(global); KEYWORD(constant);
504 
505  KEYWORD(dso_local);
506  KEYWORD(dso_preemptable);
507 
508  KEYWORD(private);
509  KEYWORD(internal);
510  KEYWORD(available_externally);
511  KEYWORD(linkonce);
512  KEYWORD(linkonce_odr);
513  KEYWORD(weak); // Use as a linkage, and a modifier for "cmpxchg".
514  KEYWORD(weak_odr);
515  KEYWORD(appending);
516  KEYWORD(dllimport);
517  KEYWORD(dllexport);
518  KEYWORD(common);
519  KEYWORD(default);
520  KEYWORD(hidden);
521  KEYWORD(protected);
522  KEYWORD(unnamed_addr);
523  KEYWORD(local_unnamed_addr);
524  KEYWORD(externally_initialized);
525  KEYWORD(extern_weak);
526  KEYWORD(external);
527  KEYWORD(thread_local);
528  KEYWORD(localdynamic);
529  KEYWORD(initialexec);
530  KEYWORD(localexec);
531  KEYWORD(zeroinitializer);
532  KEYWORD(undef);
533  KEYWORD(null);
534  KEYWORD(none);
535  KEYWORD(to);
536  KEYWORD(caller);
537  KEYWORD(within);
538  KEYWORD(from);
539  KEYWORD(tail);
540  KEYWORD(musttail);
541  KEYWORD(notail);
542  KEYWORD(target);
543  KEYWORD(triple);
544  KEYWORD(source_filename);
545  KEYWORD(unwind);
546  KEYWORD(deplibs); // FIXME: Remove in 4.0.
547  KEYWORD(datalayout);
548  KEYWORD(volatile);
549  KEYWORD(atomic);
550  KEYWORD(unordered);
551  KEYWORD(monotonic);
552  KEYWORD(acquire);
553  KEYWORD(release);
554  KEYWORD(acq_rel);
555  KEYWORD(seq_cst);
556  KEYWORD(syncscope);
557 
558  KEYWORD(nnan);
559  KEYWORD(ninf);
560  KEYWORD(nsz);
561  KEYWORD(arcp);
562  KEYWORD(contract);
563  KEYWORD(reassoc);
564  KEYWORD(afn);
565  KEYWORD(fast);
566  KEYWORD(nuw);
567  KEYWORD(nsw);
568  KEYWORD(exact);
569  KEYWORD(inbounds);
570  KEYWORD(inrange);
571  KEYWORD(align);
572  KEYWORD(addrspace);
573  KEYWORD(section);
574  KEYWORD(alias);
575  KEYWORD(ifunc);
576  KEYWORD(module);
577  KEYWORD(asm);
578  KEYWORD(sideeffect);
579  KEYWORD(alignstack);
580  KEYWORD(inteldialect);
581  KEYWORD(gc);
582  KEYWORD(prefix);
583  KEYWORD(prologue);
584 
585  KEYWORD(ccc);
586  KEYWORD(fastcc);
587  KEYWORD(coldcc);
588  KEYWORD(x86_stdcallcc);
589  KEYWORD(x86_fastcallcc);
590  KEYWORD(x86_thiscallcc);
591  KEYWORD(x86_vectorcallcc);
592  KEYWORD(arm_apcscc);
593  KEYWORD(arm_aapcscc);
594  KEYWORD(arm_aapcs_vfpcc);
595  KEYWORD(msp430_intrcc);
596  KEYWORD(avr_intrcc);
597  KEYWORD(avr_signalcc);
598  KEYWORD(ptx_kernel);
599  KEYWORD(ptx_device);
600  KEYWORD(spir_kernel);
601  KEYWORD(spir_func);
602  KEYWORD(intel_ocl_bicc);
603  KEYWORD(x86_64_sysvcc);
604  KEYWORD(win64cc);
605  KEYWORD(x86_regcallcc);
606  KEYWORD(webkit_jscc);
607  KEYWORD(swiftcc);
608  KEYWORD(anyregcc);
609  KEYWORD(preserve_mostcc);
610  KEYWORD(preserve_allcc);
611  KEYWORD(ghccc);
612  KEYWORD(x86_intrcc);
613  KEYWORD(hhvmcc);
614  KEYWORD(hhvm_ccc);
615  KEYWORD(cxx_fast_tlscc);
616  KEYWORD(amdgpu_vs);
617  KEYWORD(amdgpu_ls);
618  KEYWORD(amdgpu_hs);
619  KEYWORD(amdgpu_es);
620  KEYWORD(amdgpu_gs);
621  KEYWORD(amdgpu_ps);
622  KEYWORD(amdgpu_cs);
623  KEYWORD(amdgpu_kernel);
624 
625  KEYWORD(cc);
626  KEYWORD(c);
627 
629 
630  KEYWORD(alwaysinline);
631  KEYWORD(allocsize);
632  KEYWORD(argmemonly);
633  KEYWORD(builtin);
634  KEYWORD(byval);
635  KEYWORD(inalloca);
636  KEYWORD(cold);
637  KEYWORD(convergent);
638  KEYWORD(dereferenceable);
639  KEYWORD(dereferenceable_or_null);
640  KEYWORD(inaccessiblememonly);
641  KEYWORD(inaccessiblemem_or_argmemonly);
642  KEYWORD(inlinehint);
643  KEYWORD(inreg);
644  KEYWORD(jumptable);
645  KEYWORD(minsize);
646  KEYWORD(naked);
647  KEYWORD(nest);
648  KEYWORD(noalias);
649  KEYWORD(nobuiltin);
650  KEYWORD(nocapture);
651  KEYWORD(noduplicate);
652  KEYWORD(noimplicitfloat);
653  KEYWORD(noinline);
654  KEYWORD(norecurse);
655  KEYWORD(nonlazybind);
656  KEYWORD(nonnull);
657  KEYWORD(noredzone);
658  KEYWORD(noreturn);
659  KEYWORD(nocf_check);
660  KEYWORD(nounwind);
661  KEYWORD(optforfuzzing);
662  KEYWORD(optnone);
663  KEYWORD(optsize);
664  KEYWORD(readnone);
665  KEYWORD(readonly);
666  KEYWORD(returned);
667  KEYWORD(returns_twice);
668  KEYWORD(signext);
669  KEYWORD(speculatable);
670  KEYWORD(sret);
671  KEYWORD(ssp);
672  KEYWORD(sspreq);
673  KEYWORD(sspstrong);
674  KEYWORD(strictfp);
675  KEYWORD(safestack);
676  KEYWORD(shadowcallstack);
677  KEYWORD(sanitize_address);
678  KEYWORD(sanitize_hwaddress);
679  KEYWORD(sanitize_thread);
680  KEYWORD(sanitize_memory);
681  KEYWORD(swifterror);
682  KEYWORD(swiftself);
683  KEYWORD(uwtable);
684  KEYWORD(writeonly);
685  KEYWORD(zeroext);
686 
687  KEYWORD(type);
688  KEYWORD(opaque);
689 
690  KEYWORD(comdat);
691 
692  // Comdat types
693  KEYWORD(any);
694  KEYWORD(exactmatch);
695  KEYWORD(largest);
696  KEYWORD(noduplicates);
697  KEYWORD(samesize);
698 
699  KEYWORD(eq); KEYWORD(ne); KEYWORD(slt); KEYWORD(sgt); KEYWORD(sle);
700  KEYWORD(sge); KEYWORD(ult); KEYWORD(ugt); KEYWORD(ule); KEYWORD(uge);
701  KEYWORD(oeq); KEYWORD(one); KEYWORD(olt); KEYWORD(ogt); KEYWORD(ole);
702  KEYWORD(oge); KEYWORD(ord); KEYWORD(uno); KEYWORD(ueq); KEYWORD(une);
703 
704  KEYWORD(xchg); KEYWORD(nand); KEYWORD(max); KEYWORD(min); KEYWORD(umax);
705  KEYWORD(umin);
706 
707  KEYWORD(x);
708  KEYWORD(blockaddress);
709 
710  // Metadata types.
711  KEYWORD(distinct);
712 
713  // Use-list order directives.
714  KEYWORD(uselistorder);
715  KEYWORD(uselistorder_bb);
716 
717  KEYWORD(personality);
718  KEYWORD(cleanup);
719  KEYWORD(catch);
720  KEYWORD(filter);
721 
722  // Summary index keywords.
723  KEYWORD(path);
724  KEYWORD(hash);
725  KEYWORD(gv);
726  KEYWORD(guid);
727  KEYWORD(name);
728  KEYWORD(summaries);
729  KEYWORD(flags);
730  KEYWORD(linkage);
731  KEYWORD(notEligibleToImport);
732  KEYWORD(live);
733  KEYWORD(dsoLocal);
734  KEYWORD(function);
735  KEYWORD(insts);
736  KEYWORD(funcFlags);
737  KEYWORD(readNone);
738  KEYWORD(readOnly);
739  KEYWORD(noRecurse);
740  KEYWORD(returnDoesNotAlias);
741  KEYWORD(calls);
742  KEYWORD(callee);
743  KEYWORD(hotness);
744  KEYWORD(unknown);
745  KEYWORD(hot);
746  KEYWORD(critical);
747  KEYWORD(relbf);
748  KEYWORD(variable);
749  KEYWORD(aliasee);
750  KEYWORD(refs);
751  KEYWORD(typeIdInfo);
752  KEYWORD(typeTests);
753  KEYWORD(typeTestAssumeVCalls);
754  KEYWORD(typeCheckedLoadVCalls);
755  KEYWORD(typeTestAssumeConstVCalls);
756  KEYWORD(typeCheckedLoadConstVCalls);
757  KEYWORD(vFuncId);
758  KEYWORD(offset);
759  KEYWORD(args);
760  KEYWORD(typeid);
761  KEYWORD(summary);
762  KEYWORD(typeTestRes);
763  KEYWORD(kind);
764  KEYWORD(unsat);
765  KEYWORD(byteArray);
766  KEYWORD(inline);
767  KEYWORD(single);
768  KEYWORD(allOnes);
769  KEYWORD(sizeM1BitWidth);
770  KEYWORD(alignLog2);
771  KEYWORD(sizeM1);
772  KEYWORD(bitMask);
773  KEYWORD(inlineBits);
774  KEYWORD(wpdResolutions);
775  KEYWORD(wpdRes);
776  KEYWORD(indir);
777  KEYWORD(singleImpl);
778  KEYWORD(branchFunnel);
779  KEYWORD(singleImplName);
780  KEYWORD(resByArg);
781  KEYWORD(byArg);
782  KEYWORD(uniformRetVal);
783  KEYWORD(uniqueRetVal);
784  KEYWORD(virtualConstProp);
785  KEYWORD(info);
786  KEYWORD(byte);
787  KEYWORD(bit);
788 
789 #undef KEYWORD
790 
791  // Keywords for types.
792 #define TYPEKEYWORD(STR, LLVMTY) \
793  do { \
794  if (Keyword == STR) { \
795  TyVal = LLVMTY; \
796  return lltok::Type; \
797  } \
798  } while (false)
799 
800  TYPEKEYWORD("void", Type::getVoidTy(Context));
801  TYPEKEYWORD("half", Type::getHalfTy(Context));
802  TYPEKEYWORD("float", Type::getFloatTy(Context));
803  TYPEKEYWORD("double", Type::getDoubleTy(Context));
804  TYPEKEYWORD("x86_fp80", Type::getX86_FP80Ty(Context));
805  TYPEKEYWORD("fp128", Type::getFP128Ty(Context));
806  TYPEKEYWORD("ppc_fp128", Type::getPPC_FP128Ty(Context));
807  TYPEKEYWORD("label", Type::getLabelTy(Context));
808  TYPEKEYWORD("metadata", Type::getMetadataTy(Context));
809  TYPEKEYWORD("x86_mmx", Type::getX86_MMXTy(Context));
810  TYPEKEYWORD("token", Type::getTokenTy(Context));
811 
812 #undef TYPEKEYWORD
813 
814  // Keywords for instructions.
815 #define INSTKEYWORD(STR, Enum) \
816  do { \
817  if (Keyword == #STR) { \
818  UIntVal = Instruction::Enum; \
819  return lltok::kw_##STR; \
820  } \
821  } while (false)
822 
823  INSTKEYWORD(add, Add); INSTKEYWORD(fadd, FAdd);
824  INSTKEYWORD(sub, Sub); INSTKEYWORD(fsub, FSub);
825  INSTKEYWORD(mul, Mul); INSTKEYWORD(fmul, FMul);
826  INSTKEYWORD(udiv, UDiv); INSTKEYWORD(sdiv, SDiv); INSTKEYWORD(fdiv, FDiv);
827  INSTKEYWORD(urem, URem); INSTKEYWORD(srem, SRem); INSTKEYWORD(frem, FRem);
828  INSTKEYWORD(shl, Shl); INSTKEYWORD(lshr, LShr); INSTKEYWORD(ashr, AShr);
829  INSTKEYWORD(and, And); INSTKEYWORD(or, Or); INSTKEYWORD(xor, Xor);
830  INSTKEYWORD(icmp, ICmp); INSTKEYWORD(fcmp, FCmp);
831 
832  INSTKEYWORD(phi, PHI);
833  INSTKEYWORD(call, Call);
834  INSTKEYWORD(trunc, Trunc);
835  INSTKEYWORD(zext, ZExt);
836  INSTKEYWORD(sext, SExt);
837  INSTKEYWORD(fptrunc, FPTrunc);
838  INSTKEYWORD(fpext, FPExt);
839  INSTKEYWORD(uitofp, UIToFP);
840  INSTKEYWORD(sitofp, SIToFP);
841  INSTKEYWORD(fptoui, FPToUI);
842  INSTKEYWORD(fptosi, FPToSI);
843  INSTKEYWORD(inttoptr, IntToPtr);
844  INSTKEYWORD(ptrtoint, PtrToInt);
845  INSTKEYWORD(bitcast, BitCast);
846  INSTKEYWORD(addrspacecast, AddrSpaceCast);
847  INSTKEYWORD(select, Select);
848  INSTKEYWORD(va_arg, VAArg);
849  INSTKEYWORD(ret, Ret);
850  INSTKEYWORD(br, Br);
851  INSTKEYWORD(switch, Switch);
852  INSTKEYWORD(indirectbr, IndirectBr);
853  INSTKEYWORD(invoke, Invoke);
854  INSTKEYWORD(resume, Resume);
855  INSTKEYWORD(unreachable, Unreachable);
856 
857  INSTKEYWORD(alloca, Alloca);
858  INSTKEYWORD(load, Load);
859  INSTKEYWORD(store, Store);
860  INSTKEYWORD(cmpxchg, AtomicCmpXchg);
861  INSTKEYWORD(atomicrmw, AtomicRMW);
862  INSTKEYWORD(fence, Fence);
863  INSTKEYWORD(getelementptr, GetElementPtr);
864 
865  INSTKEYWORD(extractelement, ExtractElement);
866  INSTKEYWORD(insertelement, InsertElement);
867  INSTKEYWORD(shufflevector, ShuffleVector);
868  INSTKEYWORD(extractvalue, ExtractValue);
869  INSTKEYWORD(insertvalue, InsertValue);
870  INSTKEYWORD(landingpad, LandingPad);
871  INSTKEYWORD(cleanupret, CleanupRet);
872  INSTKEYWORD(catchret, CatchRet);
873  INSTKEYWORD(catchswitch, CatchSwitch);
874  INSTKEYWORD(catchpad, CatchPad);
875  INSTKEYWORD(cleanuppad, CleanupPad);
876 
877 #undef INSTKEYWORD
878 
879 #define DWKEYWORD(TYPE, TOKEN) \
880  do { \
881  if (Keyword.startswith("DW_" #TYPE "_")) { \
882  StrVal.assign(Keyword.begin(), Keyword.end()); \
883  return lltok::TOKEN; \
884  } \
885  } while (false)
886 
887  DWKEYWORD(TAG, DwarfTag);
889  DWKEYWORD(VIRTUALITY, DwarfVirtuality);
890  DWKEYWORD(LANG, DwarfLang);
891  DWKEYWORD(CC, DwarfCC);
892  DWKEYWORD(OP, DwarfOp);
893  DWKEYWORD(MACINFO, DwarfMacinfo);
894 
895 #undef DWKEYWORD
896 
897  if (Keyword.startswith("DIFlag")) {
898  StrVal.assign(Keyword.begin(), Keyword.end());
899  return lltok::DIFlag;
900  }
901 
902  if (Keyword.startswith("CSK_")) {
903  StrVal.assign(Keyword.begin(), Keyword.end());
904  return lltok::ChecksumKind;
905  }
906 
907  if (Keyword == "NoDebug" || Keyword == "FullDebug" ||
908  Keyword == "LineTablesOnly") {
909  StrVal.assign(Keyword.begin(), Keyword.end());
910  return lltok::EmissionKind;
911  }
912 
913  // Check for [us]0x[0-9A-Fa-f]+ which are Hexadecimal constant generated by
914  // the CFE to avoid forcing it to deal with 64-bit numbers.
915  if ((TokStart[0] == 'u' || TokStart[0] == 's') &&
916  TokStart[1] == '0' && TokStart[2] == 'x' &&
917  isxdigit(static_cast<unsigned char>(TokStart[3]))) {
918  int len = CurPtr-TokStart-3;
919  uint32_t bits = len * 4;
920  StringRef HexStr(TokStart + 3, len);
921  if (!all_of(HexStr, isxdigit)) {
922  // Bad token, return it as an error.
923  CurPtr = TokStart+3;
924  return lltok::Error;
925  }
926  APInt Tmp(bits, HexStr, 16);
927  uint32_t activeBits = Tmp.getActiveBits();
928  if (activeBits > 0 && activeBits < bits)
929  Tmp = Tmp.trunc(activeBits);
930  APSIntVal = APSInt(Tmp, TokStart[0] == 'u');
931  return lltok::APSInt;
932  }
933 
934  // If this is "cc1234", return this as just "cc".
935  if (TokStart[0] == 'c' && TokStart[1] == 'c') {
936  CurPtr = TokStart+2;
937  return lltok::kw_cc;
938  }
939 
940  // Finally, if this isn't known, return an error.
941  CurPtr = TokStart+1;
942  return lltok::Error;
943 }
944 
945 /// Lex all tokens that start with a 0x prefix, knowing they match and are not
946 /// labels.
947 /// HexFPConstant 0x[0-9A-Fa-f]+
948 /// HexFP80Constant 0xK[0-9A-Fa-f]+
949 /// HexFP128Constant 0xL[0-9A-Fa-f]+
950 /// HexPPC128Constant 0xM[0-9A-Fa-f]+
951 /// HexHalfConstant 0xH[0-9A-Fa-f]+
952 lltok::Kind LLLexer::Lex0x() {
953  CurPtr = TokStart + 2;
954 
955  char Kind;
956  if ((CurPtr[0] >= 'K' && CurPtr[0] <= 'M') || CurPtr[0] == 'H') {
957  Kind = *CurPtr++;
958  } else {
959  Kind = 'J';
960  }
961 
962  if (!isxdigit(static_cast<unsigned char>(CurPtr[0]))) {
963  // Bad token, return it as an error.
964  CurPtr = TokStart+1;
965  return lltok::Error;
966  }
967 
968  while (isxdigit(static_cast<unsigned char>(CurPtr[0])))
969  ++CurPtr;
970 
971  if (Kind == 'J') {
972  // HexFPConstant - Floating point constant represented in IEEE format as a
973  // hexadecimal number for when exponential notation is not precise enough.
974  // Half, Float, and double only.
975  APFloatVal = APFloat(APFloat::IEEEdouble(),
976  APInt(64, HexIntToVal(TokStart + 2, CurPtr)));
977  return lltok::APFloat;
978  }
979 
980  uint64_t Pair[2];
981  switch (Kind) {
982  default: llvm_unreachable("Unknown kind!");
983  case 'K':
984  // F80HexFPConstant - x87 long double in hexadecimal format (10 bytes)
985  FP80HexToIntPair(TokStart+3, CurPtr, Pair);
986  APFloatVal = APFloat(APFloat::x87DoubleExtended(), APInt(80, Pair));
987  return lltok::APFloat;
988  case 'L':
989  // F128HexFPConstant - IEEE 128-bit in hexadecimal format (16 bytes)
990  HexToIntPair(TokStart+3, CurPtr, Pair);
991  APFloatVal = APFloat(APFloat::IEEEquad(), APInt(128, Pair));
992  return lltok::APFloat;
993  case 'M':
994  // PPC128HexFPConstant - PowerPC 128-bit in hexadecimal format (16 bytes)
995  HexToIntPair(TokStart+3, CurPtr, Pair);
996  APFloatVal = APFloat(APFloat::PPCDoubleDouble(), APInt(128, Pair));
997  return lltok::APFloat;
998  case 'H':
999  APFloatVal = APFloat(APFloat::IEEEhalf(),
1000  APInt(16,HexIntToVal(TokStart+3, CurPtr)));
1001  return lltok::APFloat;
1002  }
1003 }
1004 
1005 /// Lex tokens for a label or a numeric constant, possibly starting with -.
1006 /// Label [-a-zA-Z$._0-9]+:
1007 /// NInteger -[0-9]+
1008 /// FPConstant [-+]?[0-9]+[.][0-9]*([eE][-+]?[0-9]+)?
1009 /// PInteger [0-9]+
1010 /// HexFPConstant 0x[0-9A-Fa-f]+
1011 /// HexFP80Constant 0xK[0-9A-Fa-f]+
1012 /// HexFP128Constant 0xL[0-9A-Fa-f]+
1013 /// HexPPC128Constant 0xM[0-9A-Fa-f]+
1014 lltok::Kind LLLexer::LexDigitOrNegative() {
1015  // If the letter after the negative is not a number, this is probably a label.
1016  if (!isdigit(static_cast<unsigned char>(TokStart[0])) &&
1017  !isdigit(static_cast<unsigned char>(CurPtr[0]))) {
1018  // Okay, this is not a number after the -, it's probably a label.
1019  if (const char *End = isLabelTail(CurPtr)) {
1020  StrVal.assign(TokStart, End-1);
1021  CurPtr = End;
1022  return lltok::LabelStr;
1023  }
1024 
1025  return lltok::Error;
1026  }
1027 
1028  // At this point, it is either a label, int or fp constant.
1029 
1030  // Skip digits, we have at least one.
1031  for (; isdigit(static_cast<unsigned char>(CurPtr[0])); ++CurPtr)
1032  /*empty*/;
1033 
1034  // Check to see if this really is a label afterall, e.g. "-1:".
1035  if (isLabelChar(CurPtr[0]) || CurPtr[0] == ':') {
1036  if (const char *End = isLabelTail(CurPtr)) {
1037  StrVal.assign(TokStart, End-1);
1038  CurPtr = End;
1039  return lltok::LabelStr;
1040  }
1041  }
1042 
1043  // If the next character is a '.', then it is a fp value, otherwise its
1044  // integer.
1045  if (CurPtr[0] != '.') {
1046  if (TokStart[0] == '0' && TokStart[1] == 'x')
1047  return Lex0x();
1048  APSIntVal = APSInt(StringRef(TokStart, CurPtr - TokStart));
1049  return lltok::APSInt;
1050  }
1051 
1052  ++CurPtr;
1053 
1054  // Skip over [0-9]*([eE][-+]?[0-9]+)?
1055  while (isdigit(static_cast<unsigned char>(CurPtr[0]))) ++CurPtr;
1056 
1057  if (CurPtr[0] == 'e' || CurPtr[0] == 'E') {
1058  if (isdigit(static_cast<unsigned char>(CurPtr[1])) ||
1059  ((CurPtr[1] == '-' || CurPtr[1] == '+') &&
1060  isdigit(static_cast<unsigned char>(CurPtr[2])))) {
1061  CurPtr += 2;
1062  while (isdigit(static_cast<unsigned char>(CurPtr[0]))) ++CurPtr;
1063  }
1064  }
1065 
1066  APFloatVal = APFloat(APFloat::IEEEdouble(),
1067  StringRef(TokStart, CurPtr - TokStart));
1068  return lltok::APFloat;
1069 }
1070 
1071 /// Lex a floating point constant starting with +.
1072 /// FPConstant [-+]?[0-9]+[.][0-9]*([eE][-+]?[0-9]+)?
1073 lltok::Kind LLLexer::LexPositive() {
1074  // If the letter after the negative is a number, this is probably not a
1075  // label.
1076  if (!isdigit(static_cast<unsigned char>(CurPtr[0])))
1077  return lltok::Error;
1078 
1079  // Skip digits.
1080  for (++CurPtr; isdigit(static_cast<unsigned char>(CurPtr[0])); ++CurPtr)
1081  /*empty*/;
1082 
1083  // At this point, we need a '.'.
1084  if (CurPtr[0] != '.') {
1085  CurPtr = TokStart+1;
1086  return lltok::Error;
1087  }
1088 
1089  ++CurPtr;
1090 
1091  // Skip over [0-9]*([eE][-+]?[0-9]+)?
1092  while (isdigit(static_cast<unsigned char>(CurPtr[0]))) ++CurPtr;
1093 
1094  if (CurPtr[0] == 'e' || CurPtr[0] == 'E') {
1095  if (isdigit(static_cast<unsigned char>(CurPtr[1])) ||
1096  ((CurPtr[1] == '-' || CurPtr[1] == '+') &&
1097  isdigit(static_cast<unsigned char>(CurPtr[2])))) {
1098  CurPtr += 2;
1099  while (isdigit(static_cast<unsigned char>(CurPtr[0]))) ++CurPtr;
1100  }
1101  }
1102 
1103  APFloatVal = APFloat(APFloat::IEEEdouble(),
1104  StringRef(TokStart, CurPtr - TokStart));
1105  return lltok::APFloat;
1106 }
objc arc contract
uint64_t CallInst * C
static const fltSemantics & IEEEquad() LLVM_READNONE
Definition: APFloat.cpp:126
Maximum number of bits that can be specified.
Definition: DerivedTypes.h:52
static Type * getDoubleTy(LLVMContext &C)
Definition: Type.cpp:165
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
Minimum number of bits that can be specified.
Definition: DerivedTypes.h:51
void Warning(LocTy WarningLoc, const Twine &Msg) const
Definition: LLLexer.cpp:34
static const char * isLabelTail(const char *CurPtr)
isLabelTail - Return true if this pointer points to a valid end of a label.
Definition: LLLexer.cpp:148
demanded bits
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly...
Definition: STLExtras.h:921
APInt trunc(unsigned width) const
Truncate to new width.
Definition: APInt.cpp:817
#define DWKEYWORD(TYPE, TOKEN)
static void cleanup(BlockFrequencyInfoImplBase &BFI)
Clear all memory not needed downstream.
static Type * getMetadataTy(LLVMContext &C)
Definition: Type.cpp:166
static Type * getX86_MMXTy(LLVMContext &C)
Definition: Type.cpp:171
static Type * getX86_FP80Ty(LLVMContext &C)
Definition: Type.cpp:168
static uint64_t allOnes(unsigned int Count)
void PrintMessage(raw_ostream &OS, SMLoc Loc, DiagKind Kind, const Twine &Msg, ArrayRef< SMRange > Ranges=None, ArrayRef< SMFixIt > FixIts=None, bool ShowColors=true) const
Emit a message about the specified location with the specified string.
Definition: SourceMgr.cpp:247
static Type * getTokenTy(LLVMContext &C)
Definition: Type.cpp:167
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
static Type * getFloatTy(LLVMContext &C)
Definition: Type.cpp:164
#define TYPEKEYWORD(STR, LLVMTY)
static Type * getPPC_FP128Ty(LLVMContext &C)
Definition: Type.cpp:170
LLLexer(StringRef StartBuf, SourceMgr &SM, SMDiagnostic &, LLVMContext &C)
Definition: LLLexer.cpp:160
static bool isLabelChar(char C)
isLabelChar - Return true for [-a-zA-Z$._0-9].
Definition: LLLexer.cpp:142
This file implements a class to represent arbitrary precision integral constant values and operations...
unsigned getActiveBits() const
Compute the number of active bits in the value.
Definition: APInt.h:1526
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
Definition: StringRef.h:267
static Type * getLabelTy(LLVMContext &C)
Definition: Type.cpp:162
static const fltSemantics & IEEEdouble() LLVM_READNONE
Definition: APFloat.cpp:123
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:69
static Type * getVoidTy(LLVMContext &C)
Definition: Type.cpp:161
static const fltSemantics & x87DoubleExtended() LLVM_READNONE
Definition: APFloat.cpp:129
rewrite statepoints for gc
lazy value info
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling...
Definition: SourceMgr.h:42
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
SMDiagnostic GetMessage(SMLoc Loc, DiagKind Kind, const Twine &Msg, ArrayRef< SMRange > Ranges=None, ArrayRef< SMFixIt > FixIts=None) const
Return an SMDiagnostic at the specified location with the specified string.
Definition: SourceMgr.cpp:168
static Type * getFP128Ty(LLVMContext &C)
Definition: Type.cpp:169
const APInt & umin(const APInt &A, const APInt &B)
Determine the smaller of two APInts considered to be signed.
Definition: APInt.h:2108
static Type * getHalfTy(LLVMContext &C)
Definition: Type.cpp:163
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
Definition: Type.cpp:240
static const fltSemantics & IEEEhalf() LLVM_READNONE
Definition: APFloat.cpp:117
Class for arbitrary precision integers.
Definition: APInt.h:69
Base class for user error types.
Definition: Error.h:340
unsigned hexDigitValue(char C)
Interpret the given character C as a hexadecimal digit and return its value.
Definition: StringExtras.h:69
const APInt & umax(const APInt &A, const APInt &B)
Determine the larger of two APInts considered to be unsigned.
Definition: APInt.h:2113
iterator begin() const
Definition: StringRef.h:106
static const fltSemantics & PPCDoubleDouble() LLVM_READNONE
Definition: APFloat.cpp:135
static const size_t npos
Definition: StringRef.h:51
Deduce function attributes
bool Error(LocTy ErrorLoc, const Twine &Msg) const
Definition: LLLexer.cpp:29
static void UnEscapeLexed(std::string &Str)
Definition: LLLexer.cpp:115
const unsigned Kind
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static const char * name
amdgpu Simplify well known AMD library calls
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
#define KEYWORD(STR)
Represents a location in source code.
Definition: SMLoc.h:24
iterator end() const
Definition: StringRef.h:108
#define OP(n)
Definition: regex2.h:73
#define INSTKEYWORD(STR, Enum)
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...
Definition: SourceMgr.h:260