Import prebuilt clang toolchain for linux.
diff --git a/linux-x64/clang/include/llvm/MC/MCParser/AsmCond.h b/linux-x64/clang/include/llvm/MC/MCParser/AsmCond.h
new file mode 100644
index 0000000..8e7bfc5
--- /dev/null
+++ b/linux-x64/clang/include/llvm/MC/MCParser/AsmCond.h
@@ -0,0 +1,40 @@
+//===- AsmCond.h - Assembly file conditional assembly ----------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_MC_MCPARSER_ASMCOND_H
+#define LLVM_MC_MCPARSER_ASMCOND_H
+
+namespace llvm {
+
+/// AsmCond - Class to support conditional assembly
+///
+/// The conditional assembly feature (.if, .else, .elseif and .endif) is
+/// implemented with AsmCond that tells us what we are in the middle of
+/// processing. Ignore can be either true or false. When true we are ignoring
+/// the block of code in the middle of a conditional.
+
+class AsmCond {
+public:
+ enum ConditionalAssemblyType {
+ NoCond, // no conditional is being processed
+ IfCond, // inside if conditional
+ ElseIfCond, // inside elseif conditional
+ ElseCond // inside else conditional
+ };
+
+ ConditionalAssemblyType TheCond = NoCond;
+ bool CondMet = false;
+ bool Ignore = false;
+
+ AsmCond() = default;
+};
+
+} // end namespace llvm
+
+#endif // LLVM_MC_MCPARSER_ASMCOND_H
diff --git a/linux-x64/clang/include/llvm/MC/MCParser/AsmLexer.h b/linux-x64/clang/include/llvm/MC/MCParser/AsmLexer.h
new file mode 100644
index 0000000..207183a
--- /dev/null
+++ b/linux-x64/clang/include/llvm/MC/MCParser/AsmLexer.h
@@ -0,0 +1,76 @@
+//===- AsmLexer.h - Lexer for Assembly Files --------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This class declares the lexer for assembly files.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_MC_MCPARSER_ASMLEXER_H
+#define LLVM_MC_MCPARSER_ASMLEXER_H
+
+#include "llvm/ADT/StringRef.h"
+#include "llvm/MC/MCParser/MCAsmLexer.h"
+#include <string>
+
+namespace llvm {
+
+class MCAsmInfo;
+
+/// AsmLexer - Lexer class for assembly files.
+class AsmLexer : public MCAsmLexer {
+ const MCAsmInfo &MAI;
+
+ const char *CurPtr = nullptr;
+ StringRef CurBuf;
+ bool IsAtStartOfLine = true;
+ bool IsAtStartOfStatement = true;
+ bool IsParsingMSInlineAsm = false;
+ bool IsPeeking = false;
+
+protected:
+ /// LexToken - Read the next token and return its code.
+ AsmToken LexToken() override;
+
+public:
+ AsmLexer(const MCAsmInfo &MAI);
+ AsmLexer(const AsmLexer &) = delete;
+ AsmLexer &operator=(const AsmLexer &) = delete;
+ ~AsmLexer() override;
+
+ void setBuffer(StringRef Buf, const char *ptr = nullptr);
+ void setParsingMSInlineAsm(bool V) { IsParsingMSInlineAsm = V; }
+
+ StringRef LexUntilEndOfStatement() override;
+
+ size_t peekTokens(MutableArrayRef<AsmToken> Buf,
+ bool ShouldSkipSpace = true) override;
+
+ const MCAsmInfo &getMAI() const { return MAI; }
+
+private:
+ bool isAtStartOfComment(const char *Ptr);
+ bool isAtStatementSeparator(const char *Ptr);
+ int getNextChar();
+ AsmToken ReturnError(const char *Loc, const std::string &Msg);
+
+ AsmToken LexIdentifier();
+ AsmToken LexSlash();
+ AsmToken LexLineComment();
+ AsmToken LexDigit();
+ AsmToken LexSingleQuote();
+ AsmToken LexQuote();
+ AsmToken LexFloatLiteral();
+ AsmToken LexHexFloatLiteral(bool NoIntDigits);
+
+ StringRef LexUntilEndOfLine();
+};
+
+} // end namespace llvm
+
+#endif // LLVM_MC_MCPARSER_ASMLEXER_H
diff --git a/linux-x64/clang/include/llvm/MC/MCParser/MCAsmLexer.h b/linux-x64/clang/include/llvm/MC/MCParser/MCAsmLexer.h
new file mode 100644
index 0000000..10550b3
--- /dev/null
+++ b/linux-x64/clang/include/llvm/MC/MCParser/MCAsmLexer.h
@@ -0,0 +1,162 @@
+//===- llvm/MC/MCAsmLexer.h - Abstract Asm Lexer Interface ------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_MC_MCPARSER_MCASMLEXER_H
+#define LLVM_MC_MCPARSER_MCASMLEXER_H
+
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/MC/MCAsmMacro.h"
+#include <algorithm>
+#include <cassert>
+#include <cstddef>
+#include <cstdint>
+#include <string>
+
+namespace llvm {
+
+/// A callback class which is notified of each comment in an assembly file as
+/// it is lexed.
+class AsmCommentConsumer {
+public:
+ virtual ~AsmCommentConsumer() = default;
+
+ /// Callback function for when a comment is lexed. Loc is the start of the
+ /// comment text (excluding the comment-start marker). CommentText is the text
+ /// of the comment, excluding the comment start and end markers, and the
+ /// newline for single-line comments.
+ virtual void HandleComment(SMLoc Loc, StringRef CommentText) = 0;
+};
+
+
+/// Generic assembler lexer interface, for use by target specific assembly
+/// lexers.
+class MCAsmLexer {
+ /// The current token, stored in the base class for faster access.
+ SmallVector<AsmToken, 1> CurTok;
+
+ /// The location and description of the current error
+ SMLoc ErrLoc;
+ std::string Err;
+
+protected: // Can only create subclasses.
+ const char *TokStart = nullptr;
+ bool SkipSpace = true;
+ bool AllowAtInIdentifier;
+ bool IsAtStartOfStatement = true;
+ AsmCommentConsumer *CommentConsumer = nullptr;
+
+ bool AltMacroMode;
+ MCAsmLexer();
+
+ virtual AsmToken LexToken() = 0;
+
+ void SetError(SMLoc errLoc, const std::string &err) {
+ ErrLoc = errLoc;
+ Err = err;
+ }
+
+public:
+ MCAsmLexer(const MCAsmLexer &) = delete;
+ MCAsmLexer &operator=(const MCAsmLexer &) = delete;
+ virtual ~MCAsmLexer();
+
+ bool IsaAltMacroMode() {
+ return AltMacroMode;
+ }
+
+ void SetAltMacroMode(bool AltMacroSet) {
+ AltMacroMode = AltMacroSet;
+ }
+
+ /// Consume the next token from the input stream and return it.
+ ///
+ /// The lexer will continuosly return the end-of-file token once the end of
+ /// the main input file has been reached.
+ const AsmToken &Lex() {
+ assert(!CurTok.empty());
+ // Mark if we parsing out a EndOfStatement.
+ IsAtStartOfStatement = CurTok.front().getKind() == AsmToken::EndOfStatement;
+ CurTok.erase(CurTok.begin());
+ // LexToken may generate multiple tokens via UnLex but will always return
+ // the first one. Place returned value at head of CurTok vector.
+ if (CurTok.empty()) {
+ AsmToken T = LexToken();
+ CurTok.insert(CurTok.begin(), T);
+ }
+ return CurTok.front();
+ }
+
+ void UnLex(AsmToken const &Token) {
+ IsAtStartOfStatement = false;
+ CurTok.insert(CurTok.begin(), Token);
+ }
+
+ bool isAtStartOfStatement() { return IsAtStartOfStatement; }
+
+ virtual StringRef LexUntilEndOfStatement() = 0;
+
+ /// Get the current source location.
+ SMLoc getLoc() const;
+
+ /// Get the current (last) lexed token.
+ const AsmToken &getTok() const {
+ return CurTok[0];
+ }
+
+ /// Look ahead at the next token to be lexed.
+ const AsmToken peekTok(bool ShouldSkipSpace = true) {
+ AsmToken Tok;
+
+ MutableArrayRef<AsmToken> Buf(Tok);
+ size_t ReadCount = peekTokens(Buf, ShouldSkipSpace);
+
+ assert(ReadCount == 1);
+ (void)ReadCount;
+
+ return Tok;
+ }
+
+ /// Look ahead an arbitrary number of tokens.
+ virtual size_t peekTokens(MutableArrayRef<AsmToken> Buf,
+ bool ShouldSkipSpace = true) = 0;
+
+ /// Get the current error location
+ SMLoc getErrLoc() {
+ return ErrLoc;
+ }
+
+ /// Get the current error string
+ const std::string &getErr() {
+ return Err;
+ }
+
+ /// Get the kind of current token.
+ AsmToken::TokenKind getKind() const { return getTok().getKind(); }
+
+ /// Check if the current token has kind \p K.
+ bool is(AsmToken::TokenKind K) const { return getTok().is(K); }
+
+ /// Check if the current token has kind \p K.
+ bool isNot(AsmToken::TokenKind K) const { return getTok().isNot(K); }
+
+ /// Set whether spaces should be ignored by the lexer
+ void setSkipSpace(bool val) { SkipSpace = val; }
+
+ bool getAllowAtInIdentifier() { return AllowAtInIdentifier; }
+ void setAllowAtInIdentifier(bool v) { AllowAtInIdentifier = v; }
+
+ void setCommentConsumer(AsmCommentConsumer *CommentConsumer) {
+ this->CommentConsumer = CommentConsumer;
+ }
+};
+
+} // end namespace llvm
+
+#endif // LLVM_MC_MCPARSER_MCASMLEXER_H
diff --git a/linux-x64/clang/include/llvm/MC/MCParser/MCAsmParser.h b/linux-x64/clang/include/llvm/MC/MCParser/MCAsmParser.h
new file mode 100644
index 0000000..0f79c47
--- /dev/null
+++ b/linux-x64/clang/include/llvm/MC/MCParser/MCAsmParser.h
@@ -0,0 +1,313 @@
+//===- llvm/MC/MCAsmParser.h - Abstract Asm Parser Interface ----*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_MC_MCPARSER_MCASMPARSER_H
+#define LLVM_MC_MCPARSER_MCASMPARSER_H
+
+#include "llvm/ADT/None.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/Twine.h"
+#include "llvm/MC/MCParser/MCAsmLexer.h"
+#include "llvm/Support/SMLoc.h"
+#include <cstdint>
+#include <string>
+#include <utility>
+
+namespace llvm {
+
+class MCAsmInfo;
+class MCAsmParserExtension;
+class MCContext;
+class MCExpr;
+class MCInstPrinter;
+class MCInstrInfo;
+class MCStreamer;
+class MCTargetAsmParser;
+class SourceMgr;
+
+struct InlineAsmIdentifierInfo {
+ enum IdKind {
+ IK_Invalid, // Initial state. Unexpected after a successful parsing.
+ IK_Label, // Function/Label reference.
+ IK_EnumVal, // Value of enumeration type.
+ IK_Var // Variable.
+ };
+ // Represents an Enum value
+ struct EnumIdentifier {
+ int64_t EnumVal;
+ };
+ // Represents a label/function reference
+ struct LabelIdentifier {
+ void *Decl;
+ };
+ // Represents a variable
+ struct VariableIdentifier {
+ void *Decl;
+ bool IsGlobalLV;
+ unsigned Length;
+ unsigned Size;
+ unsigned Type;
+ };
+ // An InlineAsm identifier can only be one of those
+ union {
+ EnumIdentifier Enum;
+ LabelIdentifier Label;
+ VariableIdentifier Var;
+ };
+ bool isKind(IdKind kind) const { return Kind == kind; }
+ // Initializers
+ void setEnum(int64_t enumVal) {
+ assert(isKind(IK_Invalid) && "should be initialized only once");
+ Kind = IK_EnumVal;
+ Enum.EnumVal = enumVal;
+ }
+ void setLabel(void *decl) {
+ assert(isKind(IK_Invalid) && "should be initialized only once");
+ Kind = IK_Label;
+ Label.Decl = decl;
+ }
+ void setVar(void *decl, bool isGlobalLV, unsigned size, unsigned type) {
+ assert(isKind(IK_Invalid) && "should be initialized only once");
+ Kind = IK_Var;
+ Var.Decl = decl;
+ Var.IsGlobalLV = isGlobalLV;
+ Var.Size = size;
+ Var.Type = type;
+ Var.Length = size / type;
+ }
+ InlineAsmIdentifierInfo() : Kind(IK_Invalid) {}
+
+private:
+ // Discriminate using the current kind.
+ IdKind Kind;
+};
+
+/// \brief Generic Sema callback for assembly parser.
+class MCAsmParserSemaCallback {
+public:
+ virtual ~MCAsmParserSemaCallback();
+
+ virtual void LookupInlineAsmIdentifier(StringRef &LineBuf,
+ InlineAsmIdentifierInfo &Info,
+ bool IsUnevaluatedContext) = 0;
+ virtual StringRef LookupInlineAsmLabel(StringRef Identifier, SourceMgr &SM,
+ SMLoc Location, bool Create) = 0;
+ virtual bool LookupInlineAsmField(StringRef Base, StringRef Member,
+ unsigned &Offset) = 0;
+};
+
+/// \brief Generic assembler parser interface, for use by target specific
+/// assembly parsers.
+class MCAsmParser {
+public:
+ using DirectiveHandler = bool (*)(MCAsmParserExtension*, StringRef, SMLoc);
+ using ExtensionDirectiveHandler =
+ std::pair<MCAsmParserExtension*, DirectiveHandler>;
+
+ struct MCPendingError {
+ SMLoc Loc;
+ SmallString<64> Msg;
+ SMRange Range;
+ };
+
+private:
+ MCTargetAsmParser *TargetParser = nullptr;
+
+ unsigned ShowParsedOperands : 1;
+
+protected: // Can only create subclasses.
+ MCAsmParser();
+
+ /// Flag tracking whether any errors have been encountered.
+ bool HadError = false;
+ /// Enable print [latency:throughput] in output file.
+ bool EnablePrintSchedInfo = false;
+
+ SmallVector<MCPendingError, 1> PendingErrors;
+
+public:
+ MCAsmParser(const MCAsmParser &) = delete;
+ MCAsmParser &operator=(const MCAsmParser &) = delete;
+ virtual ~MCAsmParser();
+
+ virtual void addDirectiveHandler(StringRef Directive,
+ ExtensionDirectiveHandler Handler) = 0;
+
+ virtual void addAliasForDirective(StringRef Directive, StringRef Alias) = 0;
+
+ virtual SourceMgr &getSourceManager() = 0;
+
+ virtual MCAsmLexer &getLexer() = 0;
+ const MCAsmLexer &getLexer() const {
+ return const_cast<MCAsmParser*>(this)->getLexer();
+ }
+
+ virtual MCContext &getContext() = 0;
+
+ /// \brief Return the output streamer for the assembler.
+ virtual MCStreamer &getStreamer() = 0;
+
+ MCTargetAsmParser &getTargetParser() const { return *TargetParser; }
+ void setTargetParser(MCTargetAsmParser &P);
+
+ virtual unsigned getAssemblerDialect() { return 0;}
+ virtual void setAssemblerDialect(unsigned i) { }
+
+ bool getShowParsedOperands() const { return ShowParsedOperands; }
+ void setShowParsedOperands(bool Value) { ShowParsedOperands = Value; }
+
+ void setEnablePrintSchedInfo(bool Value) { EnablePrintSchedInfo = Value; }
+ bool shouldPrintSchedInfo() { return EnablePrintSchedInfo; }
+
+ /// \brief Run the parser on the input source buffer.
+ virtual bool Run(bool NoInitialTextSection, bool NoFinalize = false) = 0;
+
+ virtual void setParsingInlineAsm(bool V) = 0;
+ virtual bool isParsingInlineAsm() = 0;
+
+ /// \brief Parse MS-style inline assembly.
+ virtual bool parseMSInlineAsm(
+ void *AsmLoc, 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;
+
+ /// \brief Emit a note at the location \p L, with the message \p Msg.
+ virtual void Note(SMLoc L, const Twine &Msg, SMRange Range = None) = 0;
+
+ /// \brief Emit a warning at the location \p L, with the message \p Msg.
+ ///
+ /// \return The return value is true, if warnings are fatal.
+ virtual bool Warning(SMLoc L, const Twine &Msg, SMRange Range = None) = 0;
+
+ /// \brief Return an error at the location \p L, with the message \p Msg. This
+ /// may be modified before being emitted.
+ ///
+ /// \return The return value is always true, as an idiomatic convenience to
+ /// clients.
+ bool Error(SMLoc L, const Twine &Msg, SMRange Range = None);
+
+ /// \brief Emit an error at the location \p L, with the message \p Msg.
+ ///
+ /// \return The return value is always true, as an idiomatic convenience to
+ /// clients.
+ virtual bool printError(SMLoc L, const Twine &Msg, SMRange Range = None) = 0;
+
+ bool hasPendingError() { return !PendingErrors.empty(); }
+
+ bool printPendingErrors() {
+ bool rv = !PendingErrors.empty();
+ for (auto Err : PendingErrors) {
+ printError(Err.Loc, Twine(Err.Msg), Err.Range);
+ }
+ PendingErrors.clear();
+ return rv;
+ }
+
+ bool addErrorSuffix(const Twine &Suffix);
+
+ /// \brief Get the next AsmToken in the stream, possibly handling file
+ /// inclusion first.
+ virtual const AsmToken &Lex() = 0;
+
+ /// \brief Get the current AsmToken from the stream.
+ const AsmToken &getTok() const;
+
+ /// \brief Report an error at the current lexer location.
+ bool TokError(const Twine &Msg, SMRange Range = None);
+
+ bool parseTokenLoc(SMLoc &Loc);
+ bool parseToken(AsmToken::TokenKind T, const Twine &Msg = "unexpected token");
+ /// \brief Attempt to parse and consume token, returning true on
+ /// success.
+ bool parseOptionalToken(AsmToken::TokenKind T);
+
+ bool parseEOL(const Twine &ErrMsg);
+
+ bool parseMany(function_ref<bool()> parseOne, bool hasComma = true);
+
+ bool parseIntToken(int64_t &V, const Twine &ErrMsg);
+
+ bool check(bool P, const Twine &Msg);
+ bool check(bool P, SMLoc Loc, const Twine &Msg);
+
+ /// \brief Parse an identifier or string (as a quoted identifier) and set \p
+ /// Res to the identifier contents.
+ virtual bool parseIdentifier(StringRef &Res) = 0;
+
+ /// \brief Parse up to the end of statement and return the contents from the
+ /// current token until the end of the statement; the current token on exit
+ /// will be either the EndOfStatement or EOF.
+ virtual StringRef parseStringToEndOfStatement() = 0;
+
+ /// \brief Parse the current token as a string which may include escaped
+ /// characters and return the string contents.
+ virtual bool parseEscapedString(std::string &Data) = 0;
+
+ /// \brief Skip to the end of the current statement, for error recovery.
+ virtual void eatToEndOfStatement() = 0;
+
+ /// \brief Parse an arbitrary expression.
+ ///
+ /// \param Res - The value of the expression. The result is undefined
+ /// on error.
+ /// \return - False on success.
+ virtual bool parseExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0;
+ bool parseExpression(const MCExpr *&Res);
+
+ /// \brief Parse a primary expression.
+ ///
+ /// \param Res - The value of the expression. The result is undefined
+ /// on error.
+ /// \return - False on success.
+ virtual bool parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) = 0;
+
+ /// \brief Parse an arbitrary expression, assuming that an initial '(' has
+ /// already been consumed.
+ ///
+ /// \param Res - The value of the expression. The result is undefined
+ /// on error.
+ /// \return - False on success.
+ virtual bool parseParenExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0;
+
+ /// \brief Parse an expression which must evaluate to an absolute value.
+ ///
+ /// \param Res - The value of the absolute expression. The result is undefined
+ /// on error.
+ /// \return - False on success.
+ virtual bool parseAbsoluteExpression(int64_t &Res) = 0;
+
+ /// \brief Ensure that we have a valid section set in the streamer. Otherwise,
+ /// report an error and switch to .text.
+ /// \return - False on success.
+ virtual bool checkForValidSection() = 0;
+
+ /// \brief Parse an arbitrary expression of a specified parenthesis depth,
+ /// assuming that the initial '(' characters have already been consumed.
+ ///
+ /// \param ParenDepth - Specifies how many trailing expressions outside the
+ /// current parentheses we have to parse.
+ /// \param Res - The value of the expression. The result is undefined
+ /// on error.
+ /// \return - False on success.
+ virtual bool parseParenExprOfDepth(unsigned ParenDepth, const MCExpr *&Res,
+ SMLoc &EndLoc) = 0;
+};
+
+/// \brief Create an MCAsmParser instance.
+MCAsmParser *createMCAsmParser(SourceMgr &, MCContext &, MCStreamer &,
+ const MCAsmInfo &, unsigned CB = 0);
+
+} // end namespace llvm
+
+#endif // LLVM_MC_MCPARSER_MCASMPARSER_H
diff --git a/linux-x64/clang/include/llvm/MC/MCParser/MCAsmParserExtension.h b/linux-x64/clang/include/llvm/MC/MCParser/MCAsmParserExtension.h
new file mode 100644
index 0000000..ffb8d7a
--- /dev/null
+++ b/linux-x64/clang/include/llvm/MC/MCParser/MCAsmParserExtension.h
@@ -0,0 +1,121 @@
+//===- llvm/MC/MCAsmParserExtension.h - Asm Parser Hooks --------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_MC_MCPARSER_MCASMPARSEREXTENSION_H
+#define LLVM_MC_MCPARSER_MCASMPARSEREXTENSION_H
+
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/MC/MCParser/MCAsmLexer.h"
+#include "llvm/MC/MCParser/MCAsmParser.h"
+#include "llvm/Support/SMLoc.h"
+
+namespace llvm {
+
+class Twine;
+
+/// \brief Generic interface for extending the MCAsmParser,
+/// which is implemented by target and object file assembly parser
+/// implementations.
+class MCAsmParserExtension {
+ MCAsmParser *Parser;
+
+protected:
+ MCAsmParserExtension();
+
+ // Helper template for implementing static dispatch functions.
+ template<typename T, bool (T::*Handler)(StringRef, SMLoc)>
+ static bool HandleDirective(MCAsmParserExtension *Target,
+ StringRef Directive,
+ SMLoc DirectiveLoc) {
+ T *Obj = static_cast<T*>(Target);
+ return (Obj->*Handler)(Directive, DirectiveLoc);
+ }
+
+ bool BracketExpressionsSupported = false;
+
+public:
+ MCAsmParserExtension(const MCAsmParserExtension &) = delete;
+ MCAsmParserExtension &operator=(const MCAsmParserExtension &) = delete;
+ virtual ~MCAsmParserExtension();
+
+ /// \brief Initialize the extension for parsing using the given \p Parser.
+ /// The extension should use the AsmParser interfaces to register its
+ /// parsing routines.
+ virtual void Initialize(MCAsmParser &Parser);
+
+ /// \name MCAsmParser Proxy Interfaces
+ /// @{
+
+ MCContext &getContext() { return getParser().getContext(); }
+
+ MCAsmLexer &getLexer() { return getParser().getLexer(); }
+ const MCAsmLexer &getLexer() const {
+ return const_cast<MCAsmParserExtension *>(this)->getLexer();
+ }
+
+ MCAsmParser &getParser() { return *Parser; }
+ const MCAsmParser &getParser() const {
+ return const_cast<MCAsmParserExtension*>(this)->getParser();
+ }
+
+ SourceMgr &getSourceManager() { return getParser().getSourceManager(); }
+ MCStreamer &getStreamer() { return getParser().getStreamer(); }
+
+ bool Warning(SMLoc L, const Twine &Msg) {
+ return getParser().Warning(L, Msg);
+ }
+
+ bool Error(SMLoc L, const Twine &Msg, SMRange Range = SMRange()) {
+ return getParser().Error(L, Msg, Range);
+ }
+
+ void Note(SMLoc L, const Twine &Msg) {
+ getParser().Note(L, Msg);
+ }
+
+ bool TokError(const Twine &Msg) {
+ return getParser().TokError(Msg);
+ }
+
+ const AsmToken &Lex() { return getParser().Lex(); }
+ const AsmToken &getTok() { return getParser().getTok(); }
+ bool parseToken(AsmToken::TokenKind T,
+ const Twine &Msg = "unexpected token") {
+ return getParser().parseToken(T, Msg);
+ }
+
+ bool parseMany(function_ref<bool()> parseOne, bool hasComma = true) {
+ return getParser().parseMany(parseOne, hasComma);
+ }
+
+ bool parseOptionalToken(AsmToken::TokenKind T) {
+ return getParser().parseOptionalToken(T);
+ }
+
+ bool check(bool P, const Twine &Msg) {
+ return getParser().check(P, Msg);
+ }
+
+ bool check(bool P, SMLoc Loc, const Twine &Msg) {
+ return getParser().check(P, Loc, Msg);
+ }
+
+ bool addErrorSuffix(const Twine &Suffix) {
+ return getParser().addErrorSuffix(Suffix);
+ }
+
+ bool HasBracketExpressions() const { return BracketExpressionsSupported; }
+
+ /// @}
+};
+
+} // end namespace llvm
+
+#endif // LLVM_MC_MCPARSER_MCASMPARSEREXTENSION_H
diff --git a/linux-x64/clang/include/llvm/MC/MCParser/MCAsmParserUtils.h b/linux-x64/clang/include/llvm/MC/MCParser/MCAsmParserUtils.h
new file mode 100644
index 0000000..84173bb
--- /dev/null
+++ b/linux-x64/clang/include/llvm/MC/MCParser/MCAsmParserUtils.h
@@ -0,0 +1,34 @@
+//===- llvm/MC/MCAsmParserUtils.h - Asm Parser Utilities --------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_MC_MCPARSER_MCASMPARSERUTILS_H
+#define LLVM_MC_MCPARSER_MCASMPARSERUTILS_H
+
+namespace llvm {
+
+class MCAsmParser;
+class MCExpr;
+class MCSymbol;
+class StringRef;
+
+namespace MCParserUtils {
+
+/// Parse a value expression and return whether it can be assigned to a symbol
+/// with the given name.
+///
+/// On success, returns false and sets the Symbol and Value output parameters.
+bool parseAssignmentExpression(StringRef Name, bool allow_redef,
+ MCAsmParser &Parser, MCSymbol *&Symbol,
+ const MCExpr *&Value);
+
+} // namespace MCParserUtils
+
+} // namespace llvm
+
+#endif // LLVM_MC_MCPARSER_MCASMPARSERUTILS_H
diff --git a/linux-x64/clang/include/llvm/MC/MCParser/MCParsedAsmOperand.h b/linux-x64/clang/include/llvm/MC/MCParser/MCParsedAsmOperand.h
new file mode 100644
index 0000000..4af76ac
--- /dev/null
+++ b/linux-x64/clang/include/llvm/MC/MCParser/MCParsedAsmOperand.h
@@ -0,0 +1,100 @@
+//===- llvm/MC/MCParsedAsmOperand.h - Asm Parser Operand --------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_MC_MCPARSER_MCPARSEDASMOPERAND_H
+#define LLVM_MC_MCPARSER_MCPARSEDASMOPERAND_H
+
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/SMLoc.h"
+#include <string>
+
+namespace llvm {
+
+class raw_ostream;
+
+/// MCParsedAsmOperand - This abstract class represents a source-level assembly
+/// instruction operand. It should be subclassed by target-specific code. This
+/// base class is used by target-independent clients and is the interface
+/// between parsing an asm instruction and recognizing it.
+class MCParsedAsmOperand {
+ /// MCOperandNum - The corresponding MCInst operand number. Only valid when
+ /// parsing MS-style inline assembly.
+ unsigned MCOperandNum;
+
+ /// Constraint - The constraint on this operand. Only valid when parsing
+ /// MS-style inline assembly.
+ std::string Constraint;
+
+protected:
+ // This only seems to need to be movable (by ARMOperand) but ARMOperand has
+ // lots of members and MSVC doesn't support defaulted move ops, so to avoid
+ // that verbosity, just rely on defaulted copy ops. It's only the Constraint
+ // string member that would benefit from movement anyway.
+ MCParsedAsmOperand() = default;
+ MCParsedAsmOperand(const MCParsedAsmOperand &RHS) = default;
+ MCParsedAsmOperand &operator=(const MCParsedAsmOperand &) = default;
+
+public:
+ virtual ~MCParsedAsmOperand() = default;
+
+ void setConstraint(StringRef C) { Constraint = C.str(); }
+ StringRef getConstraint() { return Constraint; }
+
+ void setMCOperandNum (unsigned OpNum) { MCOperandNum = OpNum; }
+ unsigned getMCOperandNum() { return MCOperandNum; }
+
+ virtual StringRef getSymName() { return StringRef(); }
+ virtual void *getOpDecl() { return nullptr; }
+
+ /// isToken - Is this a token operand?
+ virtual bool isToken() const = 0;
+ /// isImm - Is this an immediate operand?
+ virtual bool isImm() const = 0;
+ /// isReg - Is this a register operand?
+ virtual bool isReg() const = 0;
+ virtual unsigned getReg() const = 0;
+
+ /// isMem - Is this a memory operand?
+ virtual bool isMem() const = 0;
+
+ /// getStartLoc - Get the location of the first token of this operand.
+ virtual SMLoc getStartLoc() const = 0;
+ /// getEndLoc - Get the location of the last token of this operand.
+ virtual SMLoc getEndLoc() const = 0;
+
+ /// needAddressOf - Do we need to emit code to get the address of the
+ /// variable/label? Only valid when parsing MS-style inline assembly.
+ virtual bool needAddressOf() const { return false; }
+
+ /// isOffsetOf - Do we need to emit code to get the offset of the variable,
+ /// rather then the value of the variable? Only valid when parsing MS-style
+ /// inline assembly.
+ virtual bool isOffsetOf() const { return false; }
+
+ /// getOffsetOfLoc - Get the location of the offset operator.
+ virtual SMLoc getOffsetOfLoc() const { return SMLoc(); }
+
+ /// print - Print a debug representation of the operand to the given stream.
+ virtual void print(raw_ostream &OS) const = 0;
+
+ /// dump - Print to the debug stream.
+ virtual void dump() const;
+};
+
+//===----------------------------------------------------------------------===//
+// Debugging Support
+
+inline raw_ostream& operator<<(raw_ostream &OS, const MCParsedAsmOperand &MO) {
+ MO.print(OS);
+ return OS;
+}
+
+} // end namespace llvm
+
+#endif // LLVM_MC_MCPARSER_MCPARSEDASMOPERAND_H
diff --git a/linux-x64/clang/include/llvm/MC/MCParser/MCTargetAsmParser.h b/linux-x64/clang/include/llvm/MC/MCParser/MCTargetAsmParser.h
new file mode 100644
index 0000000..d628794
--- /dev/null
+++ b/linux-x64/clang/include/llvm/MC/MCParser/MCTargetAsmParser.h
@@ -0,0 +1,432 @@
+//===- llvm/MC/MCTargetAsmParser.h - Target Assembly Parser -----*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_MC_MCPARSER_MCTARGETASMPARSER_H
+#define LLVM_MC_MCPARSER_MCTARGETASMPARSER_H
+
+#include "llvm/ADT/StringRef.h"
+#include "llvm/MC/MCExpr.h"
+#include "llvm/MC/MCInstrInfo.h"
+#include "llvm/MC/MCParser/MCAsmLexer.h"
+#include "llvm/MC/MCParser/MCAsmParserExtension.h"
+#include "llvm/MC/MCTargetOptions.h"
+#include "llvm/Support/SMLoc.h"
+#include <cstdint>
+#include <memory>
+
+namespace llvm {
+
+class MCInst;
+class MCParsedAsmOperand;
+class MCStreamer;
+class MCSubtargetInfo;
+template <typename T> class SmallVectorImpl;
+
+using OperandVector = SmallVectorImpl<std::unique_ptr<MCParsedAsmOperand>>;
+
+enum AsmRewriteKind {
+ AOK_Align, // Rewrite align as .align.
+ AOK_EVEN, // Rewrite even as .even.
+ AOK_Emit, // Rewrite _emit as .byte.
+ AOK_Input, // Rewrite in terms of $N.
+ AOK_Output, // Rewrite in terms of $N.
+ AOK_SizeDirective, // Add a sizing directive (e.g., dword ptr).
+ AOK_Label, // Rewrite local labels.
+ AOK_EndOfStatement, // Add EndOfStatement (e.g., "\n\t").
+ AOK_Skip, // Skip emission (e.g., offset/type operators).
+ AOK_IntelExpr // SizeDirective SymDisp [BaseReg + IndexReg * Scale + ImmDisp]
+};
+
+const char AsmRewritePrecedence [] = {
+ 2, // AOK_Align
+ 2, // AOK_EVEN
+ 2, // AOK_Emit
+ 3, // AOK_Input
+ 3, // AOK_Output
+ 5, // AOK_SizeDirective
+ 1, // AOK_Label
+ 5, // AOK_EndOfStatement
+ 2, // AOK_Skip
+ 2 // AOK_IntelExpr
+};
+
+// Represnt the various parts which makes up an intel expression,
+// used for emitting compound intel expressions
+struct IntelExpr {
+ bool NeedBracs;
+ int64_t Imm;
+ StringRef BaseReg;
+ StringRef IndexReg;
+ unsigned Scale;
+
+ IntelExpr(bool needBracs = false) : NeedBracs(needBracs), Imm(0),
+ BaseReg(StringRef()), IndexReg(StringRef()),
+ Scale(1) {}
+ // Compund immediate expression
+ IntelExpr(int64_t imm, bool needBracs) : IntelExpr(needBracs) {
+ Imm = imm;
+ }
+ // [Reg + ImmediateExpression]
+ // We don't bother to emit an immediate expression evaluated to zero
+ IntelExpr(StringRef reg, int64_t imm = 0, unsigned scale = 0,
+ bool needBracs = true) :
+ IntelExpr(imm, needBracs) {
+ IndexReg = reg;
+ if (scale)
+ Scale = scale;
+ }
+ // [BaseReg + IndexReg * ScaleExpression + ImmediateExpression]
+ IntelExpr(StringRef baseReg, StringRef indexReg, unsigned scale = 0,
+ int64_t imm = 0, bool needBracs = true) :
+ IntelExpr(indexReg, imm, scale, needBracs) {
+ BaseReg = baseReg;
+ }
+ bool hasBaseReg() const {
+ return BaseReg.size();
+ }
+ bool hasIndexReg() const {
+ return IndexReg.size();
+ }
+ bool hasRegs() const {
+ return hasBaseReg() || hasIndexReg();
+ }
+ bool isValid() const {
+ return (Scale == 1) ||
+ (hasIndexReg() && (Scale == 2 || Scale == 4 || Scale == 8));
+ }
+};
+
+struct AsmRewrite {
+ AsmRewriteKind Kind;
+ SMLoc Loc;
+ unsigned Len;
+ int64_t Val;
+ StringRef Label;
+ IntelExpr IntelExp;
+
+public:
+ AsmRewrite(AsmRewriteKind kind, SMLoc loc, unsigned len = 0, int64_t val = 0)
+ : Kind(kind), Loc(loc), Len(len), Val(val) {}
+ AsmRewrite(AsmRewriteKind kind, SMLoc loc, unsigned len, StringRef label)
+ : AsmRewrite(kind, loc, len) { Label = label; }
+ AsmRewrite(SMLoc loc, unsigned len, IntelExpr exp)
+ : AsmRewrite(AOK_IntelExpr, loc, len) { IntelExp = exp; }
+};
+
+struct ParseInstructionInfo {
+ SmallVectorImpl<AsmRewrite> *AsmRewrites = nullptr;
+
+ ParseInstructionInfo() = default;
+ ParseInstructionInfo(SmallVectorImpl<AsmRewrite> *rewrites)
+ : AsmRewrites(rewrites) {}
+};
+
+enum OperandMatchResultTy {
+ MatchOperand_Success, // operand matched successfully
+ MatchOperand_NoMatch, // operand did not match
+ MatchOperand_ParseFail // operand matched but had errors
+};
+
+// When matching of an assembly instruction fails, there may be multiple
+// encodings that are close to being a match. It's often ambiguous which one
+// the programmer intended to use, so we want to report an error which mentions
+// each of these "near-miss" encodings. This struct contains information about
+// one such encoding, and why it did not match the parsed instruction.
+class NearMissInfo {
+public:
+ enum NearMissKind {
+ NoNearMiss,
+ NearMissOperand,
+ NearMissFeature,
+ NearMissPredicate,
+ NearMissTooFewOperands,
+ };
+
+ // The encoding is valid for the parsed assembly string. This is only used
+ // internally to the table-generated assembly matcher.
+ static NearMissInfo getSuccess() { return NearMissInfo(); }
+
+ // The instruction encoding is not valid because it requires some target
+ // features that are not currently enabled. MissingFeatures has a bit set for
+ // each feature that the encoding needs but which is not enabled.
+ static NearMissInfo getMissedFeature(uint64_t MissingFeatures) {
+ NearMissInfo Result;
+ Result.Kind = NearMissFeature;
+ Result.Features = MissingFeatures;
+ return Result;
+ }
+
+ // The instruction encoding is not valid because the target-specific
+ // predicate function returned an error code. FailureCode is the
+ // target-specific error code returned by the predicate.
+ static NearMissInfo getMissedPredicate(unsigned FailureCode) {
+ NearMissInfo Result;
+ Result.Kind = NearMissPredicate;
+ Result.PredicateError = FailureCode;
+ return Result;
+ }
+
+ // The instruction encoding is not valid because one (and only one) parsed
+ // operand is not of the correct type. OperandError is the error code
+ // relating to the operand class expected by the encoding. OperandClass is
+ // the type of the expected operand. Opcode is the opcode of the encoding.
+ // OperandIndex is the index into the parsed operand list.
+ static NearMissInfo getMissedOperand(unsigned OperandError,
+ unsigned OperandClass, unsigned Opcode,
+ unsigned OperandIndex) {
+ NearMissInfo Result;
+ Result.Kind = NearMissOperand;
+ Result.MissedOperand.Error = OperandError;
+ Result.MissedOperand.Class = OperandClass;
+ Result.MissedOperand.Opcode = Opcode;
+ Result.MissedOperand.Index = OperandIndex;
+ return Result;
+ }
+
+ // The instruction encoding is not valid because it expects more operands
+ // than were parsed. OperandClass is the class of the expected operand that
+ // was not provided. Opcode is the instruction encoding.
+ static NearMissInfo getTooFewOperands(unsigned OperandClass,
+ unsigned Opcode) {
+ NearMissInfo Result;
+ Result.Kind = NearMissTooFewOperands;
+ Result.TooFewOperands.Class = OperandClass;
+ Result.TooFewOperands.Opcode = Opcode;
+ return Result;
+ }
+
+ operator bool() const { return Kind != NoNearMiss; }
+
+ NearMissKind getKind() const { return Kind; }
+
+ // Feature flags required by the instruction, that the current target does
+ // not have.
+ uint64_t getFeatures() const {
+ assert(Kind == NearMissFeature);
+ return Features;
+ }
+ // Error code returned by the target predicate when validating this
+ // instruction encoding.
+ unsigned getPredicateError() const {
+ assert(Kind == NearMissPredicate);
+ return PredicateError;
+ }
+ // MatchClassKind of the operand that we expected to see.
+ unsigned getOperandClass() const {
+ assert(Kind == NearMissOperand || Kind == NearMissTooFewOperands);
+ return MissedOperand.Class;
+ }
+ // Opcode of the encoding we were trying to match.
+ unsigned getOpcode() const {
+ assert(Kind == NearMissOperand || Kind == NearMissTooFewOperands);
+ return MissedOperand.Opcode;
+ }
+ // Error code returned when validating the operand.
+ unsigned getOperandError() const {
+ assert(Kind == NearMissOperand);
+ return MissedOperand.Error;
+ }
+ // Index of the actual operand we were trying to match in the list of parsed
+ // operands.
+ unsigned getOperandIndex() const {
+ assert(Kind == NearMissOperand);
+ return MissedOperand.Index;
+ }
+
+private:
+ NearMissKind Kind;
+
+ // These two structs share a common prefix, so we can safely rely on the fact
+ // that they overlap in the union.
+ struct MissedOpInfo {
+ unsigned Class;
+ unsigned Opcode;
+ unsigned Error;
+ unsigned Index;
+ };
+
+ struct TooFewOperandsInfo {
+ unsigned Class;
+ unsigned Opcode;
+ };
+
+ union {
+ uint64_t Features;
+ unsigned PredicateError;
+ MissedOpInfo MissedOperand;
+ TooFewOperandsInfo TooFewOperands;
+ };
+
+ NearMissInfo() : Kind(NoNearMiss) {}
+};
+
+/// MCTargetAsmParser - Generic interface to target specific assembly parsers.
+class MCTargetAsmParser : public MCAsmParserExtension {
+public:
+ enum MatchResultTy {
+ Match_InvalidOperand,
+ Match_InvalidTiedOperand,
+ Match_MissingFeature,
+ Match_MnemonicFail,
+ Match_Success,
+ Match_NearMisses,
+ FIRST_TARGET_MATCH_RESULT_TY
+ };
+
+protected: // Can only create subclasses.
+ MCTargetAsmParser(MCTargetOptions const &, const MCSubtargetInfo &STI,
+ const MCInstrInfo &MII);
+
+ /// Create a copy of STI and return a non-const reference to it.
+ MCSubtargetInfo ©STI();
+
+ /// AvailableFeatures - The current set of available features.
+ uint64_t AvailableFeatures = 0;
+
+ /// ParsingInlineAsm - Are we parsing ms-style inline assembly?
+ bool ParsingInlineAsm = false;
+
+ /// SemaCallback - The Sema callback implementation. Must be set when parsing
+ /// ms-style inline assembly.
+ MCAsmParserSemaCallback *SemaCallback;
+
+ /// Set of options which affects instrumentation of inline assembly.
+ MCTargetOptions MCOptions;
+
+ /// Current STI.
+ const MCSubtargetInfo *STI;
+
+ const MCInstrInfo &MII;
+
+public:
+ MCTargetAsmParser(const MCTargetAsmParser &) = delete;
+ MCTargetAsmParser &operator=(const MCTargetAsmParser &) = delete;
+
+ ~MCTargetAsmParser() override;
+
+ const MCSubtargetInfo &getSTI() const;
+
+ uint64_t getAvailableFeatures() const { return AvailableFeatures; }
+ void setAvailableFeatures(uint64_t Value) { AvailableFeatures = Value; }
+
+ bool isParsingInlineAsm () { return ParsingInlineAsm; }
+ void setParsingInlineAsm (bool Value) { ParsingInlineAsm = Value; }
+
+ MCTargetOptions getTargetOptions() const { return MCOptions; }
+
+ void setSemaCallback(MCAsmParserSemaCallback *Callback) {
+ SemaCallback = Callback;
+ }
+
+ virtual bool ParseRegister(unsigned &RegNo, SMLoc &StartLoc,
+ SMLoc &EndLoc) = 0;
+
+ /// Sets frame register corresponding to the current MachineFunction.
+ virtual void SetFrameRegister(unsigned RegNo) {}
+
+ /// ParseInstruction - Parse one assembly instruction.
+ ///
+ /// The parser is positioned following the instruction name. The target
+ /// specific instruction parser should parse the entire instruction and
+ /// construct the appropriate MCInst, or emit an error. On success, the entire
+ /// line should be parsed up to and including the end-of-statement token. On
+ /// failure, the parser is not required to read to the end of the line.
+ //
+ /// \param Name - The instruction name.
+ /// \param NameLoc - The source location of the name.
+ /// \param Operands [out] - The list of parsed operands, this returns
+ /// ownership of them to the caller.
+ /// \return True on failure.
+ virtual bool ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
+ SMLoc NameLoc, OperandVector &Operands) = 0;
+ virtual bool ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
+ AsmToken Token, OperandVector &Operands) {
+ return ParseInstruction(Info, Name, Token.getLoc(), Operands);
+ }
+
+ /// ParseDirective - Parse a target specific assembler directive
+ ///
+ /// The parser is positioned following the directive name. The target
+ /// specific directive parser should parse the entire directive doing or
+ /// recording any target specific work, or return true and do nothing if the
+ /// directive is not target specific. If the directive is specific for
+ /// the target, the entire line is parsed up to and including the
+ /// end-of-statement token and false is returned.
+ ///
+ /// \param DirectiveID - the identifier token of the directive.
+ virtual bool ParseDirective(AsmToken DirectiveID) = 0;
+
+ /// MatchAndEmitInstruction - Recognize a series of operands of a parsed
+ /// instruction as an actual MCInst and emit it to the specified MCStreamer.
+ /// This returns false on success and returns true on failure to match.
+ ///
+ /// On failure, the target parser is responsible for emitting a diagnostic
+ /// explaining the match failure.
+ virtual bool MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
+ OperandVector &Operands, MCStreamer &Out,
+ uint64_t &ErrorInfo,
+ bool MatchingInlineAsm) = 0;
+
+ /// Allows targets to let registers opt out of clobber lists.
+ virtual bool OmitRegisterFromClobberLists(unsigned RegNo) { return false; }
+
+ /// Allow a target to add special case operand matching for things that
+ /// tblgen doesn't/can't handle effectively. For example, literal
+ /// immediates on ARM. TableGen expects a token operand, but the parser
+ /// will recognize them as immediates.
+ virtual unsigned validateTargetOperandClass(MCParsedAsmOperand &Op,
+ unsigned Kind) {
+ return Match_InvalidOperand;
+ }
+
+ /// Validate the instruction match against any complex target predicates
+ /// before rendering any operands to it.
+ virtual unsigned
+ checkEarlyTargetMatchPredicate(MCInst &Inst, const OperandVector &Operands) {
+ return Match_Success;
+ }
+
+ /// checkTargetMatchPredicate - Validate the instruction match against
+ /// any complex target predicates not expressible via match classes.
+ virtual unsigned checkTargetMatchPredicate(MCInst &Inst) {
+ return Match_Success;
+ }
+
+ virtual void convertToMapAndConstraints(unsigned Kind,
+ const OperandVector &Operands) = 0;
+
+ // Return whether this parser uses assignment statements with equals tokens
+ virtual bool equalIsAsmAssignment() { return true; };
+ // Return whether this start of statement identifier is a label
+ virtual bool isLabel(AsmToken &Token) { return true; };
+ // Return whether this parser accept star as start of statement
+ virtual bool starIsStartOfStatement() { return false; };
+
+ virtual const MCExpr *applyModifierToExpr(const MCExpr *E,
+ MCSymbolRefExpr::VariantKind,
+ MCContext &Ctx) {
+ return nullptr;
+ }
+
+ virtual void onLabelParsed(MCSymbol *Symbol) {}
+
+ /// Ensure that all previously parsed instructions have been emitted to the
+ /// output streamer, if the target does not emit them immediately.
+ virtual void flushPendingInstructions(MCStreamer &Out) {}
+
+ virtual const MCExpr *createTargetUnaryExpr(const MCExpr *E,
+ AsmToken::TokenKind OperatorToken,
+ MCContext &Ctx) {
+ return nullptr;
+ }
+};
+
+} // end namespace llvm
+
+#endif // LLVM_MC_MCPARSER_MCTARGETASMPARSER_H