forked from OSchip/llvm-project
llvm-mc: Add MCAsmParser::Parse[Paren]Expression forms which return an MCExpr.
llvm-svn: 80574
This commit is contained in:
parent
945e257e99
commit
7c82d56930
|
@ -15,6 +15,7 @@
|
|||
namespace llvm {
|
||||
class MCAsmLexer;
|
||||
class MCContext;
|
||||
class MCExpr;
|
||||
class MCValue;
|
||||
class SMLoc;
|
||||
class Twine;
|
||||
|
@ -45,6 +46,21 @@ public:
|
|||
/// clients.
|
||||
virtual bool Error(SMLoc L, const Twine &Msg) = 0;
|
||||
|
||||
/// ParseExpression - Parse an arbitrary expression.
|
||||
///
|
||||
/// @param Res - The value of the expression. The result is undefined
|
||||
/// on error.
|
||||
/// @result - False on success.
|
||||
virtual bool ParseExpression(const MCExpr *&Res) = 0;
|
||||
|
||||
/// ParseParenExpression - Parse an arbitrary expression, assuming that an
|
||||
/// initial '(' has already been consumed.
|
||||
///
|
||||
/// @param Res - The value of the expression. The result is undefined
|
||||
/// on error.
|
||||
/// @result - False on success.
|
||||
virtual bool ParseParenExpression(const MCExpr *&Res) = 0;
|
||||
|
||||
/// ParseAbsoluteExpression - Parse an expression which must evaluate to an
|
||||
/// absolute value.
|
||||
///
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "llvm/MC/MCSectionMachO.h"
|
||||
#include "llvm/MC/MCStreamer.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
#include "llvm/MC/MCValue.h"
|
||||
#include "llvm/Support/SourceMgr.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Target/TargetAsmParser.h"
|
||||
|
@ -258,6 +259,13 @@ bool AsmParser::ParseExpression(const MCExpr *&Res) {
|
|||
ParseBinOpRHS(1, Res);
|
||||
}
|
||||
|
||||
bool AsmParser::ParseParenExpression(const MCExpr *&Res) {
|
||||
if (ParseParenExpr(Res))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AsmParser::ParseAbsoluteExpression(int64_t &Res) {
|
||||
const MCExpr *Expr;
|
||||
|
||||
|
|
|
@ -70,6 +70,8 @@ public:
|
|||
|
||||
virtual bool ParseExpression(const MCExpr *&Res);
|
||||
|
||||
virtual bool ParseParenExpression(const MCExpr *&Res);
|
||||
|
||||
virtual bool ParseAbsoluteExpression(int64_t &Res);
|
||||
|
||||
virtual bool ParseRelocatableExpression(MCValue &Res);
|
||||
|
|
Loading…
Reference in New Issue