1
//===-- llvm/MC/MCAsmParser.h - Abstract Asm Parser Interface ---*- C++ -*-===//
3
// The LLVM Compiler Infrastructure
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
8
//===----------------------------------------------------------------------===//
10
#ifndef LLVM_MC_MCASMPARSER_H
11
#define LLVM_MC_MCASMPARSER_H
13
#include "llvm/System/DataTypes.h"
25
/// MCAsmParser - Generic assembler parser interface, for use by target specific
28
MCAsmParser(const MCAsmParser &); // DO NOT IMPLEMENT
29
void operator=(const MCAsmParser &); // DO NOT IMPLEMENT
30
protected: // Can only create subclasses.
34
virtual ~MCAsmParser();
36
virtual MCAsmLexer &getLexer() = 0;
38
virtual MCContext &getContext() = 0;
40
/// getSteamer - Return the output streamer for the assembler.
41
virtual MCStreamer &getStreamer() = 0;
43
/// Warning - Emit a warning at the location \arg L, with the message \arg
45
virtual void Warning(SMLoc L, const Twine &Msg) = 0;
47
/// Warning - Emit an error at the location \arg L, with the message \arg
50
/// \return The return value is always true, as an idiomatic convenience to
52
virtual bool Error(SMLoc L, const Twine &Msg) = 0;
54
/// Lex - Get the next AsmToken in the stream, possibly handling file
56
virtual const AsmToken &Lex() = 0;
58
/// getTok - Get the current AsmToken from the stream.
59
const AsmToken &getTok();
61
/// ParseExpression - Parse an arbitrary expression.
63
/// @param Res - The value of the expression. The result is undefined
65
/// @result - False on success.
66
virtual bool ParseExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0;
67
bool ParseExpression(const MCExpr *&Res);
69
/// ParseParenExpression - Parse an arbitrary expression, assuming that an
70
/// initial '(' has already been consumed.
72
/// @param Res - The value of the expression. The result is undefined
74
/// @result - False on success.
75
virtual bool ParseParenExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0;
77
/// ParseAbsoluteExpression - Parse an expression which must evaluate to an
80
/// @param Res - The value of the absolute expression. The result is undefined
82
/// @result - False on success.
83
virtual bool ParseAbsoluteExpression(int64_t &Res) = 0;
86
} // End llvm namespace