LLVM  8.0.1
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
llvm::MCTargetAsmParser Class Referenceabstract

MCTargetAsmParser - Generic interface to target specific assembly parsers. More...

#include "llvm/MC/MCParser/MCTargetAsmParser.h"

Inheritance diagram for llvm::MCTargetAsmParser:
Inheritance graph
[legend]
Collaboration diagram for llvm::MCTargetAsmParser:
Collaboration graph
[legend]

Public Types

enum  MatchResultTy {
  Match_InvalidOperand, Match_InvalidTiedOperand, Match_MissingFeature, Match_MnemonicFail,
  Match_Success, Match_NearMisses, FIRST_TARGET_MATCH_RESULT_TY
}
 

Public Member Functions

 MCTargetAsmParser (const MCTargetAsmParser &)=delete
 
MCTargetAsmParseroperator= (const MCTargetAsmParser &)=delete
 
 ~MCTargetAsmParser () override
 
const MCSubtargetInfogetSTI () const
 
uint64_t getAvailableFeatures () const
 
void setAvailableFeatures (uint64_t Value)
 
bool isParsingInlineAsm ()
 
void setParsingInlineAsm (bool Value)
 
MCTargetOptions getTargetOptions () const
 
void setSemaCallback (MCAsmParserSemaCallback *Callback)
 
virtual bool parsePrimaryExpr (const MCExpr *&Res, SMLoc &EndLoc)
 
virtual bool ParseRegister (unsigned &RegNo, SMLoc &StartLoc, SMLoc &EndLoc)=0
 
virtual void SetFrameRegister (unsigned RegNo)
 Sets frame register corresponding to the current MachineFunction. More...
 
virtual bool ParseInstruction (ParseInstructionInfo &Info, StringRef Name, SMLoc NameLoc, OperandVector &Operands)=0
 ParseInstruction - Parse one assembly instruction. More...
 
virtual bool ParseInstruction (ParseInstructionInfo &Info, StringRef Name, AsmToken Token, OperandVector &Operands)
 
virtual bool ParseDirective (AsmToken DirectiveID)=0
 ParseDirective - Parse a target specific assembler directive. More...
 
virtual bool MatchAndEmitInstruction (SMLoc IDLoc, unsigned &Opcode, OperandVector &Operands, MCStreamer &Out, uint64_t &ErrorInfo, bool MatchingInlineAsm)=0
 MatchAndEmitInstruction - Recognize a series of operands of a parsed instruction as an actual MCInst and emit it to the specified MCStreamer. More...
 
virtual bool OmitRegisterFromClobberLists (unsigned RegNo)
 Allows targets to let registers opt out of clobber lists. More...
 
virtual unsigned validateTargetOperandClass (MCParsedAsmOperand &Op, unsigned Kind)
 Allow a target to add special case operand matching for things that tblgen doesn't/can't handle effectively. More...
 
virtual unsigned checkEarlyTargetMatchPredicate (MCInst &Inst, const OperandVector &Operands)
 Validate the instruction match against any complex target predicates before rendering any operands to it. More...
 
virtual unsigned checkTargetMatchPredicate (MCInst &Inst)
 checkTargetMatchPredicate - Validate the instruction match against any complex target predicates not expressible via match classes. More...
 
virtual void convertToMapAndConstraints (unsigned Kind, const OperandVector &Operands)=0
 
virtual bool regsEqual (const MCParsedAsmOperand &Op1, const MCParsedAsmOperand &Op2) const
 Returns whether two registers are equal and is used by the tied-operands checks in the AsmMatcher. More...
 
virtual bool equalIsAsmAssignment ()
 
virtual bool isLabel (AsmToken &Token)
 
virtual bool starIsStartOfStatement ()
 
virtual const MCExprapplyModifierToExpr (const MCExpr *E, MCSymbolRefExpr::VariantKind, MCContext &Ctx)
 
virtual void doBeforeLabelEmit (MCSymbol *Symbol)
 
virtual void onLabelParsed (MCSymbol *Symbol)
 
virtual void flushPendingInstructions (MCStreamer &Out)
 Ensure that all previously parsed instructions have been emitted to the output streamer, if the target does not emit them immediately. More...
 
virtual const MCExprcreateTargetUnaryExpr (const MCExpr *E, AsmToken::TokenKind OperatorToken, MCContext &Ctx)
 
virtual void onEndOfFile ()
 
- Public Member Functions inherited from llvm::MCAsmParserExtension
 MCAsmParserExtension (const MCAsmParserExtension &)=delete
 
