[llvm-commits] [llvm] r80574 - in /llvm/trunk: include/llvm/MC/MCAsmParser.h tools/llvm-mc/AsmParser.cpp tools/llvm-mc/AsmParser.h
Daniel Dunbar
daniel at zuster.org
Mon Aug 31 01:08:17 PDT 2009
Author: ddunbar
Date: Mon Aug 31 03:08:17 2009
New Revision: 80574
URL: http://llvm.org/viewvc/llvm-project?rev=80574&view=rev
Log:
llvm-mc: Add MCAsmParser::Parse[Paren]Expression forms which return an MCExpr.
Modified:
llvm/trunk/include/llvm/MC/MCAsmParser.h
llvm/trunk/tools/llvm-mc/AsmParser.cpp
llvm/trunk/tools/llvm-mc/AsmParser.h
Modified: llvm/trunk/include/llvm/MC/MCAsmParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmParser.h?rev=80574&r1=80573&r2=80574&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAsmParser.h (original)
+++ llvm/trunk/include/llvm/MC/MCAsmParser.h Mon Aug 31 03:08:17 2009
@@ -15,6 +15,7 @@
namespace llvm {
class MCAsmLexer;
class MCContext;
+class MCExpr;
class MCValue;
class SMLoc;
class Twine;
@@ -45,6 +46,21 @@
/// 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.
///
Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=80574&r1=80573&r2=80574&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original)
+++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Mon Aug 31 03:08:17 2009
@@ -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 @@
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;
Modified: llvm/trunk/tools/llvm-mc/AsmParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.h?rev=80574&r1=80573&r2=80574&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmParser.h (original)
+++ llvm/trunk/tools/llvm-mc/AsmParser.h Mon Aug 31 03:08:17 2009
@@ -70,6 +70,8 @@
virtual bool ParseExpression(const MCExpr *&Res);
+ virtual bool ParseParenExpression(const MCExpr *&Res);
+
virtual bool ParseAbsoluteExpression(int64_t &Res);
virtual bool ParseRelocatableExpression(MCValue &Res);
More information about the llvm-commits
mailing list