LLVM: include/llvm/MC/MCParser/MCAsmParser.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9#ifndef LLVM_MC_MCPARSER_MCASMPARSER_H

10#define LLVM_MC_MCPARSER_MCASMPARSER_H

11

22#include

23#include

24#include

25

26namespace llvm {

27

36

44

48

52

60

61 union {

65 };

66 bool isKind(IdKind kind) const { return Kind == kind; }

67

71 Enum.EnumVal = enumVal;

72 }

76 Label.Decl = decl;

77 }

78 void setVar(void *decl, bool isGlobalLV, unsigned size, unsigned type) {

81 Var.Decl = decl;

82 Var.IsGlobalLV = isGlobalLV;

84 Var.Type = type;

86 }

88

89private:

90

92};

93

94

95

102

107

108

110public:

112

115 bool IsUnevaluatedContext) = 0;

117 SMLoc Location, bool Create) = 0;

119 unsigned &Offset) = 0;

120};

121

122

123

125public:

128 std::pair<MCAsmParserExtension*, DirectiveHandler>;

129

135

136private:

138

139protected:

141

148

149

151

153

154public:

158

161

163

169

172

175

178

179

180 virtual bool Run(bool NoInitialTextSection, bool NoFinalize = false) = 0;

181

184

186

188

190

198

202

203

205 std::string &AsmString, unsigned &NumOutputs, unsigned &NumInputs,

210

211

213

214

215

216

218

219

220

221

222

223

225

226

227

228

229

231

233

238 }

240 return rv;

241 }

242

244

245 bool addErrorSuffix(const Twine &Suffix);

246

247

248

250

251

253

254

256

257 bool parseTokenLoc(SMLoc &Loc);

259

260

262

265 bool parseEOL();

266 bool parseEOL(const Twine &ErrMsg);

267

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

269

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

271

272 bool check(bool P, const Twine &Msg);

274

275

276

278

279

281

282

283

284

286

287

288

290

291

292

294

295

297

298

299

300

301

302

305

306

307

308

309

310

313

314

315

316

317

318

319

321

322

323

324

325

326

328

329

330

331

333

334

336

339};

340

341

343 const MCAsmInfo &, unsigned CB = 0);

344

345

348 unsigned CB = 0);

349

350}

351

352#endif

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

static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")

Analysis containing CSE Info

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

This file defines the SmallString class.

This file defines the SmallVector class.

Target independent representation for an assembler token.

Lightweight error class with error context and mandatory checking.

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

Generic interface for extending the MCAsmParser, which is implemented by target and object file assem...

Generic Sema callback for assembly parser.

Definition MCAsmParser.h:109

virtual ~MCAsmParserSemaCallback()

virtual bool LookupInlineAsmField(StringRef Base, StringRef Member, unsigned &Offset)=0

virtual StringRef LookupInlineAsmLabel(StringRef Identifier, SourceMgr &SM, SMLoc Location, bool Create)=0

virtual void LookupInlineAsmIdentifier(StringRef &LineBuf, InlineAsmIdentifierInfo &Info, bool IsUnevaluatedContext)=0

Generic assembler parser interface, for use by target specific assembly parsers.

Definition MCAsmParser.h:124

virtual void eatToEndOfStatement()=0

Skip to the end of the current statement, for error recovery.

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

bool printPendingErrors()

Definition MCAsmParser.h:234

bool ShowParsedOperands

Definition MCAsmParser.h:152

virtual bool parseEscapedString(std::string &Data)=0

Parse the current token as a string which may include escaped characters and return the string conten...

virtual bool defineMacro(StringRef Name, StringRef Value)

Definition MCAsmParser.h:189

void clearPendingErrors()

Definition MCAsmParser.h:243

bool hasPendingError()

Definition MCAsmParser.h:232

MCContext & getContext()

Definition MCAsmParser.h:164

virtual StringRef parseStringToEndOfStatement()=0

