1 //===- AsmParser.h - Parser for Assembly Files ------------------*- 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 // This class declares the parser for assembly files.
12 //===----------------------------------------------------------------------===//
18 #include "llvm/MC/MCStreamer.h"
35 AsmParser(SourceMgr &SM, MCContext &ctx, MCStreamer &OutStr)
36 : Lexer(SM), Ctx(ctx), Out(OutStr) {}
42 bool ParseStatement();
44 void Warning(SMLoc L, const char *Msg);
45 bool Error(SMLoc L, const char *Msg);
46 bool TokError(const char *Msg);
48 void EatToEndOfStatement();
50 bool ParseAssignment(const char *Name, bool IsDotSet);
52 /// ParseExpression - Parse a general assembly expression.
54 /// @param Res - The resulting expression. The pointer value is null on error.
55 /// @result - False on success.
56 bool ParseExpression(AsmExpr *&Res);
58 /// ParseAbsoluteExpression - Parse an expression which must evaluate to an
61 /// @param Res - The value of the absolute expression. The result is undefined
63 /// @result - False on success.
64 bool ParseAbsoluteExpression(int64_t &Res);
66 /// ParseRelocatableExpression - Parse an expression which must be
69 /// @param Res - The relocatable expression value. The result is undefined on
71 /// @result - False on success.
72 bool ParseRelocatableExpression(MCValue &Res);
74 bool ParsePrimaryExpr(AsmExpr *&Res);
75 bool ParseBinOpRHS(unsigned Precedence, AsmExpr *&Res);
76 bool ParseParenExpr(AsmExpr *&Res);
79 bool ParseX86InstOperands(MCInst &Inst);
80 bool ParseX86Operand(X86Operand &Op);
81 bool ParseX86MemOperand(X86Operand &Op);
84 bool ParseDirectiveDarwinSection(); // Darwin specific ".section".
85 bool ParseDirectiveSectionSwitch(const char *Section,
86 const char *Directives = 0);
87 bool ParseDirectiveAscii(bool ZeroTerminated); // ".ascii", ".asciiz"
88 bool ParseDirectiveValue(unsigned Size); // ".byte", ".long", ...
89 bool ParseDirectiveFill(); // ".fill"
90 bool ParseDirectiveSpace(); // ".space"
91 bool ParseDirectiveSet(); // ".set"
92 bool ParseDirectiveOrg(); // ".org"
93 // ".align{,32}", ".p2align{,w,l}"
94 bool ParseDirectiveAlign(bool IsPow2, unsigned ValueSize);
96 /// ParseDirectiveSymbolAttribute - Parse a directive like ".globl" which
97 /// accepts a single symbol (which should be a label or an external).
98 bool ParseDirectiveSymbolAttribute(MCStreamer::SymbolAttr Attr);
102 } // end namespace llvm