MCAsmParserExtensionoperator= (const MCAsmParserExtension &)=delete
 
virtual ~MCAsmParserExtension ()
 
virtual void Initialize (MCAsmParser &Parser)
 Initialize the extension for parsing using the given Parser. More...
 
MCContextgetContext ()
 
MCAsmLexergetLexer ()
 
const MCAsmLexergetLexer () const
 
MCAsmParsergetParser ()
 
const MCAsmParsergetParser () const
 
SourceMgrgetSourceManager ()
 
MCStreamergetStreamer ()
 
bool Warning (SMLoc L, const Twine &Msg)
 
bool Error (SMLoc L, const Twine &Msg, SMRange Range=SMRange())
 
void Note (SMLoc L, const Twine &Msg)
 
bool TokError (const Twine &Msg)
 
const AsmTokenLex ()
 
const AsmTokengetTok ()
 
bool parseToken (AsmToken::TokenKind T, const Twine &Msg="unexpected token")
 
bool parseMany (function_ref< bool()> parseOne, bool hasComma=true)
 
bool parseOptionalToken (AsmToken::TokenKind T)
 
bool check (bool P, const Twine &Msg)
 
bool check (bool P, SMLoc Loc, const Twine &Msg)
 
bool addErrorSuffix (const Twine &Suffix)
 
bool HasBracketExpressions () const
 

Protected Member Functions

 MCTargetAsmParser (MCTargetOptions const &, const MCSubtargetInfo &STI, const MCInstrInfo &MII)
 
MCSubtargetInfocopySTI ()
 Create a copy of STI and return a non-const reference to it. More...
 
- Protected Member Functions inherited from llvm::MCAsmParserExtension
 MCAsmParserExtension ()
 

Protected Attributes

uint64_t AvailableFeatures = 0
 AvailableFeatures - The current set of available features. More...
 
bool ParsingInlineAsm = false
 ParsingInlineAsm - Are we parsing ms-style inline assembly? More...
 
MCAsmParserSemaCallbackSemaCallback
 SemaCallback - The Sema callback implementation. More...
 
MCTargetOptions MCOptions
 Set of options which affects instrumentation of inline assembly. More...
 
const MCSubtargetInfoSTI
 Current STI. More...
 
const MCInstrInfoMII
 
- Protected Attributes inherited from llvm::MCAsmParserExtension
bool BracketExpressionsSupported = false
 

Additional Inherited Members

- Static Protected Member Functions inherited from llvm::MCAsmParserExtension
template<typename T , bool(T::*)(StringRef, SMLoc) Handler>
static bool HandleDirective (MCAsmParserExtension *Target, StringRef Directive, SMLoc DirectiveLoc)
 

Detailed Description

MCTargetAsmParser - Generic interface to target specific assembly parsers.

Definition at line 318 of file MCTargetAsmParser.h.

Member Enumeration Documentation

◆ MatchResultTy

Enumerator
Match_InvalidOperand 
Match_InvalidTiedOperand 
Match_MissingFeature 
Match_MnemonicFail 
Match_Success 
Match_NearMisses 
FIRST_TARGET_MATCH_RESULT_TY 

Definition at line 320 of file MCTargetAsmParser.h.

Constructor & Destructor Documentation

◆ MCTargetAsmParser() [1/2]

MCTargetAsmParser::MCTargetAsmParser ( MCTargetOptions const MCOptions,
const MCSubtargetInfo STI,
const MCInstrInfo MII 
)
protected

Definition at line 15 of file MCTargetAsmParser.cpp.

References ~MCTargetAsmParser().

◆ MCTargetAsmParser() [2/2]

llvm::MCTargetAsmParser::MCTargetAsmParser ( const MCTargetAsmParser )
delete

◆ ~MCTargetAsmParser()

MCTargetAsmParser::~MCTargetAsmParser ( )
overridedefault

Referenced by MCTargetAsmParser().

Member Function Documentation

◆ applyModifierToExpr()

virtual const MCExpr* llvm::MCTargetAsmParser::applyModifierToExpr ( const MCExpr E,
MCSymbolRefExpr::VariantKind  ,
MCContext Ctx 
)
inlinevirtual

Definition at line 473 of file MCTargetAsmParser.h.

◆ checkEarlyTargetMatchPredicate()

virtual unsigned llvm::MCTargetAsmParser::checkEarlyTargetMatchPredicate ( MCInst Inst,
const OperandVector Operands 
)
inlinevirtual