Parse up to the end of statement and return the contents from the current token until the end of the ...

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

Parse an arbitrary expression.

AsmLexer & getLexer()

Definition MCAsmParser.h:167

bool parseAtSpecifier(const MCExpr *&Res, SMLoc &EndLoc)

const AsmToken & getTok() const

Get the current AsmToken from the stream.

const MCExpr * applySpecifier(const MCExpr *E, uint32_t Variant)

virtual bool checkForValidSection()=0

Ensure that we have a valid section set in the streamer.

virtual bool isParsingMasm() const

Definition MCAsmParser.h:187

virtual bool parseIdentifier(StringRef &Res)=0

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

MCAsmParser(const MCAsmParser &)=delete

bool getShowParsedOperands() const

Definition MCAsmParser.h:176

bool parseSymbol(MCSymbol *&Res)

Parse identifier and get or create symbol for it.

virtual bool discardLTOSymbol(StringRef) const

Definition MCAsmParser.h:185

bool parseRParen()

Definition MCAsmParser.h:264

MCAsmParser & operator=(const MCAsmParser &)=delete

SmallVector< MCPendingError, 0 > PendingErrors

Definition MCAsmParser.h:147

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

Parse an arbitrary expression, assuming that an initial '(' has already been consumed.

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

virtual bool isParsingMSInlineAsm()=0

MCStreamer & Out

Definition MCAsmParser.h:143

virtual bool parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc, AsmTypeInfo *TypeInfo=nullptr)=0

Parse a primary expression.

virtual void Note(SMLoc L, const Twine &Msg, SMRange Range={})=0

Emit a note at the location L, with the message Msg.

virtual const AsmToken & Lex()=0

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

SourceMgr & SrcMgr

Definition MCAsmParser.h:144

virtual unsigned getAssemblerDialect()

Definition MCAsmParser.h:173

std::pair< MCAsmParserExtension *, DirectiveHandler > ExtensionDirectiveHandler

Definition MCAsmParser.h:127

virtual bool Warning(SMLoc L, const Twine &Msg, SMRange Range={})=0

Emit a warning at the location L, with the message Msg.

void setShowParsedOperands(bool Value)

Definition MCAsmParser.h:177

bool(*)(MCAsmParserExtension *, StringRef, SMLoc) DirectiveHandler

Definition MCAsmParser.h:126

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

Report an error at the current lexer location.

virtual bool Run(bool NoInitialTextSection, bool NoFinalize=false)=0

Run the parser on the input source buffer.

MCContext & Ctx

Definition MCAsmParser.h:142

virtual void addAliasForDirective(StringRef Directive, StringRef Alias)=0

virtual bool parseAngleBracketString(std::string &Data)=0

Parse an angle-bracket delimited string at the current position if one is present,...

const MCAsmInfo & MAI

Definition MCAsmParser.h:145

AsmLexer Lexer

Definition MCAsmParser.h:146

virtual bool lookUpType(StringRef Name, AsmTypeInfo &Info) const

Definition MCAsmParser.h:199

virtual bool printError(SMLoc L, const Twine &Msg, SMRange Range={})=0

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

bool parseComma()

Definition MCAsmParser.h:263

SourceMgr & getSourceManager()

Definition MCAsmParser.h:166

virtual bool lookUpField(StringRef Base, StringRef Member, AsmFieldInfo &Info) const

Definition MCAsmParser.h:194

virtual bool parseAbsoluteExpression(int64_t &Res)=0

Parse an expression which must evaluate to an absolute value.

virtual bool lookUpField(StringRef Name, AsmFieldInfo &Info) const

Definition MCAsmParser.h:191

const AsmLexer & getLexer() const

Definition MCAsmParser.h:168

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

Parse a .gnu_attribute.

MCStreamer & getStreamer()

Definition MCAsmParser.h:165

virtual void setAssemblerDialect(unsigned i)

