Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/AsmParser/LLLexer.cpp
Line
Count
Source (jump to first uncovered line)
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
13
#include "LLLexer.h"
14
#include "llvm/ADT/APInt.h"
15
#include "llvm/ADT/STLExtras.h"
16
#include "llvm/ADT/StringExtras.h"
17
#include "llvm/ADT/Twine.h"
18
#include "llvm/IR/DerivedTypes.h"
19
#include "llvm/IR/Instruction.h"
20
#include "llvm/Support/ErrorHandling.h"
21
#include "llvm/Support/SourceMgr.h"
22
#include <cassert>
23
#include <cctype>
24
#include <cstdio>
25
26
using namespace llvm;
27
28
230
bool LLLexer::Error(LocTy ErrorLoc, const Twine &Msg) const {
29
230
  ErrorInfo = SM.GetMessage(ErrorLoc, SourceMgr::DK_Error, Msg);
30
230
  return true;
31
230
}
32
33
0
void LLLexer::Warning(LocTy WarningLoc, const Twine &Msg) const {
34
0
  SM.PrintMessage(WarningLoc, SourceMgr::DK_Warning, Msg);
35
0
}
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
//
45
5.04M
uint64_t LLLexer::atoull(const char *Buffer, const char *End) {
46
5.04M
  uint64_t Result = 0;
47
13.5M
  for (; Buffer != End; 
Buffer++8.52M
) {
48
8.52M
    uint64_t OldRes = Result;
49
8.52M
    Result *= 10;
50
8.52M
    Result += *Buffer-'0';
51
8.52M
    if (Result < OldRes) {  // Uh, oh, overflow detected!!!
52
0
      Error("constant bigger than 64 bits detected!");
53
0
      return 0;
54
0
    }
55
8.52M
  }
56
5.04M
  return Result;
57
5.04M
}
58
59
9.68k
uint64_t LLLexer::HexIntToVal(const char *Buffer, const char *End) {
60
9.68k
  uint64_t Result = 0;
61
140k
  for (; Buffer != End; 
++Buffer130k
) {
62
130k
    uint64_t OldRes = Result;
63
130k
    Result *= 16;
64
130k
    Result += hexDigitValue(*Buffer);
65
130k
66
130k
    if (Result < OldRes) {   // Uh, oh, overflow detected!!!
67
1
      Error("constant bigger than 64 bits detected!");
68
1
      return 0;
69
1
    }
70
130k
  }
71
9.68k
  
return Result9.67k
;
72
9.68k
}
73
74
void LLLexer::HexToIntPair(const char *Buffer, const char *End,
75
335
                           uint64_t Pair[2]) {
76
335
  Pair[0] = 0;
77
335
  if (End - Buffer >= 16) {
78
5.52k
    for (int i = 0; i < 16; 
i++, Buffer++5.20k
) {
79
5.20k
      assert(Buffer != End);
80
5.20k
      Pair[0] *= 16;
81
5.20k
      Pair[0] += hexDigitValue(*Buffer);
82
5.20k
    }
83
325
  }
84
335
  Pair[1] = 0;
85
5.54k
  for (int i = 0; i < 16 && 
Buffer != End5.22k
;
i++, Buffer++5.21k
) {
86
5.21k
    Pair[1] *= 16;
87
5.21k
    Pair[1] += hexDigitValue(*Buffer);
88
5.21k
  }
89
335
  if (Buffer != End)
90
0
    Error("constant bigger than 128 bits detected!");
91
335
}
92
93
/// FP80HexToIntPair - translate an 80 bit FP80 number (20 hexits) into
94
/// { low64, high16 } as usual for an APInt.
95
void LLLexer::FP80HexToIntPair(const char *Buffer, const char *End,
96
149
                           uint64_t Pair[2]) {
97
149
  Pair[1] = 0;
98
742
  for (int i=0; i<4 && 
Buffer != End594
;
i++, Buffer++593
) {
99
593
    assert(Buffer != End);
100
593
    Pair[1] *= 16;
101
593
    Pair[1] += hexDigitValue(*Buffer);
102
593
  }
103
149
  Pair[0] = 0;
104
2.51k
  for (int i = 0; i < 16 && 
Buffer != End2.36k
;
i++, Buffer++2.36k
) {
105
2.36k
    Pair[0] *= 16;
106
2.36k
    Pair[0] += hexDigitValue(*Buffer);
107
2.36k
  }
108
149
  if (Buffer != End)
109
0
    Error("constant bigger than 128 bits detected!");
110
149
}
111
112
// UnEscapeLexed - Run through the specified buffer and change \xx codes to the
113
// appropriate character.
114
258k
static void UnEscapeLexed(std::string &Str) {
115
258k
  if (Str.empty()) 
return5.89k
;
116
252k
117
252k
  char *Buffer = &Str[0], *EndBuffer = Buffer+Str.size();
118
252k
  char *BOut = Buffer;
119
5.16M
  for (char *BIn = Buffer; BIn != EndBuffer; ) {
120
4.91M
    if (BIn[0] == '\\') {
121
10.9k
      if (BIn < EndBuffer-1 && BIn[1] == '\\') {
122
10
        *BOut++ = '\\'; // Two \ becomes one
123
10
        BIn += 2;
124
10.9k
      } else if (BIn < EndBuffer-2 &&
125
10.9k
                 isxdigit(static_cast<unsigned char>(BIn[1])) &&
126
10.9k
                 
isxdigit(static_cast<unsigned char>(BIn[2]))10.9k
) {
127
10.9k
        *BOut = hexDigitValue(BIn[1]) * 16 + hexDigitValue(BIn[2]);
128
10.9k
        BIn += 3;                           // Skip over handled chars
129
10.9k
        ++BOut;
130
10.9k
      } else {
131
5
        *BOut++ = *BIn++;
132
5
      }
133
4.90M
    } else {
134
4.90M
      *BOut++ = *BIn++;
135
4.90M
    }
136
4.91M
  }
137
252k
  Str.resize(BOut-Buffer);
138
252k
}
139
140
/// isLabelChar - Return true for [-a-zA-Z$._0-9].
141
50.5M
static bool isLabelChar(char C) {
142
50.5M
  return isalnum(static_cast<unsigned char>(C)) || 
C == '-'16.1M
||
C == '$'16.1M
||
143
50.5M
         
C == '.'16.1M
||
C == '_'15.9M
;
144
50.5M
}
145
146
/// isLabelTail - Return true if this pointer points to a valid end of a label.
147
81.9k
static const char *isLabelTail(const char *CurPtr) {
148
551k
  while (true) {
149
551k
    if (CurPtr[0] == ':') 
return CurPtr+1854
;
150
550k
    if (!isLabelChar(CurPtr[0])) 
return nullptr81.0k
;
151
469k
    ++CurPtr;
152
469k
  }
153
81.9k
}
154
155
//===----------------------------------------------------------------------===//
156
// Lexer definition.
157
//===----------------------------------------------------------------------===//
158
159
LLLexer::LLLexer(StringRef StartBuf, SourceMgr &SM, SMDiagnostic &Err,
160
                 LLVMContext &C)
161
    : CurBuf(StartBuf), ErrorInfo(Err), SM(SM), Context(C), APFloatVal(0.0),
