/// \return True on failure.
virtual bool ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
SMLoc NameLoc, OperandVector &Operands) = 0;
+ virtual bool ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
+ AsmToken Token, OperandVector &Operands) {
+ return ParseInstruction(Info, Name, Token.getLoc(), Operands);
+ }
/// ParseDirective - Parse a target specific assembler directive
///
virtual void convertToMapAndConstraints(unsigned Kind,
const OperandVector &Operands) = 0;
+ // Return whether this parser uses assignment statements with equals tokens
+ virtual bool equalIsAsmAssignment() { return true; };
+ // Return whether this start of statement identifier is a label
+ virtual bool isLabel(AsmToken &Token) { return true; };
+
virtual const MCExpr *applyModifierToExpr(const MCExpr *E,
MCSymbolRefExpr::VariantKind,
MCContext &Ctx) {
// See what kind of statement we have.
switch (Lexer.getKind()) {
case AsmToken::Colon: {
+ if (!getTargetParser().isLabel(ID))
+ break;
checkForValidSection();
// identifier ':' -> Label.
}
case AsmToken::Equal:
+ if (!getTargetParser().equalIsAsmAssignment())
+ break;
// identifier '=' ... -> assignment statement
Lex();
// Canonicalize the opcode to lower case.
std::string OpcodeStr = IDVal.lower();
ParseInstructionInfo IInfo(Info.AsmRewrites);
- bool HadError = getTargetParser().ParseInstruction(IInfo, OpcodeStr, IDLoc,
+ bool HadError = getTargetParser().ParseInstruction(IInfo, OpcodeStr, ID,
Info.ParsedOperands);
Info.ParseError = HadError;