Definition MCAsmParser.h:174

virtual void setParsingMSInlineAsm(bool V)=0

bool HadError

Flag tracking whether any errors have been encountered.

Definition MCAsmParser.h:150

virtual bool parseMSInlineAsm(std::string &AsmString, unsigned &NumOutputs, unsigned &NumInputs, SmallVectorImpl< std::pair< void *, bool > > &OpDecls, SmallVectorImpl< std::string > &Constraints, SmallVectorImpl< std::string > &Clobbers, const MCInstrInfo *MII, MCInstPrinter *IP, MCAsmParserSemaCallback &SI)=0

Parse MS-style inline assembly.

MCTargetAsmParser & getTargetParser() const

Definition MCAsmParser.h:170

virtual void addDirectiveHandler(StringRef Directive, ExtensionDirectiveHandler Handler)=0

Context object for machine code objects.

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

This is an instance of a target assembly language printer that converts an MCInst to valid target ass...

Interface to description of machine instruction set.

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.

SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...

This class consists of common code factored out of the SmallVector class to reduce code duplication b...

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

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 Value Representation.

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

This is an optimization pass for GlobalISel generic memory operations.

auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)

Get the size of a range.

LLVM_ABI MCAsmParser * createMCMasmParser(SourceMgr &, MCContext &, MCStreamer &, const MCAsmInfo &, struct tm, unsigned CB=0)

Create an MCAsmParser instance for parsing Microsoft MASM-style assembly.

LLVM_ABI MCAsmParser * createMCAsmParser(SourceMgr &, MCContext &, MCStreamer &, const MCAsmInfo &, unsigned CB=0)

Create an MCAsmParser instance for parsing assembly similar to gas syntax.

FunctionAddr VTableAddr uintptr_t uintptr_t Data

Definition MCAsmParser.h:103

AsmTypeInfo Type

Definition MCAsmParser.h:104

unsigned Offset

Definition MCAsmParser.h:105

Definition MCAsmParser.h:96

unsigned Size

Definition MCAsmParser.h:98

unsigned Length

Definition MCAsmParser.h:100

unsigned ElementSize

Definition MCAsmParser.h:99

StringRef Name

Definition MCAsmParser.h:97

Definition MCAsmParser.h:45

int64_t EnumVal

Definition MCAsmParser.h:46

Definition MCAsmParser.h:49

void * Decl

Definition MCAsmParser.h:50

Definition MCAsmParser.h:53

bool IsGlobalLV

Definition MCAsmParser.h:55

void * Decl

Definition MCAsmParser.h:54

unsigned Type

Definition MCAsmParser.h:58

unsigned Length

Definition MCAsmParser.h:56

unsigned Size

Definition MCAsmParser.h:57

Definition MCAsmParser.h:37

IdKind

Definition MCAsmParser.h:38

@ IK_Invalid

Definition MCAsmParser.h:39

@ IK_Label

Definition MCAsmParser.h:40

@ IK_EnumVal

Definition MCAsmParser.h:41

@ IK_Var

Definition MCAsmParser.h:42

EnumIdentifier Enum

Definition MCAsmParser.h:62

void setVar(void *decl, bool isGlobalLV, unsigned size, unsigned type)

Definition MCAsmParser.h:78

VariableIdentifier Var

Definition MCAsmParser.h:64

void setLabel(void *decl)

Definition MCAsmParser.h:73

bool isKind(IdKind kind) const

Definition MCAsmParser.h:66

void setEnum(int64_t enumVal)

Definition MCAsmParser.h:68

InlineAsmIdentifierInfo()=default

LabelIdentifier Label

Definition MCAsmParser.h:63

Definition MCAsmParser.h:130

SMLoc Loc

Definition MCAsmParser.h:131

SmallString< 64 > Msg

Definition MCAsmParser.h:132

SMRange Range

Definition MCAsmParser.h:133