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"
37 AsmParser(SourceMgr &SM, MCContext &ctx, MCStreamer &OutStr)
38 : Lexer(SM), Ctx(ctx), Out(OutStr) {}
44 bool ParseStatement();
46 void Warning(SMLoc L, const char *Msg);
47 bool Error(SMLoc L, const char *Msg);
48 bool TokError(const char *Msg);
50 void EatToEndOfStatement();
52 bool ParseAssignment(const char *Name, bool IsDotSet);
54 /// ParseExpression - Parse a general assembly expression.
56 /// @param Res - The resulting expression. The pointer value is null on error.
57 /// @result - False on success.
58 bool ParseExpression(AsmExpr *&Res);
60 /// ParseAbsoluteExpression - Parse an expression which must evaluate to an
63 /// @param Res - The value of the absolute expression. The result is undefined
65 /// @result - False on success.
66 bool ParseAbsoluteExpression(int64_t &Res);
68 /// ParseRelocatableExpression - Parse an expression which must be
71 /// @param Res - The relocatable expression value. The result is undefined on
73 /// @result - False on success.
74 bool ParseRelocatableExpression(MCValue &Res);
76 bool ParsePrimaryExpr(AsmExpr *&Res);
77 bool ParseBinOpRHS(unsigned Precedence, AsmExpr *&Res);
78 bool ParseParenExpr(AsmExpr *&Res);
81 bool ParseX86InstOperands(const char *InstName, MCInst &Inst);
82 bool ParseX86Operand(X86Operand &Op);
83 bool ParseX86MemOperand(X86Operand &Op);
86 bool ParseDirectiveDarwinSection(); // Darwin specific ".section".
87 bool ParseDirectiveSectionSwitch(const char *Section,
88 const char *Directives = 0);
89 bool ParseDirectiveAscii(bool ZeroTerminated); // ".ascii", ".asciiz"
90 bool ParseDirectiveValue(unsigned Size); // ".byte", ".long", ...
91 bool ParseDirectiveFill(); // ".fill"
92 bool ParseDirectiveSpace(); // ".space"
93 bool ParseDirectiveSet(); // ".set"
94 bool ParseDirectiveOrg(); // ".org"
95 // ".align{,32}", ".p2align{,w,l}"
96 bool ParseDirectiveAlign(bool IsPow2, unsigned ValueSize);
98 /// ParseDirectiveSymbolAttribute - Parse a directive like ".globl" which
99 /// accepts a single symbol (which should be a label or an external).
100 bool ParseDirectiveSymbolAttribute(MCStreamer::SymbolAttr Attr);
104 } // end namespace llvm