LLVM  8.0.1
Public Types | Public Member Functions | List of all members
llvm::AsmToken Class Reference

Target independent representation for an assembler token. More...

#include "llvm/MC/MCAsmMacro.h"

Public Types

enum  TokenKind {
  Eof, Error, Identifier, String,
  Integer, BigNum, Real, Comment,
  HashDirective, 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, MinusGreater, PercentCall16,
  PercentCall_Hi, PercentCall_Lo, PercentDtprel_Hi, PercentDtprel_Lo,
  PercentGot, PercentGot_Disp, PercentGot_Hi, PercentGot_Lo,
  PercentGot_Ofst, PercentGot_Page, PercentGottprel, PercentGp_Rel,
  PercentHi, PercentHigher, PercentHighest, PercentLo,
  PercentNeg, PercentPcrel_Hi, PercentPcrel_Lo, PercentTlsgd,
  PercentTlsldm, PercentTprel_Hi, PercentTprel_Lo
}
 

Public Member Functions

 AsmToken ()=default
 
 AsmToken (TokenKind Kind, StringRef Str, APInt IntVal)
 
 AsmToken (TokenKind Kind, StringRef Str, int64_t IntVal=0)
 
TokenKind getKind () const
 
bool is (TokenKind K) const
 
bool isNot (TokenKind K) const
 
SMLoc getLoc () const
 
SMLoc getEndLoc () const
 
SMRange getLocRange () const
 
StringRef getStringContents () const
 Get the contents of a string token (without quotes). More...
 
StringRef getIdentifier () const
 Get the identifier string for the current token, which should be an identifier or a string. More...
 
StringRef getString () const
 Get the string for the current token, this includes all characters (for example, the quotes on strings) in the token. More...
 
int64_t getIntVal () const
 
APInt getAPIntVal () const
 
void dump (raw_ostream &OS) const
 
void dump () const
 

Detailed Description

Target independent representation for an assembler token.

Definition at line 22 of file MCAsmMacro.h.

Member Enumeration Documentation

◆ TokenKind

Enumerator
Eof 
Error 
Identifier 
String 
Integer 
BigNum 
Real 
Comment 
HashDirective 
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 
MinusGreater 
PercentCall16 
PercentCall_Hi 
PercentCall_Lo 
PercentDtprel_Hi 
PercentDtprel_Lo 
PercentGot 
PercentGot_Disp 
PercentGot_Hi 
PercentGot_Lo 
PercentGot_Ofst 
PercentGot_Page 
PercentGottprel 
PercentGp_Rel 
PercentHi 
PercentHigher 
PercentHighest 
PercentLo 
PercentNeg 
PercentPcrel_Hi 
PercentPcrel_Lo 
PercentTlsgd 
PercentTlsldm 
PercentTprel_Hi 
PercentTprel_Lo 

Definition at line 24 of file MCAsmMacro.h.

Constructor & Destructor Documentation

◆ AsmToken() [1/3]

llvm::AsmToken::AsmToken ( )
default

◆ AsmToken() [2/3]

llvm::AsmToken::AsmToken ( TokenKind  Kind,
StringRef  Str,
APInt  IntVal 
)
inline

Definition at line 77 of file MCAsmMacro.h.

◆ AsmToken() [3/3]

llvm::AsmToken::AsmToken ( TokenKind  Kind,
StringRef  Str,
int64_t  IntVal = 0 
)
inline

Definition at line 79 of file MCAsmMacro.h.

Member Function Documentation

◆ dump() [1/2]

void AsmToken::dump ( raw_ostream OS) const

◆ dump() [2/2]

void llvm::AsmToken::dump ( ) const
inline

Definition at line 128 of file MCAsmMacro.h.

References llvm::dbgs(), and dump().

Referenced by dump(), llvm::MCAsmMacroParameter::dump(), llvm::MCAsmMacro::dump(), and getAPIntVal().

◆ getAPIntVal()

APInt llvm::AsmToken::getAPIntVal ( ) const
inline

Definition at line 121 of file MCAsmMacro.h.

References assert(), BigNum, dump(), and Integer.

◆ getEndLoc()

SMLoc AsmToken::getEndLoc ( ) const

◆ getIdentifier()

StringRef llvm::AsmToken::getIdentifier ( ) const
inline

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.

Definition at line 100 of file MCAsmMacro.h.

References getString(), getStringContents(), and Identifier.

Referenced by addNegOperand(), convertFPR32ToFPR64(), doesIgnoreDataTypeSuffix(), getPrefixes(), incrementLoc(), llvm::IsCPSRDead< MCInst >(), isMatchingOrAlias(), isOperator(), isSDKVersionToken(), isValidEncoding(), matchSVEPredicateVectorRegName(), printMCExpr(), and RefineErrorLoc().

◆ getIntVal()

int64_t llvm::AsmToken::getIntVal ( ) const
inline

◆ getKind()

TokenKind llvm::AsmToken::getKind ( ) const
inline

◆ getLoc()

SMLoc AsmToken::getLoc ( ) const

◆ getLocRange()

SMRange AsmToken::getLocRange ( ) const

Definition at line 36 of file MCAsmLexer.cpp.

References llvm::MCAsmLexer::getLoc().

Referenced by isNot(), and RefineErrorLoc().

◆ getString()

StringRef llvm::AsmToken::getString ( ) const
inline

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().

Definition at line 111 of file MCAsmMacro.h.

Referenced by addNegOperand(), CheckBaseRegAndIndexRegAndScale(), convertFPR32ToFPR64(), ExpandCryptoAEK(), getIdentifier(), getNextRegister(), getPrefixes(), getSpecialRegForName(), hasGOTReference(), llvm::IsCPSRDead< MCInst >(), MatchCoprocessorOperandName(), matchSVEPredicateVectorRegName(), previousIsLoop(), RefineErrorLoc(), and setRequiredFeatureString().

◆ getStringContents()

StringRef llvm::AsmToken::getStringContents ( ) const
inline

Get the contents of a string token (without quotes).

Definition at line 91 of file MCAsmMacro.h.

References assert(), llvm::StringRef::size(), llvm::StringRef::slice(), and String.

Referenced by getIdentifier(), and llvm::IsCPSRDead< MCInst >().

◆ is()

bool llvm::AsmToken::is ( TokenKind  K) const
inline

◆ isNot()

bool llvm::AsmToken::isNot ( TokenKind  K) const
inline

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