LLVM  14.0.0git
MCAsmParser.h
Go to the documentation of this file.
1 //===- llvm/MC/MCAsmParser.h - Abstract Asm Parser Interface ----*- C++ -*-===//
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 #ifndef LLVM_MC_MCPARSER_MCASMPARSER_H
10 #define LLVM_MC_MCPARSER_MCASMPARSER_H
11 
12 #include "llvm/ADT/None.h"
13 #include "llvm/ADT/STLExtras.h"
14 #include "llvm/ADT/SmallString.h"
15 #include "llvm/ADT/SmallVector.h"
16 #include "llvm/ADT/StringRef.h"
17 #include "llvm/ADT/Twine.h"
19 #include "llvm/Support/SMLoc.h"
20 #include <cstdint>
21 #include <ctime>
22 #include <string>
23 #include <utility>
24 
25 namespace llvm {
26 
27 class MCAsmInfo;
28 class MCAsmParserExtension;
29 class MCContext;
30 class MCExpr;
31 class MCInstPrinter;
32 class MCInstrInfo;
33 class MCStreamer;
34 class MCTargetAsmParser;
35 class SourceMgr;
36 
38  enum IdKind {
39  IK_Invalid, // Initial state. Unexpected after a successful parsing.
40  IK_Label, // Function/Label reference.
41  IK_EnumVal, // Value of enumeration type.
42  IK_Var // Variable.
43  };
44  // Represents an Enum value
45  struct EnumIdentifier {
46  int64_t EnumVal;
47  };
48  // Represents a label/function reference
49  struct LabelIdentifier {
50  void *Decl;
51  };
52  // Represents a variable
54  void *Decl;
55  bool IsGlobalLV;
56  unsigned Length;
57  unsigned Size;
58  unsigned Type;
59  };
60  // An InlineAsm identifier can only be one of those
61  union {
65  };
66  bool isKind(IdKind kind) const { return Kind == kind; }
67  // Initializers
68  void setEnum(int64_t enumVal) {
69  assert(isKind(IK_Invalid) && "should be initialized only once");
70  Kind = IK_EnumVal;
71  Enum.EnumVal = enumVal;
72  }
73  void setLabel(void *decl) {
74  assert(isKind(IK_Invalid) && "should be initialized only once");
75  Kind = IK_Label;
76  Label.Decl = decl;
77  }
78  void setVar(void *decl, bool isGlobalLV, unsigned size, unsigned type) {
79  assert(isKind(IK_Invalid) && "should be initialized only once");
80  Kind = IK_Var;
81  Var.Decl = decl;
82  Var.IsGlobalLV = isGlobalLV;
83  Var.Size = size;
84  Var.Type = type;
85  Var.Length = size / type;
86  }
88 
89 private:
90  // Discriminate using the current kind.
91  IdKind Kind;
92 };
93 
94 // Generic type information for an assembly object.
95 // All sizes measured in bytes.
96 struct AsmTypeInfo {
98  unsigned Size = 0;
99  unsigned ElementSize = 0;
100  unsigned Length = 0;
101 };
102 
103 struct AsmFieldInfo {
105  unsigned Offset = 0;
106 };
107 
108 /// Generic Sema callback for assembly parser.
110 public:
111  virtual ~MCAsmParserSemaCallback();
112 
113  virtual void LookupInlineAsmIdentifier(StringRef &LineBuf,
115  bool IsUnevaluatedContext) = 0;
116  virtual StringRef LookupInlineAsmLabel(StringRef Identifier, SourceMgr &SM,
117  SMLoc Location, bool Create) = 0;
118  virtual bool LookupInlineAsmField(StringRef Base, StringRef Member,
119  unsigned &Offset) = 0;
120 };
121 
122 /// Generic assembler parser interface, for use by target specific
123 /// assembly parsers.
124 class MCAsmParser {
125 public:
128  std::pair<MCAsmParserExtension*, DirectiveHandler>;
129 
130  struct MCPendingError {
134  };
135 
136 private:
137  MCTargetAsmParser *TargetParser = nullptr;
138 
139 protected: // Can only create subclasses.
140  MCAsmParser();
141 
143 
144  /// Flag tracking whether any errors have been encountered.
145  bool HadError = false;
146 
147  bool ShowParsedOperands = false;
148 
149 public:
150  MCAsmParser(const MCAsmParser &) = delete;
151  MCAsmParser &operator=(const MCAsmParser &) = delete;
152  virtual ~MCAsmParser();
153 
155  ExtensionDirectiveHandler Handler) = 0;
156 
157  virtual void addAliasForDirective(StringRef Directive, StringRef Alias) = 0;
158 
159  virtual SourceMgr &getSourceManager() = 0;
160 
161  virtual MCAsmLexer &getLexer() = 0;
162  const MCAsmLexer &getLexer() const {
163  return const_cast<MCAsmParser*>(this)->getLexer();
164  }
165 
166  virtual MCContext &getContext() = 0;
167 
168  /// Return the output streamer for the assembler.
169  virtual MCStreamer &getStreamer() = 0;
170 
171  MCTargetAsmParser &getTargetParser() const { return *TargetParser; }
173 
174  virtual unsigned getAssemblerDialect() { return 0;}
175  virtual void setAssemblerDialect(unsigned i) { }
176 
177  bool getShowParsedOperands() const { return ShowParsedOperands; }
179 
180  /// Run the parser on the input source buffer.
181  virtual bool Run(bool NoInitialTextSection, bool NoFinalize = false) = 0;
182 
183  virtual void setParsingMSInlineAsm(bool V) = 0;
184  virtual bool isParsingMSInlineAsm() = 0;
185 
186  virtual bool discardLTOSymbol(StringRef) const { return false; }
187 
188  virtual bool isParsingMasm() const { return false; }
189 
190  virtual bool defineMacro(StringRef Name, StringRef Value) { return true; }
191 
192  virtual bool lookUpField(StringRef Name, AsmFieldInfo &Info) const {
193  return true;
194  }
195  virtual bool lookUpField(StringRef Base, StringRef Member,
196  AsmFieldInfo &Info) const {
197  return true;
198  }
199 
200  virtual bool lookUpType(StringRef Name, AsmTypeInfo &Info) const {
201  return true;
202  }
203 
204  /// Parse MS-style inline assembly.
205  virtual bool parseMSInlineAsm(
206  std::string &AsmString, unsigned &NumOutputs, unsigned &NumInputs,
207  SmallVectorImpl<std::pair<void *, bool>> &OpDecls,
208  SmallVectorImpl<std::string> &Constraints,
209  SmallVectorImpl<std::string> &Clobbers, const MCInstrInfo *MII,
211 
212  /// Emit a note at the location \p L, with the message \p Msg.
213  virtual void Note(SMLoc L, const Twine &Msg, SMRange Range = None) = 0;
214 
215  /// Emit a warning at the location \p L, with the message \p Msg.
216  ///
217  /// \return The return value is true, if warnings are fatal.
218  virtual bool Warning(SMLoc L, const Twine &Msg, SMRange Range = None) = 0;
219 
220  /// Return an error at the location \p L, with the message \p Msg. This
221  /// may be modified before being emitted.
222  ///
223  /// \return The return value is always true, as an idiomatic convenience to
224  /// clients.
225  bool Error(SMLoc L, const Twine &Msg, SMRange Range = None);
226 
227  /// Emit an error at the location \p L, with the message \p Msg.
228  ///
229  /// \return The return value is always true, as an idiomatic convenience to
230  /// clients.
231  virtual bool printError(SMLoc L, const Twine &Msg, SMRange Range = None) = 0;
232 
233  bool hasPendingError() { return !PendingErrors.empty(); }
234 
236  bool rv = !PendingErrors.empty();
237  for (auto Err : PendingErrors) {
238  printError(Err.Loc, Twine(Err.Msg), Err.Range);
239  }
240  PendingErrors.clear();
241  return rv;
242  }
243 
244  void clearPendingErrors() { PendingErrors.clear(); }
245 
246  bool addErrorSuffix(const Twine &Suffix);
247 
248  /// Get the next AsmToken in the stream, possibly handling file
249  /// inclusion first.
250  virtual const AsmToken &Lex() = 0;
251 
252  /// Get the current AsmToken from the stream.
253  const AsmToken &getTok() const;
254 
255  /// Report an error at the current lexer location.
256  bool TokError(const Twine &Msg, SMRange Range = None);
257 
258  bool parseTokenLoc(SMLoc &Loc);
259  bool parseToken(AsmToken::TokenKind T, const Twine &Msg = "unexpected token");
260  /// Attempt to parse and consume token, returning true on
261  /// success.
263 
264  bool parseComma() { return parseToken(AsmToken::Comma, "expected comma"); }
265  bool parseEOL();
266  bool parseEOL(const Twine &ErrMsg);
267 
268  bool parseMany(function_ref<bool()> parseOne, bool hasComma = true);
269 
270  bool parseIntToken(int64_t &V, const Twine &ErrMsg);
271 
272  bool check(bool P, const Twine &Msg);
273  bool check(bool P, SMLoc Loc, const Twine &Msg);
274 
275  /// Parse an identifier or string (as a quoted identifier) and set \p
276  /// Res to the identifier contents.
277  virtual bool parseIdentifier(StringRef &Res) = 0;
278 
279  /// Parse up to the end of statement and return the contents from the
280  /// current token until the end of the statement; the current token on exit
281  /// will be either the EndOfStatement or EOF.
283 
284  /// Parse the current token as a string which may include escaped
285  /// characters and return the string contents.
286  virtual bool parseEscapedString(std::string &Data) = 0;
287 
288  /// Parse an angle-bracket delimited string at the current position if one is
289  /// present, returning the string contents.
290  virtual bool parseAngleBracketString(std::string &Data) = 0;
291 
292  /// Skip to the end of the current statement, for error recovery.
293  virtual void eatToEndOfStatement() = 0;
294 
295  /// Parse an arbitrary expression.
296  ///
297  /// \param Res - The value of the expression. The result is undefined
298  /// on error.
299  /// \return - False on success.
300  virtual bool parseExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0;
301  bool parseExpression(const MCExpr *&Res);
302 
303  /// Parse a primary expression.
304  ///
305  /// \param Res - The value of the expression. The result is undefined
306  /// on error.
307  /// \return - False on success.
308  virtual bool parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc,
309  AsmTypeInfo *TypeInfo) = 0;
310 
311  /// Parse an arbitrary expression, assuming that an initial '(' has
312  /// already been consumed.
313  ///
314  /// \param Res - The value of the expression. The result is undefined
315  /// on error.
316  /// \return - False on success.
317  virtual bool parseParenExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0;
318 
319  /// Parse an expression which must evaluate to an absolute value.
320  ///
321  /// \param Res - The value of the absolute expression. The result is undefined
322  /// on error.
323  /// \return - False on success.
324  virtual bool parseAbsoluteExpression(int64_t &Res) = 0;
325 
326  /// Ensure that we have a valid section set in the streamer. Otherwise,
327  /// report an error and switch to .text.
328  /// \return - False on success.
329  virtual bool checkForValidSection() = 0;
330 
331  /// Parse an arbitrary expression of a specified parenthesis depth,
332  /// assuming that the initial '(' characters have already been consumed.
333  ///
334  /// \param ParenDepth - Specifies how many trailing expressions outside the
335  /// current parentheses we have to parse.
336  /// \param Res - The value of the expression. The result is undefined
337  /// on error.
338  /// \return - False on success.
339  virtual bool parseParenExprOfDepth(unsigned ParenDepth, const MCExpr *&Res,
340  SMLoc &EndLoc) = 0;
341 
342  /// Parse a .gnu_attribute.
343  bool parseGNUAttribute(SMLoc L, int64_t &Tag, int64_t &IntegerValue);
344 };
345 
346 /// Create an MCAsmParser instance for parsing assembly similar to gas syntax
347 MCAsmParser *createMCAsmParser(SourceMgr &, MCContext &, MCStreamer &,
348  const MCAsmInfo &, unsigned CB = 0);
349 
350 /// Create an MCAsmParser instance for parsing Microsoft MASM-style assembly
351 MCAsmParser *createMCMasmParser(SourceMgr &, MCContext &, MCStreamer &,
352  const MCAsmInfo &, struct tm, unsigned CB = 0);
353 
354 } // end namespace llvm
355 
356 #endif // LLVM_MC_MCPARSER_MCASMPARSER_H
i
i
Definition: README.txt:29
llvm::MCAsmParser
Generic assembler parser interface, for use by target specific assembly parsers.
Definition: MCAsmParser.h:124
llvm::MCAsmParser::getSourceManager
virtual SourceMgr & getSourceManager()=0
llvm::AsmFieldInfo::Offset
unsigned Offset
Definition: MCAsmParser.h:105
llvm::MCAsmParser::operator=
MCAsmParser & operator=(const MCAsmParser &)=delete
llvm::InlineAsmIdentifierInfo::IdKind
IdKind
Definition: MCAsmParser.h:38
llvm::MCAsmParser::Error
bool Error(SMLoc L, const Twine &Msg, SMRange Range=None)
Return an error at the location L, with the message Msg.
Definition: MCAsmParser.cpp:99
llvm::MCAsmParser::printError
virtual bool printError(SMLoc L, const Twine &Msg, SMRange Range=None)=0
Emit an error at the location L, with the message Msg.
llvm::MCAsmParserSemaCallback
Generic Sema callback for assembly parser.
Definition: MCAsmParser.h:109
llvm::MCAsmParser::getStreamer
virtual MCStreamer & getStreamer()=0
Return the output streamer for the assembler.
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::MCAsmParser::getLexer
const MCAsmLexer & getLexer() const
Definition: MCAsmParser.h:162
llvm::InlineAsmIdentifierInfo::setEnum
void setEnum(int64_t enumVal)
Definition: MCAsmParser.h:68
llvm::MCAsmLexer
Generic assembler lexer interface, for use by target specific assembly lexers.
Definition: MCAsmLexer.h:39
llvm::InlineAsmIdentifierInfo::VariableIdentifier::IsGlobalLV
bool IsGlobalLV
Definition: MCAsmParser.h:55
llvm::MCContext
Context object for machine code objects.
Definition: MCContext.h:72
StringRef.h
P
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Definition: README-SSE.txt:411
llvm::MCAsmParser::addDirectiveHandler
virtual void addDirectiveHandler(StringRef Directive, ExtensionDirectiveHandler Handler)=0
llvm::MCAsmParser::parseEOL
bool parseEOL()
Definition: MCAsmParser.cpp:47
llvm::MCAsmParser::ShowParsedOperands
bool ShowParsedOperands
Definition: MCAsmParser.h:147
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1168
llvm::MCAsmParser::setAssemblerDialect
virtual void setAssemblerDialect(unsigned i)
Definition: MCAsmParser.h:175
llvm::MCAsmParser::parseIdentifier
virtual bool parseIdentifier(StringRef &Res)=0
Parse an identifier or string (as a quoted identifier) and set Res to the identifier contents.
llvm::MCAsmParser::getAssemblerDialect
virtual unsigned getAssemblerDialect()
Definition: MCAsmParser.h:174
llvm::MCAsmParser::parseEscapedString
virtual bool parseEscapedString(std::string &Data)=0
Parse the current token as a string which may include escaped characters and return the string conten...
llvm::InlineAsmIdentifierInfo::InlineAsmIdentifierInfo
InlineAsmIdentifierInfo()
Definition: MCAsmParser.h:87
llvm::MCAsmParserSemaCallback::LookupInlineAsmIdentifier
virtual void LookupInlineAsmIdentifier(StringRef &LineBuf, InlineAsmIdentifierInfo &Info, bool IsUnevaluatedContext)=0
llvm::MCAsmParser::defineMacro
virtual bool defineMacro(StringRef Name, StringRef Value)
Definition: MCAsmParser.h:190
llvm::MCAsmParser::parseParenExprOfDepth
virtual bool parseParenExprOfDepth(unsigned ParenDepth, const MCExpr *&Res, SMLoc &EndLoc)=0
Parse an arbitrary expression of a specified parenthesis depth, assuming that the initial '(' charact...
llvm::InlineAsmIdentifierInfo::EnumIdentifier
Definition: MCAsmParser.h:45
llvm::MCAsmParser::parseOptionalToken
bool parseOptionalToken(AsmToken::TokenKind T)
Attempt to parse and consume token, returning true on success.
Definition: MCAsmParser.cpp:78
llvm::AsmTypeInfo::Name
StringRef Name
Definition: MCAsmParser.h:97
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:81
llvm::InlineAsmIdentifierInfo
Definition: MCAsmParser.h:37
STLExtras.h
llvm::MCAsmParserSemaCallback::~MCAsmParserSemaCallback
virtual ~MCAsmParserSemaCallback()
llvm::MCAsmParser::~MCAsmParser
virtual ~MCAsmParser()
llvm::InlineAsmIdentifierInfo::Label
LabelIdentifier Label
Definition: MCAsmParser.h:63
llvm::InlineAsmIdentifierInfo::IK_EnumVal
@ IK_EnumVal
Definition: MCAsmParser.h:41
llvm::InlineAsmIdentifierInfo::LabelIdentifier::Decl
void * Decl
Definition: MCAsmParser.h:50
llvm::MCAsmParser::MCPendingError
Definition: MCAsmParser.h:130
llvm::Data
@ Data
Definition: SIMachineScheduler.h:55
llvm::MCAsmParser::parseAbsoluteExpression
virtual bool parseAbsoluteExpression(int64_t &Res)=0
Parse an expression which must evaluate to an absolute value.
llvm::AsmToken
Target independent representation for an assembler token.
Definition: MCAsmMacro.h:21
llvm::MCAsmParser::Lex
virtual const AsmToken & Lex()=0
Get the next AsmToken in the stream, possibly handling file inclusion first.
llvm::MCStreamer
Streaming machine code generation interface.
Definition: MCStreamer.h:199
llvm::MCAsmParser::hasPendingError
bool hasPendingError()
Definition: MCAsmParser.h:233
llvm::MCAsmParserSemaCallback::LookupInlineAsmField
virtual bool LookupInlineAsmField(StringRef Base, StringRef Member, unsigned &Offset)=0
llvm::MCAsmParser::parseExpression
virtual bool parseExpression(const MCExpr *&Res, SMLoc &EndLoc)=0
Parse an arbitrary expression.
llvm::SMLoc
Represents a location in source code.
Definition: SMLoc.h:23
SmallString.h
llvm::MCAsmParser::parseStringToEndOfStatement
virtual StringRef parseStringToEndOfStatement()=0
Parse up to the end of statement and return the contents from the current token until the end of the ...
llvm::AsmTypeInfo::Size
unsigned Size
Definition: MCAsmParser.h:98
Twine.h
llvm::MCAsmParser::parseIntToken
bool parseIntToken(int64_t &V, const Twine &ErrMsg)
Definition: MCAsmParser.cpp:70
llvm::AsmTypeInfo
Definition: MCAsmParser.h:96
llvm::MCAsmParser::discardLTOSymbol
virtual bool discardLTOSymbol(StringRef) const
Definition: MCAsmParser.h:186
IP
Definition: NVPTXLowerArgs.cpp:166
llvm::MCAsmParser::printPendingErrors
bool printPendingErrors()
Definition: MCAsmParser.h:235
llvm::MCAsmParser::PendingErrors
SmallVector< MCPendingError, 0 > PendingErrors
Definition: MCAsmParser.h:142
llvm::MCAsmParser::ExtensionDirectiveHandler
std::pair< MCAsmParserExtension *, DirectiveHandler > ExtensionDirectiveHandler
Definition: MCAsmParser.h:128
llvm::MCAsmParser::parseComma
bool parseComma()
Definition: MCAsmParser.h:264
llvm::MCAsmParser::getContext
virtual MCContext & getContext()=0
llvm::MCAsmParser::isParsingMasm
virtual bool isParsingMasm() const
Definition: MCAsmParser.h:188
SMLoc.h
llvm::MCAsmParser::addAliasForDirective
virtual void addAliasForDirective(StringRef Directive, StringRef Alias)=0
llvm::InlineAsmIdentifierInfo::IK_Label
@ IK_Label
Definition: MCAsmParser.h:40
Info
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
llvm::MCAsmParser::Note
virtual void Note(SMLoc L, const Twine &Msg, SMRange Range=None)=0
Emit a note at the location L, with the message Msg.
llvm::None
const NoneType None
Definition: None.h:23
llvm::MCAsmParser::setParsingMSInlineAsm
virtual void setParsingMSInlineAsm(bool V)=0
llvm::MCAsmParser::parsePrimaryExpr
virtual bool parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc, AsmTypeInfo *TypeInfo)=0
Parse a primary expression.
llvm::SmallString< 64 >
llvm::MCAsmParser::MCPendingError::Range
SMRange Range
Definition: MCAsmParser.h:133
llvm::function_ref
An efficient, type-erasing, non-owning reference to a callable.
Definition: STLExtras.h:168
llvm::AsmTypeInfo::ElementSize
unsigned ElementSize
Definition: MCAsmParser.h:99
llvm::MCAsmParser::getTargetParser
MCTargetAsmParser & getTargetParser() const
Definition: MCAsmParser.h:171
llvm::MCAsmParser::checkForValidSection
virtual bool checkForValidSection()=0
Ensure that we have a valid section set in the streamer.
MCAsmLexer.h
type
AMD64 Optimization Manual has some nice information about optimizing integer multiplication by a constant How much of it applies to Intel s X86 implementation There are definite trade offs to xmm0 cvttss2siq rdx jb L3 subss xmm0 rax cvttss2siq rdx xorq rdx rax ret instead of xmm1 cvttss2siq rcx movaps xmm2 subss xmm2 cvttss2siq rax rdx xorq rax ucomiss xmm0 cmovb rax ret Seems like the jb branch has high likelihood of being taken It would have saved a few instructions It s not possible to reference and DH registers in an instruction requiring REX prefix divb and mulb both produce results in AH If isel emits a CopyFromReg which gets turned into a movb and that can be allocated a r8b r15b To get around isel emits a CopyFromReg from AX and then right shift it down by and truncate it It s not pretty but it works We need some register allocation magic to make the hack go which would often require a callee saved register Callees usually need to keep this value live for most of their body so it doesn t add a significant burden on them We currently implement this in however this is suboptimal because it means that it would be quite awkward to implement the optimization for callers A better implementation would be to relax the LLVM IR rules for sret arguments to allow a function with an sret argument to have a non void return type
Definition: README-X86-64.txt:70
llvm::InlineAsmIdentifierInfo::IK_Invalid
@ IK_Invalid
Definition: MCAsmParser.h:39
llvm::MCAsmParser::addErrorSuffix
bool addErrorSuffix(const Twine &Suffix)
Definition: MCAsmParser.cpp:115
llvm::MCInstPrinter
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:43
llvm::MCAsmParser::parseMany
bool parseMany(function_ref< bool()> parseOne, bool hasComma=true)
Definition: MCAsmParser.cpp:124
llvm::InlineAsmIdentifierInfo::Enum
EnumIdentifier Enum
Definition: MCAsmParser.h:62
llvm::MCAsmParser::check
bool check(bool P, const Twine &Msg)
Definition: MCAsmParser.cpp:85
llvm::InlineAsmIdentifierInfo::VariableIdentifier::Length
unsigned Length
Definition: MCAsmParser.h:56
llvm::AsmFieldInfo
Definition: MCAsmParser.h:103
llvm::InlineAsmIdentifierInfo::IK_Var
@ IK_Var
Definition: MCAsmParser.h:42
llvm::MCAsmParser::MCPendingError::Loc
SMLoc Loc
Definition: MCAsmParser.h:131
llvm::MCAsmParser::parseParenExpression
virtual bool parseParenExpression(const MCExpr *&Res, SMLoc &EndLoc)=0
Parse an arbitrary expression, assuming that an initial '(' has already been consumed.
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::MCAsmParser::lookUpField
virtual bool lookUpField(StringRef Base, StringRef Member, AsmFieldInfo &Info) const
Definition: MCAsmParser.h:195
SI
StandardInstrumentations SI(Debug, VerifyEach)
llvm::MCAsmParser::DirectiveHandler
bool(*)(MCAsmParserExtension *, StringRef, SMLoc) DirectiveHandler
Definition: MCAsmParser.h:126
llvm::InlineAsmIdentifierInfo::setVar
void setVar(void *decl, bool isGlobalLV, unsigned size, unsigned type)
Definition: MCAsmParser.h:78
llvm::AsmToken::Comma
@ Comma
Definition: MCAsmMacro.h:49
llvm::size
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
Definition: STLExtras.h:1532
None.h
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::MCAsmParser::getTok
const AsmToken & getTok() const
Get the current AsmToken from the stream.
Definition: MCAsmParser.cpp:38
llvm::MCAsmParserExtension
Generic interface for extending the MCAsmParser, which is implemented by target and object file assem...
Definition: MCAsmParserExtension.h:25
llvm::SourceMgr
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling.
Definition: SourceMgr.h:31
llvm::MCAsmParser::parseMSInlineAsm
virtual bool parseMSInlineAsm(std::string &AsmString, unsigned &NumOutputs, unsigned &NumInputs, SmallVectorImpl< std::pair< void *, bool >> &OpDecls, SmallVectorImpl< std::string > &Constraints, SmallVectorImpl< std::string > &Clobbers, const MCInstrInfo *MII, const MCInstPrinter *IP, MCAsmParserSemaCallback &SI)=0
Parse MS-style inline assembly.
llvm::MCAsmParser::lookUpField
virtual bool lookUpField(StringRef Name, AsmFieldInfo &Info) const
Definition: MCAsmParser.h:192
llvm::createMCMasmParser
MCAsmParser * createMCMasmParser(SourceMgr &, MCContext &, MCStreamer &, const MCAsmInfo &, struct tm, unsigned CB=0)
Create an MCAsmParser instance for parsing Microsoft MASM-style assembly.
Definition: MasmParser.cpp:7740
llvm::MCAsmParser::parseAngleBracketString
virtual bool parseAngleBracketString(std::string &Data)=0
Parse an angle-bracket delimited string at the current position if one is present,...
llvm::MCAsmParser::isParsingMSInlineAsm
virtual bool isParsingMSInlineAsm()=0
llvm::AsmFieldInfo::Type
AsmTypeInfo Type
Definition: MCAsmParser.h:104
llvm::InlineAsmIdentifierInfo::Var
VariableIdentifier Var
Definition: MCAsmParser.h:64
llvm::MCAsmParser::eatToEndOfStatement
virtual void eatToEndOfStatement()=0
Skip to the end of the current statement, for error recovery.
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::MCAsmParser::clearPendingErrors
void clearPendingErrors()
Definition: MCAsmParser.h:244
llvm::MCAsmParser::TokError
bool TokError(const Twine &Msg, SMRange Range=None)
Report an error at the current lexer location.
Definition: MCAsmParser.cpp:95
llvm::MCAsmParserSemaCallback::LookupInlineAsmLabel
virtual StringRef LookupInlineAsmLabel(StringRef Identifier, SourceMgr &SM, SMLoc Location, bool Create)=0
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
llvm::MCAsmParser::MCPendingError::Msg
SmallString< 64 > Msg
Definition: MCAsmParser.h:132
llvm::InlineAsmIdentifierInfo::VariableIdentifier::Size
unsigned Size
Definition: MCAsmParser.h:57
llvm::MCTargetAsmParser
MCTargetAsmParser - Generic interface to target specific assembly parsers.
Definition: MCTargetAsmParser.h:309
llvm::InlineAsmIdentifierInfo::EnumIdentifier::EnumVal
int64_t EnumVal
Definition: MCAsmParser.h:46
llvm::MCAsmParser::lookUpType
virtual bool lookUpType(StringRef Name, AsmTypeInfo &Info) const
Definition: MCAsmParser.h:200
llvm::AsmTypeInfo::Length
unsigned Length
Definition: MCAsmParser.h:100
llvm::AsmToken::TokenKind
TokenKind
Definition: MCAsmMacro.h:23
SmallVector.h
llvm::MCAsmParser::parseGNUAttribute
bool parseGNUAttribute(SMLoc L, int64_t &Tag, int64_t &IntegerValue)
Parse a .gnu_attribute.
Definition: MCAsmParser.cpp:143
llvm::MCAsmParser::getLexer
virtual MCAsmLexer & getLexer()=0
llvm::SMRange
Represents a range in source code.
Definition: SMLoc.h:48
llvm::MCAsmParser::HadError
bool HadError
Flag tracking whether any errors have been encountered.
Definition: MCAsmParser.h:145
llvm::InlineAsmIdentifierInfo::setLabel
void setLabel(void *decl)
Definition: MCAsmParser.h:73
llvm::createMCAsmParser
MCAsmParser * createMCAsmParser(SourceMgr &, MCContext &, MCStreamer &, const MCAsmInfo &, unsigned CB=0)
Create an MCAsmParser instance for parsing assembly similar to gas syntax.
Definition: AsmParser.cpp:6408
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:43
llvm::InlineAsmIdentifierInfo::VariableIdentifier::Type
unsigned Type
Definition: MCAsmParser.h:58
llvm::InlineAsmIdentifierInfo::VariableIdentifier
Definition: MCAsmParser.h:53
llvm::MCAsmParser::setShowParsedOperands
void setShowParsedOperands(bool Value)
Definition: MCAsmParser.h:178
llvm::MCAsmParser::Warning
virtual bool Warning(SMLoc L, const Twine &Msg, SMRange Range=None)=0
Emit a warning at the location L, with the message Msg.
llvm::InlineAsmIdentifierInfo::LabelIdentifier
Definition: MCAsmParser.h:49
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::MCAsmParser::getShowParsedOperands
bool getShowParsedOperands() const
Definition: MCAsmParser.h:177
llvm::Directive
Definition: DirectiveEmitter.h:100
llvm::MCExpr
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
llvm::InlineAsmIdentifierInfo::VariableIdentifier::Decl
void * Decl
Definition: MCAsmParser.h:54
llvm::InlineAsmIdentifierInfo::isKind
bool isKind(IdKind kind) const
Definition: MCAsmParser.h:66
llvm::MCAsmParser::Run
virtual bool Run(bool NoInitialTextSection, bool NoFinalize=false)=0
Run the parser on the input source buffer.
llvm::MCAsmParser::MCAsmParser
MCAsmParser()
Definition: MCAsmParser.cpp:28
llvm::MCAsmParser::parseToken
bool parseToken(AsmToken::TokenKind T, const Twine &Msg="unexpected token")
Definition: MCAsmParser.cpp:61
llvm::sampleprof::Base
@ Base
Definition: Discriminator.h:58
llvm::MCAsmParser::setTargetParser
void setTargetParser(MCTargetAsmParser &P)
Definition: MCAsmParser.cpp:32
llvm::MCAsmParser::parseTokenLoc
bool parseTokenLoc(SMLoc &Loc)
Definition: MCAsmParser.cpp:42