llvm-6502/tools/llvm-mc/AsmParser.h
Daniel Dunbar a0d1426af0 Basic .s parsing for .asci[iz], .fill, .space, {.byte, .short, ... }
- Includes some DG tests in test/MC/AsmParser, which are rather primitive since
   we don't have a -verify mode yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74139 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 23:30:00 +00:00

70 lines
1.8 KiB
C++

//===- AsmParser.h - Parser for Assembly Files ------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This class declares the parser for assembly files.
//
//===----------------------------------------------------------------------===//
#ifndef ASMPARSER_H
#define ASMPARSER_H
#include "AsmLexer.h"
namespace llvm {
class MCContext;
class MCInst;
class MCStreamer;
class AsmParser {
AsmLexer Lexer;
MCContext &Ctx;
MCStreamer &Out;
struct X86Operand;
public:
AsmParser(SourceMgr &SM, MCContext &ctx, MCStreamer &OutStr)
: Lexer(SM), Ctx(ctx), Out(OutStr) {}
~AsmParser() {}
bool Run();
private:
bool ParseStatement();
bool Error(SMLoc L, const char *Msg);
bool TokError(const char *Msg);
void EatToEndOfStatement();
bool ParseExpression(int64_t &Res);
bool ParsePrimaryExpr(int64_t &Res);
bool ParseBinOpRHS(unsigned Precedence, int64_t &Res);
bool ParseParenExpr(int64_t &Res);
// X86 specific.
bool ParseX86InstOperands(MCInst &Inst);
bool ParseX86Operand(X86Operand &Op);
bool ParseX86MemOperand(X86Operand &Op);
// Directive Parsing.
bool ParseDirectiveDarwinSection(); // Darwin specific ".section".
bool ParseDirectiveSectionSwitch(const char *Section,
const char *Directives = 0);
bool ParseDirectiveAscii(bool ZeroTerminated); // ".ascii", ".asciiz"
bool ParseDirectiveValue(unsigned Size); // ".byte", ".long", ...
bool ParseDirectiveFill(); // ".fill"
bool ParseDirectiveSpace(); // ".space"
};
} // end namespace llvm
#endif