1 //===-- llvm/Target/TargetAsmParser.h - Target Assembly Parser --*- 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 #ifndef LLVM_TARGET_TARGETPARSER_H
11 #define LLVM_TARGET_TARGETPARSER_H
21 /// TargetAsmParser - Generic interface to target specific assembly parsers.
22 class TargetAsmParser {
23 TargetAsmParser(const TargetAsmParser &); // DO NOT IMPLEMENT
24 void operator=(const TargetAsmParser &); // DO NOT IMPLEMENT
25 protected: // Can only create subclasses.
26 TargetAsmParser(const Target &);
28 /// TheTarget - The Target that this machine was created for.
29 const Target &TheTarget;
32 virtual ~TargetAsmParser();
34 const Target &getTarget() const { return TheTarget; }
36 /// ParseInstruction - Parse one assembly instruction.
38 /// The parser is positioned following the instruction name. The target
39 /// specific instruction parser should parse the entire instruction and
40 /// construct the appropriate MCInst, or emit an error. On success, the entire
41 /// line should be parsed up to and including the end-of-statement token. On
42 /// failure, the parser is not required to read to the end of the line.
44 /// \param AP - The current parser object.
45 /// \param Name - The instruction name.
46 /// \param Inst [out] - On success, the parsed instruction.
47 /// \return True on failure.
48 virtual bool ParseInstruction(const StringRef &Name, SMLoc NameLoc,
51 /// ParseDirective - Parse a target specific assembler directive
53 /// The parser is positioned following the directive name. The target
54 /// specific directive parser should parse the entire directive doing or
55 /// recording any target specific work, or return true and do nothing if the
56 /// directive is not target specific. If the directive is specific for
57 /// the target, the entire line is parsed up to and including the
58 /// end-of-statement token and false is returned.
60 /// \param ID - the identifier token of the directive.
61 virtual bool ParseDirective(AsmToken DirectiveID) = 0;
64 } // End llvm namespace