From 4b0f4eff1fd931c782ea277b15c389dc34079c0c Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Mon, 20 Jul 2009 18:55:04 +0000 Subject: Add MCAsmParser interface. - This provides the AsmParser interface to the target specific assembly parsers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76453 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCAsmParser.h | 33 +++++++++++++++++++++++++++++++++ include/llvm/Target/TargetAsmParser.h | 17 +++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 include/llvm/MC/MCAsmParser.h (limited to 'include') diff --git a/include/llvm/MC/MCAsmParser.h b/include/llvm/MC/MCAsmParser.h new file mode 100644 index 0000000..2379f21 --- /dev/null +++ b/include/llvm/MC/MCAsmParser.h @@ -0,0 +1,33 @@ +//===-- llvm/MC/MCAsmParser.h - Abstract Asm Parser Interface ---*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_MC_MCASMPARSER_H +#define LLVM_MC_MCASMPARSER_H + +namespace llvm { +class MCAsmParser; +class MCInst; +class Target; +class TargetAsmParser; + +/// MCAsmParser - Generic assembler parser interface, for use by target specific +/// assembly parsers. +class MCAsmParser { + MCAsmParser(const MCAsmParser &); // DO NOT IMPLEMENT + void operator=(const MCAsmParser &); // DO NOT IMPLEMENT +protected: // Can only create subclasses. + MCAsmParser(); + +public: + virtual ~MCAsmParser(); +}; + +} // End llvm namespace + +#endif diff --git a/include/llvm/Target/TargetAsmParser.h b/include/llvm/Target/TargetAsmParser.h index bf96bf7..c179991 100644 --- a/include/llvm/Target/TargetAsmParser.h +++ b/include/llvm/Target/TargetAsmParser.h @@ -11,6 +11,8 @@ #define LLVM_TARGET_TARGETPARSER_H namespace llvm { +class MCAsmParser; +class MCInst; class Target; /// TargetAsmParser - Generic interface to target specific assembly parsers. @@ -27,6 +29,21 @@ public: virtual ~TargetAsmParser(); const Target &getTarget() const { return TheTarget; } + + /// ParseInstruction - Parse one assembly instruction. + /// + /// The parser is positioned following the instruction name. The target + /// specific instruction parser should parse the entire instruction and + /// construct the appropriate MCInst, or emit an error. On success, the entire + /// line should be parsed up to and including the end-of-statement token. On + /// failure, the parser is not required to read to the end of the line. + // + /// \param AP - The current parser object. + /// \param Name - The instruction name. + /// \param Inst [out] - On success, the parsed instruction. + /// \return True on failure. + virtual bool ParseInstruction(MCAsmParser &AP, const char *Name, + MCInst &Inst) = 0; }; } // End llvm namespace -- cgit v1.1