create a new MCParser library and move some stuff into it.
authorChris Lattner <sabre@nondot.org>
Fri, 22 Jan 2010 01:44:57 +0000 (01:44 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 22 Jan 2010 01:44:57 +0000 (01:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94129 91177308-0d34-0410-b5e6-96231b3b80d8

22 files changed:
include/llvm/MC/MCAsmLexer.h [deleted file]
include/llvm/MC/MCAsmParser.h [deleted file]
include/llvm/MC/MCParsedAsmOperand.h [deleted file]
include/llvm/MC/MCParser/MCAsmLexer.h [new file with mode: 0644]
include/llvm/MC/MCParser/MCAsmParser.h [new file with mode: 0644]
include/llvm/MC/MCParser/MCParsedAsmOperand.h [new file with mode: 0644]
lib/MC/CMakeLists.txt
lib/MC/MCAsmLexer.cpp [deleted file]
lib/MC/MCAsmParser.cpp [deleted file]
lib/MC/MCParser/MCAsmLexer.cpp [new file with mode: 0644]
lib/MC/MCParser/MCAsmParser.cpp [new file with mode: 0644]
lib/MC/MCParser/TargetAsmParser.cpp [new file with mode: 0644]
lib/MC/Makefile
lib/MC/TargetAsmParser.cpp [deleted file]
lib/Target/ARM/AsmParser/ARMAsmParser.cpp
lib/Target/X86/AsmParser/X86AsmParser.cpp
tools/llvm-mc/AsmLexer.h
tools/llvm-mc/AsmParser.cpp
tools/llvm-mc/AsmParser.h
tools/llvm-mc/CMakeLists.txt
tools/llvm-mc/Makefile
tools/llvm-mc/llvm-mc.cpp

diff --git a/include/llvm/MC/MCAsmLexer.h b/include/llvm/MC/MCAsmLexer.h
deleted file mode 100644 (file)
index bec6ede..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-//===-- llvm/MC/MCAsmLexer.h - Abstract Asm Lexer Interface -----*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_MC_MCASMLEXER_H
-#define LLVM_MC_MCASMLEXER_H
-
-#include "llvm/ADT/StringRef.h"
-#include "llvm/System/DataTypes.h"
-#include "llvm/Support/SMLoc.h"
-
-namespace llvm {
-class MCAsmLexer;
-class MCInst;
-class Target;
-
-/// AsmToken - Target independent representation for an assembler token.
-class AsmToken {
-public:
-  enum TokenKind {
-    // Markers
-    Eof, Error,
-
-    // String values.
-    Identifier,
-    String,
-    
-    // Integer values.
-    Integer,
-    
-    // No-value.
-    EndOfStatement,
-    Colon,
-    Plus, Minus, Tilde,
-    Slash,    // '/'
-    LParen, RParen, LBrac, RBrac, LCurly, RCurly,
-    Star, Comma, Dollar, Equal, EqualEqual,
-    
-    Pipe, PipePipe, Caret, 
-    Amp, AmpAmp, Exclaim, ExclaimEqual, Percent, Hash,
-    Less, LessEqual, LessLess, LessGreater,
-    Greater, GreaterEqual, GreaterGreater
-  };
-
-  TokenKind Kind;
-
-  /// A reference to the entire token contents; this is always a pointer into
-  /// a memory buffer owned by the source manager.
-  StringRef Str;
-
-  int64_t IntVal;
-
-public:
-  AsmToken() {}
-  AsmToken(TokenKind _Kind, StringRef _Str, int64_t _IntVal = 0)
-    : Kind(_Kind), Str(_Str), IntVal(_IntVal) {}
-
-  TokenKind getKind() const { return Kind; }
-  bool is(TokenKind K) const { return Kind == K; }
-  bool isNot(TokenKind K) const { return Kind != K; }
-
-  SMLoc getLoc() const;
-
-  /// getStringContents - Get the contents of a string token (without quotes).
-  StringRef getStringContents() const { 
-    assert(Kind == String && "This token isn't a string!");
-    return Str.slice(1, Str.size() - 1);
-  }
-
-  /// getIdentifier - Get the identifier string for the current token, which
-  /// should be an identifier or a string. This gets the portion of the string
-  /// which should be used as the identifier, e.g., it does not include the
-  /// quotes on strings.
-  StringRef getIdentifier() const {
-    if (Kind == Identifier)
-      return getString();
-    return getStringContents();
-  }
-
-  /// getString - Get the string for the current token, this includes all
-  /// characters (for example, the quotes on strings) in the token.
-  ///
-  /// The returned StringRef points into the source manager's memory buffer, and
-  /// is safe to store across calls to Lex().
-  StringRef getString() const { return Str; }
-
-  // FIXME: Don't compute this in advance, it makes every token larger, and is
-  // also not generally what we want (it is nicer for recovery etc. to lex 123br
-  // as a single token, then diagnose as an invalid number).
-  int64_t getIntVal() const { 
-    assert(Kind == Integer && "This token isn't an integer!");
-    return IntVal; 
-  }
-};
-
-/// MCAsmLexer - Generic assembler lexer interface, for use by target specific
-/// assembly lexers.
-class MCAsmLexer {
-  /// The current token, stored in the base class for faster access.
-  AsmToken CurTok;
-  
-  /// The location and description of the current error
-  SMLoc ErrLoc;
-  std::string Err;
-
-  MCAsmLexer(const MCAsmLexer &);   // DO NOT IMPLEMENT
-  void operator=(const MCAsmLexer &);  // DO NOT IMPLEMENT
-protected: // Can only create subclasses.
-  MCAsmLexer();
-
-  virtual AsmToken LexToken() = 0;
-  
-  void SetError(const SMLoc &errLoc, const std::string &err) {
-    ErrLoc = errLoc;
-    Err = err;
-  }
-  
-public:
-  virtual ~MCAsmLexer();
-
-  /// Lex - Consume the next token from the input stream and return it.
-  ///
-  /// The lexer will continuosly return the end-of-file token once the end of
-  /// the main input file has been reached.
-  const AsmToken &Lex() {
-    return CurTok = LexToken();
-  }
-
-  /// getTok - Get the current (last) lexed token.
-  const AsmToken &getTok() {
-    return CurTok;
-  }
-  
-  /// getErrLoc - Get the current error location
-  const SMLoc &getErrLoc() {
-    return ErrLoc;
-  }
-           
-  /// getErr - Get the current error string
-  const std::string &getErr() {
-    return Err;
-  }
-
-  /// getKind - Get the kind of current token.
-  AsmToken::TokenKind getKind() const { return CurTok.getKind(); }
-
-  /// is - Check if the current token has kind \arg K.
-  bool is(AsmToken::TokenKind K) const { return CurTok.is(K); }
-
-  /// isNot - Check if the current token has kind \arg K.
-  bool isNot(AsmToken::TokenKind K) const { return CurTok.isNot(K); }
-};
-
-} // End llvm namespace
-
-#endif
diff --git a/include/llvm/MC/MCAsmParser.h b/include/llvm/MC/MCAsmParser.h
deleted file mode 100644 (file)
index 843c692..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-//===-- llvm/MC/MCAsmParser.h - Abstract Asm Parser Interface ---*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_MC_MCASMPARSER_H
-#define LLVM_MC_MCASMPARSER_H
-
-#include "llvm/System/DataTypes.h"
-
-namespace llvm {
-class AsmToken;
-class MCAsmLexer;
-class MCContext;
-class MCExpr;
-class MCStreamer;
-class MCValue;
-class SMLoc;
-class Twine;
-
-/// MCAsmParser - Generic assembler parser interface, for use by target specific
-/// assembly parsers.
-class MCAsmParser {
-  MCAsmParser(const MCAsmParser &);   // DO NOT IMPLEMENT
-  void operator=(const MCAsmParser &);  // DO NOT IMPLEMENT
-protected: // Can only create subclasses.
-  MCAsmParser();
-public:
-  virtual ~MCAsmParser();
-
-  virtual MCAsmLexer &getLexer() = 0;
-
-  virtual MCContext &getContext() = 0;
-
-  /// getSteamer - Return the output streamer for the assembler.
-  virtual MCStreamer &getStreamer() = 0;
-
-  /// Warning - Emit a warning at the location \arg L, with the message \arg
-  /// Msg.
-  virtual void Warning(SMLoc L, const Twine &Msg) = 0;
-
-  /// Warning - Emit an error at the location \arg L, with the message \arg
-  /// Msg.
-  ///
-  /// \return The return value is always true, as an idiomatic convenience to
-  /// clients.
-  virtual bool Error(SMLoc L, const Twine &Msg) = 0;
-
-  /// Lex - Get the next AsmToken in the stream, possibly handling file
-  /// inclusion first.
-  virtual const AsmToken &Lex() = 0;
-  
-  /// getTok - Get the current AsmToken from the stream.
-  const AsmToken &getTok();
-  
-  /// ParseExpression - Parse an arbitrary expression.
-  ///
-  /// @param Res - The value of the expression. The result is undefined
-  /// on error.
-  /// @result - False on success.
-  virtual bool ParseExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0;
-  bool ParseExpression(const MCExpr *&Res);
-  
-  /// ParseParenExpression - Parse an arbitrary expression, assuming that an
-  /// initial '(' has already been consumed.
-  ///
-  /// @param Res - The value of the expression. The result is undefined
-  /// on error.
-  /// @result - False on success.
-  virtual bool ParseParenExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0;
-
-  /// ParseAbsoluteExpression - Parse an expression which must evaluate to an
-  /// absolute value.
-  ///
-  /// @param Res - The value of the absolute expression. The result is undefined
-  /// on error.
-  /// @result - False on success.
-  virtual bool ParseAbsoluteExpression(int64_t &Res) = 0;
-};
-
-} // End llvm namespace
-
-#endif
diff --git a/include/llvm/MC/MCParsedAsmOperand.h b/include/llvm/MC/MCParsedAsmOperand.h
deleted file mode 100644 (file)
index 7c2f5be..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-//===-- llvm/MC/MCParsedAsmOperand.h - Asm Parser Operand -------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_MC_MCASMOPERAND_H
-#define LLVM_MC_MCASMOPERAND_H
-
-namespace llvm {
-class SMLoc;
-
-/// MCParsedAsmOperand - This abstract class represents a source-level assembly
-/// instruction operand.  It should be subclassed by target-specific code.  This
-/// base class is used by target-independent clients and is the interface
-/// between parsing an asm instruction and recognizing it.
-class MCParsedAsmOperand {
-public:  
-  MCParsedAsmOperand() {}
-  virtual ~MCParsedAsmOperand() {}
-  
-  /// getStartLoc - Get the location of the first token of this operand.
-  virtual SMLoc getStartLoc() const;
-  /// getEndLoc - Get the location of the last token of this operand.
-  virtual SMLoc getEndLoc() const;
-};
-
-} // end namespace llvm.
-
-#endif
diff --git a/include/llvm/MC/MCParser/MCAsmLexer.h b/include/llvm/MC/MCParser/MCAsmLexer.h
new file mode 100644 (file)
index 0000000..bec6ede
--- /dev/null
@@ -0,0 +1,161 @@
+//===-- llvm/MC/MCAsmLexer.h - Abstract Asm Lexer Interface -----*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_MC_MCASMLEXER_H
+#define LLVM_MC_MCASMLEXER_H
+
+#include "llvm/ADT/StringRef.h"
+#include "llvm/System/DataTypes.h"
+#include "llvm/Support/SMLoc.h"
+
+namespace llvm {
+class MCAsmLexer;
+class MCInst;
+class Target;
+
+/// AsmToken - Target independent representation for an assembler token.
+class AsmToken {
+public:
+  enum TokenKind {
+    // Markers
+    Eof, Error,
+
+    // String values.
+    Identifier,
+    String,
+    
+    // Integer values.
+    Integer,
+    
+    // No-value.
+    EndOfStatement,
+    Colon,
+    Plus, Minus, Tilde,
+    Slash,    // '/'
+    LParen, RParen, LBrac, RBrac, LCurly, RCurly,
+    Star, Comma, Dollar, Equal, EqualEqual,
+    
+    Pipe, PipePipe, Caret, 
+    Amp, AmpAmp, Exclaim, ExclaimEqual, Percent, Hash,
+    Less, LessEqual, LessLess, LessGreater,
+    Greater, GreaterEqual, GreaterGreater
+  };
+
+  TokenKind Kind;
+
+  /// A reference to the entire token contents; this is always a pointer into
+  /// a memory buffer owned by the source manager.
+  StringRef Str;
+
+  int64_t IntVal;
+
+public:
+  AsmToken() {}
+  AsmToken(TokenKind _Kind, StringRef _Str, int64_t _IntVal = 0)
+    : Kind(_Kind), Str(_Str), IntVal(_IntVal) {}
+
+  TokenKind getKind() const { return Kind; }
+  bool is(TokenKind K) const { return Kind == K; }
+  bool isNot(TokenKind K) const { return Kind != K; }
+
+  SMLoc getLoc() const;
+
+  /// getStringContents - Get the contents of a string token (without quotes).
+  StringRef getStringContents() const { 
+    assert(Kind == String && "This token isn't a string!");
+    return Str.slice(1, Str.size() - 1);
+  }
+
+  /// getIdentifier - Get the identifier string for the current token, which
+  /// should be an identifier or a string. This gets the portion of the string
+  /// which should be used as the identifier, e.g., it does not include the
+  /// quotes on strings.
+  StringRef getIdentifier() const {
+    if (Kind == Identifier)
+      return getString();
+    return getStringContents();
+  }
+
+  /// getString - Get the string for the current token, this includes all
+  /// characters (for example, the quotes on strings) in the token.
+  ///
+  /// The returned StringRef points into the source manager's memory buffer, and
+  /// is safe to store across calls to Lex().
+  StringRef getString() const { return Str; }
+
+  // FIXME: Don't compute this in advance, it makes every token larger, and is
+  // also not generally what we want (it is nicer for recovery etc. to lex 123br
+  // as a single token, then diagnose as an invalid number).
+  int64_t getIntVal() const { 
+    assert(Kind == Integer && "This token isn't an integer!");
+    return IntVal; 
+  }
+};
+
+/// MCAsmLexer - Generic assembler lexer interface, for use by target specific
+/// assembly lexers.
+class MCAsmLexer {
+  /// The current token, stored in the base class for faster access.
+  AsmToken CurTok;
+  
+  /// The location and description of the current error
+  SMLoc ErrLoc;
+  std::string Err;
+
+  MCAsmLexer(const MCAsmLexer &);   // DO NOT IMPLEMENT
+  void operator=(const MCAsmLexer &);  // DO NOT IMPLEMENT
+protected: // Can only create subclasses.
+  MCAsmLexer();
+
+  virtual AsmToken LexToken() = 0;
+  
+  void SetError(const SMLoc &errLoc, const std::string &err) {
+    ErrLoc = errLoc;
+    Err = err;
+  }
+  
+public:
+  virtual ~MCAsmLexer();
+
+  /// Lex - Consume the next token from the input stream and return it.
+  ///
+  /// The lexer will continuosly return the end-of-file token once the end of
+  /// the main input file has been reached.
+  const AsmToken &Lex() {
+    return CurTok = LexToken();
+  }
+
+  /// getTok - Get the current (last) lexed token.
+  const AsmToken &getTok() {
+    return CurTok;
+  }
+  
+  /// getErrLoc - Get the current error location
+  const SMLoc &getErrLoc() {
+    return ErrLoc;
+  }
+           
+  /// getErr - Get the current error string
+  const std::string &getErr() {
+    return Err;
+  }
+
+  /// getKind - Get the kind of current token.
+  AsmToken::TokenKind getKind() const { return CurTok.getKind(); }
+
+  /// is - Check if the current token has kind \arg K.
+  bool is(AsmToken::TokenKind K) const { return CurTok.is(K); }
+
+  /// isNot - Check if the current token has kind \arg K.
+  bool isNot(AsmToken::TokenKind K) const { return CurTok.isNot(K); }
+};
+
+} // End llvm namespace
+
+#endif
diff --git a/include/llvm/MC/MCParser/MCAsmParser.h b/include/llvm/MC/MCParser/MCAsmParser.h
new file mode 100644 (file)
index 0000000..843c692
--- /dev/null
@@ -0,0 +1,88 @@
+//===-- llvm/MC/MCAsmParser.h - Abstract Asm Parser Interface ---*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_MC_MCASMPARSER_H
+#define LLVM_MC_MCASMPARSER_H
+
+#include "llvm/System/DataTypes.h"
+
+namespace llvm {
+class AsmToken;
+class MCAsmLexer;
+class MCContext;
+class MCExpr;
+class MCStreamer;
+class MCValue;
+class SMLoc;
+class Twine;
+
+/// MCAsmParser - Generic assembler parser interface, for use by target specific
+/// assembly parsers.
+class MCAsmParser {
+  MCAsmParser(const MCAsmParser &);   // DO NOT IMPLEMENT
+  void operator=(const MCAsmParser &);  // DO NOT IMPLEMENT
+protected: // Can only create subclasses.
+  MCAsmParser();
+public:
+  virtual ~MCAsmParser();
+
+  virtual MCAsmLexer &getLexer() = 0;
+
+  virtual MCContext &getContext() = 0;
+
+  /// getSteamer - Return the output streamer for the assembler.
+  virtual MCStreamer &getStreamer() = 0;
+
+  /// Warning - Emit a warning at the location \arg L, with the message \arg
+  /// Msg.
+  virtual void Warning(SMLoc L, const Twine &Msg) = 0;
+
+  /// Warning - Emit an error at the location \arg L, with the message \arg
+  /// Msg.
+  ///
+  /// \return The return value is always true, as an idiomatic convenience to
+  /// clients.
+  virtual bool Error(SMLoc L, const Twine &Msg) = 0;
+
+  /// Lex - Get the next AsmToken in the stream, possibly handling file
+  /// inclusion first.
+  virtual const AsmToken &Lex() = 0;
+  
+  /// getTok - Get the current AsmToken from the stream.
+  const AsmToken &getTok();
+  
+  /// ParseExpression - Parse an arbitrary expression.
+  ///
+  /// @param Res - The value of the expression. The result is undefined
+  /// on error.
+  /// @result - False on success.
+  virtual bool ParseExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0;
+  bool ParseExpression(const MCExpr *&Res);
+  
+  /// ParseParenExpression - Parse an arbitrary expression, assuming that an
+  /// initial '(' has already been consumed.
+  ///
+  /// @param Res - The value of the expression. The result is undefined
+  /// on error.
+  /// @result - False on success.
+  virtual bool ParseParenExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0;
+
+  /// ParseAbsoluteExpression - Parse an expression which must evaluate to an
+  /// absolute value.
+  ///
+  /// @param Res - The value of the absolute expression. The result is undefined
+  /// on error.
+  /// @result - False on success.
+  virtual bool ParseAbsoluteExpression(int64_t &Res) = 0;
+};
+
+} // End llvm namespace
+
+#endif
diff --git a/include/llvm/MC/MCParser/MCParsedAsmOperand.h b/include/llvm/MC/MCParser/MCParsedAsmOperand.h
new file mode 100644 (file)
index 0000000..7c2f5be
--- /dev/null
@@ -0,0 +1,33 @@
+//===-- llvm/MC/MCParsedAsmOperand.h - Asm Parser Operand -------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_MC_MCASMOPERAND_H
+#define LLVM_MC_MCASMOPERAND_H
+
+namespace llvm {
+class SMLoc;
+
+/// MCParsedAsmOperand - This abstract class represents a source-level assembly
+/// instruction operand.  It should be subclassed by target-specific code.  This
+/// base class is used by target-independent clients and is the interface
+/// between parsing an asm instruction and recognizing it.
+class MCParsedAsmOperand {
+public:  
+  MCParsedAsmOperand() {}
+  virtual ~MCParsedAsmOperand() {}
+  
+  /// getStartLoc - Get the location of the first token of this operand.
+  virtual SMLoc getStartLoc() const;
+  /// getEndLoc - Get the location of the last token of this operand.
+  virtual SMLoc getEndLoc() const;
+};
+
+} // end namespace llvm.
+
+#endif
index 8a1a05863746adcf06ca7faebb035258270fe5f6..9ead33b481f76aee83d2a3c1bc23e0dd64f33346 100644 (file)
@@ -2,8 +2,6 @@ add_llvm_library(LLVMMC
   MCAsmInfo.cpp
   MCAsmInfoCOFF.cpp
   MCAsmInfoDarwin.cpp
-  MCAsmLexer.cpp
-  MCAsmParser.cpp
   MCAsmStreamer.cpp
   MCAssembler.cpp
   MCCodeEmitter.cpp
@@ -20,5 +18,4 @@ add_llvm_library(LLVMMC
   MCStreamer.cpp
   MCSymbol.cpp
   MCValue.cpp
-  TargetAsmParser.cpp
   )
diff --git a/lib/MC/MCAsmLexer.cpp b/lib/MC/MCAsmLexer.cpp
deleted file mode 100644 (file)
index 1e34ed6..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-//===-- MCAsmLexer.cpp - Abstract Asm Lexer Interface ---------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/MC/MCAsmLexer.h"
-#include "llvm/Support/SourceMgr.h"
-
-using namespace llvm;
-
-MCAsmLexer::MCAsmLexer() : CurTok(AsmToken::Error, StringRef()) {
-}
-
-MCAsmLexer::~MCAsmLexer() {
-}
-
-SMLoc AsmToken::getLoc() const {
-  return SMLoc::getFromPointer(Str.data());
-}
diff --git a/lib/MC/MCAsmParser.cpp b/lib/MC/MCAsmParser.cpp
deleted file mode 100644 (file)
index 299d005..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-//===-- MCAsmParser.cpp - Abstract Asm Parser Interface -------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/MC/MCAsmParser.h"
-#include "llvm/MC/MCAsmLexer.h"
-#include "llvm/MC/MCParsedAsmOperand.h"
-#include "llvm/Support/SourceMgr.h"
-using namespace llvm;
-
-MCAsmParser::MCAsmParser() {
-}
-
-MCAsmParser::~MCAsmParser() {
-}
-
-const AsmToken &MCAsmParser::getTok() {
-  return getLexer().getTok();
-}
-
-bool MCAsmParser::ParseExpression(const MCExpr *&Res) {
-  SMLoc L;
-  return ParseExpression(Res, L);
-}
-
-/// getStartLoc - Get the location of the first token of this operand.
-SMLoc MCParsedAsmOperand::getStartLoc() const { return SMLoc(); }
-SMLoc MCParsedAsmOperand::getEndLoc() const { return SMLoc(); }
-
-
diff --git a/lib/MC/MCParser/MCAsmLexer.cpp b/lib/MC/MCParser/MCAsmLexer.cpp
new file mode 100644 (file)
index 0000000..e5b2955
--- /dev/null
@@ -0,0 +1,23 @@
+//===-- MCAsmLexer.cpp - Abstract Asm Lexer Interface ---------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/MC/MCParser/MCAsmLexer.h"
+#include "llvm/Support/SourceMgr.h"
+
+using namespace llvm;
+
+MCAsmLexer::MCAsmLexer() : CurTok(AsmToken::Error, StringRef()) {
+}
+
+MCAsmLexer::~MCAsmLexer() {
+}
+
+SMLoc AsmToken::getLoc() const {
+  return SMLoc::getFromPointer(Str.data());
+}
diff --git a/lib/MC/MCParser/MCAsmParser.cpp b/lib/MC/MCParser/MCAsmParser.cpp
new file mode 100644 (file)
index 0000000..b8c2054
--- /dev/null
@@ -0,0 +1,35 @@
+//===-- MCAsmParser.cpp - Abstract Asm Parser Interface -------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/MC/MCParser/MCAsmParser.h"
+#include "llvm/MC/MCParser/MCAsmLexer.h"
+#include "llvm/MC/MCParser/MCParsedAsmOperand.h"
+#include "llvm/Support/SourceMgr.h"
+using namespace llvm;
+
+MCAsmParser::MCAsmParser() {
+}
+
+MCAsmParser::~MCAsmParser() {
+}
+
+const AsmToken &MCAsmParser::getTok() {
+  return getLexer().getTok();
+}
+
+bool MCAsmParser::ParseExpression(const MCExpr *&Res) {
+  SMLoc L;
+  return ParseExpression(Res, L);
+}
+
+/// getStartLoc - Get the location of the first token of this operand.
+SMLoc MCParsedAsmOperand::getStartLoc() const { return SMLoc(); }
+SMLoc MCParsedAsmOperand::getEndLoc() const { return SMLoc(); }
+
+
diff --git a/lib/MC/MCParser/TargetAsmParser.cpp b/lib/MC/MCParser/TargetAsmParser.cpp
new file mode 100644 (file)
index 0000000..05760c9
--- /dev/null
@@ -0,0 +1,19 @@
+//===-- TargetAsmParser.cpp - Target Assembly Parser -----------------------==//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Target/TargetAsmParser.h"
+using namespace llvm;
+
+TargetAsmParser::TargetAsmParser(const Target &T) 
+  : TheTarget(T)
+{
+}
+
+TargetAsmParser::~TargetAsmParser() {
+}
index 314a5b1af2f40e70808f2cd355d923edb908a4cd..a661fa6f40804ddcaeba0c1bd6779abed2a410ee 100644 (file)
@@ -10,6 +10,7 @@
 LEVEL = ../..
 LIBRARYNAME = LLVMMC
 BUILD_ARCHIVE := 1
+PARALLEL_DIRS := MCParser
 
 include $(LEVEL)/Makefile.common
 
diff --git a/lib/MC/TargetAsmParser.cpp b/lib/MC/TargetAsmParser.cpp
deleted file mode 100644 (file)
index 05760c9..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-//===-- TargetAsmParser.cpp - Target Assembly Parser -----------------------==//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/Target/TargetAsmParser.h"
-using namespace llvm;
-
-TargetAsmParser::TargetAsmParser(const Target &T) 
-  : TheTarget(T)
-{
-}
-
-TargetAsmParser::~TargetAsmParser() {
-}
index b6dac44cfce4829fd6de57ba23e3b1fb15997b78..89c77690907865cd3c5b69c36495550ba4aefa21 100644 (file)
@@ -8,18 +8,18 @@
 //===----------------------------------------------------------------------===//
 
 #include "ARM.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/Twine.h"
-#include "llvm/MC/MCAsmLexer.h"
-#include "llvm/MC/MCAsmParser.h"
-#include "llvm/MC/MCParsedAsmOperand.h"
+#include "llvm/MC/MCParser/MCAsmLexer.h"
+#include "llvm/MC/MCParser/MCAsmParser.h"
+#include "llvm/MC/MCParser/MCParsedAsmOperand.h"
 #include "llvm/MC/MCStreamer.h"
 #include "llvm/MC/MCExpr.h"
 #include "llvm/MC/MCInst.h"
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/SourceMgr.h"
 #include "llvm/Target/TargetRegistry.h"
 #include "llvm/Target/TargetAsmParser.h"
+#include "llvm/Support/Compiler.h"
+#include "llvm/Support/SourceMgr.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/Twine.h"
 using namespace llvm;
 
 namespace {
index 8bff9bfd9138fede76b8e7473112ccbddb16274e..6ced1f4f151dba172b71295070730df2ae4308af 100644 (file)
 #include "X86.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/Twine.h"
-#include "llvm/MC/MCAsmLexer.h"
-#include "llvm/MC/MCAsmParser.h"
 #include "llvm/MC/MCStreamer.h"
 #include "llvm/MC/MCExpr.h"
 #include "llvm/MC/MCInst.h"
-#include "llvm/MC/MCParsedAsmOperand.h"
+#include "llvm/MC/MCParser/MCAsmLexer.h"
+#include "llvm/MC/MCParser/MCAsmParser.h"
+#include "llvm/MC/MCParser/MCParsedAsmOperand.h"
 #include "llvm/Support/SourceMgr.h"
 #include "llvm/Target/TargetRegistry.h"
 #include "llvm/Target/TargetAsmParser.h"
index 1d49e4b766dd8d2ea8d5a0130a187356a6aefb14..cf6eefb4083103160f21f9d01abf916e3745656e 100644 (file)
@@ -15,7 +15,7 @@
 #define ASMLEXER_H
 
 #include "llvm/ADT/StringRef.h"
-#include "llvm/MC/MCAsmLexer.h"
+#include "llvm/MC/MCParser/MCAsmLexer.h"
 #include "llvm/MC/MCAsmInfo.h"
 #include "llvm/System/DataTypes.h"
 #include <string>
index 068e506be26642ffcdc25ce35660bd802439cd16..503addb5e6cba4e4b621f1c6892f8ae9894abef2 100644 (file)
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCExpr.h"
 #include "llvm/MC/MCInst.h"
-#include "llvm/MC/MCParsedAsmOperand.h"
 #include "llvm/MC/MCSectionMachO.h"
 #include "llvm/MC/MCStreamer.h"
 #include "llvm/MC/MCSymbol.h"
 #include "llvm/MC/MCValue.h"
+#include "llvm/MC/MCParser/MCParsedAsmOperand.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/SourceMgr.h"
 #include "llvm/Support/raw_ostream.h"
index 9336d358063ba597588b17376fa7a39375d2c4cb..ef53d79ec8da0e039c3cbb65b58b69d6f476438a 100644 (file)
@@ -17,7 +17,7 @@
 #include <vector>
 #include "AsmLexer.h"
 #include "AsmCond.h"
-#include "llvm/MC/MCAsmParser.h"
+#include "llvm/MC/MCParser/MCAsmParser.h"
 #include "llvm/MC/MCSectionMachO.h"
 #include "llvm/MC/MCStreamer.h"
 #include "llvm/MC/MCAsmInfo.h"
index 46c5c6bfd642a3098024fe77823d3ba44fe3e220..fbfc2d4e26bdfab2a6942078ab672aaba90fa56f 100644 (file)
@@ -1,4 +1,4 @@
-set(LLVM_LINK_COMPONENTS ${LLVM_TARGETS_TO_BUILD} support MC)
+set(LLVM_LINK_COMPONENTS ${LLVM_TARGETS_TO_BUILD} support MC MCParser)
 
 add_llvm_tool(llvm-mc
   llvm-mc.cpp
index 9bfb773076de42302febbd8f16823abd83f6f9a8..5b0fe3f54462291c15ce3f1e91a3224d526a8e79 100644 (file)
@@ -19,6 +19,6 @@ NO_INSTALL = 1
 # early so we can set up LINK_COMPONENTS before including Makefile.rules
 include $(LEVEL)/Makefile.config
 
-LINK_COMPONENTS := $(TARGETS_TO_BUILD) MC support
+LINK_COMPONENTS := $(TARGETS_TO_BUILD) MCParser MC support
 
 include $(LLVM_SRC_ROOT)/Makefile.rules
index fe545ab6e90d7c2a210c0bf76bae9e44e551c680..9979df91757dfbb0914143e3cafaa5bbc49a8932 100644 (file)
@@ -12,7 +12,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/MC/MCAsmLexer.h"
+#include "llvm/MC/MCParser/MCAsmLexer.h"
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCCodeEmitter.h"
 #include "llvm/MC/MCInstPrinter.h"