162
40.2k
      IgnoreColonInIdentifiers(false) {
163
40.2k
  CurPtr = CurBuf.begin();
164
40.2k
}
165
166
411M
int LLLexer::getNextChar() {
167
411M
  char CurChar = *CurPtr++;
168
411M
  switch (CurChar) {
169
411M
  
default: return (unsigned char)CurChar411M
;
170
411M
  case 0:
171
40.0k
    // A nul character in the stream is either the end of the current buffer or
172
40.0k
    // a random nul in the file.  Disambiguate that here.
173
40.0k
    if (CurPtr-1 != CurBuf.end())
174
2
      return 0;  // Just whitespace.
175
40.0k
176
40.0k
    // Otherwise, return end of file.
177
40.0k
    --CurPtr;  // Another call to lex will return EOF again.
178
40.0k
    return EOF;
179
411M
  }
180
411M
}
181
182
33.1M
lltok::Kind LLLexer::LexToken() {
183
76.6M
  while (true) {
184
76.6M
    TokStart = CurPtr;
185
76.6M
186
76.6M
    int CurChar = getNextChar();
187
76.6M
    switch (CurChar) {
188
76.6M
    default:
189
11.7M
      // Handle letters: [a-zA-Z_]
190
11.7M
      if (isalpha(static_cast<unsigned char>(CurChar)) || 
CurChar == '_'420
)
191
11.7M
        return LexIdentifier();
192
0
193
0
      return lltok::Error;
194
40.0k
    case EOF: return lltok::Eof;
195
36.0M
    case 0:
196
36.0M
    case ' ':
197
36.0M
    case '\t':
198
36.0M
    case '\n':
199
36.0M
    case '\r':
200
36.0M
      // Ignore whitespace.
201
36.0M
      continue;
202
36.0M
    
case '+': return LexPositive()25
;
203
36.0M
    
case '@': return LexAt()709k
;
204
36.0M
    
case '$': return LexDollar()1.13k
;
205
36.0M
    
case '%': return LexPercent()3.81M
;
206
36.0M
    
case '"': return LexQuote()141k
;
207
36.0M
    case '.':
208
13.5k
      if (const char *Ptr = isLabelTail(CurPtr)) {
209
838
        CurPtr = Ptr;
210
838
        StrVal.assign(TokStart, CurPtr-1);
211
838
        return lltok::LabelStr;
212
838
      }
213
12.7k
      if (CurPtr[0] == '.' && CurPtr[1] == '.') {
214
12.7k
        CurPtr += 2;
215
12.7k
        return lltok::dotdotdot;
216
12.7k
      }
217
0
      return lltok::Error;
218
7.38M
    case ';':
219
7.38M
      SkipLineComment();
220
7.38M
      continue;
221
380k
    case '!': return LexExclaim();
222
339
    case '^':
223
339
      return LexCaret();
224
1.55k
    case ':':
225
1.55k
      return lltok::colon;
226
77.1k
    case '#': return LexHash();
227
3.98M
    case '0': case '1': case '2': case '3': case '4':
228
3.98M
    case '5': case '6': case '7': case '8': case '9':
229
3.98M
    case '-':
230
3.98M
      return LexDigitOrNegative();
231
3.98M
    
case '=': return lltok::equal1.31M
;
232
3.98M
    
case '[': return lltok::lsquare265k
;
233
3.98M
    
case ']': return lltok::rsquare265k
;
234
3.98M
    
case '{': return lltok::lbrace396k
;
235
3.98M
    
case '}': return lltok::rbrace395k
;
236
3.98M
    
case '<': return lltok::less1.59M
;
237
3.98M
    
case '>': return lltok::greater1.59M
;
238
3.98M
    
case '(': return lltok::lparen852k
;
239
3.98M
    
case ')': return lltok::rparen852k
;
240
3.98M
    
case ',': return lltok::comma3.79M
;
241
3.98M
    
case '*': return lltok::star908k
;
242
3.98M
    
case '|': return lltok::bar1.03k
;
243
76.6M
    }
244
76.6M
  }
245
33.1M
}
246
247
7.38M
void LLLexer::SkipLineComment() {
248
337M
  while (true) {
249
337M
    if (CurPtr[0] == '\n' || 
CurPtr[0] == '\r'330M
||
getNextChar() == EOF330M
)
250
337M
      
return7.38M
;
251
337M
  }
252
7.38M
}
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]+
258
709k
lltok::Kind LLLexer::LexAt() {
259
709k
  return LexVar(lltok::GlobalVar, lltok::GlobalID);
260
709k
}
261
262
1.13k
lltok::Kind LLLexer::LexDollar() {
263
1.13k
  if (const char *Ptr = isLabelTail(TokStart)) {
264
2
    CurPtr = Ptr;
265
2
    StrVal.assign(TokStart, CurPtr - 1);
266
2
    return lltok::LabelStr;
267
2
  }
268
1.13k
269
1.13k
  // Handle DollarStringConstant: $\"[^\"]*\"
270
1.13k
  if (CurPtr[0] == '"') {
271
387
    ++CurPtr;
272
387
273
6.75k
    while (true) {
274
6.75k
      int CurChar = getNextChar();
275
6.75k
276
6.75k
      if (CurChar == EOF) {
277
0
        Error("end of file in COMDAT variable name");
278
0
        return lltok::Error;
279
0
      }
280
6.75k
      if (CurChar == '"') {
281
387
        StrVal.assign(TokStart + 2, CurPtr - 1);
282
387
        UnEscapeLexed(StrVal);
283
387
        if (StringRef(StrVal).find_first_of(0) != StringRef::npos) {
284
0
          Error("Null bytes are not allowed in names");
285
0
          return lltok::Error;
286
0
        }
287
387
        return lltok::ComdatVar;
288
387
      }
289
6.75k
    }
290
387
  }
291
1.13k
292
1.13k
  // Handle ComdatVarName: $[-a-zA-Z$._][-a-zA-Z$._0-9]*
293
1.13k
  
if (743
ReadVarName()743
)
294
743
    return lltok::ComdatVar;
295
0
296
0
  return lltok::Error;
297
0
}
298
299
/// ReadString - Read a string until the closing quote.
300
141k
lltok::Kind LLLexer::ReadString(lltok::Kind kind) {
301
141k
  const char *Start = CurPtr;
302
3.72M
  while (true) {
303
3.72M
    int CurChar = getNextChar();
304
3.72M
305
3.72M
    if (CurChar == EOF) {
306
0
      Error("end of file in string constant");
307
0
      return lltok::Error;
308
0
    }
309
3.72M
    if (CurChar == '"') {
310
141k
      StrVal.assign(Start, CurPtr-1);
311
141k
      UnEscapeLexed(StrVal);
312
141k
      return kind;
313
141k
    }
314
3.72M
  }
315
141k
}
316
317
/// ReadVarName - Read the rest of a token containing a variable name.
318
4.51M
bool LLLexer::ReadVarName() {
319
4.51M
  const char *NameStart = CurPtr;
320
4.51M
  if (isalpha(static_cast<unsigned char>(CurPtr[0])) ||
321
4.51M
      
CurPtr[0] == '-'652k
||
CurPtr[0] == '$'652k
||
322
4.51M
      
CurPtr[0] == '.'652k
||
CurPtr[0] == '_'639k
) {
323
3.98M
    ++CurPtr;
324
24.8M
    while (isalnum(static_cast<unsigned char>(CurPtr[0])) ||
325
24.8M
           
CurPtr[0] == '-'6.27M
||
CurPtr[0] == '$'6.27M
||
326
24.8M
           
CurPtr[0] == '.'6.27M
||
CurPtr[0] == '_'4.92M
)
327
20.8M
      ++CurPtr;
328
3.98M
329
3.98M
    StrVal.assign(NameStart, CurPtr);
330
3.98M
    return true;
331
3.98M
  }
332
532k
  return false;
333
532k
}
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.
337
610k
lltok::Kind LLLexer::LexUIntID(lltok::Kind Token) {
338
610k
  if (!isdigit(static_cast<unsigned char>(CurPtr[0])))
339
0
    return lltok::Error;
340
610k
341
702k
  
for (++CurPtr; 610k
isdigit(static_cast<unsigned char>(CurPtr[0]));
++CurPtr92.4k
)
342
92.4k
    /*empty*/;
343
610k
344
610k
  uint64_t Val = atoull(TokStart + 1, CurPtr);
345
610k
  if ((unsigned)Val != Val)
346
0
    Error("invalid value number (too large)!");
347
610k
  UIntVal = unsigned(Val);
348
610k
  return Token;
349
610k
}
350
351
4.52M
lltok::Kind LLLexer::LexVar(lltok::Kind Var, lltok::Kind VarID) {
352
4.52M
  // Handle StringConstant: \"[^\"]*\"
353
4.52M
  if (CurPtr[0] == '"') {
354
11.7k
    ++CurPtr;
355
11.7k
356
356k
    while (true) {
357
356k
      int CurChar = getNextChar();
358
356k
359
356k
      if (CurChar == EOF) {
360
0
        Error("end of file in global variable name");
361
0
        return lltok::Error;
362
0
      }
363
356k
      if (CurChar == '"') {
364
11.7k
        StrVal.assign(TokStart+2, CurPtr-1);
365
11.7k
        UnEscapeLexed(StrVal);
366
11.7k
        if (StringRef(StrVal).find_first_of(0) != StringRef::npos) {
367
1
          Error("Null bytes are not allowed in names");
368
1
          return lltok::Error;
369
1
        }
370
11.7k
        return Var;
371
11.7k
      }
372
356k
    }
373
11.7k
  }
374
4.52M
375
4.52M
  // Handle VarName: [-a-zA-Z$._][-a-zA-Z$._0-9]*
376
4.52M
  
if (4.51M
ReadVarName()4.51M
)
377
3.98M
    return Var;
378
532k
379
532k
  // Handle VarID: [0-9]+
380
532k
  return LexUIntID(VarID);
381
532k
}
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]+
387
3.81M
lltok::Kind LLLexer::LexPercent() {
388
3.81M
  return LexVar(lltok::LocalVar, lltok::LocalVarID);
389
3.81M
}
390
391
/// Lex all tokens that start with a " character.
392
///   QuoteLabel        "[^"]+":
393
///   StringConstant    "[^"]*"
394
141k
lltok::Kind LLLexer::LexQuote() {
395
141k
  lltok::Kind kind = ReadString(lltok::StringConstant);
396
141k
  if (kind == lltok::Error || kind == lltok::Eof)
397
0
    return kind;
398
141k
399
141k
  if (CurPtr[0] == ':') {
400
586
    ++CurPtr;
401
586
    if (StringRef(StrVal).find_first_of(0) != StringRef::npos) {
402
1
      Error("Null bytes are not allowed in names");
403
1
      kind = lltok::Error;
404
585
    } else {
405
585
      kind = lltok::LabelStr;
406
585
    }
407
586
  }
408
141k
409
141k
  return kind;
410
141k
}
411
412
/// Lex all tokens that start with a ! character.
413
///    !foo
414
///    !
415
380k
lltok::Kind LLLexer::LexExclaim() {
416
380k
  // Lex a metadata name as a MetadataVar.
417
380k
  if (isalpha(static_cast<unsigned char>(CurPtr[0])) ||
418
380k
      
CurPtr[0] == '-'276k
||
CurPtr[0] == '$'276k
||
419
380k
      
CurPtr[0] == '.'276k
||
CurPtr[0] == '_'276k
||
CurPtr[0] == '\\'276k
) {
420
104k
    ++CurPtr;
421
995k
    while (isalnum(static_cast<unsigned char>(CurPtr[0])) ||
422
995k
           
CurPtr[0] == '-'124k
||
CurPtr[0] == '$'124k
||
423
995k
           
CurPtr[0] == '.'124k
||
CurPtr[0] == '_'111k
||
CurPtr[0] == '\\'104k
)
424
890k
      ++CurPtr;
425
104k
426
104k
    StrVal.assign(TokStart+1, CurPtr);   // Skip !
427
104k
    UnEscapeLexed(StrVal);
428
104k
    return lltok::MetadataVar;
429
104k
  }
430
276k
  return lltok::exclaim;
431
276k
}
432
433
/// Lex all tokens that start with a ^ character.
434
///    SummaryID ::= ^[0-9]+
435
339
lltok::Kind LLLexer::LexCaret() {
436
339
  // Handle SummaryID: ^[0-9]+
437
339
  return LexUIntID(lltok::SummaryID);
438
339
}
439
440
/// Lex all tokens that start with a # character.
441
///    AttrGrpID ::= #[0-9]+
442
77.1k
lltok::Kind LLLexer::LexHash() {
443
77.1k
  // Handle AttrGrpID: #[0-9]+
444
77.1k
  return LexUIntID(lltok::AttrGrpID);
445
77.1k
}
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]+
452
11.7M
lltok::Kind LLLexer::LexIdentifier() {
453
11.7M
  const char *StartChar = CurPtr;
454
11.7M
  const char *IntEnd = CurPtr[-1] == 'i' ? 
nullptr4.73M
:
StartChar7.03M
;
455
11.7M
  const char *KeywordEnd = nullptr;
456
11.7M
457
46.0M
  for (; isLabelChar(*CurPtr); 
++CurPtr34.2M
) {
458
34.2M
    // If we decide this is an integer, remember the end of the sequence.
459
34.2M
    if (!IntEnd && 
!isdigit(static_cast<unsigned char>(*CurPtr))8.11M
)
460
299k
      IntEnd = CurPtr;
461
34.2M
    if (!KeywordEnd && 
!isalnum(static_cast<unsigned char>(*CurPtr))33.9M
&&
462
34.2M
        
*CurPtr != '_'174k
)
463
46.3k
      KeywordEnd = CurPtr;
464
34.2M
  }
465
11.7M
466
11.7M
  // If we stopped due to a colon, unless we were directed to ignore it,
467
11.7M
  // this really is a label.
468
11.7M
  if (!IgnoreColonInIdentifiers && 
*CurPtr == ':'11.7M
) {
469
383k
    StrVal.assign(StartChar-1, CurPtr++);
470
383k
    return lltok::LabelStr;
471
383k
  }
472
11.3M
473
11.3M
  // Otherwise, this wasn't a label.  If this was valid as an integer type,
474
11.3M
  // return it.
475
11.3M
  if (!IntEnd) 
IntEnd = CurPtr4.43M
;
476
11.3M
  if (IntEnd != StartChar) {
477
4.43M
    CurPtr = IntEnd;
478
4.43M
    uint64_t NumBits = atoull(StartChar, CurPtr);
479
4.43M
    if (NumBits < IntegerType::MIN_INT_BITS ||
480
4.43M
        NumBits > IntegerType::MAX_INT_BITS) {
481
1
      Error("bitwidth for integer type out of range!");
482
1
      return lltok::Error;
483
1
    }
484
4.43M
    TyVal = IntegerType::get(Context, NumBits);
485
4.43M
    return lltok::Type;
486
4.43M
  }
487
6.94M
488
6.94M
  // Otherwise, this was a letter sequence.  See which keyword this is.
489
6.94M
  if (!KeywordEnd) KeywordEnd = CurPtr;
490
6.94M
  CurPtr = KeywordEnd;
491
6.94M
  --StartChar;
492
6.94M
  StringRef Keyword(StartChar, CurPtr - StartChar);
493
6.94M
494
6.94M
#define KEYWORD(STR)                                                           \
495
1.48G
  do {                                                                         \
496
1.48G
    if (Keyword == #STR)                                                       \
497
1.48G
      
return lltok::kw_3.75M
##STR; \
498
1.48G
  } while (
false1.48G
)
499
6.94M
500
6.94M
  KEYWORD(true);    
KEYWORD6.93M
(false);
501
6.93M
  
KEYWORD6.90M
(declare); 6.90M
KEYWORD6.82M
(define);
502
6.82M
  
KEYWORD6.52M
(global); 6.52M
KEYWORD6.50M
(constant);
503
6.50M
504
6.50M
  
KEYWORD6.49M
(dso_local);
505
6.49M
  
KEYWORD6.49M
(dso_preemptable);
506
6.49M
507
6.49M
  
KEYWORD6.49M
(private);
508
6.49M
  
KEYWORD6.49M
(internal);
509
6.49M
  
KEYWORD6.49M
(available_externally);
510
6.49M
  
KEYWORD6.49M
(linkonce);
511
6.49M
  
KEYWORD6.48M
(linkonce_odr);
512
6.48M
  
KEYWORD6.48M
(weak); // Use as a linkage, and a modifier for "cmpxchg".
513
6.48M
  
KEYWORD6.48M
(weak_odr);
514
6.48M
  
KEYWORD6.48M
(appending);
515
6.48M
  
KEYWORD6.48M
(dllimport);
516
6.48M
  
KEYWORD6.48M
(dllexport);
517
6.48M
  
KEYWORD6.48M
(common);
518
6.48M
  
KEYWORD6.48M
(default);
519
6.48M
  
KEYWORD6.48M
(hidden);
520
6.48M
  
KEYWORD6.47M
(protected);
521
6.47M
  
KEYWORD6.47M
(unnamed_addr);
522
6.47M
  
KEYWORD6.47M
(local_unnamed_addr);
523
6.47M
  
KEYWORD6.46M
(externally_initialized);
524
6.46M
  
KEYWORD6.46M
(extern_weak);
525
6.46M
  
KEYWORD6.46M
(external);
526
6.46M
  
KEYWORD6.46M
(thread_local);
527
6.46M
  
KEYWORD6.46M
(localdynamic);
528
6.46M
  
KEYWORD6.46M
(initialexec);
529
6.46M
  
KEYWORD6.46M
(localexec);
530
6.46M
  
KEYWORD6.46M
(zeroinitializer);
531
6.46M
  
KEYWORD6.42M
(undef);
532
6.42M
  
KEYWORD6.21M
(null);
533
6.21M
  
KEYWORD6.20M
(none);
534
6.20M
  
KEYWORD6.20M
(to);
535
6.20M
  
KEYWORD6.03M
(caller);
536
6.03M
  
KEYWORD6.03M
(within);
537
6.03M
  
KEYWORD6.03M
(from);
538
6.03M
  
KEYWORD6.03M
(tail);
539
6.03M
  
KEYWORD5.99M
(musttail);
540
5.99M
  
KEYWORD5.99M
(notail);
541
5.99M
  
KEYWORD5.99M
(target);
542
5.99M
  
KEYWORD5.97M
(triple);
543
5.97M
  
KEYWORD5.97M
(source_filename);
544
5.97M
  
KEYWORD5.97M
(unwind);
545
5.97M
  
KEYWORD5.96M
(deplibs); // FIXME: Remove in 4.0.
546
5.96M
  KEYWORD(datalayout);
547
5.96M
  
KEYWORD5.96M
(volatile);
548
5.96M
  
KEYWORD5.93M
(atomic);
549
5.93M
  
KEYWORD5.93M
(unordered);
550
5.93M
  
KEYWORD5.92M
(monotonic);
551
5.92M
  
KEYWORD5.92M
(acquire);
552
5.92M
  
KEYWORD5.92M
(release);
553
5.92M
  
KEYWORD5.92M
(acq_rel);
554
5.92M
  
KEYWORD5.92M
(seq_cst);
555
5.92M
  
KEYWORD5.91M
(syncscope);
556
5.91M
557
5.91M
  
KEYWORD5.91M
(nnan);
558
5.91M
  
KEYWORD5.91M
(ninf);
559
5.91M
  
KEYWORD5.91M
(nsz);
560
5.91M
  
KEYWORD5.90M
(arcp);
561
5.90M
  
KEYWORD5.90M
(contract);
562
5.90M
  
KEYWORD5.90M
(reassoc);
563
5.90M
  
KEYWORD5.90M
(afn);
564
5.90M
  
KEYWORD5.90M
(fast);
565
5.90M
  
KEYWORD5.90M
(nuw);
566
5.90M
  
KEYWORD5.89M
(nsw);
567
5.89M
  
KEYWORD5.86M
(exact);
568
5.86M
  
KEYWORD5.86M
(inbounds);
569
5.86M
  
KEYWORD5.72M
(inrange);
570
5.72M
  
KEYWORD5.72M
(align);
571
5.72M
  
KEYWORD5.41M
(addrspace);
572
5.41M
  
KEYWORD5.29M
(section);
573
5.29M
  
KEYWORD5.29M
(partition);
574
5.29M
  
KEYWORD5.29M
(alias);
575
5.29M
  
KEYWORD5.29M
(ifunc);
576
5.29M
  
KEYWORD5.29M
(module);
577
5.29M
  
KEYWORD5.29M
(asm);
578
5.29M
  
KEYWORD5.28M
(sideeffect);
579
5.28M
  
KEYWORD5.27M
(alignstack);
580
5.27M
  
KEYWORD5.27M
(inteldialect);
581
5.27M
  
KEYWORD5.27M
(gc);
582
5.27M
  
KEYWORD5.27M
(prefix);
583
5.27M
  
KEYWORD5.27M
(prologue);
584
5.27M
585
5.27M
  
KEYWORD5.27M
(ccc);
586
5.27M
  
KEYWORD5.27M
(fastcc);
587
5.27M
  
KEYWORD5.27M
(coldcc);
588
5.27M
  
KEYWORD5.27M
(x86_stdcallcc);
589
5.27M
  
KEYWORD5.27M
(x86_fastcallcc);
590
5.27M
  
KEYWORD5.27M
(x86_thiscallcc);
591
5.27M
  
KEYWORD5.27M
(x86_vectorcallcc);
592
5.27M
  
KEYWORD5.27M
(arm_apcscc);
593
5.27M
  
KEYWORD5.27M
(arm_aapcscc);
594
5.27M
  
KEYWORD5.27M
(arm_aapcs_vfpcc);
595
5.27M
  
KEYWORD5.27M
(aarch64_vector_pcs);
596
5.27M
  
KEYWORD5.27M
(msp430_intrcc);
597
5.27M
  
KEYWORD5.27M
(avr_intrcc);
598
5.27M
  
KEYWORD5.27M
(avr_signalcc);
599
5.27M
  
KEYWORD5.27M
(ptx_kernel);
600
5.27M
  
KEYWORD5.27M
(ptx_device);
601
5.27M
  
KEYWORD5.27M
(spir_kernel);
602
5.27M
  
KEYWORD5.27M
(spir_func);
603
5.27M
  
KEYWORD5.27M
(intel_ocl_bicc);
604
5.27M
  
KEYWORD5.27M
(x86_64_sysvcc);
605
5.27M
  
KEYWORD5.27M
(win64cc);
606
5.27M
  
KEYWORD5.27M
(x86_regcallcc);
607
5.27M
  
KEYWORD5.27M
(webkit_jscc);
608
5.27M
  
KEYWORD5.27M
(swiftcc);
609
5.27M
  
KEYWORD5.27M
(anyregcc);
610
5.27M
  
KEYWORD5.26M
(preserve_mostcc);
611
5.26M
  
KEYWORD5.26M
(preserve_allcc);
612
5.26M
  
KEYWORD5.26M
(ghccc);
613
5.26M
  
KEYWORD5.26M
(x86_intrcc);
614
5.26M
  
KEYWORD5.26M
(hhvmcc);
615
5.26M
  
KEYWORD5.26M
(hhvm_ccc);
616
5.26M
  
KEYWORD5.26M
(cxx_fast_tlscc);
617
5.26M
  
KEYWORD5.26M
(amdgpu_vs);
618
5.26M
  
KEYWORD5.26M
(amdgpu_ls);
619
5.26M
  
KEYWORD5.26M
(amdgpu_hs);
620
5.26M
  
KEYWORD5.26M
(amdgpu_es);
621
5.26M
  
KEYWORD5.26M
(amdgpu_gs);
622
5.26M
  
KEYWORD5.26M
(amdgpu_ps);
623
5.26M
  
KEYWORD5.26M
(amdgpu_cs);
624
5.26M
  
KEYWORD5.26M
(amdgpu_kernel);
625
5.26M
626
5.26M
  
KEYWORD5.24M
(cc);
627
5.24M
  
KEYWORD5.24M
(c);
628
5.24M
629
5.24M
  
KEYWORD5.23M
(attributes);
630
5.23M
631
5.23M
  
KEYWORD5.22M
(alwaysinline);
632
5.22M
  
KEYWORD5.22M
(allocsize);
633
5.22M
  
KEYWORD5.22M
(argmemonly);
634
5.22M
  
KEYWORD5.22M
(builtin);
635
5.22M
  
KEYWORD5.22M
(byval);
636
5.22M
  
KEYWORD5.22M
(inalloca);
637
5.22M
  
KEYWORD5.22M
(cold);
638
5.22M
  
KEYWORD5.22M
(convergent);
639
5.22M
  
KEYWORD5.22M
(dereferenceable);
640
5.22M
  
KEYWORD5.22M
(dereferenceable_or_null);
641
5.22M
  
KEYWORD5.22M
(inaccessiblememonly);
642
5.22M
  
KEYWORD5.22M
(inaccessiblemem_or_argmemonly);
643
5.22M
  
KEYWORD5.22M
(inlinehint);
644
5.22M
  
KEYWORD5.22M
(inreg);
645
5.22M
  
KEYWORD5.21M
(jumptable);
646
5.21M
  
KEYWORD5.21M
(minsize);
647
5.21M
  
KEYWORD5.21M
(naked);
648
5.21M
  
KEYWORD5.21M
(nest);
649
5.21M
  
KEYWORD5.21M
(noalias);
650
5.21M
  
KEYWORD5.21M
(nobuiltin);
651
5.21M
  
KEYWORD5.21M
(nocapture);
652
5.21M
  
KEYWORD5.19M
(noduplicate);
653
5.19M
  
KEYWORD5.19M
(nofree);
654
5.19M
  
KEYWORD5.19M
(noimplicitfloat);
655
5.19M
  
KEYWORD5.19M
(noinline);
656
5.19M
  
KEYWORD5.19M
(norecurse);
657
5.19M
  
KEYWORD5.19M
(nonlazybind);
658
5.19M
  
KEYWORD5.19M
(nonnull);
659
5.19M
  
KEYWORD5.18M
(noredzone);
660
5.18M
  
KEYWORD5.18M
(noreturn);
661
5.18M
  
KEYWORD5.18M
(nosync);
662
5.18M
  
KEYWORD5.18M
(nocf_check);
663
5.18M
  
KEYWORD5.18M
(nounwind);
664
5.18M
  
KEYWORD5.09M
(optforfuzzing);
665
5.09M
  
KEYWORD5.09M
(optnone);
666
5.09M
  
KEYWORD5.09M
(optsize);
667
5.09M
  
KEYWORD5.09M
(readnone);
668
5.09M
  
KEYWORD5.07M
(readonly);
669
5.07M
  
KEYWORD5.06M
(returned);
670
5.06M
  
KEYWORD5.06M
(returns_twice);
671
5.06M
  
KEYWORD5.06M
(signext);
672
5.06M
  
KEYWORD5.04M
(speculatable);
673
5.04M
  
KEYWORD5.04M
(sret);
674
5.04M
  
KEYWORD5.04M
(ssp);
675
5.04M
  
KEYWORD5.04M
(sspreq);
676
5.04M
  
KEYWORD5.04M
(sspstrong);
677
5.04M
  
KEYWORD5.04M
(strictfp);
678
5.04M
  
KEYWORD5.04M
(safestack);
679
5.04M
  
KEYWORD5.04M
(shadowcallstack);
680
5.04M
  
KEYWORD5.04M
(sanitize_address);
681
5.04M
  
KEYWORD5.03M
(sanitize_hwaddress);
682
5.03M
  
KEYWORD5.03M
(sanitize_memtag);
683
5.03M
  
KEYWORD5.03M
(sanitize_thread);
684
5.03M
  
KEYWORD5.03M
(sanitize_memory);
685
5.03M
  
KEYWORD5.03M
(speculative_load_hardening);
686
5.03M
  
KEYWORD5.03M
(swifterror);
687
5.03M
  
KEYWORD5.03M
(swiftself);
688
5.03M
  
KEYWORD5.03M
(uwtable);
689
5.03M
  
KEYWORD5.03M
(willreturn);
690
5.03M
  
KEYWORD5.03M
(writeonly);
691
5.03M
  
KEYWORD5.03M
(zeroext);
692
5.03M
  
KEYWORD5.01M
(immarg);
693
5.01M
694
5.01M
  
KEYWORD5.01M
(type);
695
5.01M
  
KEYWORD5.00M
(opaque);
696
5.00M
697
5.00M
  
KEYWORD5.00M
(comdat);
698
5.00M
699
5.00M
  // Comdat types
700
5.00M
  
KEYWORD5.00M
(any);
701
5.00M
  
KEYWORD5.00M
(exactmatch);
702
5.00M
  
KEYWORD5.00M
(largest);
703
5.00M
  
KEYWORD5.00M
(noduplicates);
704
5.00M
  
KEYWORD5.00M
(samesize);
705
5.00M
706
5.00M
  
KEYWORD5.00M
(eq); 5.00M
KEYWORD4.97M
(ne); 4.97M
KEYWORD4.96M
(slt); 4.96M
KEYWORD4.95M
(sgt); 4.95M
KEYWORD4.94M
(sle);
707
4.94M
  
KEYWORD4.94M
(sge); 4.94M
KEYWORD4.94M
(ult); 4.94M
KEYWORD4.93M
(ugt); 4.93M
KEYWORD4.93M
(ule); 4.93M
KEYWORD4.93M
(uge);
708
4.93M
  
KEYWORD4.92M
(oeq); 4.92M
KEYWORD4.92M
(one); 4.92M
KEYWORD4.92M
(olt); 4.92M
KEYWORD4.92M
(ogt); 4.92M
KEYWORD4.92M
(ole);
709
4.92M
  
KEYWORD4.92M
(oge); 4.92M
KEYWORD4.91M
(ord); 4.91M
KEYWORD4.91M
(uno); 4.91M
KEYWORD4.91M
(ueq); 4.91M
KEYWORD4.91M
(une);
710
4.91M
711
4.91M
  
KEYWORD4.91M
(xchg); 4.91M
KEYWORD4.91M
(nand); 4.91M
KEYWORD4.91M
(max); 4.91M
KEYWORD4.91M
(min); 4.91M
KEYWORD4.91M
(umax);
712
4.91M
  
KEYWORD4.91M
(umin);
713
4.91M
714
4.91M
  
KEYWORD4.91M
(vscale);
715
4.91M
  
KEYWORD4.91M
(x);
716
4.91M
  
KEYWORD3.21M
(blockaddress);
717
3.21M
718
3.21M
  // Metadata types.
719
3.21M
  
KEYWORD3.21M
(distinct);
720
3.21M
721
3.21M
  // Use-list order directives.
722
3.21M
  
KEYWORD3.20M
(uselistorder);
723
3.20M
  
KEYWORD3.20M
(uselistorder_bb);
724
3.20M
725
3.20M
  
KEYWORD3.20M
(personality);
726
3.20M
  
KEYWORD3.20M
(cleanup);
727
3.20M
  
KEYWORD3.19M
(catch);
728
3.19M
  
KEYWORD3.19M
(filter);
729
3.19M
730
3.19M
  // Summary index keywords.
731
3.19M
  
KEYWORD3.19M
(path);
732
3.19M
  
KEYWORD3.19M
(hash);
733
3.19M
  
KEYWORD3.19M
(gv);
734
3.19M
  
KEYWORD3.19M
(guid);
735
3.19M
  
KEYWORD3.19M
(name);
736
3.19M
  
KEYWORD3.19M
(summaries);
737
3.19M
  
KEYWORD3.19M
(flags);
738
3.19M
  
KEYWORD3.19M
(linkage);
739
3.19M
  
KEYWORD3.19M
(notEligibleToImport);
740
3.19M
  
KEYWORD3.19M
(live);
741
3.19M
  
KEYWORD3.19M
(dsoLocal);
742
3.19M
  
KEYWORD3.19M
(canAutoHide);
743
3.19M
  
KEYWORD3.19M
(function);
744
3.19M
  
KEYWORD3.19M
(insts);
745
3.19M
  
KEYWORD3.19M
(funcFlags);
746
3.19M
  
KEYWORD3.19M
(readNone);
747
3.19M
  
KEYWORD3.19M
(readOnly);
748
3.19M
  
KEYWORD3.19M
(noRecurse);
749
3.19M
  
KEYWORD3.19M
(returnDoesNotAlias);
750
3.19M
  
KEYWORD3.19M
(noInline);
751
3.19M
  
KEYWORD3.19M
(calls);
752
3.19M
  
KEYWORD3.19M
(callee);
753
3.19M
  
KEYWORD3.19M
(hotness);
754
3.19M
  
KEYWORD3.19M
(unknown);
755
3.19M
  KEYWORD(hot);
756
3.19M
  
KEYWORD3.19M
(critical);
757
3.19M
  
KEYWORD3.19M
(relbf);
758
3.19M
  
KEYWORD3.19M
(variable);
759
3.19M
  
KEYWORD3.19M
(vTableFuncs);
760
3.19M
  
KEYWORD3.19M
(virtFunc);
761
3.19M
  
KEYWORD3.19M
(aliasee);
762
3.19M
  
KEYWORD3.19M
(refs);
763
3.19M
  
KEYWORD3.19M
(typeIdInfo);
764
3.19M
  
KEYWORD3.19M
(typeTests);
765
3.19M
  
KEYWORD3.19M
(typeTestAssumeVCalls);
766
3.19M
  
KEYWORD3.19M
(typeCheckedLoadVCalls);
767
3.19M
  
KEYWORD3.19M
(typeTestAssumeConstVCalls);
768
3.19M
  
KEYWORD3.19M
(typeCheckedLoadConstVCalls);
769
3.19M
  
KEYWORD3.19M
(vFuncId);
770
3.19M
  
KEYWORD3.19M
(offset);
771
3.19M
  
KEYWORD3.19M
(args);
772
3.19M
  
KEYWORD3.19M
(typeid);
773
3.19M
  
KEYWORD3.19M
(typeidCompatibleVTable);
774
3.19M
  
KEYWORD3.19M
(summary);
775
3.19M
  
KEYWORD3.19M
(typeTestRes);
776
3.19M
  
KEYWORD3.19M
(kind);
777
3.19M
  
KEYWORD3.19M
(unsat);
778
3.19M
  
KEYWORD3.19M
(byteArray);
779
3.19M
  
KEYWORD3.19M
(inline);
780
3.19M
  
KEYWORD3.19M
(single);
781
3.19M
  
KEYWORD3.19M
(allOnes);
782
3.19M
  
KEYWORD3.19M
(sizeM1BitWidth);
783
3.19M
  
KEYWORD3.19M
(alignLog2);
784
3.19M
  
KEYWORD3.19M
(sizeM1);
785
3.19M
  
KEYWORD3.19M
(bitMask);
786
3.19M
  
KEYWORD3.19M
(inlineBits);
787
3.19M
  
KEYWORD3.19M
(wpdResolutions);
788
3.19M
  
KEYWORD3.19M
(wpdRes);
789
3.19M
  
KEYWORD3.19M
(indir);
790
3.19M
  
KEYWORD3.19M
(singleImpl);
791
3.19M
  
KEYWORD3.19M
(branchFunnel);
792
3.19M
  
KEYWORD3.19M
(singleImplName);
793
3.19M
  
KEYWORD3.19M
(resByArg);
794
3.19M
  
KEYWORD3.19M
(byArg);
795
3.19M
  
KEYWORD3.19M
(uniformRetVal);
796
3.19M
  
KEYWORD3.19M
(uniqueRetVal);
797
3.19M
  
KEYWORD3.19M
(virtualConstProp);
798
3.19M
  
KEYWORD3.19M
(info);
799
3.19M
  
KEYWORD3.19M
(byte);
800
3.19M
  
KEYWORD3.19M
(bit);
801
3.19M
  
KEYWORD3.19M
(varFlags);
802
3.19M
803
3.19M
#undef KEYWORD
804
3.19M
805
3.19M
  // Keywords for types.
806
3.19M
#define TYPEKEYWORD(STR, LLVMTY)                                               \
807
25.1M
  do {                                                                         \
808
25.1M
    if (Keyword == STR) {                                                      \
809
1.33M
      TyVal = LLVMTY;                                                          \
810
1.33M
      return lltok::Type;                                                      \
811
1.33M
    }                                                                          \
812
25.1M
  } while (
false23.8M
)
813
3.19M
814
3.19M
  
TYPEKEYWORD3.19M
("void", Type::getVoidTy(Context));
815
3.19M
  
TYPEKEYWORD2.93M
("half", Type::getHalfTy(Context));
816
2.93M
  
TYPEKEYWORD2.86M
("float", Type::getFloatTy(Context));
817
2.86M
  
TYPEKEYWORD2.32M
("double", Type::getDoubleTy(Context));
818
2.32M
  
TYPEKEYWORD2.05M
("x86_fp80", Type::getX86_FP80Ty(Context));
819
2.05M
  
TYPEKEYWORD2.05M
("fp128", Type::getFP128Ty(Context));
820
2.05M
  
TYPEKEYWORD2.04M
("ppc_fp128", Type::getPPC_FP128Ty(Context));
821
2.04M
  
TYPEKEYWORD2.04M
("label", Type::getLabelTy(Context));
822
2.04M
  
TYPEKEYWORD1.89M
("metadata", Type::getMetadataTy(Context));
823
1.89M
  
TYPEKEYWORD1.86M
("x86_mmx", Type::getX86_MMXTy(Context));
824
1.86M
  
TYPEKEYWORD1.85M
("token", Type::getTokenTy(Context));
825
1.85M
826
1.85M
#undef TYPEKEYWORD
827
1.85M
828
1.85M
  // Keywords for instructions.
829
1.85M
#define INSTKEYWORD(STR, Enum)                                                 \
830
68.2M
  do {                                                                         \
831
68.2M
    if (Keyword == #STR) {                                                     \
832
1.83M
      UIntVal = Instruction::Enum;                                             \
833
1.83M
      return lltok::kw_##STR;                                                  \
834
1.83M
    }                                                                          \
835
68.2M
  } while (
false66.4M
)
836
1.85M
837
1.85M
  
INSTKEYWORD1.85M
(fneg, FNeg);
838
1.85M
839
1.85M
  
INSTKEYWORD1.85M
(add, Add); 1.85M
INSTKEYWORD1.79M
(fadd, FAdd);
840
1.79M
  
INSTKEYWORD1.78M
(sub, Sub); 1.78M
INSTKEYWORD1.76M
(fsub, FSub);
841
1.76M
  
INSTKEYWORD1.75M
(mul, Mul); 1.75M
INSTKEYWORD1.74M
(fmul, FMul);
842
1.74M
  
INSTKEYWORD1.73M
(udiv, UDiv); 1.73M
INSTKEYWORD1.72M
(sdiv, SDiv); 1.72M
INSTKEYWORD1.72M
(fdiv, FDiv);
843
1.72M
  
INSTKEYWORD1.72M
(urem, URem); 1.72M
INSTKEYWORD1.72M
(srem, SRem); 1.72M
INSTKEYWORD1.71M
(frem, FRem);
844
1.71M
  
INSTKEYWORD1.71M
(shl, Shl); 1.71M
INSTKEYWORD1.70M
(lshr, LShr); 1.70M
INSTKEYWORD1.68M
(ashr, AShr);
845
1.68M
  
INSTKEYWORD1.68M
(and, And); 1.68M
INSTKEYWORD1.65M
(or, Or); 1.65M
INSTKEYWORD1.64M
(xor, Xor);
846
1.64M
  
INSTKEYWORD1.63M
(icmp, ICmp); 1.63M
INSTKEYWORD1.56M
(fcmp, FCmp);
847
1.56M
848
1.56M
  
INSTKEYWORD1.54M
(phi, PHI);
849
1.54M
  
INSTKEYWORD1.51M
(call, Call);
850
1.51M
  
INSTKEYWORD1.33M
(trunc, Trunc);
851
1.33M
  
INSTKEYWORD1.31M
(zext, ZExt);
852
1.31M
  
INSTKEYWORD1.29M
(sext, SExt);
853
1.29M
  
INSTKEYWORD1.27M
(fptrunc, FPTrunc);
854
1.27M
  
INSTKEYWORD1.26M
(fpext, FPExt);
855
1.26M
  
INSTKEYWORD1.26M
(uitofp, UIToFP);
856
1.26M
  
INSTKEYWORD1.26M
(sitofp, SIToFP);
857
1.26M
  
INSTKEYWORD1.25M
(fptoui, FPToUI);
858
1.25M
  
INSTKEYWORD1.25M
(fptosi, FPToSI);
859
1.25M
  
INSTKEYWORD1.24M
(inttoptr, IntToPtr);
860
1.24M
  
INSTKEYWORD1.24M
(ptrtoint, PtrToInt);
861
1.24M
  
INSTKEYWORD1.24M
(bitcast, BitCast);
862
1.24M
  
INSTKEYWORD1.16M
(addrspacecast, AddrSpaceCast);
863
1.16M
  
INSTKEYWORD1.16M
(select, Select);
864
1.16M
  
INSTKEYWORD1.13M
(va_arg, VAArg);
865
1.13M
  
INSTKEYWORD1.13M
(ret, Ret);
866
1.13M
  
INSTKEYWORD831k
(br, Br);
867
831k
  
INSTKEYWORD746k
(switch, Switch);
868
746k
  
INSTKEYWORD744k
(indirectbr, IndirectBr);
869
744k
  
INSTKEYWORD744k
(invoke, Invoke);
870
744k
  
INSTKEYWORD741k
(resume, Resume);
871
741k
  
INSTKEYWORD741k
(unreachable, Unreachable);
872
741k
  
INSTKEYWORD737k
(callbr, CallBr);
873
737k
874
737k
  
INSTKEYWORD737k
(alloca, Alloca);
875
737k
  
INSTKEYWORD685k
(load, Load);
876
685k
  
INSTKEYWORD491k
(store, Store);
877
491k
  
INSTKEYWORD341k
(cmpxchg, AtomicCmpXchg);
878
341k
  
INSTKEYWORD339k
(atomicrmw, AtomicRMW);
879
339k
  
INSTKEYWORD331k
(fence, Fence);
880
331k
  
INSTKEYWORD330k
(getelementptr, GetElementPtr);
881
330k
882
330k
  
INSTKEYWORD159k
(extractelement, ExtractElement);
883
159k
  
INSTKEYWORD124k
(insertelement, InsertElement);
884
124k
  
INSTKEYWORD86.6k
(shufflevector, ShuffleVector);
885
86.6k
  
INSTKEYWORD40.5k
(extractvalue, ExtractValue);
886
40.5k
  
INSTKEYWORD26.5k
(insertvalue, InsertValue);
887
26.5k
  
INSTKEYWORD24.7k
(landingpad, LandingPad);
888
24.7k
  
INSTKEYWORD23.5k
(cleanupret, CleanupRet);
889
23.5k
  
INSTKEYWORD23.3k
(catchret, CatchRet);
890
23.3k
  
INSTKEYWORD23.0k
(catchswitch, CatchSwitch);
891
23.0k
  
INSTKEYWORD22.7k
(catchpad, CatchPad);
892
22.7k
  
INSTKEYWORD22.3k
(cleanuppad, CleanupPad);
893
22.3k
894
22.3k
#undef INSTKEYWORD
895
22.3k
896
22.3k
#define DWKEYWORD(TYPE, TOKEN)                                                 \
897
103k
  do {                                                                         \
898
103k
    if (Keyword.startswith("DW_" #TYPE "_")) {                                 \
899
13.9k
      StrVal.assign(Keyword.begin(), Keyword.end());                           \
900
13.9k
      return lltok::TOKEN;                                                     \
901
13.9k
    }                                                                          \
902
103k
  } while (
false89.2k
)
903
22.3k
904
22.3k
  
DWKEYWORD22.0k
(TAG, DwarfTag);
905
22.0k
  
DWKEYWORD17.2k
(ATE, DwarfAttEncoding);
906
17.2k
  
DWKEYWORD15.2k
(VIRTUALITY, DwarfVirtuality);
907
15.2k
  
DWKEYWORD15.1k
(LANG, DwarfLang);
908
15.1k
  
DWKEYWORD12.7k
(CC, DwarfCC);
909
12.7k
  
DWKEYWORD12.6k
(OP, DwarfOp);
910
12.6k
  
DWKEYWORD8.11k
(MACINFO, DwarfMacinfo);
911
8.11k
912
8.11k
#undef DWKEYWORD
913
8.11k
914
8.11k
  
if (8.08k
Keyword.startswith("DIFlag")8.08k
) {
915
4.63k
    StrVal.assign(Keyword.begin(), Keyword.end());
916
4.63k
    return lltok::DIFlag;
917
4.63k
  }
918
3.45k
919
3.45k
  if (Keyword.startswith("DISPFlag")) {
920
546
    StrVal.assign(Keyword.begin(), Keyword.end());
921
546
    return lltok::DISPFlag;
922
546
  }
923
2.90k
924
2.90k
  if (Keyword.startswith("CSK_")) {
925
225
    StrVal.assign(Keyword.begin(), Keyword.end());
926
225
    return lltok::ChecksumKind;
927
225
  }
928
2.68k
929
2.68k
  if (Keyword == "NoDebug" || 
Keyword == "FullDebug"2.54k
||
930
2.68k
      
Keyword == "LineTablesOnly"591
||
Keyword == "DebugDirectivesOnly"404
) {
931
2.28k
    StrVal.assign(Keyword.begin(), Keyword.end());
932
2.28k
    return lltok::EmissionKind;
933
2.28k
  }
934
401
935
401
  if (Keyword == "GNU" || 
Keyword == "None"374
||
Keyword == "Default"119
) {
936
285
    StrVal.assign(Keyword.begin(), Keyword.end());
937
285
    return lltok::NameTableKind;
938
285
  }
939
116
940
116
  // Check for [us]0x[0-9A-Fa-f]+ which are Hexadecimal constant generated by
941
116
  // the CFE to avoid forcing it to deal with 64-bit numbers.
942
116
  if ((TokStart[0] == 'u' || 
TokStart[0] == 's'94
) &&
943
116
      
TokStart[1] == '0'24
&&
TokStart[2] == 'x'24
&&
944
116
      
isxdigit(static_cast<unsigned char>(TokStart[3]))24
) {
945
24
    int len = CurPtr-TokStart-3;
946
24
    uint32_t bits = len * 4;
947
24
    StringRef HexStr(TokStart + 3, len);
948
24
    if (!all_of(HexStr, isxdigit)) {
949
1
      // Bad token, return it as an error.
950
1
      CurPtr = TokStart+3;
951
1
      return lltok::Error;
952
1
    }
953
23
    APInt Tmp(bits, HexStr, 16);
954
23
    uint32_t activeBits = Tmp.getActiveBits();
955
23
    if (activeBits > 0 && activeBits < bits)
956
22
      Tmp = Tmp.trunc(activeBits);
957
23
    APSIntVal = APSInt(Tmp, TokStart[0] == 'u');
958
23
    return lltok::APSInt;
959
23
  }
960
92
961
92
  // If this is "cc1234", return this as just "cc".
962
92
  if (TokStart[0] == 'c' && 
TokStart[1] == 'c'86
) {
963
86
    CurPtr = TokStart+2;
964
86
    return lltok::kw_cc;
965
86
  }
966
6
967
6
  // Finally, if this isn't known, return an error.
968
6
  CurPtr = TokStart+1;
969
6
  return lltok::Error;
970
6
}
971
972
/// Lex all tokens that start with a 0x prefix, knowing they match and are not
973
/// labels.
974
///    HexFPConstant     0x[0-9A-Fa-f]+
975
///    HexFP80Constant   0xK[0-9A-Fa-f]+
976
///    HexFP128Constant  0xL[0-9A-Fa-f]+
977
///    HexPPC128Constant 0xM[0-9A-Fa-f]+
978
///    HexHalfConstant   0xH[0-9A-Fa-f]+
979
10.1k
lltok::Kind LLLexer::Lex0x() {
980
10.1k
  CurPtr = TokStart + 2;
981
10.1k
982
10.1k
  char Kind;
983
10.1k
  if ((CurPtr[0] >= 'K' && 
CurPtr[0] <= 'M'1.20k
) ||
CurPtr[0] == 'H'9.68k
) {
984
1.80k
    Kind = *CurPtr++;
985
8.35k
  } else {
986
8.35k
    Kind = 'J';
987
8.35k
  }
988
10.1k
989
10.1k
  if (!isxdigit(static_cast<unsigned char>(CurPtr[0]))) {
990
0
    // Bad token, return it as an error.
991
0
    CurPtr = TokStart+1;
992
0
    return lltok::Error;
993
0
  }
994
10.1k
995
154k
  
while (10.1k
isxdigit(static_cast<unsigned char>(CurPtr[0])))
996
144k
    ++CurPtr;
997
10.1k
998
10.1k
  if (Kind == 'J') {
999
8.35k
    // HexFPConstant - Floating point constant represented in IEEE format as a
1000
8.35k
    // hexadecimal number for when exponential notation is not precise enough.
1001
8.35k
    // Half, Float, and double only.
1002
8.35k
    APFloatVal = APFloat(APFloat::IEEEdouble(),
1003
8.35k
                         APInt(64, HexIntToVal(TokStart + 2, CurPtr)));
1004
8.35k
    return lltok::APFloat;
1005
8.35k
  }
1006
1.80k
1007
1.80k
  uint64_t Pair[2];
1008
1.80k
  switch (Kind) {
1009
1.80k
  
default: 0
llvm_unreachable0
("Unknown kind!");
1010
1.80k
  case 'K':
1011
149
    // F80HexFPConstant - x87 long double in hexadecimal format (10 bytes)
1012
149
    FP80HexToIntPair(TokStart+3, CurPtr, Pair);
1013
149
    APFloatVal = APFloat(APFloat::x87DoubleExtended(), APInt(80, Pair));
1014
149
    return lltok::APFloat;
1015
1.80k
  case 'L':
1016
266
    // F128HexFPConstant - IEEE 128-bit in hexadecimal format (16 bytes)
1017
266
    HexToIntPair(TokStart+3, CurPtr, Pair);
1018
266
    APFloatVal = APFloat(APFloat::IEEEquad(), APInt(128, Pair));
1019
266
    return lltok::APFloat;
1020
1.80k
  case 'M':
1021
69
    // PPC128HexFPConstant - PowerPC 128-bit in hexadecimal format (16 bytes)
1022
69
    HexToIntPair(TokStart+3, CurPtr, Pair);
1023
69
    APFloatVal = APFloat(APFloat::PPCDoubleDouble(), APInt(128, Pair));
1024
69
    return lltok::APFloat;
1025
1.80k
  case 'H':
1026
1.32k
    APFloatVal = APFloat(APFloat::IEEEhalf(),
1027
1.32k
                         APInt(16,HexIntToVal(TokStart+3, CurPtr)));
1028
1.32k
    return lltok::APFloat;
1029
1.80k
  }
1030
1.80k
}
1031
1032
/// Lex tokens for a label or a numeric constant, possibly starting with -.
1033
///    Label             [-a-zA-Z$._0-9]+:
1034
///    NInteger          -[0-9]+
1035
///    FPConstant        [-+]?[0-9]+[.][0-9]*([eE][-+]?[0-9]+)?
1036
///    PInteger          [0-9]+
1037
///    HexFPConstant     0x[0-9A-Fa-f]+
1038
///    HexFP80Constant   0xK[0-9A-Fa-f]+
1039
///    HexFP128Constant  0xL[0-9A-Fa-f]+
1040
///    HexPPC128Constant 0xM[0-9A-Fa-f]+
1041
3.98M
lltok::Kind LLLexer::LexDigitOrNegative() {
1042
3.98M
  // If the letter after the negative is not a number, this is probably a label.
1043
3.98M
  if (!isdigit(static_cast<unsigned char>(TokStart[0])) &&
1044
3.98M
      
!isdigit(static_cast<unsigned char>(CurPtr[0]))108k
) {
1045
7
    // Okay, this is not a number after the -, it's probably a label.
1046
7
    if (const char *End = isLabelTail(CurPtr)) {
1047
7
      StrVal.assign(TokStart, End-1);
1048
7
      CurPtr = End;
1049
7
      return lltok::LabelStr;
1050
7
    }
1051
0
1052
0
    return lltok::Error;
1053
0
  }
1054
3.98M
1055
3.98M
  // At this point, it is either a label, int or fp constant.
1056
3.98M
1057
3.98M
  // Skip digits, we have at least one.
1058
5.97M
  
for (; 3.98M
isdigit(static_cast<unsigned char>(CurPtr[0]));
++CurPtr1.98M
)
1059
1.98M
    /*empty*/;
1060
3.98M
1061
3.98M
  // Check if this is a fully-numeric label:
1062
3.98M
  if (isdigit(TokStart[0]) && 
CurPtr[0] == ':'3.88M
) {
1063
236
    uint64_t Val = atoull(TokStart, CurPtr);
1064
236
    ++CurPtr; // Skip the colon.
1065
236
    if ((unsigned)Val != Val)
1066
0
      Error("invalid value number (too large)!");
1067
236
    UIntVal = unsigned(Val);
1068
236
    return lltok::LabelID;
1069
236
  }
1070
3.98M
1071
3.98M
  // Check to see if this really is a string label, e.g. "-1:".
1072
3.98M
  if (isLabelChar(CurPtr[0]) || 
CurPtr[0] == ':'3.92M
) {
1073
67.2k
    if (const char *End = isLabelTail(CurPtr)) {
1074
7
      StrVal.assign(TokStart, End-1);
1075
7
      CurPtr = End;
1076
7
      return lltok::LabelStr;
1077
7
    }
1078
3.98M
  }
1079
3.98M
1080
3.98M
  // If the next character is a '.', then it is a fp value, otherwise its
1081
3.98M
  // integer.
1082
3.98M
  if (CurPtr[0] != '.') {
1083
3.93M
    if (TokStart[0] == '0' && 
TokStart[1] == 'x'340k
)
1084
10.1k
      return Lex0x();
1085
3.92M
    APSIntVal = APSInt(StringRef(TokStart, CurPtr - TokStart));
1086
3.92M
    return lltok::APSInt;
1087
3.92M
  }
1088
56.9k
1089
56.9k
  ++CurPtr;
1090
56.9k
1091
56.9k
  // Skip over [0-9]*([eE][-+]?[0-9]+)?
1092
245k
  while (isdigit(static_cast<unsigned char>(CurPtr[0]))) 
++CurPtr188k
;
1093
56.9k
1094
56.9k
  if (CurPtr[0] == 'e' || 
CurPtr[0] == 'E'30.2k
) {
1095
26.7k
    if (isdigit(static_cast<unsigned char>(CurPtr[1])) ||
1096
26.7k
        
(26.5k
(26.5k
CurPtr[1] == '-'26.5k
||
CurPtr[1] == '+'26.0k
) &&
1097
26.7k
          
isdigit(static_cast<unsigned char>(CurPtr[2]))26.5k
)) {
1098
26.7k
      CurPtr += 2;
1099
79.8k
      while (isdigit(static_cast<unsigned char>(CurPtr[0]))) 
++CurPtr53.1k
;
1100
26.7k
    }
1101
26.7k
  }
1102
56.9k
1103
56.9k
  APFloatVal = APFloat(APFloat::IEEEdouble(),
1104
56.9k
                       StringRef(TokStart, CurPtr - TokStart));
1105
56.9k
  return lltok::APFloat;
1106
56.9k
}
1107
1108
/// Lex a floating point constant starting with +.
1109
///    FPConstant  [-+]?[0-9]+[.][0-9]*([eE][-+]?[0-9]+)?
1110
25
lltok::Kind LLLexer::LexPositive() {
1111
25
  // If the letter after the negative is a number, this is probably not a
1112
25
  // label.
1113
25
  if (!isdigit(static_cast<unsigned char>(CurPtr[0])))
1114
0
    return lltok::Error;
1115
25
1116
25
  // Skip digits.
1117
25
  for (++CurPtr; isdigit(static_cast<unsigned char>(CurPtr[0])); 
++CurPtr0
)
1118
0
    /*empty*/;
1119
25
1120
25
  // At this point, we need a '.'.
1121
25
  if (CurPtr[0] != '.') {
1122
0
    CurPtr = TokStart+1;
1123
0
    return lltok::Error;
1124
0
  }
1125
25
1126
25
  ++CurPtr;
1127
25
1128
25
  // Skip over [0-9]*([eE][-+]?[0-9]+)?
1129
50
  while (isdigit(static_cast<unsigned char>(CurPtr[0]))) 
++CurPtr25
;
1130
25
1131
25
  if (CurPtr[0] == 'e' || CurPtr[0] == 'E') {
1132
0
    if (isdigit(static_cast<unsigned char>(CurPtr[1])) ||
1133
0
        ((CurPtr[1] == '-' || CurPtr[1] == '+') &&
1134
0
        isdigit(static_cast<unsigned char>(CurPtr[2])))) {
1135
0
      CurPtr += 2;
1136
0
      while (isdigit(static_cast<unsigned char>(CurPtr[0]))) ++CurPtr;
1137
0
    }
1138
0
  }
1139
25
1140
25
  APFloatVal = APFloat(APFloat::IEEEdouble(),
1141
25
                       StringRef(TokStart, CurPtr - TokStart));
1142
25
  return lltok::APFloat;
1143
25
}