LLVM  14.0.0git
CSKYAsmParser.cpp
Go to the documentation of this file.
1 //===-- CSKYAsmParser.cpp - Parse CSKY assembly to MCInst instructions --===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
13 #include "llvm/ADT/STLExtras.h"
14 #include "llvm/ADT/StringSwitch.h"
15 #include "llvm/CodeGen/Register.h"
16 #include "llvm/MC/MCContext.h"
17 #include "llvm/MC/MCExpr.h"
18 #include "llvm/MC/MCInst.h"
22 #include "llvm/MC/MCRegisterInfo.h"
23 #include "llvm/MC/MCStreamer.h"
25 #include "llvm/Support/Casting.h"
27 
28 using namespace llvm;
29 
30 namespace {
31 struct CSKYOperand;
32 
33 class CSKYAsmParser : public MCTargetAsmParser {
34 
35  bool generateImmOutOfRangeError(OperandVector &Operands, uint64_t ErrorInfo,
36  int64_t Lower, int64_t Upper, Twine Msg);
37 
38  SMLoc getLoc() const { return getParser().getTok().getLoc(); }
39 
40  bool MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
42  uint64_t &ErrorInfo,
43  bool MatchingInlineAsm) override;
44 
45  bool ParseRegister(unsigned &RegNo, SMLoc &StartLoc, SMLoc &EndLoc) override;
46 
47  bool ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
48  SMLoc NameLoc, OperandVector &Operands) override;
49 
50  bool ParseDirective(AsmToken DirectiveID) override;
51 
52  OperandMatchResultTy tryParseRegister(unsigned &RegNo, SMLoc &StartLoc,
53  SMLoc &EndLoc) override;
54 
55 // Auto-generated instruction matching functions
56 #define GET_ASSEMBLER_HEADER
57 #include "CSKYGenAsmMatcher.inc"
58 
63  OperandMatchResultTy parseConstpoolSymbol(OperandVector &Operands);
64 
65  bool parseOperand(OperandVector &Operands, StringRef Mnemonic);
66 
67 public:
68  enum CSKYMatchResultTy {
69  Match_Dummy = FIRST_TARGET_MATCH_RESULT_TY,
70 #define GET_OPERAND_DIAGNOSTIC_TYPES
71 #include "CSKYGenAsmMatcher.inc"
72 #undef GET_OPERAND_DIAGNOSTIC_TYPES
73  };
74 
75  CSKYAsmParser(const MCSubtargetInfo &STI, MCAsmParser &Parser,
76  const MCInstrInfo &MII, const MCTargetOptions &Options)
77  : MCTargetAsmParser(Options, STI, MII) {
78  setAvailableFeatures(ComputeAvailableFeatures(STI.getFeatureBits()));
79  }
80 };
81 
82 /// Instances of this class represent a parsed machine instruction.
83 struct CSKYOperand : public MCParsedAsmOperand {
84  enum KindTy {
85  Token,
86  Register,
87  Immediate,
88  } Kind;
89 
90  struct RegOp {
91  unsigned RegNum;
92  };
93 
94  struct ImmOp {
95  const MCExpr *Val;
96  };
97 
98  SMLoc StartLoc, EndLoc;
99  union {
100  StringRef Tok;
101  RegOp Reg;
102  ImmOp Imm;
103  };
104 
105  CSKYOperand(KindTy K) : MCParsedAsmOperand(), Kind(K) {}
106 
107 public:
108  CSKYOperand(const CSKYOperand &o) : MCParsedAsmOperand() {
109  Kind = o.Kind;
110  StartLoc = o.StartLoc;
111  EndLoc = o.EndLoc;
112  switch (Kind) {
113  case Register:
114  Reg = o.Reg;
115  break;
116  case Immediate:
117  Imm = o.Imm;
118  break;
119  case Token:
120  Tok = o.Tok;
121  break;
122  }
123  }
124 
125  bool isToken() const override { return Kind == Token; }
126  bool isReg() const override { return Kind == Register; }
127  bool isImm() const override { return Kind == Immediate; }
128  bool isMem() const override { return false; }
129 
130  static bool evaluateConstantImm(const MCExpr *Expr, int64_t &Imm) {
131  if (auto CE = dyn_cast<MCConstantExpr>(Expr)) {
132  Imm = CE->getValue();
133  return true;
134  }
135 
136  return false;
137  }
138 
139  template <unsigned num, unsigned shift = 0> bool isUImm() const {
140  if (!isImm())
141  return false;
142 
143  int64_t Imm;
144  bool IsConstantImm = evaluateConstantImm(getImm(), Imm);
145  return IsConstantImm && isShiftedUInt<num, shift>(Imm);
146  }
147 
148  template <unsigned num> bool isOImm() const {
149  if (!isImm())
150  return false;
151 
152  int64_t Imm;
153  bool IsConstantImm = evaluateConstantImm(getImm(), Imm);
154  return IsConstantImm && isUInt<num>(Imm - 1);
155  }
156 
157  template <unsigned num, unsigned shift = 0> bool isSImm() const {
158  if (!isImm())
159  return false;
160 
161  int64_t Imm;
162  bool IsConstantImm = evaluateConstantImm(getImm(), Imm);
163  return IsConstantImm && isShiftedInt<num, shift>(Imm);
164  }
165 
166  bool isUImm2() const { return isUImm<2>(); }
167  bool isUImm5() const { return isUImm<5>(); }
168  bool isUImm12() const { return isUImm<12>(); }
169  bool isUImm16() const { return isUImm<16>(); }
170 
171  bool isOImm12() const { return isOImm<12>(); }
172  bool isOImm16() const { return isOImm<16>(); }
173 
174  bool isUImm12Shift1() { return isUImm<12, 1>(); }
175  bool isUImm12Shift2() { return isUImm<12, 2>(); }
176 
177  bool isSImm16Shift1() { return isSImm<16, 1>(); }
178 
179  bool isCSKYSymbol() const {
180  int64_t Imm;
181  // Must be of 'immediate' type but not a constant.
182  return isImm() && !evaluateConstantImm(getImm(), Imm);
183  }
184 
185  bool isConstpoolSymbol() const {
186  int64_t Imm;
187  // Must be of 'immediate' type but not a constant.
188  return isImm() && !evaluateConstantImm(getImm(), Imm);
189  }
190 
191  /// Gets location of the first token of this operand.
192  SMLoc getStartLoc() const override { return StartLoc; }
193  /// Gets location of the last token of this operand.
194  SMLoc getEndLoc() const override { return EndLoc; }
195 
196  unsigned getReg() const override {
197  assert(Kind == Register && "Invalid type access!");
198  return Reg.RegNum;
199  }
200 
201  const MCExpr *getImm() const {
202  assert(Kind == Immediate && "Invalid type access!");
203  return Imm.Val;
204  }
205 
206  StringRef getToken() const {
207  assert(Kind == Token && "Invalid type access!");
208  return Tok;
209  }
210 
211  void print(raw_ostream &OS) const override {
212  switch (Kind) {
213  case Immediate:
214  OS << *getImm();
215  break;
216  case Register:
217  OS << "<register x" << getReg() << ">";
218  break;
219  case Token:
220  OS << "'" << getToken() << "'";
221  break;
222  }
223  }
224 
225  static std::unique_ptr<CSKYOperand> createToken(StringRef Str, SMLoc S) {
226  auto Op = std::make_unique<CSKYOperand>(Token);
227  Op->Tok = Str;
228  Op->StartLoc = S;
229  Op->EndLoc = S;
230  return Op;
231  }
232 
233  static std::unique_ptr<CSKYOperand> createReg(unsigned RegNo, SMLoc S,
234  SMLoc E) {
235  auto Op = std::make_unique<CSKYOperand>(Register);
236  Op->Reg.RegNum = RegNo;
237  Op->StartLoc = S;
238  Op->EndLoc = E;
239  return Op;
240  }
241 
242  static std::unique_ptr<CSKYOperand> createImm(const MCExpr *Val, SMLoc S,
243  SMLoc E) {
244  auto Op = std::make_unique<CSKYOperand>(Immediate);
245  Op->Imm.Val = Val;
246  Op->StartLoc = S;
247  Op->EndLoc = E;
248  return Op;
249  }
250 
251  void addExpr(MCInst &Inst, const MCExpr *Expr) const {
252  assert(Expr && "Expr shouldn't be null!");
253  if (auto *CE = dyn_cast<MCConstantExpr>(Expr))
254  Inst.addOperand(MCOperand::createImm(CE->getValue()));
255  else
256  Inst.addOperand(MCOperand::createExpr(Expr));
257  }
258 
259  // Used by the TableGen Code.
260  void addRegOperands(MCInst &Inst, unsigned N) const {
261  assert(N == 1 && "Invalid number of operands!");
263  }
264 
265  void addImmOperands(MCInst &Inst, unsigned N) const {
266  assert(N == 1 && "Invalid number of operands!");
267  addExpr(Inst, getImm());
268  }
269 };
270 } // end anonymous namespace.
271 
272 #define GET_REGISTER_MATCHER
273 #define GET_SUBTARGET_FEATURE_NAME
274 #define GET_MATCHER_IMPLEMENTATION
275 #define GET_MNEMONIC_SPELL_CHECKER
276 #include "CSKYGenAsmMatcher.inc"
277 
278 static std::string CSKYMnemonicSpellCheck(StringRef S, const FeatureBitset &FBS,
279  unsigned VariantID = 0);
280 
281 bool CSKYAsmParser::generateImmOutOfRangeError(
282  OperandVector &Operands, uint64_t ErrorInfo, int64_t Lower, int64_t Upper,
283  Twine Msg = "immediate must be an integer in the range") {
284  SMLoc ErrorLoc = ((CSKYOperand &)*Operands[ErrorInfo]).getStartLoc();
285  return Error(ErrorLoc, Msg + " [" + Twine(Lower) + ", " + Twine(Upper) + "]");
286 }
287 
288 bool CSKYAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
290  MCStreamer &Out,
291  uint64_t &ErrorInfo,
292  bool MatchingInlineAsm) {
293  MCInst Inst;
294  FeatureBitset MissingFeatures;
295 
296  auto Result = MatchInstructionImpl(Operands, Inst, ErrorInfo, MissingFeatures,
297  MatchingInlineAsm);
298  switch (Result) {
299  default:
300  break;
301  case Match_Success:
302  Inst.setLoc(IDLoc);
303  Out.emitInstruction(Inst, getSTI());
304  return false;
305  case Match_MissingFeature: {
306  assert(MissingFeatures.any() && "Unknown missing features!");
307  ListSeparator LS;
308  std::string Msg = "instruction requires the following: ";
309  for (unsigned i = 0, e = MissingFeatures.size(); i != e; ++i) {
310  if (MissingFeatures[i]) {
311  Msg += LS;
312  Msg += getSubtargetFeatureName(i);
313  }
314  }
315  return Error(IDLoc, Msg);
316  }
317  case Match_MnemonicFail: {
318  FeatureBitset FBS = ComputeAvailableFeatures(getSTI().getFeatureBits());
319  std::string Suggestion =
320  CSKYMnemonicSpellCheck(((CSKYOperand &)*Operands[0]).getToken(), FBS);
321  return Error(IDLoc, "unrecognized instruction mnemonic" + Suggestion);
322  }
323  case Match_InvalidTiedOperand:
324  case Match_InvalidOperand: {
325  SMLoc ErrorLoc = IDLoc;
326  if (ErrorInfo != ~0U) {
327  if (ErrorInfo >= Operands.size())
328  return Error(ErrorLoc, "too few operands for instruction");
329 
330  ErrorLoc = ((CSKYOperand &)*Operands[ErrorInfo]).getStartLoc();
331  if (ErrorLoc == SMLoc())
332  ErrorLoc = IDLoc;
333  }
334  return Error(ErrorLoc, "invalid operand for instruction");
335  }
336  }
337 
338  // Handle the case when the error message is of specific type
339  // other than the generic Match_InvalidOperand, and the
340  // corresponding operand is missing.
341  if (Result > FIRST_TARGET_MATCH_RESULT_TY) {
342  SMLoc ErrorLoc = IDLoc;
343  if (ErrorInfo != ~0U && ErrorInfo >= Operands.size())
344  return Error(ErrorLoc, "too few operands for instruction");
345  }
346 
347  switch (Result) {
348  default:
349  break;
350  case Match_InvalidOImm12:
351  return generateImmOutOfRangeError(Operands, ErrorInfo, 1, (1 << 12));
352  case Match_InvalidOImm16:
353  return generateImmOutOfRangeError(Operands, ErrorInfo, 1, (1 << 16));
354  case Match_InvalidUImm2:
355  return generateImmOutOfRangeError(Operands, ErrorInfo, 0, (1 << 2) - 1);
356  case Match_InvalidUImm5:
357  return generateImmOutOfRangeError(Operands, ErrorInfo, 0, (1 << 5) - 1);
358  case Match_InvalidUImm12:
359  return generateImmOutOfRangeError(Operands, ErrorInfo, 0, (1 << 12) - 1);
360  case Match_InvalidUImm12Shift1:
361  return generateImmOutOfRangeError(
362  Operands, ErrorInfo, 0, (1 << 12) - 2,
363  "immediate must be a multiple of 2 bytes in the range");
364  case Match_InvalidUImm12Shift2:
365  return generateImmOutOfRangeError(
366  Operands, ErrorInfo, 0, (1 << 12) - 4,
367  "immediate must be a multiple of 4 bytes in the range");
368  case Match_InvalidUImm16:
369  return generateImmOutOfRangeError(Operands, ErrorInfo, 0, (1 << 16) - 1);
370  case Match_InvalidCSKYSymbol: {
371  SMLoc ErrorLoc = ((CSKYOperand &)*Operands[ErrorInfo]).getStartLoc();
372  return Error(ErrorLoc, "operand must be a symbol name");
373  }
374  case Match_InvalidConstpool: {
375  SMLoc ErrorLoc = ((CSKYOperand &)*Operands[ErrorInfo]).getStartLoc();
376  return Error(ErrorLoc, "operand must be a constpool symbol name");
377  }
378  }
379 
380  llvm_unreachable("Unknown match type detected!");
381 }
382 
383 // Attempts to match Name as a register (either using the default name or
384 // alternative ABI names), setting RegNo to the matching register. Upon
385 // failure, returns true and sets RegNo to 0.
387  RegNo = MatchRegisterName(Name);
388 
389  if (RegNo == CSKY::NoRegister)
390  RegNo = MatchRegisterAltName(Name);
391 
392  return RegNo == CSKY::NoRegister;
393 }
394 
395 bool CSKYAsmParser::ParseRegister(unsigned &RegNo, SMLoc &StartLoc,
396  SMLoc &EndLoc) {
397  const AsmToken &Tok = getParser().getTok();
398  StartLoc = Tok.getLoc();
399  EndLoc = Tok.getEndLoc();
400  StringRef Name = getLexer().getTok().getIdentifier();
401 
402  if (!matchRegisterNameHelper((MCRegister &)RegNo, Name)) {
403  getParser().Lex(); // Eat identifier token.
404  return false;
405  }
406 
407  return Error(StartLoc, "invalid register name");
408 }
409 
410 OperandMatchResultTy CSKYAsmParser::parseRegister(OperandVector &Operands) {
411  SMLoc S = getLoc();
412  SMLoc E = SMLoc::getFromPointer(S.getPointer() - 1);
413 
414  switch (getLexer().getKind()) {
415  default:
416  return MatchOperand_NoMatch;
417  case AsmToken::Identifier: {
418  StringRef Name = getLexer().getTok().getIdentifier();
419  MCRegister RegNo;
420 
421  if (matchRegisterNameHelper((MCRegister &)RegNo, Name))
422  return MatchOperand_NoMatch;
423 
424  getLexer().Lex();
425  Operands.push_back(CSKYOperand::createReg(RegNo, S, E));
426 
427  return MatchOperand_Success;
428  }
429  }
430 }
431 
432 OperandMatchResultTy CSKYAsmParser::parseBaseRegImm(OperandVector &Operands) {
433  assert(getLexer().is(AsmToken::LParen));
434 
435  Operands.push_back(CSKYOperand::createToken("(", getLoc()));
436 
437  auto Tok = getParser().Lex(); // Eat '('
438 
439  if (parseRegister(Operands) != MatchOperand_Success) {
440  getLexer().UnLex(Tok);
441  Operands.pop_back();
442  return MatchOperand_ParseFail;
443  }
444 
445  if (getLexer().isNot(AsmToken::Comma)) {
446  Error(getLoc(), "expected ','");
447  return MatchOperand_ParseFail;
448  }
449 
450  getParser().Lex(); // Eat ','
451 
452  if (parseRegister(Operands) == MatchOperand_Success) {
453  if (getLexer().isNot(AsmToken::LessLess)) {
454  Error(getLoc(), "expected '<<'");
455  return MatchOperand_ParseFail;
456  }
457 
458  Operands.push_back(CSKYOperand::createToken("<<", getLoc()));
459 
460  getParser().Lex(); // Eat '<<'
461 
463  Error(getLoc(), "expected imm");
464  return MatchOperand_ParseFail;
465  }
466 
468  Error(getLoc(), "expected imm");
469  return MatchOperand_ParseFail;
470  }
471 
472  if (getLexer().isNot(AsmToken::RParen)) {
473  Error(getLoc(), "expected ')'");
474  return MatchOperand_ParseFail;
475  }
476 
477  Operands.push_back(CSKYOperand::createToken(")", getLoc()));
478 
479  getParser().Lex(); // Eat ')'
480 
481  return MatchOperand_Success;
482 }
483 
485  switch (getLexer().getKind()) {
486  default:
487  return MatchOperand_NoMatch;
488  case AsmToken::LParen:
489  case AsmToken::Minus:
490  case AsmToken::Plus:
491  case AsmToken::Integer:
492  case AsmToken::String:
493  break;
494  }
495 
496  const MCExpr *IdVal;
497  SMLoc S = getLoc();
498  if (getParser().parseExpression(IdVal))
499  return MatchOperand_ParseFail;
500 
501  SMLoc E = SMLoc::getFromPointer(S.getPointer() - 1);
502  Operands.push_back(CSKYOperand::createImm(IdVal, S, E));
503  return MatchOperand_Success;
504 }
505 
506 /// Looks at a token type and creates the relevant operand from this
507 /// information, adding to Operands. If operand was parsed, returns false, else
508 /// true.
509 bool CSKYAsmParser::parseOperand(OperandVector &Operands, StringRef Mnemonic) {
510  // Check if the current operand has a custom associated parser, if so, try to
511  // custom parse the operand, or fallback to the general approach.
513  MatchOperandParserImpl(Operands, Mnemonic, /*ParseForAllFeatures=*/true);
514  if (Result == MatchOperand_Success)
515  return false;
516  if (Result == MatchOperand_ParseFail)
517  return true;
518 
519  // Attempt to parse token as register
520  if (parseRegister(Operands) == MatchOperand_Success)
521  return false;
522 
523  // Attempt to parse token as (register, imm)
524  if (getLexer().is(AsmToken::LParen))
525  if (parseBaseRegImm(Operands) == MatchOperand_Success)
526  return false;
527 
528  // Attempt to parse token as a imm.
530  return false;
531 
532  // Finally we have exhausted all options and must declare defeat.
533  Error(getLoc(), "unknown operand");
534  return true;
535 }
536 
537 OperandMatchResultTy CSKYAsmParser::parseCSKYSymbol(OperandVector &Operands) {
538  SMLoc S = getLoc();
539  SMLoc E = SMLoc::getFromPointer(S.getPointer() - 1);
540 
541  if (getLexer().getKind() != AsmToken::Identifier)
542  return MatchOperand_NoMatch;
543 
545  if (getParser().parseIdentifier(Identifier))
546  return MatchOperand_ParseFail;
547 
549 
550  if (Identifier.consume_back("@GOT"))
552  else if (Identifier.consume_back("@GOTOFF"))
554  else if (Identifier.consume_back("@PLT"))
556  else if (Identifier.consume_back("@GOTPC"))
558 
559  MCSymbol *Sym = getContext().getOrCreateSymbol(Identifier);
560  const MCExpr *Res =
562 
564  Res = CSKYMCExpr::create(Res, Kind, getContext());
565 
566  Operands.push_back(CSKYOperand::createImm(Res, S, E));
567  return MatchOperand_Success;
568 }
569 
571 CSKYAsmParser::parseConstpoolSymbol(OperandVector &Operands) {
572  SMLoc S = getLoc();
573  SMLoc E = SMLoc::getFromPointer(S.getPointer() - 1);
574 
575  if (getLexer().getKind() != AsmToken::LBrac)
576  return MatchOperand_NoMatch;
577 
578  getLexer().Lex(); // Eat '['.
579 
580  if (getLexer().getKind() != AsmToken::Identifier)
581  return MatchOperand_NoMatch;
582 
584  if (getParser().parseIdentifier(Identifier))
585  return MatchOperand_ParseFail;
586 
587  if (getLexer().getKind() != AsmToken::RBrac)
588  return MatchOperand_NoMatch;
589 
590  getLexer().Lex(); // Eat ']'.
591 
592  MCSymbol *Sym = getContext().getOrCreateSymbol(Identifier);
593  const MCExpr *Res =
595  Operands.push_back(CSKYOperand::createImm(Res, S, E));
596  return MatchOperand_Success;
597 }
598 
599 bool CSKYAsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
600  SMLoc NameLoc, OperandVector &Operands) {
601  // First operand is token for instruction.
602  Operands.push_back(CSKYOperand::createToken(Name, NameLoc));
603 
604  // If there are no more operands, then finish.
605  if (getLexer().is(AsmToken::EndOfStatement))
606  return false;
607 
608  // Parse first operand.
609  if (parseOperand(Operands, Name))
610  return true;
611 
612  // Parse until end of statement, consuming commas between operands.
613  while (getLexer().is(AsmToken::Comma)) {
614  // Consume comma token.
615  getLexer().Lex();
616 
617  // Parse next operand.
618  if (parseOperand(Operands, Name))
619  return true;
620  }
621 
622  if (getLexer().isNot(AsmToken::EndOfStatement)) {
623  SMLoc Loc = getLexer().getLoc();
624  getParser().eatToEndOfStatement();
625  return Error(Loc, "unexpected token");
626  }
627 
628  getParser().Lex(); // Consume the EndOfStatement.
629  return false;
630 }
631 
632 OperandMatchResultTy CSKYAsmParser::tryParseRegister(unsigned &RegNo,
633  SMLoc &StartLoc,
634  SMLoc &EndLoc) {
635  const AsmToken &Tok = getParser().getTok();
636  StartLoc = Tok.getLoc();
637  EndLoc = Tok.getEndLoc();
638 
639  StringRef Name = getLexer().getTok().getIdentifier();
640 
641  if (matchRegisterNameHelper((MCRegister &)RegNo, Name))
642  return MatchOperand_NoMatch;
643 
644  getParser().Lex(); // Eat identifier token.
645  return MatchOperand_Success;
646 }
647 
648 bool CSKYAsmParser::ParseDirective(AsmToken DirectiveID) { return true; }
649 
652 }
i
i
Definition: README.txt:29
llvm::CSKYMCExpr::VK_CSKY_GOTOFF
@ VK_CSKY_GOTOFF
Definition: CSKYMCExpr.h:25
llvm::MCAsmParser
Generic assembler parser interface, for use by target specific assembly parsers.
Definition: MCAsmParser.h:124
is
should just be implemented with a CLZ instruction Since there are other e that share this it would be best to implement this in a target independent as zero is the default value for the binary encoder e add r0 add r5 Register operands should be distinct That is
Definition: README.txt:725
matchRegisterNameHelper
static bool matchRegisterNameHelper(MCRegister &RegNo, StringRef Name)
Definition: CSKYAsmParser.cpp:386
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
Reg
unsigned Reg
Definition: MachineSink.cpp:1566
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
llvm::CSKYMCExpr::VK_CSKY_GOTPC
@ VK_CSKY_GOTPC
Definition: CSKYMCExpr.h:24
llvm::MCOperand::createExpr
static MCOperand createExpr(const MCExpr *Val)
Definition: MCInst.h:162
print
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
Definition: ArchiveWriter.cpp:147
llvm::MCParsedAsmOperand
MCParsedAsmOperand - This abstract class represents a source-level assembly instruction operand.
Definition: MCParsedAsmOperand.h:24
llvm::MCOperand::createImm
static MCOperand createImm(int64_t Val)
Definition: MCInst.h:141
llvm::AsmToken::LBrac
@ LBrac
Definition: MCAsmMacro.h:48
llvm::AsmToken::EndOfStatement
@ EndOfStatement
Definition: MCAsmMacro.h:42
MCParsedAsmOperand.h
llvm::AsmToken::Integer
@ Integer
Definition: MCAsmMacro.h:32
llvm::FeatureBitset
Container class for subtarget features.
Definition: SubtargetFeature.h:40
llvm::CSKYMCExpr::create
static const CSKYMCExpr * create(const MCExpr *Expr, VariantKind Kind, MCContext &Ctx)
Definition: CSKYMCExpr.cpp:20
STLExtras.h
llvm::CSKYMCExpr::VK_CSKY_GOT
@ VK_CSKY_GOT
Definition: CSKYMCExpr.h:23
llvm::MCInst
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
MCTargetAsmParser.h
llvm::CSKYMCExpr::VK_CSKY_None
@ VK_CSKY_None
Definition: CSKYMCExpr.h:20
llvm::AsmToken
Target independent representation for an assembler token.
Definition: MCAsmMacro.h:21
llvm::getTheCSKYTarget
Target & getTheCSKYTarget()
Definition: CSKYTargetInfo.cpp:13
llvm::AsmToken::Minus
@ Minus
Definition: MCAsmMacro.h:45
llvm::AsmToken::LParen
@ LParen
Definition: MCAsmMacro.h:48
llvm::MCStreamer
Streaming machine code generation interface.
Definition: MCStreamer.h:197
llvm::RegisterMCAsmParser
RegisterMCAsmParser - Helper template for registering a target specific assembly parser,...
Definition: TargetRegistry.h:1317
llvm::MatchOperand_Success
@ MatchOperand_Success
Definition: MCTargetAsmParser.h:122
llvm::SMLoc
Represents a location in source code.
Definition: SMLoc.h:23
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
MatchRegisterAltName
static unsigned MatchRegisterAltName(StringRef Name)
Maps from the set of all alternative registernames to a register number.
MCContext.h
llvm::ms_demangle::QualifierMangleMode::Result
@ Result
MCInst.h
MCSubtargetInfo.h
llvm::MCSubtargetInfo::getFeatureBits
const FeatureBitset & getFeatureBits() const
Definition: MCSubtargetInfo.h:111
Options
const char LLVMTargetMachineRef LLVMPassBuilderOptionsRef Options
Definition: PassBuilderBindings.cpp:48
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
getSubtargetFeatureName
static const char * getSubtargetFeatureName(uint64_t Val)
Info
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
llvm::CSKYMCExpr::VK_CSKY_PLT
@ VK_CSKY_PLT
Definition: CSKYMCExpr.h:26
isNot
static bool isNot(const MachineRegisterInfo &MRI, const MachineInstr &MI)
Definition: AMDGPULegalizerInfo.cpp:2748
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
X
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
llvm::MCInst::addOperand
void addOperand(const MCOperand Op)
Definition: MCInst.h:210
Operands
mir Rename Register Operands
Definition: MIRNamerPass.cpp:78
MCAsmLexer.h
llvm::ParseInstructionInfo
Definition: MCTargetAsmParser.h:113
LLVM_EXTERNAL_VISIBILITY
#define LLVM_EXTERNAL_VISIBILITY
Definition: Compiler.h:132
llvm::numbers::e
constexpr double e
Definition: MathExtras.h:57
llvm::MCStreamer::emitInstruction
virtual void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI)
Emit the given Instruction into the current section.
Definition: MCStreamer.cpp:1085
llvm::MatchOperand_ParseFail
@ MatchOperand_ParseFail
Definition: MCTargetAsmParser.h:124
MCRegisterInfo.h
llvm::CSKYMCExpr::VariantKind
VariantKind
Definition: CSKYMCExpr.h:19
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
CSKYMCTargetDesc.h
llvm::FeatureBitset::size
constexpr size_t size() const
Definition: SubtargetFeature.h:92
CSKYMnemonicSpellCheck
static std::string CSKYMnemonicSpellCheck(StringRef S, const FeatureBitset &FBS, unsigned VariantID=0)
llvm::WinEH::EncodingType::CE
@ CE
Windows NT (Windows on ARM)
MatchRegisterName
static unsigned MatchRegisterName(StringRef Name)
llvm::ErrorInfo
Base class for user error types.
Definition: Error.h:349
llvm::MCTargetOptions
Definition: MCTargetOptions.h:36
isReg
static bool isReg(const MCInst &MI, unsigned OpNo)
Definition: MipsInstPrinter.cpp:31
llvm::AsmToken::Comma
@ Comma
Definition: MCAsmMacro.h:49
LLVMInitializeCSKYAsmParser
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeCSKYAsmParser()
Definition: CSKYAsmParser.cpp:650
llvm::MatchOperand_NoMatch
@ MatchOperand_NoMatch
Definition: MCTargetAsmParser.h:123
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::AsmToken::Plus
@ Plus
Definition: MCAsmMacro.h:45
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:136
llvm::MCOperand::createReg
static MCOperand createReg(unsigned Reg)
Definition: MCInst.h:134
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::AsmToken::RParen
@ RParen
Definition: MCAsmMacro.h:48
llvm::AsmToken::LessLess
@ LessLess
Definition: MCAsmMacro.h:53
llvm::Register
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
llvm::OperandMatchResultTy
OperandMatchResultTy
Definition: MCTargetAsmParser.h:121
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:83
llvm::MCInstrInfo
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:25
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
llvm::MCInst::setLoc
void setLoc(SMLoc loc)
Definition: MCInst.h:203
llvm::AsmToken::Identifier
@ Identifier
Definition: MCAsmMacro.h:28
llvm::AMDGPU::SendMsg::Op
Op
Definition: SIDefines.h:314
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
llvm::AArch64CC::LS
@ LS
Definition: AArch64BaseInfo.h:264
Casting.h
llvm::AsmToken::RBrac
@ RBrac
Definition: MCAsmMacro.h:48
llvm::MCTargetAsmParser
MCTargetAsmParser - Generic interface to target specific assembly parsers.
Definition: MCTargetAsmParser.h:309
parseImmediate
bool parseImmediate(MCInst &MI, uint64_t &Size, ArrayRef< uint8_t > Bytes)
Definition: WebAssemblyDisassembler.cpp:109
llvm::object::Identifier
@ Identifier
Definition: COFFModuleDefinition.cpp:36
llvm::MCSymbolRefExpr::create
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
Definition: MCExpr.h:384
StringSwitch.h
CSKYMCExpr.h
N
#define N
MCStreamer.h
llvm::isMem
static bool isMem(const MachineInstr &MI, unsigned Op)
Definition: X86InstrInfo.h:123
CSKYTargetInfo.h
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:43
llvm::SMLoc::getFromPointer
static SMLoc getFromPointer(const char *Ptr)
Definition: SMLoc.h:36
Register.h
llvm::MCSymbolRefExpr::VK_None
@ VK_None
Definition: MCExpr.h:195
llvm::AsmToken::String
@ String
Definition: MCAsmMacro.h:29
llvm::AsmToken::getLoc
SMLoc getLoc() const
Definition: MCAsmLexer.cpp:27
llvm::AsmToken::getEndLoc
SMLoc getEndLoc() const
Definition: MCAsmLexer.cpp:31
TargetRegistry.h
MCExpr.h
llvm::MCSubtargetInfo
Generic base class for all target subtargets.
Definition: MCSubtargetInfo.h:75
llvm::FeatureBitset::any
bool any() const
Definition: SubtargetFeature.h:94
llvm::MCExpr
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
getReg
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
Definition: MipsDisassembler.cpp:580
llvm::MCRegister
Wrapper class representing physical registers. Should be passed by value.
Definition: MCRegister.h:23