~ubuntu-branches/ubuntu/feisty/clamav/feisty

« back to all changes in this revision

Viewing changes to libclamav/c++/llvm/include/llvm/MC/MCParser/MCAsmParser.h

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2007-02-20 10:33:44 UTC
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: james.westby@ubuntu.com-20070220103344-zgcu2psnx9d98fpa
Tags: upstream-0.90
ImportĀ upstreamĀ versionĀ 0.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 MCAsmInfo;
18
 
class MCAsmLexer;
19
 
class MCAsmParserExtension;
20
 
class MCContext;
21
 
class MCExpr;
22
 
class MCStreamer;
23
 
class SMLoc;
24
 
class SourceMgr;
25
 
class StringRef;
26
 
class Target;
27
 
class TargetAsmParser;
28
 
class Twine;
29
 
 
30
 
/// MCAsmParser - Generic assembler parser interface, for use by target specific
31
 
/// assembly parsers.
32
 
class MCAsmParser {
33
 
public:
34
 
  typedef bool (*DirectiveHandler)(MCAsmParserExtension*, StringRef, SMLoc);
35
 
 
36
 
private:
37
 
  MCAsmParser(const MCAsmParser &);   // DO NOT IMPLEMENT
38
 
  void operator=(const MCAsmParser &);  // DO NOT IMPLEMENT
39
 
 
40
 
  TargetAsmParser *TargetParser;
41
 
 
42
 
  unsigned ShowParsedOperands : 1;
43
 
 
44
 
protected: // Can only create subclasses.
45
 
  MCAsmParser();
46
 
 
47
 
public:
48
 
  virtual ~MCAsmParser();
49
 
 
50
 
  virtual void AddDirectiveHandler(MCAsmParserExtension *Object,
51
 
                                   StringRef Directive,
52
 
                                   DirectiveHandler Handler) = 0;
53
 
 
54
 
  virtual SourceMgr &getSourceManager() = 0;
55
 
 
56
 
  virtual MCAsmLexer &getLexer() = 0;
57
 
 
58
 
  virtual MCContext &getContext() = 0;
59
 
 
60
 
  /// getStreamer - Return the output streamer for the assembler.
61
 
  virtual MCStreamer &getStreamer() = 0;
62
 
 
63
 
  TargetAsmParser &getTargetParser() const { return *TargetParser; }
64
 
  void setTargetParser(TargetAsmParser &P);
65
 
 
66
 
  bool getShowParsedOperands() const { return ShowParsedOperands; }
67
 
  void setShowParsedOperands(bool Value) { ShowParsedOperands = Value; }
68
 
 
69
 
  /// Run - Run the parser on the input source buffer.
70
 
  virtual bool Run(bool NoInitialTextSection, bool NoFinalize = false) = 0;
71
 
 
72
 
  /// Warning - Emit a warning at the location \arg L, with the message \arg
73
 
  /// Msg.
74
 
  virtual void Warning(SMLoc L, const Twine &Msg) = 0;
75
 
 
76
 
  /// Error - Emit an error at the location \arg L, with the message \arg
77
 
  /// Msg.
78
 
  ///
79
 
  /// \return The return value is always true, as an idiomatic convenience to
80
 
  /// clients.
81
 
  virtual bool Error(SMLoc L, const Twine &Msg) = 0;
82
 
 
83
 
  /// Lex - Get the next AsmToken in the stream, possibly handling file
84
 
  /// inclusion first.
85
 
  virtual const AsmToken &Lex() = 0;
86
 
 
87
 
  /// getTok - Get the current AsmToken from the stream.
88
 
  const AsmToken &getTok();
89
 
 
90
 
  /// \brief Report an error at the current lexer location.
91
 
  bool TokError(const Twine &Msg);
92
 
 
93
 
  /// ParseIdentifier - Parse an identifier or string (as a quoted identifier)
94
 
  /// and set \arg Res to the identifier contents.
95
 
  virtual bool ParseIdentifier(StringRef &Res) = 0;
96
 
 
97
 
  /// \brief Parse up to the end of statement and return the contents from the
98
 
  /// current token until the end of the statement; the current token on exit
99
 
  /// will be either the EndOfStatement or EOF.
100
 
  virtual StringRef ParseStringToEndOfStatement() = 0;
101
 
 
102
 
  /// ParseExpression - Parse an arbitrary expression.
103
 
  ///
104
 
  /// @param Res - The value of the expression. The result is undefined
105
 
  /// on error.
106
 
  /// @result - False on success.
107
 
  virtual bool ParseExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0;
108
 
  bool ParseExpression(const MCExpr *&Res);
109
 
 
110
 
  /// ParseParenExpression - Parse an arbitrary expression, assuming that an
111
 
  /// initial '(' has already been consumed.
112
 
  ///
113
 
  /// @param Res - The value of the expression. The result is undefined
114
 
  /// on error.
115
 
  /// @result - False on success.
116
 
  virtual bool ParseParenExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0;
117
 
 
118
 
  /// ParseAbsoluteExpression - Parse an expression which must evaluate to an
119
 
  /// absolute value.
120
 
  ///
121
 
  /// @param Res - The value of the absolute expression. The result is undefined
122
 
  /// on error.
123
 
  /// @result - False on success.
124
 
  virtual bool ParseAbsoluteExpression(int64_t &Res) = 0;
125
 
};
126
 
 
127
 
/// \brief Create an MCAsmParser instance.
128
 
MCAsmParser *createMCAsmParser(const Target &, SourceMgr &, MCContext &,
129
 
                               MCStreamer &, const MCAsmInfo &);
130
 
 
131
 
} // End llvm namespace
132
 
 
133
 
#endif