Validate the instruction match against any complex target predicates before rendering any operands to it.

Definition at line 444 of file MCTargetAsmParser.h.

◆ checkTargetMatchPredicate()

virtual unsigned llvm::MCTargetAsmParser::checkTargetMatchPredicate ( MCInst Inst)
inlinevirtual

checkTargetMatchPredicate - Validate the instruction match against any complex target predicates not expressible via match classes.

Definition at line 450 of file MCTargetAsmParser.h.

References Kind.

◆ convertToMapAndConstraints()

virtual void llvm::MCTargetAsmParser::convertToMapAndConstraints ( unsigned  Kind,
const OperandVector Operands 
)
pure virtual

◆ copySTI()

MCSubtargetInfo & MCTargetAsmParser::copySTI ( )
protected

Create a copy of STI and return a non-const reference to it.

Definition at line 22 of file MCTargetAsmParser.cpp.

References llvm::MCAsmParserExtension::getContext(), getSTI(), llvm::MCContext::getSubtargetCopy(), and STI.

◆ createTargetUnaryExpr()

virtual const MCExpr* llvm::MCTargetAsmParser::createTargetUnaryExpr ( const MCExpr E,
AsmToken::TokenKind  OperatorToken,
MCContext Ctx 
)
inlinevirtual

Definition at line 488 of file MCTargetAsmParser.h.

◆ doBeforeLabelEmit()

virtual void llvm::MCTargetAsmParser::doBeforeLabelEmit ( MCSymbol Symbol)
inlinevirtual

Definition at line 480 of file MCTargetAsmParser.h.

◆ equalIsAsmAssignment()

virtual bool llvm::MCTargetAsmParser::equalIsAsmAssignment ( )
inlinevirtual

Definition at line 467 of file MCTargetAsmParser.h.

◆ flushPendingInstructions()

virtual void llvm::MCTargetAsmParser::flushPendingInstructions ( MCStreamer Out)
inlinevirtual

Ensure that all previously parsed instructions have been emitted to the output streamer, if the target does not emit them immediately.

Definition at line 486 of file MCTargetAsmParser.h.

◆ getAvailableFeatures()

uint64_t llvm::MCTargetAsmParser::getAvailableFeatures ( ) const
inline

Definition at line 363 of file MCTargetAsmParser.h.

◆ getSTI()

const MCSubtargetInfo & MCTargetAsmParser::getSTI ( ) const

Definition at line 28 of file MCTargetAsmParser.cpp.

References STI.

Referenced by copySTI(), and isOperator().

◆ getTargetOptions()

MCTargetOptions llvm::MCTargetAsmParser::getTargetOptions ( ) const
inline

Definition at line 369 of file MCTargetAsmParser.h.

◆ isLabel()

virtual bool llvm::MCTargetAsmParser::isLabel ( AsmToken Token)
inlinevirtual

Definition at line 469 of file MCTargetAsmParser.h.

◆ isParsingInlineAsm()

bool llvm::MCTargetAsmParser::isParsingInlineAsm ( )
inline

Definition at line 366 of file MCTargetAsmParser.h.

◆ MatchAndEmitInstruction()

virtual bool llvm::MCTargetAsmParser::MatchAndEmitInstruction ( SMLoc  IDLoc,
unsigned Opcode,
OperandVector Operands,
MCStreamer Out,
uint64_t &  ErrorInfo,
bool  MatchingInlineAsm 
)
pure virtual

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.

◆ OmitRegisterFromClobberLists()

virtual bool llvm::MCTargetAsmParser::OmitRegisterFromClobberLists ( unsigned  RegNo)
inlinevirtual

Allows targets to let registers opt out of clobber lists.

Definition at line 430 of file MCTargetAsmParser.h.

◆ onEndOfFile()

virtual void llvm::MCTargetAsmParser::onEndOfFile ( )
inlinevirtual

Definition at line 495 of file MCTargetAsmParser.h.

◆ onLabelParsed()

virtual void llvm::MCTargetAsmParser::onLabelParsed ( MCSymbol Symbol)
inlinevirtual

Definition at line 482 of file MCTargetAsmParser.h.

◆ operator=()

MCTargetAsmParser& llvm::MCTargetAsmParser::operator= ( const MCTargetAsmParser )
delete

◆ ParseDirective()

virtual bool llvm::MCTargetAsmParser::ParseDirective ( AsmToken  DirectiveID)
pure virtual

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.

Parameters
DirectiveID- the identifier token of the directive.

◆ ParseInstruction() [1/2]

