LLVM API Documentation
00001 //===-- llvm/Target/TargetAsmParser.h - Target Assembly Parser --*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 00010 #ifndef LLVM_TARGET_TARGETPARSER_H 00011 #define LLVM_TARGET_TARGETPARSER_H 00012 00013 namespace llvm { 00014 class MCAsmParser; 00015 class MCInst; 00016 class StringRef; 00017 class Target; 00018 00019 /// TargetAsmParser - Generic interface to target specific assembly parsers. 00020 class TargetAsmParser { 00021 TargetAsmParser(const TargetAsmParser &); // DO NOT IMPLEMENT 00022 void operator=(const TargetAsmParser &); // DO NOT IMPLEMENT 00023 protected: // Can only create subclasses. 00024 TargetAsmParser(const Target &); 00025 00026 /// TheTarget - The Target that this machine was created for. 00027 const Target &TheTarget; 00028 00029 public: 00030 virtual ~TargetAsmParser(); 00031 00032 const Target &getTarget() const { return TheTarget; } 00033 00034 /// ParseInstruction - Parse one assembly instruction. 00035 /// 00036 /// The parser is positioned following the instruction name. The target 00037 /// specific instruction parser should parse the entire instruction and 00038 /// construct the appropriate MCInst, or emit an error. On success, the entire 00039 /// line should be parsed up to and including the end-of-statement token. On 00040 /// failure, the parser is not required to read to the end of the line. 00041 // 00042 /// \param AP - The current parser object. 00043 /// \param Name - The instruction name. 00044 /// \param Inst [out] - On success, the parsed instruction. 00045 /// \return True on failure. 00046 virtual bool ParseInstruction(const StringRef &Name, MCInst &Inst) = 0; 00047 }; 00048 00049 } // End llvm namespace 00050 00051 #endif