From f29c0b6880c217b65a6a1df18a54e308719e48b3 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 14 Jan 2010 22:21:20 +0000 Subject: Split the TargetAsmParser "ParseInstruction" interface in half: the new ParseInstruction method just parses and returns a list of target operands. A new MatchInstruction interface is used to turn the operand list into an MCInst. This requires new/deleting all the operands, but it also gives targets the ability to use polymorphic operands if they want to. llvm-svn: 93469 --- llvm/include/llvm/Target/TargetAsmParser.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'llvm/include') diff --git a/llvm/include/llvm/Target/TargetAsmParser.h b/llvm/include/llvm/Target/TargetAsmParser.h index a265610f2f2..1d3da8b2c62 100644 --- a/llvm/include/llvm/Target/TargetAsmParser.h +++ b/llvm/include/llvm/Target/TargetAsmParser.h @@ -17,6 +17,8 @@ class StringRef; class Target; class SMLoc; class AsmToken; +class MCParsedAsmOperand; +template class SmallVectorImpl; /// TargetAsmParser - Generic interface to target specific assembly parsers. class TargetAsmParser { @@ -43,10 +45,11 @@ public: // /// \param AP - The current parser object. /// \param Name - The instruction name. - /// \param Inst [out] - On success, the parsed instruction. + /// \param Operands [out] - The list of parsed operands, this returns + /// ownership of them to the caller. /// \return True on failure. virtual bool ParseInstruction(const StringRef &Name, SMLoc NameLoc, - MCInst &Inst) = 0; + SmallVectorImpl &Operands) = 0; /// ParseDirective - Parse a target specific assembler directive /// @@ -59,6 +62,14 @@ public: /// /// \param ID - the identifier token of the directive. virtual bool ParseDirective(AsmToken DirectiveID) = 0; + + /// MatchInstruction - Recognize a series of operands of a parsed instruction + /// as an actual MCInst. This returns false and fills in Inst on success and + /// returns true on failure to match. + virtual bool + MatchInstruction(const SmallVectorImpl &Operands, + MCInst &Inst) = 0; + }; } // End llvm namespace -- cgit v1.2.3