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