LLVM 19.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).contains(0)) {
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).contains(0)) {
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).contains(0)) {
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(disjoint);
568 KEYWORD(inbounds);
569 KEYWORD(nneg);
570 KEYWORD(inrange);
571 KEYWORD(addrspace);
572 KEYWORD(section);
574 KEYWORD(code_model);
575 KEYWORD(alias);
576 KEYWORD(ifunc);
577 KEYWORD(module);
578 KEYWORD(asm);
579 KEYWORD(sideeffect);
580 KEYWORD(inteldialect);
581 KEYWORD(gc);
582 KEYWORD(prefix);
583 KEYWORD(prologue);
584
585 KEYWORD(no_sanitize_address);
586 KEYWORD(no_sanitize_hwaddress);
587 KEYWORD(sanitize_address_dyninit);
588
589 KEYWORD(ccc);
590 KEYWORD(fastcc);
591 KEYWORD(coldcc);
592 KEYWORD(cfguard_checkcc);
593 KEYWORD(x86_stdcallcc);
594 KEYWORD(x86_fastcallcc);
595 KEYWORD(x86_thiscallcc);
596 KEYWORD(x86_vectorcallcc);
597 KEYWORD(arm_apcscc);
598 KEYWORD(arm_aapcscc);
599 KEYWORD(arm_aapcs_vfpcc);
600 KEYWORD(aarch64_vector_pcs);
601 KEYWORD(aarch64_sve_vector_pcs);
602 KEYWORD(aarch64_sme_preservemost_from_x0);
603 KEYWORD(aarch64_sme_preservemost_from_x2);
604 KEYWORD(msp430_intrcc);
605 KEYWORD(avr_intrcc);
606 KEYWORD(avr_signalcc);
607 KEYWORD(ptx_kernel);
608 KEYWORD(ptx_device);
609 KEYWORD(spir_kernel);
610 KEYWORD(spir_func);
611 KEYWORD(intel_ocl_bicc);
612 KEYWORD(x86_64_sysvcc);
613 KEYWORD(win64cc);
614 KEYWORD(x86_regcallcc);
615 KEYWORD(swiftcc);
616 KEYWORD(swifttailcc);
617 KEYWORD(anyregcc);
618 KEYWORD(preserve_mostcc);
619 KEYWORD(preserve_allcc);
620 KEYWORD(preserve_nonecc);
621 KEYWORD(ghccc);
622 KEYWORD(x86_intrcc);
623 KEYWORD(hhvmcc);
624 KEYWORD(hhvm_ccc);
625 KEYWORD(cxx_fast_tlscc);
626 KEYWORD(amdgpu_vs);
627 KEYWORD(amdgpu_ls);
628 KEYWORD(amdgpu_hs);
629 KEYWORD(amdgpu_es);
630 KEYWORD(amdgpu_gs);
631 KEYWORD(amdgpu_ps);
632 KEYWORD(amdgpu_cs);
633 KEYWORD(amdgpu_cs_chain);
634 KEYWORD(amdgpu_cs_chain_preserve);
635 KEYWORD(amdgpu_kernel);
636 KEYWORD(amdgpu_gfx);
637 KEYWORD(tailcc);
638 KEYWORD(m68k_rtdcc);
639 KEYWORD(graalcc);
640
641 KEYWORD(cc);
642 KEYWORD(c);
643
644 KEYWORD(attributes);
645 KEYWORD(sync);
646 KEYWORD(async);
647
648#define GET_ATTR_NAMES
649#define ATTRIBUTE_ENUM(ENUM_NAME, DISPLAY_NAME) \
650 KEYWORD(DISPLAY_NAME);
651#include "llvm/IR/Attributes.inc"
652
653 KEYWORD(read);
654 KEYWORD(write);
655 KEYWORD(readwrite);
656 KEYWORD(argmem);
657 KEYWORD(inaccessiblemem);
658 KEYWORD(argmemonly);
659 KEYWORD(inaccessiblememonly);
660 KEYWORD(inaccessiblemem_or_argmemonly);
661
662 // nofpclass attribute
663 KEYWORD(all);
664 KEYWORD(nan);
665 KEYWORD(snan);
666 KEYWORD(qnan);
667 KEYWORD(inf);
668 // ninf already a keyword
669 KEYWORD(pinf);
670 KEYWORD(norm);
671 KEYWORD(nnorm);
672 KEYWORD(pnorm);
673 // sub already a keyword
674 KEYWORD(nsub);
675 KEYWORD(psub);
676 KEYWORD(zero);
677 KEYWORD(nzero);
678 KEYWORD(pzero);
679
680 KEYWORD(type);
681 KEYWORD(opaque);
682
683 KEYWORD(comdat);
684
685 // Comdat types
686 KEYWORD(any);
687 KEYWORD(exactmatch);
688 KEYWORD(largest);
689 KEYWORD(nodeduplicate);
690 KEYWORD(samesize);
691
692 KEYWORD(eq); KEYWORD(ne); KEYWORD(slt); KEYWORD(sgt); KEYWORD(sle);
693 KEYWORD(sge); KEYWORD(ult); KEYWORD(ugt); KEYWORD(ule); KEYWORD(uge);
694 KEYWORD(oeq); KEYWORD(one); KEYWORD(olt); KEYWORD(ogt); KEYWORD(ole);
695 KEYWORD(oge); KEYWORD(ord); KEYWORD(uno); KEYWORD(ueq); KEYWORD(une);
696
697 KEYWORD(xchg); KEYWORD(nand); KEYWORD(max); KEYWORD(min); KEYWORD(umax);
698 KEYWORD(umin); KEYWORD(fmax); KEYWORD(fmin);
699 KEYWORD(uinc_wrap);
700 KEYWORD(udec_wrap);
701
702 KEYWORD(splat);
703 KEYWORD(vscale);
704 KEYWORD(x);
705 KEYWORD(blockaddress);
706 KEYWORD(dso_local_equivalent);
707 KEYWORD(no_cfi);
708
709 // Metadata types.
710 KEYWORD(distinct);
711
712 // Use-list order directives.
713 KEYWORD(uselistorder);
714 KEYWORD(uselistorder_bb);
715
716 KEYWORD(personality);
718 KEYWORD(catch);
719 KEYWORD(filter);
720
721 // Summary index keywords.
722 KEYWORD(path);
723 KEYWORD(hash);
724 KEYWORD(gv);
725 KEYWORD(guid);
726 KEYWORD(name);
727 KEYWORD(summaries);
728 KEYWORD(flags);
729 KEYWORD(blockcount);
730 KEYWORD(linkage);
731 KEYWORD(visibility);
732 KEYWORD(notEligibleToImport);
733 KEYWORD(live);
734 KEYWORD(dsoLocal);
735 KEYWORD(canAutoHide);
737 KEYWORD(insts);
738 KEYWORD(funcFlags);
739 KEYWORD(readNone);
740 KEYWORD(readOnly);
741 KEYWORD(noRecurse);
742 KEYWORD(returnDoesNotAlias);
743 KEYWORD(noInline);
744 KEYWORD(alwaysInline);
745 KEYWORD(noUnwind);
746 KEYWORD(mayThrow);
747 KEYWORD(hasUnknownCall);
748 KEYWORD(mustBeUnreachable);
749 KEYWORD(calls);
751 KEYWORD(params);
752 KEYWORD(param);
753 KEYWORD(hotness);
754 KEYWORD(unknown);
755 KEYWORD(critical);
756 KEYWORD(relbf);
757 KEYWORD(variable);
758 KEYWORD(vTableFuncs);
759 KEYWORD(virtFunc);
760 KEYWORD(aliasee);
761 KEYWORD(refs);
762 KEYWORD(typeIdInfo);
763 KEYWORD(typeTests);
764 KEYWORD(typeTestAssumeVCalls);
765 KEYWORD(typeCheckedLoadVCalls);
766 KEYWORD(typeTestAssumeConstVCalls);
767 KEYWORD(typeCheckedLoadConstVCalls);
768 KEYWORD(vFuncId);
769 KEYWORD(offset);
770 KEYWORD(args);
771 KEYWORD(typeid);
772 KEYWORD(typeidCompatibleVTable);
773 KEYWORD(summary);
774 KEYWORD(typeTestRes);
775 KEYWORD(kind);
776 KEYWORD(unsat);
777 KEYWORD(byteArray);
778 KEYWORD(inline);
779 KEYWORD(single);
781 KEYWORD(sizeM1BitWidth);
782 KEYWORD(alignLog2);
783 KEYWORD(sizeM1);
784 KEYWORD(bitMask);
785 KEYWORD(inlineBits);
786 KEYWORD(vcall_visibility);
787 KEYWORD(wpdResolutions);
788 KEYWORD(wpdRes);
789 KEYWORD(indir);
790 KEYWORD(singleImpl);
791 KEYWORD(branchFunnel);
792 KEYWORD(singleImplName);
793 KEYWORD(resByArg);
794 KEYWORD(byArg);
795 KEYWORD(uniformRetVal);
796 KEYWORD(uniqueRetVal);
797 KEYWORD(virtualConstProp);
798 KEYWORD(info);
799 KEYWORD(byte);
800 KEYWORD(bit);
801 KEYWORD(varFlags);
802 KEYWORD(callsites);
803 KEYWORD(clones);
804 KEYWORD(stackIds);
805 KEYWORD(allocs);
806 KEYWORD(versions);
807 KEYWORD(memProf);
808 KEYWORD(notcold);
809
810#undef KEYWORD
811
812 // Keywords for types.
813#define TYPEKEYWORD(STR, LLVMTY) \
814 do { \
815 if (Keyword == STR) { \
816 TyVal = LLVMTY; \
817 return lltok::Type; \
818 } \
819 } while (false)
820
821 TYPEKEYWORD("void", Type::getVoidTy(Context));
822 TYPEKEYWORD("half", Type::getHalfTy(Context));
823 TYPEKEYWORD("bfloat", Type::getBFloatTy(Context));
824 TYPEKEYWORD("float", Type::getFloatTy(Context));
825 TYPEKEYWORD("double", Type::getDoubleTy(Context));
826 TYPEKEYWORD("x86_fp80", Type::getX86_FP80Ty(Context));
827 TYPEKEYWORD("fp128", Type::getFP128Ty(Context));
828 TYPEKEYWORD("ppc_fp128", Type::getPPC_FP128Ty(Context));
829 TYPEKEYWORD("label", Type::getLabelTy(Context));
830 TYPEKEYWORD("metadata", Type::getMetadataTy(Context));
831 TYPEKEYWORD("x86_mmx", Type::getX86_MMXTy(Context));
832 TYPEKEYWORD("x86_amx", Type::getX86_AMXTy(Context));
833 TYPEKEYWORD("token", Type::getTokenTy(Context));
834 TYPEKEYWORD("ptr", PointerType::getUnqual(Context));
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.starts_with("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.starts_with("DIFlag")) {
927 StrVal.assign(Keyword.begin(), Keyword.end());
928 return lltok::DIFlag;
929 }
930
931 if (Keyword.starts_with("DISPFlag")) {
932 StrVal.assign(Keyword.begin(), Keyword.end());
933 return lltok::DISPFlag;
934 }
935
936 if (Keyword.starts_with("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 == "Apple" || Keyword == "None" ||
948 Keyword == "Default") {
949 StrVal.assign(Keyword.begin(), Keyword.end());
951 }
952
953 // Check for [us]0x[0-9A-Fa-f]+ which are Hexadecimal constant generated by
954 // the CFE to avoid forcing it to deal with 64-bit numbers.
955 if ((TokStart[0] == 'u' || TokStart[0] == 's') &&
956 TokStart[1] == '0' && TokStart[2] == 'x' &&
957 isxdigit(static_cast<unsigned char>(TokStart[3]))) {
958 int len = CurPtr-TokStart-3;
959 uint32_t bits = len * 4;
960 StringRef HexStr(TokStart + 3, len);
961 if (!all_of(HexStr, isxdigit)) {
962 // Bad token, return it as an error.
963 CurPtr = TokStart+3;
964 return lltok::Error;
965 }
966 APInt Tmp(bits, HexStr, 16);
967 uint32_t activeBits = Tmp.getActiveBits();
968 if (activeBits > 0 && activeBits < bits)
969 Tmp = Tmp.trunc(activeBits);
970 APSIntVal = APSInt(Tmp, TokStart[0] == 'u');
971 return lltok::APSInt;
972 }
973
974 // If this is "cc1234", return this as just "cc".
975 if (TokStart[0] == 'c' && TokStart[1] == 'c') {
976 CurPtr = TokStart+2;
977 return lltok::kw_cc;
978 }
979
980 // Finally, if this isn't known, return an error.
981 CurPtr = TokStart+1;
982 return lltok::Error;
983}
984
985/// Lex all tokens that start with a 0x prefix, knowing they match and are not
986/// labels.
987/// HexFPConstant 0x[0-9A-Fa-f]+
988/// HexFP80Constant 0xK[0-9A-Fa-f]+
989/// HexFP128Constant 0xL[0-9A-Fa-f]+
990/// HexPPC128Constant 0xM[0-9A-Fa-f]+
991/// HexHalfConstant 0xH[0-9A-Fa-f]+
992/// HexBFloatConstant 0xR[0-9A-Fa-f]+
993lltok::Kind LLLexer::Lex0x() {
994 CurPtr = TokStart + 2;
995
996 char Kind;
997 if ((CurPtr[0] >= 'K' && CurPtr[0] <= 'M') || CurPtr[0] == 'H' ||
998 CurPtr[0] == 'R') {
999 Kind = *CurPtr++;
1000 } else {
1001 Kind = 'J';
1002 }
1003
1004 if (!isxdigit(static_cast<unsigned char>(CurPtr[0]))) {
1005 // Bad token, return it as an error.
1006 CurPtr = TokStart+1;
1007 return lltok::Error;
1008 }
1009
1010 while (isxdigit(static_cast<unsigned char>(CurPtr[0])))
1011 ++CurPtr;
1012
1013 if (Kind == 'J') {
1014 // HexFPConstant - Floating point constant represented in IEEE format as a
1015 // hexadecimal number for when exponential notation is not precise enough.
1016 // Half, BFloat, Float, and double only.
1017 APFloatVal = APFloat(APFloat::IEEEdouble(),
1018 APInt(64, HexIntToVal(TokStart + 2, CurPtr)));
1019 return lltok::APFloat;
1020 }
1021
1022 uint64_t Pair[2];
1023 switch (Kind) {
1024 default: llvm_unreachable("Unknown kind!");
1025 case 'K':
1026 // F80HexFPConstant - x87 long double in hexadecimal format (10 bytes)
1027 FP80HexToIntPair(TokStart+3, CurPtr, Pair);
1028 APFloatVal = APFloat(APFloat::x87DoubleExtended(), APInt(80, Pair));
1029 return lltok::APFloat;
1030 case 'L':
1031 // F128HexFPConstant - IEEE 128-bit in hexadecimal format (16 bytes)
1032 HexToIntPair(TokStart+3, CurPtr, Pair);
1033 APFloatVal = APFloat(APFloat::IEEEquad(), APInt(128, Pair));
1034 return lltok::APFloat;
1035 case 'M':
1036 // PPC128HexFPConstant - PowerPC 128-bit in hexadecimal format (16 bytes)
1037 HexToIntPair(TokStart+3, CurPtr, Pair);
1038 APFloatVal = APFloat(APFloat::PPCDoubleDouble(), APInt(128, Pair));
1039 return lltok::APFloat;
1040 case 'H':
1041 APFloatVal = APFloat(APFloat::IEEEhalf(),
1042 APInt(16,HexIntToVal(TokStart+3, CurPtr)));
1043 return lltok::APFloat;
1044 case 'R':
1045 // Brain floating point
1046 APFloatVal = APFloat(APFloat::BFloat(),
1047 APInt(16, HexIntToVal(TokStart + 3, CurPtr)));
1048 return lltok::APFloat;
1049 }
1050}
1051
1052/// Lex tokens for a label or a numeric constant, possibly starting with -.
1053/// Label [-a-zA-Z$._0-9]+:
1054/// NInteger -[0-9]+
1055/// FPConstant [-+]?[0-9]+[.][0-9]*([eE][-+]?[0-9]+)?
1056/// PInteger [0-9]+
1057/// HexFPConstant 0x[0-9A-Fa-f]+
1058/// HexFP80Constant 0xK[0-9A-Fa-f]+
1059/// HexFP128Constant 0xL[0-9A-Fa-f]+
1060/// HexPPC128Constant 0xM[0-9A-Fa-f]+
1061lltok::Kind LLLexer::LexDigitOrNegative() {
1062 // If the letter after the negative is not a number, this is probably a label.
1063 if (!isdigit(static_cast<unsigned char>(TokStart[0])) &&
1064 !isdigit(static_cast<unsigned char>(CurPtr[0]))) {
1065 // Okay, this is not a number after the -, it's probably a label.
1066 if (const char *End = isLabelTail(CurPtr)) {
1067 StrVal.assign(TokStart, End-1);
1068 CurPtr = End;
1069 return lltok::LabelStr;
1070 }
1071
1072 return lltok::Error;
1073 }
1074
1075 // At this point, it is either a label, int or fp constant.
1076
1077 // Skip digits, we have at least one.
1078 for (; isdigit(static_cast<unsigned char>(CurPtr[0])); ++CurPtr)
1079 /*empty*/;
1080
1081 // Check if this is a fully-numeric label:
1082 if (isdigit(TokStart[0]) && CurPtr[0] == ':') {
1083 uint64_t Val = atoull(TokStart, CurPtr);
1084 ++CurPtr; // Skip the colon.
1085 if ((unsigned)Val != Val)
1086 Error("invalid value number (too large)!");
1087 UIntVal = unsigned(Val);
1088 return lltok::LabelID;
1089 }
1090
1091 // Check to see if this really is a string label, e.g. "-1:".
1092 if (isLabelChar(CurPtr[0]) || CurPtr[0] == ':') {
1093 if (const char *End = isLabelTail(CurPtr)) {
1094 StrVal.assign(TokStart, End-1);
1095 CurPtr = End;
1096 return lltok::LabelStr;
1097 }
1098 }
1099
1100 // If the next character is a '.', then it is a fp value, otherwise its
1101 // integer.
1102 if (CurPtr[0] != '.') {
1103 if (TokStart[0] == '0' && TokStart[1] == 'x')
1104 return Lex0x();
1105 APSIntVal = APSInt(StringRef(TokStart, CurPtr - TokStart));
1106 return lltok::APSInt;
1107 }
1108
1109 ++CurPtr;
1110
1111 // Skip over [0-9]*([eE][-+]?[0-9]+)?
1112 while (isdigit(static_cast<unsigned char>(CurPtr[0]))) ++CurPtr;
1113
1114 if (CurPtr[0] == 'e' || CurPtr[0] == 'E') {
1115 if (isdigit(static_cast<unsigned char>(CurPtr[1])) ||
1116 ((CurPtr[1] == '-' || CurPtr[1] == '+') &&
1117 isdigit(static_cast<unsigned char>(CurPtr[2])))) {
1118 CurPtr += 2;
1119 while (isdigit(static_cast<unsigned char>(CurPtr[0]))) ++CurPtr;
1120 }
1121 }
1122
1123 APFloatVal = APFloat(APFloat::IEEEdouble(),
1124 StringRef(TokStart, CurPtr - TokStart));
1125 return lltok::APFloat;
1126}
1127
1128/// Lex a floating point constant starting with +.
1129/// FPConstant [-+]?[0-9]+[.][0-9]*([eE][-+]?[0-9]+)?
1130lltok::Kind LLLexer::LexPositive() {
1131 // If the letter after the negative is a number, this is probably not a
1132 // label.
1133 if (!isdigit(static_cast<unsigned char>(CurPtr[0])))
1134 return lltok::Error;
1135
1136 // Skip digits.
1137 for (++CurPtr; isdigit(static_cast<unsigned char>(CurPtr[0])); ++CurPtr)
1138 /*empty*/;
1139
1140 // At this point, we need a '.'.
1141 if (CurPtr[0] != '.') {
1142 CurPtr = TokStart+1;
1143 return lltok::Error;
1144 }
1145
1146 ++CurPtr;
1147
1148 // Skip over [0-9]*([eE][-+]?[0-9]+)?
1149 while (isdigit(static_cast<unsigned char>(CurPtr[0]))) ++CurPtr;
1150
1151 if (CurPtr[0] == 'e' || CurPtr[0] == 'E') {
1152 if (isdigit(static_cast<unsigned char>(CurPtr[1])) ||
1153 ((CurPtr[1] == '-' || CurPtr[1] == '+') &&
1154 isdigit(static_cast<unsigned char>(CurPtr[2])))) {
1155 CurPtr += 2;
1156 while (isdigit(static_cast<unsigned char>(CurPtr[0]))) ++CurPtr;
1157 }
1158 }
1159
1160 APFloatVal = APFloat(APFloat::IEEEdouble(),
1161 StringRef(TokStart, CurPtr - TokStart));
1162 return lltok::APFloat;
1163}
AMDGPU Mark last scratch load
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.
Prepare callbr
Checks Use for liveness in LiveValues If Use is not live
Performs the initial survey of the specified function
static void zero(T &Obj)
Definition: ELFEmitter.cpp:337
bool End
Definition: ELF_riscv.cpp:480
Find IFuncs that have resolvers that always point at the same statically known callee
Definition: GlobalOpt.cpp:2438
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
nvptx lower args
LLVMContext & Context
objc arc contract
static constexpr auto TAG
Definition: OpenMPOpt.cpp:185
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)
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
Definition: Value.cpp:469
Class for arbitrary precision integers.
Definition: APInt.h:76
An arbitrary precision integer that knows its signedness.
Definition: APSInt.h:23
Base class for user error types.
Definition: Error.h:352
Lightweight error class with error context and mandatory checking.
Definition: Error.h:160
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
Definition: Type.cpp:278
@ 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
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
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
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:468
@ LocalVarID
Definition: LLToken.h:459
@ StringConstant
Definition: LLToken.h:469
@ NameTableKind
Definition: LLToken.h:476
@ ChecksumKind
Definition: LLToken.h:481
@ EmissionKind
Definition: LLToken.h:475
@ dotdotdot
Definition: LLToken.h:24
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
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:1731
FPClassTest fneg(FPClassTest Mask)
Return the test mask which returns true if the value's sign bit is flipped.
Error write(MCStreamer &Out, ArrayRef< std::string > Inputs, OnCuIndexOverflow OverflowOptValue)
Definition: DWP.cpp:601
@ 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.
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:1944
#define OP(n)
Definition: regex2.h:73
static const fltSemantics & PPCDoubleDouble() LLVM_READNONE
Definition: APFloat.cpp:252
static const fltSemantics & x87DoubleExtended() LLVM_READNONE
Definition: APFloat.cpp:263
static const fltSemantics & IEEEquad() LLVM_READNONE
Definition: APFloat.cpp:251
static const fltSemantics & IEEEdouble() LLVM_READNONE
Definition: APFloat.cpp:250
static const fltSemantics & IEEEhalf() LLVM_READNONE
Definition: APFloat.cpp:247
static const fltSemantics & BFloat() LLVM_READNONE
Definition: APFloat.cpp:248