]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - include/llvm/MC/MCParser/MCAsmParser.h
Update LLVM to r98631.
[FreeBSD/FreeBSD.git] / include / llvm / MC / MCParser / MCAsmParser.h
1 //===-- llvm/MC/MCAsmParser.h - Abstract Asm Parser Interface ---*- 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_MC_MCASMPARSER_H
11 #define LLVM_MC_MCASMPARSER_H
12
13 #include "llvm/System/DataTypes.h"
14
15 namespace llvm {
16 class AsmToken;
17 class MCAsmLexer;
18 class MCContext;
19 class MCExpr;
20 class MCStreamer;
21 class SMLoc;
22 class Twine;
23
24 /// MCAsmParser - Generic assembler parser interface, for use by target specific
25 /// assembly parsers.
26 class MCAsmParser {
27   MCAsmParser(const MCAsmParser &);   // DO NOT IMPLEMENT
28   void operator=(const MCAsmParser &);  // DO NOT IMPLEMENT
29 protected: // Can only create subclasses.
30   MCAsmParser();
31  
32 public:
33   virtual ~MCAsmParser();
34
35   virtual MCAsmLexer &getLexer() = 0;
36
37   virtual MCContext &getContext() = 0;
38
39   /// getSteamer - Return the output streamer for the assembler.
40   virtual MCStreamer &getStreamer() = 0;
41
42   /// Warning - Emit a warning at the location \arg L, with the message \arg
43   /// Msg.
44   virtual void Warning(SMLoc L, const Twine &Msg) = 0;
45
46   /// Warning - Emit an error at the location \arg L, with the message \arg
47   /// Msg.
48   ///
49   /// \return The return value is always true, as an idiomatic convenience to
50   /// clients.
51   virtual bool Error(SMLoc L, const Twine &Msg) = 0;
52
53   /// Lex - Get the next AsmToken in the stream, possibly handling file
54   /// inclusion first.
55   virtual const AsmToken &Lex() = 0;
56   
57   /// getTok - Get the current AsmToken from the stream.
58   const AsmToken &getTok();
59   
60   /// ParseExpression - Parse an arbitrary expression.
61   ///
62   /// @param Res - The value of the expression. The result is undefined
63   /// on error.
64   /// @result - False on success.
65   virtual bool ParseExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0;
66   bool ParseExpression(const MCExpr *&Res);
67   
68   /// ParseParenExpression - Parse an arbitrary expression, assuming that an
69   /// initial '(' has already been consumed.
70   ///
71   /// @param Res - The value of the expression. The result is undefined
72   /// on error.
73   /// @result - False on success.
74   virtual bool ParseParenExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0;
75
76   /// ParseAbsoluteExpression - Parse an expression which must evaluate to an
77   /// absolute value.
78   ///
79   /// @param Res - The value of the absolute expression. The result is undefined
80   /// on error.
81   /// @result - False on success.
82   virtual bool ParseAbsoluteExpression(int64_t &Res) = 0;
83 };
84
85 } // End llvm namespace
86
87 #endif