LLVM  13.0.0git
MILexer.cpp
Go to the documentation of this file.
1 //===- MILexer.cpp - Machine instructions lexer implementation ------------===//
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 // This file implements the lexing of machine instructions.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "MILexer.h"
14 #include "llvm/ADT/None.h"
15 #include "llvm/ADT/StringExtras.h"
16 #include "llvm/ADT/StringSwitch.h"
17 #include "llvm/ADT/Twine.h"
18 #include <algorithm>
19 #include <cassert>
20 #include <cctype>
21 #include <string>
22 
23 using namespace llvm;
24 
25 namespace {
26 
27 using ErrorCallbackType =
28  function_ref<void(StringRef::iterator Loc, const Twine &)>;
29 
30 /// This class provides a way to iterate and get characters from the source
31 /// string.
32 class Cursor {
33  const char *Ptr = nullptr;
34  const char *End = nullptr;
35 
36 public:
37  Cursor(NoneType) {}
38 
39  explicit Cursor(StringRef Str) {
40  Ptr = Str.data();
41  End = Ptr + Str.size();
42  }
43 
44  bool isEOF() const { return Ptr == End; }
45 
46  char peek(int I = 0) const { return End - Ptr <= I ? 0 : Ptr[I]; }
47 
48  void advance(unsigned I = 1) { Ptr += I; }
49 
50  StringRef remaining() const { return StringRef(Ptr, End - Ptr); }
51 
52  StringRef upto(Cursor C) const {
53  assert(C.Ptr >= Ptr && C.Ptr <= End);
54  return StringRef(Ptr, C.Ptr - Ptr);
55  }
56 
57  StringRef::iterator location() const { return Ptr; }
58 
59  operator bool() const { return Ptr != nullptr; }
60 };
61 
62 } // end anonymous namespace
63 
65  this->Kind = Kind;
66  this->Range = Range;
67  return *this;
68 }
69 
71  StringValue = StrVal;
72  return *this;
73 }
74 
76  StringValueStorage = std::move(StrVal);
77  StringValue = StringValueStorage;
78  return *this;
79 }
80 
82  this->IntVal = std::move(IntVal);
83  return *this;
84 }
85 
86 /// Skip the leading whitespace characters and return the updated cursor.
87 static Cursor skipWhitespace(Cursor C) {
88  while (isblank(C.peek()))
89  C.advance();
90  return C;
91 }
92 
93 static bool isNewlineChar(char C) { return C == '\n' || C == '\r'; }
94 
95 /// Skip a line comment and return the updated cursor.
96 static Cursor skipComment(Cursor C) {
97  if (C.peek() != ';')
98  return C;
99  while (!isNewlineChar(C.peek()) && !C.isEOF())
100  C.advance();
101  return C;
102 }
103 
104 /// Machine operands can have comments, enclosed between /* and */.
105 /// This eats up all tokens, including /* and */.
106 static Cursor skipMachineOperandComment(Cursor C) {
107  if (C.peek() != '/' || C.peek(1) != '*')
108  return C;
109 
110  while (C.peek() != '*' || C.peek(1) != '/')
111  C.advance();
112 
113  C.advance();
114  C.advance();
115  return C;
116 }
117 
118 /// Return true if the given character satisfies the following regular
119 /// expression: [-a-zA-Z$._0-9]
120 static bool isIdentifierChar(char C) {
121  return isalpha(C) || isdigit(C) || C == '_' || C == '-' || C == '.' ||
122  C == '$';
123 }
124 
125 /// Unescapes the given string value.
126 ///
127 /// Expects the string value to be quoted.
128 static std::string unescapeQuotedString(StringRef Value) {
129  assert(Value.front() == '"' && Value.back() == '"');
130  Cursor C = Cursor(Value.substr(1, Value.size() - 2));
131 
132  std::string Str;
133  Str.reserve(C.remaining().size());
134  while (!C.isEOF()) {
135  char Char = C.peek();
136  if (Char == '\\') {
137  if (C.peek(1) == '\\') {
138  // Two '\' become one
139  Str += '\\';
140  C.advance(2);
141  continue;
142  }
143  if (isxdigit(C.peek(1)) && isxdigit(C.peek(2))) {
144  Str += hexDigitValue(C.peek(1)) * 16 + hexDigitValue(C.peek(2));
145  C.advance(3);
146  continue;
147  }
148  }
149  Str += Char;
150  C.advance();
151  }
152  return Str;
153 }
154 
155 /// Lex a string constant using the following regular expression: \"[^\"]*\"
156 static Cursor lexStringConstant(Cursor C, ErrorCallbackType ErrorCallback) {
157  assert(C.peek() == '"');
158  for (C.advance(); C.peek() != '"'; C.advance()) {
159  if (C.isEOF() || isNewlineChar(C.peek())) {
160  ErrorCallback(
161  C.location(),
162  "end of machine instruction reached before the closing '\"'");
163  return None;
164  }
165  }
166  C.advance();
167  return C;
168 }
169 
170 static Cursor lexName(Cursor C, MIToken &Token, MIToken::TokenKind Type,
171  unsigned PrefixLength, ErrorCallbackType ErrorCallback) {
172  auto Range = C;
173  C.advance(PrefixLength);
174  if (C.peek() == '"') {
175  if (Cursor R = lexStringConstant(C, ErrorCallback)) {
176  StringRef String = Range.upto(R);
177  Token.reset(Type, String)
179  unescapeQuotedString(String.drop_front(PrefixLength)));
180  return R;
181  }
182  Token.reset(MIToken::Error, Range.remaining());
183  return Range;
184  }
185  while (isIdentifierChar(C.peek()))
186  C.advance();
187  Token.reset(Type, Range.upto(C))
188  .setStringValue(Range.upto(C).drop_front(PrefixLength));
189  return C;
190 }
191 
193  return StringSwitch<MIToken::TokenKind>(Identifier)
195  .Case("implicit", MIToken::kw_implicit)
196  .Case("implicit-def", MIToken::kw_implicit_define)
197  .Case("def", MIToken::kw_def)
198  .Case("dead", MIToken::kw_dead)
199  .Case("killed", MIToken::kw_killed)
200  .Case("undef", MIToken::kw_undef)
201  .Case("internal", MIToken::kw_internal)
202  .Case("early-clobber", MIToken::kw_early_clobber)
203  .Case("debug-use", MIToken::kw_debug_use)
204  .Case("renamable", MIToken::kw_renamable)
205  .Case("tied-def", MIToken::kw_tied_def)
206  .Case("frame-setup", MIToken::kw_frame_setup)
207  .Case("frame-destroy", MIToken::kw_frame_destroy)
208  .Case("nnan", MIToken::kw_nnan)
209  .Case("ninf", MIToken::kw_ninf)
210  .Case("nsz", MIToken::kw_nsz)
211  .Case("arcp", MIToken::kw_arcp)
212  .Case("contract", MIToken::kw_contract)
213  .Case("afn", MIToken::kw_afn)
214  .Case("reassoc", MIToken::kw_reassoc)
215  .Case("nuw", MIToken::kw_nuw)
216  .Case("nsw", MIToken::kw_nsw)
217  .Case("exact", MIToken::kw_exact)
218  .Case("nofpexcept", MIToken::kw_nofpexcept)
219  .Case("debug-location", MIToken::kw_debug_location)
220  .Case("debug-instr-number", MIToken::kw_debug_instr_number)
221  .Case("same_value", MIToken::kw_cfi_same_value)
222  .Case("offset", MIToken::kw_cfi_offset)
223  .Case("rel_offset", MIToken::kw_cfi_rel_offset)
224  .Case("def_cfa_register", MIToken::kw_cfi_def_cfa_register)
225  .Case("def_cfa_offset", MIToken::kw_cfi_def_cfa_offset)
226  .Case("adjust_cfa_offset", MIToken::kw_cfi_adjust_cfa_offset)
227  .Case("escape", MIToken::kw_cfi_escape)
228  .Case("def_cfa", MIToken::kw_cfi_def_cfa)
229  .Case("remember_state", MIToken::kw_cfi_remember_state)
230  .Case("restore", MIToken::kw_cfi_restore)
231  .Case("restore_state", MIToken::kw_cfi_restore_state)
232  .Case("undefined", MIToken::kw_cfi_undefined)
233  .Case("register", MIToken::kw_cfi_register)
234  .Case("window_save", MIToken::kw_cfi_window_save)
235  .Case("negate_ra_sign_state",
237  .Case("blockaddress", MIToken::kw_blockaddress)
238  .Case("intrinsic", MIToken::kw_intrinsic)
239  .Case("target-index", MIToken::kw_target_index)
240  .Case("half", MIToken::kw_half)
241  .Case("float", MIToken::kw_float)
242  .Case("double", MIToken::kw_double)
243  .Case("x86_fp80", MIToken::kw_x86_fp80)
244  .Case("fp128", MIToken::kw_fp128)
245  .Case("ppc_fp128", MIToken::kw_ppc_fp128)
246  .Case("target-flags", MIToken::kw_target_flags)
247  .Case("volatile", MIToken::kw_volatile)
248  .Case("non-temporal", MIToken::kw_non_temporal)
249  .Case("dereferenceable", MIToken::kw_dereferenceable)
250  .Case("invariant", MIToken::kw_invariant)
251  .Case("align", MIToken::kw_align)
252  .Case("basealign", MIToken::kw_align)
253  .Case("addrspace", MIToken::kw_addrspace)
254  .Case("stack", MIToken::kw_stack)
255  .Case("got", MIToken::kw_got)
256  .Case("jump-table", MIToken::kw_jump_table)
257  .Case("constant-pool", MIToken::kw_constant_pool)
258  .Case("call-entry", MIToken::kw_call_entry)
259  .Case("custom", MIToken::kw_custom)
260  .Case("liveout", MIToken::kw_liveout)
261  .Case("address-taken", MIToken::kw_address_taken)
262  .Case("landing-pad", MIToken::kw_landing_pad)
263  .Case("ehfunclet-entry", MIToken::kw_ehfunclet_entry)
264  .Case("liveins", MIToken::kw_liveins)
265  .Case("successors", MIToken::kw_successors)
266  .Case("floatpred", MIToken::kw_floatpred)
267  .Case("intpred", MIToken::kw_intpred)
268  .Case("shufflemask", MIToken::kw_shufflemask)
269  .Case("pre-instr-symbol", MIToken::kw_pre_instr_symbol)
270  .Case("post-instr-symbol", MIToken::kw_post_instr_symbol)
271  .Case("heap-alloc-marker", MIToken::kw_heap_alloc_marker)
272  .Case("bbsections", MIToken::kw_bbsections)
273  .Case("unknown-size", MIToken::kw_unknown_size)
274  .Case("unknown-address", MIToken::kw_unknown_address)
276 }
277 
278 static Cursor maybeLexIdentifier(Cursor C, MIToken &Token) {
279  if (!isalpha(C.peek()) && C.peek() != '_')
280  return None;
281  auto Range = C;
282  while (isIdentifierChar(C.peek()))
283  C.advance();
284  auto Identifier = Range.upto(C);
285  Token.reset(getIdentifierKind(Identifier), Identifier)
286  .setStringValue(Identifier);
287  return C;
288 }
289 
290 static Cursor maybeLexMachineBasicBlock(Cursor C, MIToken &Token,
291  ErrorCallbackType ErrorCallback) {
292  bool IsReference = C.remaining().startswith("%bb.");
293  if (!IsReference && !C.remaining().startswith("bb."))
294  return None;
295  auto Range = C;
296  unsigned PrefixLength = IsReference ? 4 : 3;
297  C.advance(PrefixLength); // Skip '%bb.' or 'bb.'
298  if (!isdigit(C.peek())) {
299  Token.reset(MIToken::Error, C.remaining());
300  ErrorCallback(C.location(), "expected a number after '%bb.'");
301  return C;
302  }
303  auto NumberRange = C;
304  while (isdigit(C.peek()))
305  C.advance();
306  StringRef Number = NumberRange.upto(C);
307  unsigned StringOffset = PrefixLength + Number.size(); // Drop '%bb.<id>'
308  // TODO: The format bb.<id>.<irname> is supported only when it's not a
309  // reference. Once we deprecate the format where the irname shows up, we
310  // should only lex forward if it is a reference.
311  if (C.peek() == '.') {
312  C.advance(); // Skip '.'
313  ++StringOffset;
314  while (isIdentifierChar(C.peek()))
315  C.advance();
316  }
317  Token.reset(IsReference ? MIToken::MachineBasicBlock
319  Range.upto(C))
321  .setStringValue(Range.upto(C).drop_front(StringOffset));
322  return C;
323 }
324 
325 static Cursor maybeLexIndex(Cursor C, MIToken &Token, StringRef Rule,
327  if (!C.remaining().startswith(Rule) || !isdigit(C.peek(Rule.size())))
328  return None;
329  auto Range = C;
330  C.advance(Rule.size());
331  auto NumberRange = C;
332  while (isdigit(C.peek()))
333  C.advance();
334  Token.reset(Kind, Range.upto(C)).setIntegerValue(APSInt(NumberRange.upto(C)));
335  return C;
336 }
337 
338 static Cursor maybeLexIndexAndName(Cursor C, MIToken &Token, StringRef Rule,
340  if (!C.remaining().startswith(Rule) || !isdigit(C.peek(Rule.size())))
341  return None;
342  auto Range = C;
343  C.advance(Rule.size());
344  auto NumberRange = C;
345  while (isdigit(C.peek()))
346  C.advance();
347  StringRef Number = NumberRange.upto(C);
348  unsigned StringOffset = Rule.size() + Number.size();
349  if (C.peek() == '.') {
350  C.advance();
351  ++StringOffset;
352  while (isIdentifierChar(C.peek()))
353  C.advance();
354  }
355  Token.reset(Kind, Range.upto(C))
357  .setStringValue(Range.upto(C).drop_front(StringOffset));
358  return C;
359 }
360 
361 static Cursor maybeLexJumpTableIndex(Cursor C, MIToken &Token) {
362  return maybeLexIndex(C, Token, "%jump-table.", MIToken::JumpTableIndex);
363 }
364 
365 static Cursor maybeLexStackObject(Cursor C, MIToken &Token) {
366  return maybeLexIndexAndName(C, Token, "%stack.", MIToken::StackObject);
367 }
368 
369 static Cursor maybeLexFixedStackObject(Cursor C, MIToken &Token) {
370  return maybeLexIndex(C, Token, "%fixed-stack.", MIToken::FixedStackObject);
371 }
372 
373 static Cursor maybeLexConstantPoolItem(Cursor C, MIToken &Token) {
374  return maybeLexIndex(C, Token, "%const.", MIToken::ConstantPoolItem);
375 }
376 
377 static Cursor maybeLexSubRegisterIndex(Cursor C, MIToken &Token,
378  ErrorCallbackType ErrorCallback) {
379  const StringRef Rule = "%subreg.";
380  if (!C.remaining().startswith(Rule))
381  return None;
382  return lexName(C, Token, MIToken::SubRegisterIndex, Rule.size(),
383  ErrorCallback);
384 }
385 
386 static Cursor maybeLexIRBlock(Cursor C, MIToken &Token,
387  ErrorCallbackType ErrorCallback) {
388  const StringRef Rule = "%ir-block.";
389  if (!C.remaining().startswith(Rule))
390  return None;
391  if (isdigit(C.peek(Rule.size())))
392  return maybeLexIndex(C, Token, Rule, MIToken::IRBlock);
393  return lexName(C, Token, MIToken::NamedIRBlock, Rule.size(), ErrorCallback);
394 }
395 
396 static Cursor maybeLexIRValue(Cursor C, MIToken &Token,
397  ErrorCallbackType ErrorCallback) {
398  const StringRef Rule = "%ir.";
399  if (!C.remaining().startswith(Rule))
400  return None;
401  if (isdigit(C.peek(Rule.size())))
402  return maybeLexIndex(C, Token, Rule, MIToken::IRValue);
403  return lexName(C, Token, MIToken::NamedIRValue, Rule.size(), ErrorCallback);
404 }
405 
406 static Cursor maybeLexStringConstant(Cursor C, MIToken &Token,
407  ErrorCallbackType ErrorCallback) {
408  if (C.peek() != '"')
409  return None;
410  return lexName(C, Token, MIToken::StringConstant, /*PrefixLength=*/0,
411  ErrorCallback);
412 }
413 
414 static Cursor lexVirtualRegister(Cursor C, MIToken &Token) {
415  auto Range = C;
416  C.advance(); // Skip '%'
417  auto NumberRange = C;
418  while (isdigit(C.peek()))
419  C.advance();
420  Token.reset(MIToken::VirtualRegister, Range.upto(C))
421  .setIntegerValue(APSInt(NumberRange.upto(C)));
422  return C;
423 }
424 
425 /// Returns true for a character allowed in a register name.
426 static bool isRegisterChar(char C) {
427  return isIdentifierChar(C) && C != '.';
428 }
429 
430 static Cursor lexNamedVirtualRegister(Cursor C, MIToken &Token) {
431  Cursor Range = C;
432  C.advance(); // Skip '%'
433  while (isRegisterChar(C.peek()))
434  C.advance();
435  Token.reset(MIToken::NamedVirtualRegister, Range.upto(C))
436  .setStringValue(Range.upto(C).drop_front(1)); // Drop the '%'
437  return C;
438 }
439 
440 static Cursor maybeLexRegister(Cursor C, MIToken &Token,
441  ErrorCallbackType ErrorCallback) {
442  if (C.peek() != '%' && C.peek() != '$')
443  return None;
444 
445  if (C.peek() == '%') {
446  if (isdigit(C.peek(1)))
447  return lexVirtualRegister(C, Token);
448 
449  if (isRegisterChar(C.peek(1)))
450  return lexNamedVirtualRegister(C, Token);
451 
452  return None;
453  }
454 
455  assert(C.peek() == '$');
456  auto Range = C;
457  C.advance(); // Skip '$'
458  while (isRegisterChar(C.peek()))
459  C.advance();
460  Token.reset(MIToken::NamedRegister, Range.upto(C))
461  .setStringValue(Range.upto(C).drop_front(1)); // Drop the '$'
462  return C;
463 }
464 
465 static Cursor maybeLexGlobalValue(Cursor C, MIToken &Token,
466  ErrorCallbackType ErrorCallback) {
467  if (C.peek() != '@')
468  return None;
469  if (!isdigit(C.peek(1)))
470  return lexName(C, Token, MIToken::NamedGlobalValue, /*PrefixLength=*/1,
471  ErrorCallback);
472  auto Range = C;
473  C.advance(1); // Skip the '@'
474  auto NumberRange = C;
475  while (isdigit(C.peek()))
476  C.advance();
477  Token.reset(MIToken::GlobalValue, Range.upto(C))
478  .setIntegerValue(APSInt(NumberRange.upto(C)));
479  return C;
480 }
481 
482 static Cursor maybeLexExternalSymbol(Cursor C, MIToken &Token,
483  ErrorCallbackType ErrorCallback) {
484  if (C.peek() != '&')
485  return None;
486  return lexName(C, Token, MIToken::ExternalSymbol, /*PrefixLength=*/1,
487  ErrorCallback);
488 }
489 
490 static Cursor maybeLexMCSymbol(Cursor C, MIToken &Token,
491  ErrorCallbackType ErrorCallback) {
492  const StringRef Rule = "<mcsymbol ";
493  if (!C.remaining().startswith(Rule))
494  return None;
495  auto Start = C;
496  C.advance(Rule.size());
497 
498  // Try a simple unquoted name.
499  if (C.peek() != '"') {
500  while (isIdentifierChar(C.peek()))
501  C.advance();
502  StringRef String = Start.upto(C).drop_front(Rule.size());
503  if (C.peek() != '>') {
504  ErrorCallback(C.location(),
505  "expected the '<mcsymbol ...' to be closed by a '>'");
506  Token.reset(MIToken::Error, Start.remaining());
507  return Start;
508  }
509  C.advance();
510 
511  Token.reset(MIToken::MCSymbol, Start.upto(C)).setStringValue(String);
512  return C;
513  }
514 
515  // Otherwise lex out a quoted name.
516  Cursor R = lexStringConstant(C, ErrorCallback);
517  if (!R) {
518  ErrorCallback(C.location(),
519  "unable to parse quoted string from opening quote");
520  Token.reset(MIToken::Error, Start.remaining());
521  return Start;
522  }
523  StringRef String = Start.upto(R).drop_front(Rule.size());
524  if (R.peek() != '>') {
525  ErrorCallback(R.location(),
526  "expected the '<mcsymbol ...' to be closed by a '>'");
527  Token.reset(MIToken::Error, Start.remaining());
528  return Start;
529  }
530  R.advance();
531 
532  Token.reset(MIToken::MCSymbol, Start.upto(R))
534  return R;
535 }
536 
537 static bool isValidHexFloatingPointPrefix(char C) {
538  return C == 'H' || C == 'K' || C == 'L' || C == 'M' || C == 'R';
539 }
540 
541 static Cursor lexFloatingPointLiteral(Cursor Range, Cursor C, MIToken &Token) {
542  C.advance();
543  // Skip over [0-9]*([eE][-+]?[0-9]+)?
544  while (isdigit(C.peek()))
545  C.advance();
546  if ((C.peek() == 'e' || C.peek() == 'E') &&
547  (isdigit(C.peek(1)) ||
548  ((C.peek(1) == '-' || C.peek(1) == '+') && isdigit(C.peek(2))))) {
549  C.advance(2);
550  while (isdigit(C.peek()))
551  C.advance();
552  }
553  Token.reset(MIToken::FloatingPointLiteral, Range.upto(C));
554  return C;
555 }
556 
557 static Cursor maybeLexHexadecimalLiteral(Cursor C, MIToken &Token) {
558  if (C.peek() != '0' || (C.peek(1) != 'x' && C.peek(1) != 'X'))
559  return None;
560  Cursor Range = C;
561  C.advance(2);
562  unsigned PrefLen = 2;
563  if (isValidHexFloatingPointPrefix(C.peek())) {
564  C.advance();
565  PrefLen++;
566  }
567  while (isxdigit(C.peek()))
568  C.advance();
569  StringRef StrVal = Range.upto(C);
570  if (StrVal.size() <= PrefLen)
571  return None;
572  if (PrefLen == 2)
573  Token.reset(MIToken::HexLiteral, Range.upto(C));
574  else // It must be 3, which means that there was a floating-point prefix.
575  Token.reset(MIToken::FloatingPointLiteral, Range.upto(C));
576  return C;
577 }
578 
579 static Cursor maybeLexNumericalLiteral(Cursor C, MIToken &Token) {
580  if (!isdigit(C.peek()) && (C.peek() != '-' || !isdigit(C.peek(1))))
581  return None;
582  auto Range = C;
583  C.advance();
584  while (isdigit(C.peek()))
585  C.advance();
586  if (C.peek() == '.')
587  return lexFloatingPointLiteral(Range, C, Token);
588  StringRef StrVal = Range.upto(C);
590  return C;
591 }
592 
594  return StringSwitch<MIToken::TokenKind>(Identifier)
595  .Case("!tbaa", MIToken::md_tbaa)
596  .Case("!alias.scope", MIToken::md_alias_scope)
597  .Case("!noalias", MIToken::md_noalias)
598  .Case("!range", MIToken::md_range)
599  .Case("!DIExpression", MIToken::md_diexpr)
600  .Case("!DILocation", MIToken::md_dilocation)
602 }
603 
604 static Cursor maybeLexExclaim(Cursor C, MIToken &Token,
605  ErrorCallbackType ErrorCallback) {
606  if (C.peek() != '!')
607  return None;
608  auto Range = C;
609  C.advance(1);
610  if (isdigit(C.peek()) || !isIdentifierChar(C.peek())) {
611  Token.reset(MIToken::exclaim, Range.upto(C));
612  return C;
613  }
614  while (isIdentifierChar(C.peek()))
615  C.advance();
616  StringRef StrVal = Range.upto(C);
618  if (Token.isError())
619  ErrorCallback(Token.location(),
620  "use of unknown metadata keyword '" + StrVal + "'");
621  return C;
622 }
623 
625  switch (C) {
626  case ',':
627  return MIToken::comma;
628  case '.':
629  return MIToken::dot;
630  case '=':
631  return MIToken::equal;
632  case ':':
633  return MIToken::colon;
634  case '(':
635  return MIToken::lparen;
636  case ')':
637  return MIToken::rparen;
638  case '{':
639  return MIToken::lbrace;
640  case '}':
641  return MIToken::rbrace;
642  case '+':
643  return MIToken::plus;
644  case '-':
645  return MIToken::minus;
646  case '<':
647  return MIToken::less;
648  case '>':
649  return MIToken::greater;
650  default:
651  return MIToken::Error;
652  }
653 }
654 
655 static Cursor maybeLexSymbol(Cursor C, MIToken &Token) {
657  unsigned Length = 1;
658  if (C.peek() == ':' && C.peek(1) == ':') {
660  Length = 2;
661  } else
662  Kind = symbolToken(C.peek());
663  if (Kind == MIToken::Error)
664  return None;
665  auto Range = C;
666  C.advance(Length);
667  Token.reset(Kind, Range.upto(C));
668  return C;
669 }
670 
671 static Cursor maybeLexNewline(Cursor C, MIToken &Token) {
672  if (!isNewlineChar(C.peek()))
673  return None;
674  auto Range = C;
675  C.advance();
676  Token.reset(MIToken::Newline, Range.upto(C));
677  return C;
678 }
679 
680 static Cursor maybeLexEscapedIRValue(Cursor C, MIToken &Token,
681  ErrorCallbackType ErrorCallback) {
682  if (C.peek() != '`')
683  return None;
684  auto Range = C;
685  C.advance();
686  auto StrRange = C;
687  while (C.peek() != '`') {
688  if (C.isEOF() || isNewlineChar(C.peek())) {
689  ErrorCallback(
690  C.location(),
691  "end of machine instruction reached before the closing '`'");
692  Token.reset(MIToken::Error, Range.remaining());
693  return C;
694  }
695  C.advance();
696  }
697  StringRef Value = StrRange.upto(C);
698  C.advance();
699  Token.reset(MIToken::QuotedIRValue, Range.upto(C)).setStringValue(Value);
700  return C;
701 }
702 
704  ErrorCallbackType ErrorCallback) {
705  auto C = skipComment(skipWhitespace(Cursor(Source)));
706  if (C.isEOF()) {
707  Token.reset(MIToken::Eof, C.remaining());
708  return C.remaining();
709  }
710 
712 
713  if (Cursor R = maybeLexMachineBasicBlock(C, Token, ErrorCallback))
714  return R.remaining();
715  if (Cursor R = maybeLexIdentifier(C, Token))
716  return R.remaining();
717  if (Cursor R = maybeLexJumpTableIndex(C, Token))
718  return R.remaining();
719  if (Cursor R = maybeLexStackObject(C, Token))
720  return R.remaining();
721  if (Cursor R = maybeLexFixedStackObject(C, Token))
722  return R.remaining();
723  if (Cursor R = maybeLexConstantPoolItem(C, Token))
724  return R.remaining();
725  if (Cursor R = maybeLexSubRegisterIndex(C, Token, ErrorCallback))
726  return R.remaining();
727  if (Cursor R = maybeLexIRBlock(C, Token, ErrorCallback))
728  return R.remaining();
729  if (Cursor R = maybeLexIRValue(C, Token, ErrorCallback))
730  return R.remaining();
731  if (Cursor R = maybeLexRegister(C, Token, ErrorCallback))
732  return R.remaining();
733  if (Cursor R = maybeLexGlobalValue(C, Token, ErrorCallback))
734  return R.remaining();
735  if (Cursor R = maybeLexExternalSymbol(C, Token, ErrorCallback))
736  return R.remaining();
737  if (Cursor R = maybeLexMCSymbol(C, Token, ErrorCallback))
738  return R.remaining();
739  if (Cursor R = maybeLexHexadecimalLiteral(C, Token))
740  return R.remaining();
741  if (Cursor R = maybeLexNumericalLiteral(C, Token))
742  return R.remaining();
743  if (Cursor R = maybeLexExclaim(C, Token, ErrorCallback))
744  return R.remaining();
745  if (Cursor R = maybeLexSymbol(C, Token))
746  return R.remaining();
747  if (Cursor R = maybeLexNewline(C, Token))
748  return R.remaining();
749  if (Cursor R = maybeLexEscapedIRValue(C, Token, ErrorCallback))
750  return R.remaining();
751  if (Cursor R = maybeLexStringConstant(C, Token, ErrorCallback))
752  return R.remaining();
753 
754  Token.reset(MIToken::Error, C.remaining());
755  ErrorCallback(C.location(),
756  Twine("unexpected character '") + Twine(C.peek()) + "'");
757  return C.remaining();
758 }
llvm::StringSwitch::Case
StringSwitch & Case(StringLiteral S, T Value)
Definition: StringSwitch.h:67
maybeLexGlobalValue
static Cursor maybeLexGlobalValue(Cursor C, MIToken &Token, ErrorCallbackType ErrorCallback)
Definition: MILexer.cpp:465
llvm::MIToken::kw_float
@ kw_float
Definition: MILexer.h:97
lexNamedVirtualRegister
static Cursor lexNamedVirtualRegister(Cursor C, MIToken &Token)
Definition: MILexer.cpp:430
llvm::MIToken::NamedRegister
@ NamedRegister
Definition: MILexer.h:141
llvm::MIToken::kw_cfi_offset
@ kw_cfi_offset
Definition: MILexer.h:79
llvm
Definition: AllocatorList.h:23
maybeLexExclaim
static Cursor maybeLexExclaim(Cursor C, MIToken &Token, ErrorCallbackType ErrorCallback)
Definition: MILexer.cpp:604
lexName
static Cursor lexName(Cursor C, MIToken &Token, MIToken::TokenKind Type, unsigned PrefixLength, ErrorCallbackType ErrorCallback)
Definition: MILexer.cpp:170
maybeLexJumpTableIndex
static Cursor maybeLexJumpTableIndex(Cursor C, MIToken &Token)
Definition: MILexer.cpp:361
llvm::MIToken::kw_exact
@ kw_exact
Definition: MILexer.h:74
llvm::MIToken::kw_unknown_size
@ kw_unknown_size
Definition: MILexer.h:128
llvm::MIToken::colon
@ colon
Definition: MILexer.h:37
llvm::MIToken::FixedStackObject
@ FixedStackObject
Definition: MILexer.h:146
llvm::MIToken::kw_nsz
@ kw_nsz
Definition: MILexer.h:67
llvm::MIToken::GlobalValue
@ GlobalValue
Definition: MILexer.h:148
maybeLexFixedStackObject
static Cursor maybeLexFixedStackObject(Cursor C, MIToken &Token)
Definition: MILexer.cpp:369
llvm::MIToken::VirtualRegister
@ VirtualRegister
Definition: MILexer.h:157
llvm::MIToken::kw_cfi_restore_state
@ kw_cfi_restore_state
Definition: MILexer.h:89
llvm::cl::location
LocationClass< Ty > location(Ty &L)
Definition: CommandLine.h:459
llvm::MIToken::md_noalias
@ md_noalias
Definition: MILexer.h:134
llvm::MIToken::Error
@ Error
Definition: MILexer.h:30
llvm::MIToken::kw_call_entry
@ kw_call_entry
Definition: MILexer.h:113
llvm::StringSwitch::Default
LLVM_NODISCARD R Default(T Value)
Definition: StringSwitch.h:181
skipWhitespace
static Cursor skipWhitespace(Cursor C)
Skip the leading whitespace characters and return the updated cursor.
Definition: MILexer.cpp:87
llvm::MIToken::kw_early_clobber
@ kw_early_clobber
Definition: MILexer.h:59
isNewlineChar
static bool isNewlineChar(char C)
Definition: MILexer.cpp:93
llvm::MIToken::kw_cfi_def_cfa
@ kw_cfi_def_cfa
Definition: MILexer.h:85
lexFloatingPointLiteral
static Cursor lexFloatingPointLiteral(Cursor Range, Cursor C, MIToken &Token)
Definition: MILexer.cpp:541
llvm::MIToken::kw_double
@ kw_double
Definition: MILexer.h:98
getIdentifierKind
static MIToken::TokenKind getIdentifierKind(StringRef Identifier)
Definition: MILexer.cpp:192
llvm::MIToken::kw_post_instr_symbol
@ kw_post_instr_symbol
Definition: MILexer.h:125
llvm::lltok::APSInt
@ APSInt
Definition: LLToken.h:491
llvm::MIToken::kw_afn
@ kw_afn
Definition: MILexer.h:70
llvm::MIToken::NamedGlobalValue
@ NamedGlobalValue
Definition: MILexer.h:147
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:46
llvm::MIToken::kw_renamable
@ kw_renamable
Definition: MILexer.h:61
llvm::MIToken::kw_nofpexcept
@ kw_nofpexcept
Definition: MILexer.h:75
llvm::MIToken::underscore
@ underscore
Definition: MILexer.h:36
llvm::MIToken::kw_frame_destroy
@ kw_frame_destroy
Definition: MILexer.h:64
llvm::MIToken::kw_ninf
@ kw_ninf
Definition: MILexer.h:66
llvm::MIToken::kw_addrspace
@ kw_addrspace
Definition: MILexer.h:108
llvm::MIToken::kw_cfi_register
@ kw_cfi_register
Definition: MILexer.h:86
maybeLexRegister
static Cursor maybeLexRegister(Cursor C, MIToken &Token, ErrorCallbackType ErrorCallback)
Definition: MILexer.cpp:440
llvm::MIToken::kw_internal
@ kw_internal
Definition: MILexer.h:58
llvm::MIToken
A token produced by the machine instruction lexer.
Definition: MILexer.h:26
llvm::RISCVFenceField::R
@ R
Definition: RISCVBaseInfo.h:180
peek
static bool peek(struct InternalInstruction *insn, uint8_t &byte)
Definition: X86Disassembler.cpp:178
llvm::MIToken::kw_cfi_def_cfa_register
@ kw_cfi_def_cfa_register
Definition: MILexer.h:81
llvm::MIToken::kw_killed
@ kw_killed
Definition: MILexer.h:56
llvm::MIToken::NamedIRValue
@ NamedIRValue
Definition: MILexer.h:162
llvm::MIToken::kw_arcp
@ kw_arcp
Definition: MILexer.h:68
llvm::MIToken::kw_debug_use
@ kw_debug_use
Definition: MILexer.h:60
llvm::MIToken::MachineBasicBlockLabel
@ MachineBasicBlockLabel
Definition: MILexer.h:143
maybeLexMachineBasicBlock
static Cursor maybeLexMachineBasicBlock(Cursor C, MIToken &Token, ErrorCallbackType ErrorCallback)
Definition: MILexer.cpp:290
skipMachineOperandComment
static Cursor skipMachineOperandComment(Cursor C)
Machine operands can have comments, enclosed between /* and ‍/.
Definition: MILexer.cpp:106
llvm::MIToken::kw_cfi_remember_state
@ kw_cfi_remember_state
Definition: MILexer.h:87
llvm::MIToken::kw_invariant
@ kw_invariant
Definition: MILexer.h:105
llvm::MIToken::kw_shufflemask
@ kw_shufflemask
Definition: MILexer.h:123
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
Twine.h
llvm::MIToken::equal
@ equal
Definition: MILexer.h:35
llvm::MIToken::kw_cfi_restore
@ kw_cfi_restore
Definition: MILexer.h:88
llvm::MIToken::kw_implicit
@ kw_implicit
Definition: MILexer.h:51
llvm::rust_demangle::BasicType::Str
@ Str
llvm::MIToken::FloatingPointLiteral
@ FloatingPointLiteral
Definition: MILexer.h:154
symbolToken
static MIToken::TokenKind symbolToken(char C)
Definition: MILexer.cpp:624
llvm::MIToken::md_tbaa
@ md_tbaa
Definition: MILexer.h:132
maybeLexIRValue
static Cursor maybeLexIRValue(Cursor C, MIToken &Token, ErrorCallbackType ErrorCallback)
Definition: MILexer.cpp:396
llvm::MIToken::kw_x86_fp80
@ kw_x86_fp80
Definition: MILexer.h:99
llvm::StringRef::iterator
const char * iterator
Definition: StringRef.h:62
llvm::MIToken::kw_cfi_undefined
@ kw_cfi_undefined
Definition: MILexer.h:90
llvm::MIToken::kw_tied_def
@ kw_tied_def
Definition: MILexer.h:62
llvm::MIToken::IRBlock
@ IRBlock
Definition: MILexer.h:161
llvm::APSInt
An arbitrary precision integer that knows its signedness.
Definition: APSInt.h:22
llvm::MIToken::setStringValue
MIToken & setStringValue(StringRef StrVal)
Definition: MILexer.cpp:70
llvm::MIToken::HexLiteral
@ HexLiteral
Definition: MILexer.h:155
llvm::MIToken::kw_cfi_escape
@ kw_cfi_escape
Definition: MILexer.h:84
llvm::MIToken::kw_heap_alloc_marker
@ kw_heap_alloc_marker
Definition: MILexer.h:126
llvm::None
const NoneType None
Definition: None.h:23
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::MIToken::StringConstant
@ StringConstant
Definition: MILexer.h:166
llvm::MIToken::kw_liveout
@ kw_liveout
Definition: MILexer.h:115
llvm::MIToken::kw_reassoc
@ kw_reassoc
Definition: MILexer.h:71
llvm::MIToken::ConstantPoolItem
@ ConstantPoolItem
Definition: MILexer.h:158
llvm::function_ref
An efficient, type-erasing, non-owning reference to a callable.
Definition: STLExtras.h:168
llvm::MIToken::StackObject
@ StackObject
Definition: MILexer.h:145
maybeLexSubRegisterIndex
static Cursor maybeLexSubRegisterIndex(Cursor C, MIToken &Token, ErrorCallbackType ErrorCallback)
Definition: MILexer.cpp:377
llvm::MIToken::kw_dead
@ kw_dead
Definition: MILexer.h:54
llvm::MIToken::kw_cfi_adjust_cfa_offset
@ kw_cfi_adjust_cfa_offset
Definition: MILexer.h:83
llvm::MIToken::kw_cfi_window_save
@ kw_cfi_window_save
Definition: MILexer.h:91
llvm::MIToken::kw_pre_instr_symbol
@ kw_pre_instr_symbol
Definition: MILexer.h:124
maybeLexStringConstant
static Cursor maybeLexStringConstant(Cursor C, MIToken &Token, ErrorCallbackType ErrorCallback)
Definition: MILexer.cpp:406
llvm::NoneType
NoneType
A simple null object to allow implicit construction of Optional<T> and similar types without having t...
Definition: None.h:22
llvm::MIToken::SubRegisterIndex
@ SubRegisterIndex
Definition: MILexer.h:165
llvm::MIToken::kw_nnan
@ kw_nnan
Definition: MILexer.h:65
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::MIToken::kw_target_index
@ kw_target_index
Definition: MILexer.h:95
llvm::MIToken::kw_fp128
@ kw_fp128
Definition: MILexer.h:100
maybeLexConstantPoolItem
static Cursor maybeLexConstantPoolItem(Cursor C, MIToken &Token)
Definition: MILexer.cpp:373
maybeLexEscapedIRValue
static Cursor maybeLexEscapedIRValue(Cursor C, MIToken &Token, ErrorCallbackType ErrorCallback)
Definition: MILexer.cpp:680
I
#define I(x, y, z)
Definition: MD5.cpp:59
StringExtras.h
llvm::MIToken::MachineBasicBlock
@ MachineBasicBlock
Definition: MILexer.h:144
llvm::MIToken::Newline
@ Newline
Definition: MILexer.h:31
llvm::MIToken::lbrace
@ lbrace
Definition: MILexer.h:43
llvm::MIToken::kw_half
@ kw_half
Definition: MILexer.h:96
llvm::MIToken::IRValue
@ IRValue
Definition: MILexer.h:163
isRegisterChar
static bool isRegisterChar(char C)
Returns true for a character allowed in a register name.
Definition: MILexer.cpp:426
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::MIToken::comma
@ comma
Definition: MILexer.h:34
llvm::MIToken::dot
@ dot
Definition: MILexer.h:39
llvm::MIToken::JumpTableIndex
@ JumpTableIndex
Definition: MILexer.h:159
lexVirtualRegister
static Cursor lexVirtualRegister(Cursor C, MIToken &Token)
Definition: MILexer.cpp:414
llvm::MIToken::kw_constant_pool
@ kw_constant_pool
Definition: MILexer.h:112
llvm::MIToken::Eof
@ Eof
Definition: MILexer.h:29
llvm::MIToken::kw_successors
@ kw_successors
Definition: MILexer.h:120
llvm::MIToken::md_dilocation
@ md_dilocation
Definition: MILexer.h:137
llvm::MIToken::kw_frame_setup
@ kw_frame_setup
Definition: MILexer.h:63
llvm::MIToken::kw_debug_location
@ kw_debug_location
Definition: MILexer.h:76
llvm::Sched::Source
@ Source
Definition: TargetLowering.h:99
llvm::MIToken::kw_nsw
@ kw_nsw
Definition: MILexer.h:73
None.h
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::MIToken::md_range
@ md_range
Definition: MILexer.h:135
maybeLexIndex
static Cursor maybeLexIndex(Cursor C, MIToken &Token, StringRef Rule, MIToken::TokenKind Kind)
Definition: MILexer.cpp:325
llvm::MIToken::kw_cfi_aarch64_negate_ra_sign_state
@ kw_cfi_aarch64_negate_ra_sign_state
Definition: MILexer.h:92
unescapeQuotedString
static std::string unescapeQuotedString(StringRef Value)
Unescapes the given string value.
Definition: MILexer.cpp:128
Number
uint32_t Number
Definition: Profile.cpp:47
llvm::MIToken::kw_intrinsic
@ kw_intrinsic
Definition: MILexer.h:94
llvm::MIToken::kw_bbsections
@ kw_bbsections
Definition: MILexer.h:127
llvm::MIToken::kw_implicit_define
@ kw_implicit_define
Definition: MILexer.h:52
llvm::MIToken::kw_ppc_fp128
@ kw_ppc_fp128
Definition: MILexer.h:101
maybeLexMCSymbol
static Cursor maybeLexMCSymbol(Cursor C, MIToken &Token, ErrorCallbackType ErrorCallback)
Definition: MILexer.cpp:490
MILexer.h
llvm::MIToken::kw_dereferenceable
@ kw_dereferenceable
Definition: MILexer.h:55
maybeLexIndexAndName
static Cursor maybeLexIndexAndName(Cursor C, MIToken &Token, StringRef Rule, MIToken::TokenKind Kind)
Definition: MILexer.cpp:338
llvm::MIToken::kw_jump_table
@ kw_jump_table
Definition: MILexer.h:111
skipComment
static Cursor skipComment(Cursor C)
Skip a line comment and return the updated cursor.
Definition: MILexer.cpp:96
llvm::MIToken::kw_non_temporal
@ kw_non_temporal
Definition: MILexer.h:104
llvm::tgtok::StrVal
@ StrVal
Definition: TGLexer.h:71
llvm::MIToken::minus
@ minus
Definition: MILexer.h:46
llvm::MIToken::ExternalSymbol
@ ExternalSymbol
Definition: MILexer.h:149
llvm::MIToken::kw_target_flags
@ kw_target_flags
Definition: MILexer.h:102
llvm::tgtok::IntVal
@ IntVal
Definition: TGLexer.h:64
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:80
llvm::MIToken::NamedIRBlock
@ NamedIRBlock
Definition: MILexer.h:160
llvm::MIToken::kw_floatpred
@ kw_floatpred
Definition: MILexer.h:121
llvm::MIToken::coloncolon
@ coloncolon
Definition: MILexer.h:38
llvm::MIToken::rparen
@ rparen
Definition: MILexer.h:42
llvm::MIToken::setIntegerValue
MIToken & setIntegerValue(APSInt IntVal)
Definition: MILexer.cpp:81
isValidHexFloatingPointPrefix
static bool isValidHexFloatingPointPrefix(char C)
Definition: MILexer.cpp:537
getMetadataKeywordKind
static MIToken::TokenKind getMetadataKeywordKind(StringRef Identifier)
Definition: MILexer.cpp:593
llvm::MIToken::kw_debug_instr_number
@ kw_debug_instr_number
Definition: MILexer.h:77
llvm::MIToken::kw_intpred
@ kw_intpred
Definition: MILexer.h:122
llvm::MIToken::MCSymbol
@ MCSymbol
Definition: MILexer.h:150
llvm::MIToken::greater
@ greater
Definition: MILexer.h:48
llvm::MIToken::exclaim
@ exclaim
Definition: MILexer.h:40
llvm::MIToken::IntegerLiteral
@ IntegerLiteral
Definition: MILexer.h:153
llvm::MIToken::kw_align
@ kw_align
Definition: MILexer.h:106
maybeLexSymbol
static Cursor maybeLexSymbol(Cursor C, MIToken &Token)
Definition: MILexer.cpp:655
StringSwitch.h
llvm::MIToken::TokenKind
TokenKind
Definition: MILexer.h:27
maybeLexNumericalLiteral
static Cursor maybeLexNumericalLiteral(Cursor C, MIToken &Token)
Definition: MILexer.cpp:579
llvm::MIToken::QuotedIRValue
@ QuotedIRValue
Definition: MILexer.h:164
maybeLexHexadecimalLiteral
static Cursor maybeLexHexadecimalLiteral(Cursor C, MIToken &Token)
Definition: MILexer.cpp:557
llvm::MIToken::kw_custom
@ kw_custom
Definition: MILexer.h:114
llvm::MIToken::kw_stack
@ kw_stack
Definition: MILexer.h:109
llvm::MIToken::kw_got
@ kw_got
Definition: MILexer.h:110
llvm::MIToken::location
StringRef::iterator location() const
Definition: MILexer.h:216
maybeLexIRBlock
static Cursor maybeLexIRBlock(Cursor C, MIToken &Token, ErrorCallbackType ErrorCallback)
Definition: MILexer.cpp:386
llvm::MIToken::Identifier
@ Identifier
Definition: MILexer.h:140
maybeLexIdentifier
static Cursor maybeLexIdentifier(Cursor C, MIToken &Token)
Definition: MILexer.cpp:278
maybeLexNewline
static Cursor maybeLexNewline(Cursor C, MIToken &Token)
Definition: MILexer.cpp:671
llvm::MIToken::isError
bool isError() const
Definition: MILexer.h:187
llvm::MIToken::rbrace
@ rbrace
Definition: MILexer.h:44
maybeLexStackObject
static Cursor maybeLexStackObject(Cursor C, MIToken &Token)
Definition: MILexer.cpp:365
llvm::StringSwitch
A switch()-like statement whose cases are string literals.
Definition: StringSwitch.h:42
llvm::MIToken::kw_cfi_def_cfa_offset
@ kw_cfi_def_cfa_offset
Definition: MILexer.h:82
isIdentifierChar
static bool isIdentifierChar(char C)
Return true if the given character satisfies the following regular expression: [-a-zA-Z$....
Definition: MILexer.cpp:120
llvm::MIToken::less
@ less
Definition: MILexer.h:47
llvm::MIToken::kw_volatile
@ kw_volatile
Definition: MILexer.h:103
llvm::MIToken::kw_def
@ kw_def
Definition: MILexer.h:53
llvm::MIToken::kw_landing_pad
@ kw_landing_pad
Definition: MILexer.h:117
llvm::MIToken::reset
MIToken & reset(TokenKind Kind, StringRef Range)
Definition: MILexer.cpp:64
llvm::MIToken::setOwnedStringValue
MIToken & setOwnedStringValue(std::string StrVal)
Definition: MILexer.cpp:75
llvm::MIToken::kw_nuw
@ kw_nuw
Definition: MILexer.h:72
llvm::MIToken::plus
@ plus
Definition: MILexer.h:45
llvm::StringRef::size
LLVM_NODISCARD size_t size() const
size - Get the string size.
Definition: StringRef.h:157
llvm::MIToken::md_alias_scope
@ md_alias_scope
Definition: MILexer.h:133
llvm::MIToken::kw_cfi_same_value
@ kw_cfi_same_value
Definition: MILexer.h:78
llvm::MIToken::NamedVirtualRegister
@ NamedVirtualRegister
Definition: MILexer.h:142
lexStringConstant
static Cursor lexStringConstant(Cursor C, ErrorCallbackType ErrorCallback)
Lex a string constant using the following regular expression: "[^"]*".
Definition: MILexer.cpp:156
llvm::MIToken::kw_ehfunclet_entry
@ kw_ehfunclet_entry
Definition: MILexer.h:118
maybeLexExternalSymbol
static Cursor maybeLexExternalSymbol(Cursor C, MIToken &Token, ErrorCallbackType ErrorCallback)
Definition: MILexer.cpp:482
llvm::MIToken::kw_liveins
@ kw_liveins
Definition: MILexer.h:119
llvm::MIToken::kw_contract
@ kw_contract
Definition: MILexer.h:69
llvm::lexMIToken
StringRef lexMIToken(StringRef Source, MIToken &Token, function_ref< void(StringRef::iterator, const Twine &)> ErrorCallback)
Consume a single machine instruction token in the given source and return the remaining source string...
llvm::MIToken::kw_cfi_rel_offset
@ kw_cfi_rel_offset
Definition: MILexer.h:80
llvm::MIToken::md_diexpr
@ md_diexpr
Definition: MILexer.h:136
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
llvm::MIToken::lparen
@ lparen
Definition: MILexer.h:41
llvm::MIToken::kw_address_taken
@ kw_address_taken
Definition: MILexer.h:116
llvm::MIToken::kw_undef
@ kw_undef
Definition: MILexer.h:57
llvm::MIToken::kw_blockaddress
@ kw_blockaddress
Definition: MILexer.h:93
llvm::MIToken::kw_unknown_address
@ kw_unknown_address
Definition: MILexer.h:129