pass the TargetTriple down from each target ctor to the
[oota-llvm.git] / include / llvm / Target / TargetAsmParser.h
1 //===-- llvm/Target/TargetAsmParser.h - Target Assembly Parser --*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_TARGET_TARGETPARSER_H
11 #define LLVM_TARGET_TARGETPARSER_H
12
13 namespace llvm {
14 class MCAsmParser;
15 class MCInst;
16 class StringRef;
17 class Target;
18
19 /// TargetAsmParser - Generic interface to target specific assembly parsers.
20 class TargetAsmParser {
21   TargetAsmParser(const TargetAsmParser &);   // DO NOT IMPLEMENT
22   void operator=(const TargetAsmParser &);  // DO NOT IMPLEMENT
23 protected: // Can only create subclasses.
24   TargetAsmParser(const Target &);
25  
26   /// TheTarget - The Target that this machine was created for.
27   const Target &TheTarget;
28
29 public:
30   virtual ~TargetAsmParser();
31
32   const Target &getTarget() const { return TheTarget; }
33
34   /// ParseInstruction - Parse one assembly instruction.
35   ///
36   /// The parser is positioned following the instruction name. The target
37   /// specific instruction parser should parse the entire instruction and
38   /// construct the appropriate MCInst, or emit an error. On success, the entire
39   /// line should be parsed up to and including the end-of-statement token. On
40   /// failure, the parser is not required to read to the end of the line.
41   //
42   /// \param AP - The current parser object.
43   /// \param Name - The instruction name.
44   /// \param Inst [out] - On success, the parsed instruction.
45   /// \return True on failure.
46   virtual bool ParseInstruction(const StringRef &Name, MCInst &Inst) = 0;
47 };
48
49 } // End llvm namespace
50
51 #endif