diff options
| author | Chris Lattner <sabre@nondot.org> | 2010-01-14 22:21:20 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2010-01-14 22:21:20 +0000 |
| commit | f29c0b6880c217b65a6a1df18a54e308719e48b3 (patch) | |
| tree | bc7ebf089faab00d1eb5efb4b266c26971c0b256 /llvm/include | |
| parent | fdf7031a1a896899cf1bb7f0bd812b2ae4467579 (diff) | |
| download | bcm5719-llvm-f29c0b6880c217b65a6a1df18a54e308719e48b3.tar.gz bcm5719-llvm-f29c0b6880c217b65a6a1df18a54e308719e48b3.zip | |
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
Diffstat (limited to 'llvm/include')
| -rw-r--r-- | llvm/include/llvm/Target/TargetAsmParser.h | 15 |
1 files changed, 13 insertions, 2 deletions
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 <typename T> 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<MCParsedAsmOperand*> &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<MCParsedAsmOperand*> &Operands, + MCInst &Inst) = 0; + }; } // End llvm namespace |