virtual bool llvm::MCTargetAsmParser::ParseInstruction ( ParseInstructionInfo Info,
StringRef  Name,
SMLoc  NameLoc,
OperandVector Operands 
)
pure virtual

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.

Parameters
Name- The instruction name.
NameLoc- The source location of the name.
Operands[out] - The list of parsed operands, this returns ownership of them to the caller.
Returns
True on failure.

◆ ParseInstruction() [2/2]

virtual bool llvm::MCTargetAsmParser::ParseInstruction ( ParseInstructionInfo Info,
StringRef  Name,
AsmToken  Token,
OperandVector Operands 
)
inlinevirtual

Definition at line 401 of file MCTargetAsmParser.h.

References llvm::AsmToken::getLoc().

◆ parsePrimaryExpr()

virtual bool llvm::MCTargetAsmParser::parsePrimaryExpr ( const MCExpr *&  Res,
SMLoc EndLoc 
)
inlinevirtual

Definition at line 376 of file MCTargetAsmParser.h.

◆ ParseRegister()

virtual bool llvm::MCTargetAsmParser::ParseRegister ( unsigned RegNo,
SMLoc StartLoc,
SMLoc EndLoc 
)
pure virtual

◆ regsEqual()

virtual bool llvm::MCTargetAsmParser::regsEqual ( const MCParsedAsmOperand Op1,
const MCParsedAsmOperand Op2 
) const
inlinevirtual

Returns whether two registers are equal and is used by the tied-operands checks in the AsmMatcher.

This method can be overridden allow e.g. a sub- or super-register as the tied operand.

Definition at line 460 of file MCTargetAsmParser.h.

References assert(), llvm::MCParsedAsmOperand::getReg(), and llvm::MCParsedAsmOperand::isReg().

◆ setAvailableFeatures()

void llvm::MCTargetAsmParser::setAvailableFeatures ( uint64_t  Value)
inline

Definition at line 364 of file MCTargetAsmParser.h.

◆ SetFrameRegister()

virtual void llvm::MCTargetAsmParser::SetFrameRegister ( unsigned  RegNo)
inlinevirtual

Sets frame register corresponding to the current MachineFunction.

Definition at line 384 of file MCTargetAsmParser.h.

References Info, and Name.

◆ setParsingInlineAsm()

void llvm::MCTargetAsmParser::setParsingInlineAsm ( bool  Value)
inline

Definition at line 367 of file MCTargetAsmParser.h.

◆ setSemaCallback()

void llvm::MCTargetAsmParser::setSemaCallback ( MCAsmParserSemaCallback Callback)
inline

Definition at line 371 of file MCTargetAsmParser.h.

◆ starIsStartOfStatement()

virtual bool llvm::MCTargetAsmParser::starIsStartOfStatement ( )
inlinevirtual

Definition at line 471 of file MCTargetAsmParser.h.

◆ validateTargetOperandClass()

virtual unsigned llvm::MCTargetAsmParser::validateTargetOperandClass ( MCParsedAsmOperand Op,
unsigned  Kind 
)
inlinevirtual

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.

Definition at line 436 of file MCTargetAsmParser.h.

Member Data Documentation

◆ AvailableFeatures

uint64_t llvm::MCTargetAsmParser::AvailableFeatures = 0
protected

AvailableFeatures - The current set of available features.

Definition at line 338 of file MCTargetAsmParser.h.

◆ MCOptions

MCTargetOptions llvm::MCTargetAsmParser::MCOptions
protected

Set of options which affects instrumentation of inline assembly.

Definition at line 348 of file MCTargetAsmParser.h.

◆ MII

const MCInstrInfo& llvm::MCTargetAsmParser::MII
protected

Definition at line 353 of file MCTargetAsmParser.h.

◆ ParsingInlineAsm

bool llvm::MCTargetAsmParser::ParsingInlineAsm = false
protected

ParsingInlineAsm - Are we parsing ms-style inline assembly?

Definition at line 341 of file MCTargetAsmParser.h.

◆ SemaCallback

MCAsmParserSemaCallback* llvm::MCTargetAsmParser::SemaCallback
protected

SemaCallback - The Sema callback implementation.

Must be set when parsing ms-style inline assembly.

Definition at line 345 of file MCTargetAsmParser.h.

◆ STI

const MCSubtargetInfo* llvm::MCTargetAsmParser::STI
protected

Current STI.

Definition at line 351 of file MCTargetAsmParser.h.

Referenced by copySTI(), and getSTI().


The documentation for this class was generated from the following files: