LLVM: lib/MC/MCParser/MCAsmParser.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

12#include "llvm/Config/llvm-config.h"

21#include

22

23using namespace llvm;

24

25namespace llvm {

28 cl::desc("The maximum nesting depth allowed for assembly macros."));

29}

30

34

36

38 assert(!TargetParser && "Target parser is already initialized!");

39 TargetParser = &P;

40 TargetParser->Initialize(*this);

41}

42

46

51

54 return Error(getTok().getLoc(), "expected newline");

56 return false;

57}

58

65

69 if (getTok().getKind() != T)

72 return false;

73}

74

82

85 if (Present)

87 return Present;

88}

89

93

95 if (P)

97 return false;

98}

99

103

106 PErr.Loc = L;

110

111

112

113

116 return true;

117}

118

120

125 return true;

126}

127

130 return false;

131 while (true) {

132 if (parseOne())

133 return true;

135 return false;

137 return true;

138 }

139 return false;

140}

141

146

148 int64_t &IntegerValue) {

149

155 return false;

157 Lex();

158 Lex();

160 return false;

162 Lex();

163 return true;

164}

165

169 return true;

170

172 return false;

173}

174

176

177#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)

178 dbgs() << " ";

180#endif

181}

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))

const AsmToken & getTok() const

Get the current (last) lexed token.

const AsmToken & Lex()

Consume the next token from the input stream and return it.

Target independent representation for an assembler token.

LLVM_ABI SMLoc getLoc() const

int64_t getIntVal() const

bool isNot(TokenKind K) const

TokenKind getKind() const

This class is intended to be used as a base class for asm properties and features specific to the tar...

bool parseMany(function_ref< bool()> parseOne, bool hasComma=true)

Definition MCAsmParser.cpp:128

bool Error(SMLoc L, const Twine &Msg, SMRange Range={})

Return an error at the location L, with the message Msg.

Definition MCAsmParser.cpp:104

bool parseToken(AsmToken::TokenKind T, const Twine &Msg="unexpected token")

Definition MCAsmParser.cpp:66

bool addErrorSuffix(const Twine &Suffix)

Definition MCAsmParser.cpp:119

bool check(bool P, const Twine &Msg)

Definition MCAsmParser.cpp:90

bool parseIntToken(int64_t &V, const Twine &ErrMsg="expected integer")

Definition MCAsmParser.cpp:75

virtual bool parseExpression(const MCExpr *&Res, SMLoc &EndLoc)=0

Parse an arbitrary expression.

const AsmToken & getTok() const

Get the current AsmToken from the stream.

Definition MCAsmParser.cpp:43

virtual bool parseIdentifier(StringRef &Res)=0

Parse an identifier or string (as a quoted identifier) and set Res to the identifier contents.

bool parseSymbol(MCSymbol *&Res)

Parse identifier and get or create symbol for it.

Definition MCAsmParser.cpp:166

bool parseEOL()

Definition MCAsmParser.cpp:52

SmallVector< MCPendingError, 0 > PendingErrors

MCAsmParser(MCContext &, MCStreamer &, SourceMgr &, const MCAsmInfo &)

Definition MCAsmParser.cpp:31

bool parseOptionalToken(AsmToken::TokenKind T)

Attempt to parse and consume token, returning true on success.

Definition MCAsmParser.cpp:83

virtual const AsmToken & Lex()=0

Get the next AsmToken in the stream, possibly handling file inclusion first.

bool TokError(const Twine &Msg, SMRange Range={})

Report an error at the current lexer location.

Definition MCAsmParser.cpp:100

bool parseTokenLoc(SMLoc &Loc)

Definition MCAsmParser.cpp:47

bool parseGNUAttribute(SMLoc L, int64_t &Tag, int64_t &IntegerValue)

Parse a .gnu_attribute.

Definition MCAsmParser.cpp:147

void setTargetParser(MCTargetAsmParser &P)

Definition MCAsmParser.cpp:37

Context object for machine code objects.

LLVM_ABI MCSymbol * parseSymbol(const Twine &Name)

Variant of getOrCreateSymbol that handles backslash-escaped symbols.

Base class for the full range of assembler expressions which are needed for parsing.

virtual void dump() const

dump - Print to the debug stream.

Definition MCAsmParser.cpp:175

virtual void print(raw_ostream &, const MCAsmInfo &) const =0

print - Print a debug representation of the operand to the given stream.

Streaming machine code generation interface.

MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...

MCTargetAsmParser - Generic interface to target specific assembly parsers.

Represents a location in source code.

Represents a range in source code.

This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling.

StringRef - Represent a constant reference to a string, i.e.

Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...

LLVM_ABI void toVector(SmallVectorImpl< char > &Out) const

Append the concatenated string into the given SmallString or SmallVector.

An efficient, type-erasing, non-owning reference to a callable.

initializer< Ty > init(const Ty &Val)

This is an optimization pass for GlobalISel generic memory operations.

cl::opt< unsigned > AsmMacroMaxNestingDepth

LLVM_ABI raw_ostream & dbgs()

dbgs() - This returns a reference to a raw_ostream for debugging messages.