llvm-mc: Add MCAsmParser::getContext.
[oota-llvm.git] / include / llvm / MC / 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/Support/DataTypes.h"
14
15 namespace llvm {
16 class MCAsmLexer;
17 class MCContext;
18 class MCValue;
19 class SMLoc;
20 class Twine;
21
22 /// MCAsmParser - Generic assembler parser interface, for use by target specific
23 /// assembly parsers.
24 class MCAsmParser {
25   MCAsmParser(const MCAsmParser &);   // DO NOT IMPLEMENT
26   void operator=(const MCAsmParser &);  // DO NOT IMPLEMENT
27 protected: // Can only create subclasses.
28   MCAsmParser();
29  
30 public:
31   virtual ~MCAsmParser();
32
33   virtual MCAsmLexer &getLexer() = 0;
34
35   virtual MCContext &getContext() = 0;
36
37   /// Warning - Emit a warning at the location \arg L, with the message \arg
38   /// Msg.
39   virtual void Warning(SMLoc L, const Twine &Msg) = 0;
40
41   /// Warning - Emit an error at the location \arg L, with the message \arg
42   /// Msg.
43   ///
44   /// \return The return value is always true, as an idiomatic convenience to
45   /// clients.
46   virtual bool Error(SMLoc L, const Twine &Msg) = 0;
47
48   /// ParseAbsoluteExpression - Parse an expression which must evaluate to an
49   /// absolute value.
50   ///
51   /// @param Res - The value of the absolute expression. The result is undefined
52   /// on error.
53   /// @result - False on success.
54   virtual bool ParseAbsoluteExpression(int64_t &Res) = 0;
55
56   /// ParseRelocatableExpression - Parse an expression which must be
57   /// relocatable.
58   ///
59   /// @param Res - The relocatable expression value. The result is undefined on
60   /// error.  
61   /// @result - False on success.
62   virtual bool ParseRelocatableExpression(MCValue &Res) = 0;
63
64   /// ParseParenRelocatableExpression - Parse an expression which must be
65   /// relocatable, assuming that an initial '(' has already been consumed.
66   ///
67   /// @param Res - The relocatable expression value. The result is undefined on
68   /// error.  
69   /// @result - False on success.
70   ///
71   /// @see ParseRelocatableExpression, ParseParenExpr.
72   virtual bool ParseParenRelocatableExpression(MCValue &Res) = 0;
73 };
74
75 } // End llvm namespace
76
77 #endif