initial
This commit is contained in:
40
thirdparty/clang/include/llvm/MC/MCParser/AsmCond.h
vendored
Normal file
40
thirdparty/clang/include/llvm/MC/MCParser/AsmCond.h
vendored
Normal file
@@ -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;
|
||||
bool CondMet;
|
||||
bool Ignore;
|
||||
|
||||
AsmCond() : TheCond(NoCond), CondMet(false), Ignore(false) {}
|
||||
};
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
70
thirdparty/clang/include/llvm/MC/MCParser/AsmLexer.h
vendored
Normal file
70
thirdparty/clang/include/llvm/MC/MCParser/AsmLexer.h
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
//===- 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 "llvm/Support/DataTypes.h"
|
||||
#include <string>
|
||||
|
||||
namespace llvm {
|
||||
class MemoryBuffer;
|
||||
class MCAsmInfo;
|
||||
|
||||
/// AsmLexer - Lexer class for assembly files.
|
||||
class AsmLexer : public MCAsmLexer {
|
||||
const MCAsmInfo &MAI;
|
||||
|
||||
const char *CurPtr;
|
||||
const MemoryBuffer *CurBuf;
|
||||
bool isAtStartOfLine;
|
||||
|
||||
void operator=(const AsmLexer&) LLVM_DELETED_FUNCTION;
|
||||
AsmLexer(const AsmLexer&) LLVM_DELETED_FUNCTION;
|
||||
|
||||
protected:
|
||||
/// LexToken - Read the next token and return its code.
|
||||
virtual AsmToken LexToken();
|
||||
|
||||
public:
|
||||
AsmLexer(const MCAsmInfo &MAI);
|
||||
~AsmLexer();
|
||||
|
||||
void setBuffer(const MemoryBuffer *buf, const char *ptr = NULL);
|
||||
|
||||
virtual StringRef LexUntilEndOfStatement();
|
||||
StringRef LexUntilEndOfLine();
|
||||
|
||||
bool isAtStartOfComment(char Char);
|
||||
bool isAtStatementSeparator(const char *Ptr);
|
||||
|
||||
const MCAsmInfo &getMAI() const { return MAI; }
|
||||
|
||||
private:
|
||||
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();
|
||||
};
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
177
thirdparty/clang/include/llvm/MC/MCParser/MCAsmLexer.h
vendored
Normal file
177
thirdparty/clang/include/llvm/MC/MCParser/MCAsmLexer.h
vendored
Normal file
@@ -0,0 +1,177 @@
|
||||
//===-- 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/StringRef.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/DataTypes.h"
|
||||
#include "llvm/Support/SMLoc.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
/// AsmToken - Target independent representation for an assembler token.
|
||||
class AsmToken {
|
||||
public:
|
||||
enum TokenKind {
|
||||
// Markers
|
||||
Eof, Error,
|
||||
|
||||
// String values.
|
||||
Identifier,
|
||||
String,
|
||||
|
||||
// Integer values.
|
||||
Integer,
|
||||
|
||||
// Real values.
|
||||
Real,
|
||||
|
||||
// No-value.
|
||||
EndOfStatement,
|
||||
Colon,
|
||||
Space,
|
||||
Plus, Minus, Tilde,
|
||||
Slash, // '/'
|
||||
BackSlash, // '\'
|
||||
LParen, RParen, LBrac, RBrac, LCurly, RCurly,
|
||||
Star, Dot, Comma, Dollar, Equal, EqualEqual,
|
||||
|
||||
Pipe, PipePipe, Caret,
|
||||
Amp, AmpAmp, Exclaim, ExclaimEqual, Percent, Hash,
|
||||
Less, LessEqual, LessLess, LessGreater,
|
||||
Greater, GreaterEqual, GreaterGreater, At
|
||||
};
|
||||
|
||||
private:
|
||||
TokenKind Kind;
|
||||
|
||||
/// A reference to the entire token contents; this is always a pointer into
|
||||
/// a memory buffer owned by the source manager.
|
||||
StringRef Str;
|
||||
|
||||
int64_t IntVal;
|
||||
|
||||
public:
|
||||
AsmToken() {}
|
||||
AsmToken(TokenKind _Kind, StringRef _Str, int64_t _IntVal = 0)
|
||||
: Kind(_Kind), Str(_Str), IntVal(_IntVal) {}
|
||||
|
||||
TokenKind getKind() const { return Kind; }
|
||||
bool is(TokenKind K) const { return Kind == K; }
|
||||
bool isNot(TokenKind K) const { return Kind != K; }
|
||||
|
||||
SMLoc getLoc() const;
|
||||
SMLoc getEndLoc() const;
|
||||
|
||||
/// getStringContents - Get the contents of a string token (without quotes).
|
||||
StringRef getStringContents() const {
|
||||
assert(Kind == String && "This token isn't a string!");
|
||||
return Str.slice(1, Str.size() - 1);
|
||||
}
|
||||
|
||||
/// getIdentifier - Get the identifier string for the current token, which
|
||||
/// should be an identifier or a string. This gets the portion of the string
|
||||
/// which should be used as the identifier, e.g., it does not include the
|
||||
/// quotes on strings.
|
||||
StringRef getIdentifier() const {
|
||||
if (Kind == Identifier)
|
||||
return getString();
|
||||
return getStringContents();
|
||||
}
|
||||
|
||||
/// getString - Get the string for the current token, this includes all
|
||||
/// characters (for example, the quotes on strings) in the token.
|
||||
///
|
||||
/// The returned StringRef points into the source manager's memory buffer, and
|
||||
/// is safe to store across calls to Lex().
|
||||
StringRef getString() const { return Str; }
|
||||
|
||||
// FIXME: Don't compute this in advance, it makes every token larger, and is
|
||||
// also not generally what we want (it is nicer for recovery etc. to lex 123br
|
||||
// as a single token, then diagnose as an invalid number).
|
||||
int64_t getIntVal() const {
|
||||
assert(Kind == Integer && "This token isn't an integer!");
|
||||
return IntVal;
|
||||
}
|
||||
};
|
||||
|
||||
/// MCAsmLexer - Generic assembler lexer interface, for use by target specific
|
||||
/// assembly lexers.
|
||||
class MCAsmLexer {
|
||||
/// The current token, stored in the base class for faster access.
|
||||
AsmToken CurTok;
|
||||
|
||||
/// The location and description of the current error
|
||||
SMLoc ErrLoc;
|
||||
std::string Err;
|
||||
|
||||
MCAsmLexer(const MCAsmLexer &) LLVM_DELETED_FUNCTION;
|
||||
void operator=(const MCAsmLexer &) LLVM_DELETED_FUNCTION;
|
||||
protected: // Can only create subclasses.
|
||||
const char *TokStart;
|
||||
bool SkipSpace;
|
||||
|
||||
MCAsmLexer();
|
||||
|
||||
virtual AsmToken LexToken() = 0;
|
||||
|
||||
void SetError(const SMLoc &errLoc, const std::string &err) {
|
||||
ErrLoc = errLoc;
|
||||
Err = err;
|
||||
}
|
||||
|
||||
public:
|
||||
virtual ~MCAsmLexer();
|
||||
|
||||
/// Lex - 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() {
|
||||
return CurTok = LexToken();
|
||||
}
|
||||
|
||||
virtual StringRef LexUntilEndOfStatement() = 0;
|
||||
|
||||
/// getLoc - Get the current source location.
|
||||
SMLoc getLoc() const;
|
||||
|
||||
/// getTok - Get the current (last) lexed token.
|
||||
const AsmToken &getTok() {
|
||||
return CurTok;
|
||||
}
|
||||
|
||||
/// getErrLoc - Get the current error location
|
||||
const SMLoc &getErrLoc() {
|
||||
return ErrLoc;
|
||||
}
|
||||
|
||||
/// getErr - Get the current error string
|
||||
const std::string &getErr() {
|
||||
return Err;
|
||||
}
|
||||
|
||||
/// getKind - Get the kind of current token.
|
||||
AsmToken::TokenKind getKind() const { return CurTok.getKind(); }
|
||||
|
||||
/// is - Check if the current token has kind \p K.
|
||||
bool is(AsmToken::TokenKind K) const { return CurTok.is(K); }
|
||||
|
||||
/// isNot - Check if the current token has kind \p K.
|
||||
bool isNot(AsmToken::TokenKind K) const { return CurTok.isNot(K); }
|
||||
|
||||
/// setSkipSpace - Set whether spaces should be ignored by the lexer
|
||||
void setSkipSpace(bool val) { SkipSpace = val; }
|
||||
};
|
||||
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
199
thirdparty/clang/include/llvm/MC/MCParser/MCAsmParser.h
vendored
Normal file
199
thirdparty/clang/include/llvm/MC/MCParser/MCAsmParser.h
vendored
Normal file
@@ -0,0 +1,199 @@
|
||||
//===-- 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/ArrayRef.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/MC/MCParser/AsmLexer.h"
|
||||
#include "llvm/Support/DataTypes.h"
|
||||
|
||||
namespace llvm {
|
||||
class MCAsmInfo;
|
||||
class MCAsmLexer;
|
||||
class MCAsmParserExtension;
|
||||
class MCContext;
|
||||
class MCExpr;
|
||||
class MCInstPrinter;
|
||||
class MCInstrInfo;
|
||||
class MCStreamer;
|
||||
class MCTargetAsmParser;
|
||||
class SMLoc;
|
||||
class SMRange;
|
||||
class SourceMgr;
|
||||
class Twine;
|
||||
|
||||
/// MCAsmParserSemaCallback - Generic Sema callback for assembly parser.
|
||||
class MCAsmParserSemaCallback {
|
||||
public:
|
||||
typedef struct {
|
||||
bool IsVarDecl;
|
||||
unsigned Length, Size, Type;
|
||||
|
||||
void clear() {
|
||||
IsVarDecl = false;
|
||||
Length = 1;
|
||||
Size = 0;
|
||||
Type = 0;
|
||||
}
|
||||
} InlineAsmIdentifierInfo;
|
||||
|
||||
virtual ~MCAsmParserSemaCallback();
|
||||
virtual void *LookupInlineAsmIdentifier(StringRef &LineBuf,
|
||||
InlineAsmIdentifierInfo &Info) = 0;
|
||||
|
||||
virtual bool LookupInlineAsmField(StringRef Base, StringRef Member,
|
||||
unsigned &Offset) = 0;
|
||||
};
|
||||
|
||||
|
||||
/// MCAsmParser - Generic assembler parser interface, for use by target specific
|
||||
/// assembly parsers.
|
||||
class MCAsmParser {
|
||||
public:
|
||||
typedef bool (*DirectiveHandler)(MCAsmParserExtension*, StringRef, SMLoc);
|
||||
typedef std::pair<MCAsmParserExtension*, DirectiveHandler>
|
||||
ExtensionDirectiveHandler;
|
||||
|
||||
private:
|
||||
MCAsmParser(const MCAsmParser &) LLVM_DELETED_FUNCTION;
|
||||
void operator=(const MCAsmParser &) LLVM_DELETED_FUNCTION;
|
||||
|
||||
MCTargetAsmParser *TargetParser;
|
||||
|
||||
unsigned ShowParsedOperands : 1;
|
||||
|
||||
protected: // Can only create subclasses.
|
||||
MCAsmParser();
|
||||
|
||||
public:
|
||||
virtual ~MCAsmParser();
|
||||
|
||||
virtual void addDirectiveHandler(StringRef Directive,
|
||||
ExtensionDirectiveHandler Handler) = 0;
|
||||
|
||||
virtual SourceMgr &getSourceManager() = 0;
|
||||
|
||||
virtual MCAsmLexer &getLexer() = 0;
|
||||
|
||||
virtual MCContext &getContext() = 0;
|
||||
|
||||
/// getStreamer - 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; }
|
||||
|
||||
/// Run - 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;
|
||||
|
||||
/// parseMSInlineAsm - 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;
|
||||
|
||||
/// Warning - 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,
|
||||
ArrayRef<SMRange> Ranges = ArrayRef<SMRange>()) = 0;
|
||||
|
||||
/// Error - 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 Error(SMLoc L, const Twine &Msg,
|
||||
ArrayRef<SMRange> Ranges = ArrayRef<SMRange>()) = 0;
|
||||
|
||||
/// Lex - Get the next AsmToken in the stream, possibly handling file
|
||||
/// inclusion first.
|
||||
virtual const AsmToken &Lex() = 0;
|
||||
|
||||
/// getTok - Get the current AsmToken from the stream.
|
||||
const AsmToken &getTok();
|
||||
|
||||
/// \brief Report an error at the current lexer location.
|
||||
bool TokError(const Twine &Msg,
|
||||
ArrayRef<SMRange> Ranges = ArrayRef<SMRange>());
|
||||
|
||||
/// parseIdentifier - 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;
|
||||
|
||||
/// parseEscapedString - Parse the current token as a string which may include
|
||||
/// escaped characters and return the string contents.
|
||||
virtual bool parseEscapedString(std::string &Data) = 0;
|
||||
|
||||
/// eatToEndOfStatement - Skip to the end of the current statement, for error
|
||||
/// recovery.
|
||||
virtual void eatToEndOfStatement() = 0;
|
||||
|
||||
/// parseExpression - Parse an arbitrary expression.
|
||||
///
|
||||
/// @param Res - The value of the expression. The result is undefined
|
||||
/// on error.
|
||||
/// @result - False on success.
|
||||
virtual bool parseExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0;
|
||||
bool parseExpression(const MCExpr *&Res);
|
||||
|
||||
/// parsePrimaryExpr - Parse a primary expression.
|
||||
///
|
||||
/// @param Res - The value of the expression. The result is undefined
|
||||
/// on error.
|
||||
/// @result - False on success.
|
||||
virtual bool parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) = 0;
|
||||
|
||||
/// parseParenExpression - 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.
|
||||
/// @result - False on success.
|
||||
virtual bool parseParenExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0;
|
||||
|
||||
/// parseAbsoluteExpression - Parse an expression which must evaluate to an
|
||||
/// absolute value.
|
||||
///
|
||||
/// @param Res - The value of the absolute expression. The result is undefined
|
||||
/// on error.
|
||||
/// @result - False on success.
|
||||
virtual bool parseAbsoluteExpression(int64_t &Res) = 0;
|
||||
|
||||
/// checkForValidSection - Ensure that we have a valid section set in the
|
||||
/// streamer. Otherwise, report an error and switch to .text.
|
||||
virtual void checkForValidSection() = 0;
|
||||
};
|
||||
|
||||
/// \brief Create an MCAsmParser instance.
|
||||
MCAsmParser *createMCAsmParser(SourceMgr &, MCContext &,
|
||||
MCStreamer &, const MCAsmInfo &);
|
||||
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
80
thirdparty/clang/include/llvm/MC/MCParser/MCAsmParserExtension.h
vendored
Normal file
80
thirdparty/clang/include/llvm/MC/MCParser/MCAsmParserExtension.h
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
//===-- 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/StringRef.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 {
|
||||
MCAsmParserExtension(const MCAsmParserExtension &) LLVM_DELETED_FUNCTION;
|
||||
void operator=(const MCAsmParserExtension &) LLVM_DELETED_FUNCTION;
|
||||
|
||||
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;
|
||||
|
||||
public:
|
||||
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(); }
|
||||
MCAsmParser &getParser() { return *Parser; }
|
||||
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) {
|
||||
return getParser().Error(L, Msg);
|
||||
}
|
||||
bool TokError(const Twine &Msg) {
|
||||
return getParser().TokError(Msg);
|
||||
}
|
||||
|
||||
const AsmToken &Lex() { return getParser().Lex(); }
|
||||
|
||||
const AsmToken &getTok() { return getParser().getTok(); }
|
||||
|
||||
bool HasBracketExpressions() const { return BracketExpressionsSupported; }
|
||||
|
||||
/// @}
|
||||
};
|
||||
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
86
thirdparty/clang/include/llvm/MC/MCParser/MCParsedAsmOperand.h
vendored
Normal file
86
thirdparty/clang/include/llvm/MC/MCParser/MCParsedAsmOperand.h
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
//===-- 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
|
||||
|
||||
namespace llvm {
|
||||
class SMLoc;
|
||||
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;
|
||||
|
||||
public:
|
||||
MCParsedAsmOperand() {}
|
||||
virtual ~MCParsedAsmOperand() {}
|
||||
|
||||
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(); }
|
||||
|
||||
/// 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
|
||||
Reference in New Issue
Block a user