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