[PATCH] D14255: [AsmParser] Provide direct access to mnemonic token. Allow assignment parsing to be hooked by target. Allow target to specify if identifier is a label.

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 31 01:22:11 PST 2015


And here is yet another commit that you landed without getting an LGTM from
anyone.

On Sun, Nov 8, 2015 at 4:18 PM Colin LeMahieu via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> This revision was automatically updated to reflect the committed changes.
> Closed by commit rL252435: [AsmParser] Provide target direct access to
> mnemonic token.  Allow assignment… (authored by colinl).
>
> Changed prior to commit:
>   http://reviews.llvm.org/D14255?vs=38961&id=39657#toc
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D14255
>
> Files:
>   llvm/trunk/include/llvm/MC/MCTargetAsmParser.h
>   llvm/trunk/lib/MC/MCParser/AsmParser.cpp
>
> Index: llvm/trunk/include/llvm/MC/MCTargetAsmParser.h
> ===================================================================
> --- llvm/trunk/include/llvm/MC/MCTargetAsmParser.h
> +++ llvm/trunk/include/llvm/MC/MCTargetAsmParser.h
> @@ -143,6 +143,10 @@
>    /// \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
>    ///
> @@ -192,6 +196,11 @@
>    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) {
> Index: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
> ===================================================================
> --- llvm/trunk/lib/MC/MCParser/AsmParser.cpp
> +++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp
> @@ -1396,6 +1396,8 @@
>    // See what kind of statement we have.
>    switch (Lexer.getKind()) {
>    case AsmToken::Colon: {
> +    if (!getTargetParser().isLabel(ID))
> +      break;
>      checkForValidSection();
>
>      // identifier ':'   -> Label.
> @@ -1454,6 +1456,8 @@
>    }
>
>    case AsmToken::Equal:
> +    if (!getTargetParser().equalIsAsmAssignment())
> +      break;
>      // identifier '=' ... -> assignment statement
>      Lex();
>
> @@ -1701,7 +1705,7 @@
>    // 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;
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151231/66e73200/attachment.html>


More information about the llvm-commits mailing list