X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FMC%2FMCTargetAsmParser.h;h=c9ea5ae48464d95b7d26230b704d30dedb4f72d3;hb=b1f8c139c5c1b1a50bf65b8141dd57434c793e54;hp=0166f2327d6798b7dbe72c3c689ee6adf5052768;hpb=bb0752b040cfe206afeef7fa60e80dde91594fa1;p=oota-llvm.git diff --git a/include/llvm/MC/MCTargetAsmParser.h b/include/llvm/MC/MCTargetAsmParser.h index 0166f2327d6..c9ea5ae4846 100644 --- a/include/llvm/MC/MCTargetAsmParser.h +++ b/include/llvm/MC/MCTargetAsmParser.h @@ -18,12 +18,23 @@ class StringRef; class SMLoc; class AsmToken; class MCParsedAsmOperand; +class MCInst; template class SmallVectorImpl; /// MCTargetAsmParser - Generic interface to target specific assembly parsers. class MCTargetAsmParser : public MCAsmParserExtension { - MCTargetAsmParser(const MCTargetAsmParser &); // DO NOT IMPLEMENT - void operator=(const MCTargetAsmParser &); // DO NOT IMPLEMENT +public: + enum MatchResultTy { + Match_InvalidOperand, + Match_MissingFeature, + Match_MnemonicFail, + Match_Success, + FIRST_TARGET_MATCH_RESULT_TY + }; + +private: + MCTargetAsmParser(const MCTargetAsmParser &) LLVM_DELETED_FUNCTION; + void operator=(const MCTargetAsmParser &) LLVM_DELETED_FUNCTION; protected: // Can only create subclasses. MCTargetAsmParser(); @@ -67,6 +78,10 @@ public: /// \param DirectiveID - the identifier token of the directive. virtual bool ParseDirective(AsmToken DirectiveID) = 0; + /// mnemonicIsValid - This returns true if this is a valid mnemonic and false + /// otherwise. + virtual bool mnemonicIsValid(StringRef Mnemonic) = 0; + /// MatchAndEmitInstruction - Recognize a series of operands of a parsed /// instruction as an actual MCInst and emit it to the specified MCStreamer. /// This returns false on success and returns true on failure to match. @@ -74,10 +89,19 @@ public: /// On failure, the target parser is responsible for emitting a diagnostic /// explaining the match failure. virtual bool - MatchAndEmitInstruction(SMLoc IDLoc, + MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode, SmallVectorImpl &Operands, - MCStreamer &Out) = 0; + MCStreamer &Out, unsigned &ErrorInfo, + bool MatchingInlineAsm) = 0; + + /// checkTargetMatchPredicate - Validate the instruction match against + /// any complex target predicates not expressible via match classes. + virtual unsigned checkTargetMatchPredicate(MCInst &Inst) { + return Match_Success; + } + virtual void convertToMapAndConstraints(unsigned Kind, + const SmallVectorImpl &Operands) = 0; }; } // End llvm namespace