MCAsmParser: Add dump() hook to MCParsedAsmOperand.
authorDaniel Dunbar <daniel@zuster.org>
Wed, 11 Aug 2010 06:37:04 +0000 (06:37 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Wed, 11 Aug 2010 06:37:04 +0000 (06:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110790 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/MCParser/MCParsedAsmOperand.h
lib/MC/MCParser/MCAsmParser.cpp
lib/Target/ARM/AsmParser/ARMAsmParser.cpp
lib/Target/X86/AsmParser/X86AsmParser.cpp

index 7c2f5beb7473db84cbf8e648e07d0803c7dab5cd..99fa5adae977fa3346fa01e64bf0aa88caa85864 100644 (file)
@@ -12,6 +12,7 @@
 
 namespace llvm {
 class SMLoc;
+class raw_ostream;
 
 /// MCParsedAsmOperand - This abstract class represents a source-level assembly
 /// instruction operand.  It should be subclassed by target-specific code.  This
@@ -23,9 +24,12 @@ public:
   virtual ~MCParsedAsmOperand() {}
   
   /// getStartLoc - Get the location of the first token of this operand.
-  virtual SMLoc getStartLoc() const;
+  virtual SMLoc getStartLoc() const = 0;
   /// getEndLoc - Get the location of the last token of this operand.
-  virtual SMLoc getEndLoc() const;
+  virtual SMLoc getEndLoc() const = 0;
+
+  /// dump - Print a debug representation of the operand to the given stream.
+  virtual void dump(raw_ostream &OS) const = 0;
 };
 
 } // end namespace llvm.
index 2544fcaf4bd298d8edfb3478857d358f5af66a02..0e0533b737016050f2d71b59ea726ed7dd66b429 100644 (file)
@@ -41,8 +41,4 @@ bool MCAsmParser::ParseExpression(const MCExpr *&Res) {
   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(); }
-
 
index 19d7d9aa47984e1501883571d19a1d34c2dfb238..2f6ac8d86d4c808c3a976250879a886e66eedcc5 100644 (file)
@@ -234,6 +234,8 @@ public:
     addExpr(Inst, getImm());
   }
 
+  virtual void dump(raw_ostream &OS) const {}
+
   static void CreateToken(OwningPtr<ARMOperand> &Op, StringRef Str,
                           SMLoc S) {
     Op.reset(new ARMOperand);
index 981245d124d7d241b4e31654edf2422af783a1b8..874a38ad0ed9964b4be47752a961a5763d081633 100644 (file)
@@ -148,6 +148,8 @@ struct X86Operand : public MCParsedAsmOperand {
   /// getEndLoc - Get the location of the last token of this operand.
   SMLoc getEndLoc() const { return EndLoc; }
 
+  virtual void dump(raw_ostream &OS) const {}
+
   StringRef getToken() const {
     assert(Kind == Token && "Invalid access!");
     return StringRef(Tok.Data, Tok.Length);