summaryrefslogtreecommitdiffstats
path: root/tools/llvm-mc/AsmParser.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/llvm-mc/AsmParser.h')
-rw-r--r--tools/llvm-mc/AsmParser.h63
1 files changed, 54 insertions, 9 deletions
diff --git a/tools/llvm-mc/AsmParser.h b/tools/llvm-mc/AsmParser.h
index da256c2..333b284 100644
--- a/tools/llvm-mc/AsmParser.h
+++ b/tools/llvm-mc/AsmParser.h
@@ -15,19 +15,24 @@
#define ASMPARSER_H
#include "AsmLexer.h"
+#include "llvm/MC/MCStreamer.h"
namespace llvm {
+class AsmExpr;
class MCContext;
class MCInst;
class MCStreamer;
-
+class MCValue;
+
class AsmParser {
+public:
+ struct X86Operand;
+
+private:
AsmLexer Lexer;
MCContext &Ctx;
MCStreamer &Out;
- struct X86Operand;
-
public:
AsmParser(SourceMgr &SM, MCContext &ctx, MCStreamer &OutStr)
: Lexer(SM), Ctx(ctx), Out(OutStr) {}
@@ -37,22 +42,56 @@ public:
private:
bool ParseStatement();
-
+
+ void Warning(SMLoc L, const char *Msg);
bool Error(SMLoc L, const char *Msg);
bool TokError(const char *Msg);
void EatToEndOfStatement();
bool ParseAssignment(const char *Name, bool IsDotSet);
- bool ParseExpression(int64_t &Res);
- bool ParsePrimaryExpr(int64_t &Res);
- bool ParseBinOpRHS(unsigned Precedence, int64_t &Res);
- bool ParseParenExpr(int64_t &Res);
+
+ /// ParseExpression - Parse a general assembly expression.
+ ///
+ /// @param Res - The resulting expression. The pointer value is null on error.
+ /// @result - False on success.
+ bool ParseExpression(AsmExpr *&Res);
+
+ /// ParseAbsoluteExpression - Parse an expression which must evaluate to an
+ /// absolute value.
+ ///
+ /// @param Res - The value of the absolute expression. The result is undefined
+ /// on error.
+ /// @result - False on success.
+ bool ParseAbsoluteExpression(int64_t &Res);
+
+ /// ParseRelocatableExpression - Parse an expression which must be
+ /// relocatable.
+ ///
+ /// @param Res - The relocatable expression value. The result is undefined on
+ /// error.
+ /// @result - False on success.
+ bool ParseRelocatableExpression(MCValue &Res);
+
+ /// ParseParenRelocatableExpression - Parse an expression which must be
+ /// relocatable, assuming that an initial '(' has already been consumed.
+ ///
+ /// @param Res - The relocatable expression value. The result is undefined on
+ /// error.
+ /// @result - False on success.
+ ///
+ /// @see ParseRelocatableExpression, ParseParenExpr.
+ bool ParseParenRelocatableExpression(MCValue &Res);
+
+ bool ParsePrimaryExpr(AsmExpr *&Res);
+ bool ParseBinOpRHS(unsigned Precedence, AsmExpr *&Res);
+ bool ParseParenExpr(AsmExpr *&Res);
// X86 specific.
- bool ParseX86InstOperands(MCInst &Inst);
+ bool ParseX86InstOperands(const char *InstName, MCInst &Inst);
bool ParseX86Operand(X86Operand &Op);
bool ParseX86MemOperand(X86Operand &Op);
+ bool ParseX86Register(X86Operand &Op);
// Directive Parsing.
bool ParseDirectiveDarwinSection(); // Darwin specific ".section".
@@ -64,6 +103,12 @@ private:
bool ParseDirectiveSpace(); // ".space"
bool ParseDirectiveSet(); // ".set"
bool ParseDirectiveOrg(); // ".org"
+ // ".align{,32}", ".p2align{,w,l}"
+ bool ParseDirectiveAlign(bool IsPow2, unsigned ValueSize);
+
+ /// ParseDirectiveSymbolAttribute - Parse a directive like ".globl" which
+ /// accepts a single symbol (which should be a label or an external).
+ bool ParseDirectiveSymbolAttribute(MCStreamer::SymbolAttr Attr);
};
OpenPOWER on IntegriCloud