<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Dec 16, 2013 at 10:24 AM, David Peixotto <span dir="ltr"><<a href="mailto:dpeixott@codeaurora.org" target="_blank">dpeixott@codeaurora.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Saleem,<br>
<br>
Thank you for implementing support for this directive. I think it is nice to have for completness with gas.<br>
<br>
My main question is how does this directive interact with .include'd files. If we have .end in a file that is being processed because of a .include will it stop processing everything, or only that file. I think gas will stop processing everything, even the original file.<br>

<br>
Please add a test case that shows the behavior to expect when processing a .end directive in a .include file. I think it is ok to follow what gas does here.<br>
<span class="HOEnZb"><font color="#888888"><br></font></span></blockquote><div><br></div><div>Yes, the behaviour would be that.  The includes are handled by the preprocessor, and the lexer would consume the rest of the tokens, behaving as gas does.  I suppose I can add additional tests.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888">
-David<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
> -----Original Message-----<br>
> From: <a href="mailto:llvm-commits-bounces@cs.uiuc.edu">llvm-commits-bounces@cs.uiuc.edu</a> [mailto:<a href="mailto:llvm-commits-">llvm-commits-</a><br>
> <a href="mailto:bounces@cs.uiuc.edu">bounces@cs.uiuc.edu</a>] On Behalf Of Saleem Abdulrasool<br>
> Sent: Sunday, December 15, 2013 7:28 PM<br>
> To: <a href="mailto:compnerd@compnerd.org">compnerd@compnerd.org</a><br>
> Cc: <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> Subject: Re: [PATCH] AsmParser: add support for .end directive<br>
><br>
>   Fix for target specific handling of end directive (e.g. MIPS).<br>
><br>
> <a href="http://llvm-reviews.chandlerc.com/D2414" target="_blank">http://llvm-reviews.chandlerc.com/D2414</a><br>
><br>
> CHANGE SINCE LAST DIFF<br>
>   <a href="http://llvm-reviews.chandlerc.com/D2414?vs=6109&id=6112#toc" target="_blank">http://llvm-reviews.chandlerc.com/D2414?vs=6109&id=6112#toc</a><br>
><br>
> Files:<br>
>   lib/MC/MCParser/AsmParser.cpp<br>
>   test/MC/AsmParser/directive_end.s<br>
><br>
> Index: lib/MC/MCParser/AsmParser.cpp<br>
> ===================================================================<br>
> --- lib/MC/MCParser/AsmParser.cpp<br>
> +++ lib/MC/MCParser/AsmParser.cpp<br>
> @@ -358,7 +358,8 @@<br>
>      DK_CFI_RESTORE, DK_CFI_ESCAPE, DK_CFI_SIGNAL_FRAME, DK_CFI_UNDEFINED,<br>
>      DK_CFI_REGISTER, DK_CFI_WINDOW_SAVE,<br>
>      DK_MACROS_ON, DK_MACROS_OFF, DK_MACRO, DK_ENDM, DK_ENDMACRO,<br>
> DK_PURGEM,<br>
> -    DK_SLEB128, DK_ULEB128<br>
> +    DK_SLEB128, DK_ULEB128,<br>
> +    DK_END<br>
>    };<br>
><br>
>    /// \brief Maps directive name --> DirectiveKind enum, for @@ -464,6<br>
> +465,9 @@<br>
>    // "align"<br>
>    bool parseDirectiveMSAlign(SMLoc DirectiveLoc, ParseStatementInfo<br>
> &Info);<br>
><br>
> +  // "end"<br>
> +  bool parseDirectiveEnd(SMLoc DirectiveLoc);<br>
> +<br>
>    void initializeDirectiveKindMap();<br>
>  };<br>
>  }<br>
> @@ -1516,6 +1520,8 @@<br>
>        return parseDirectiveEndMacro(IDVal);<br>
>      case DK_PURGEM:<br>
>        return parseDirectivePurgeMacro(IDLoc);<br>
> +    case DK_END:<br>
> +      return parseDirectiveEnd(IDLoc);<br>
>      }<br>
><br>
>      return Error(IDLoc, "unknown directive"); @@ -3751,6 +3757,20 @@<br>
>    return false;<br>
>  }<br>
><br>
> +/// parseDirectiveEnd<br>
> +/// ::= .end<br>
> +bool AsmParser::parseDirectiveEnd(SMLoc DirectiveLoc) {<br>
> +  if (getLexer().isNot(AsmToken::EndOfStatement))<br>
> +    return TokError("unexpected token in '.end' directive");<br>
> +<br>
> +  Lex();<br>
> +<br>
> +  while (Lexer.isNot(AsmToken::Eof))<br>
> +    Lex();<br>
> +<br>
> +  return false;<br>
> +}<br>
> +<br>
>  /// parseDirectiveEndIf<br>
>  /// ::= .endif<br>
>  bool AsmParser::parseDirectiveEndIf(SMLoc DirectiveLoc) { @@ -3836,6<br>
> +3856,7 @@<br>
>    DirectiveKindMap[".ifnotdef"] = DK_IFNOTDEF;<br>
>    DirectiveKindMap[".elseif"] = DK_ELSEIF;<br>
>    DirectiveKindMap[".else"] = DK_ELSE;<br>
> +  DirectiveKindMap[".end"] = DK_END;<br>
>    DirectiveKindMap[".endif"] = DK_ENDIF;<br>
>    DirectiveKindMap[".skip"] = DK_SKIP;<br>
>    DirectiveKindMap[".space"] = DK_SPACE;<br>
> Index: test/MC/AsmParser/directive_end.s<br>
> ===================================================================<br>
> --- /dev/null<br>
> +++ test/MC/AsmParser/directive_end.s<br>
> @@ -0,0 +1,11 @@<br>
> +# RUN: llvm-mc -triple i386-unknown-unknown %s -filetype obj -o - \<br>
> +# RUN:   | llvm-readobj -t | FileCheck %s<br>
> +<br>
> +     .end<br>
> +<br>
> +its_a_tarp:<br>
> +     int $0x3<br>
> +<br>
> +# CHECK: Symbol {<br>
> +# CHECK-NOT:   Name: its_a_tarp<br>
> +<br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Saleem Abdulrasool<br>compnerd (at) compnerd (dot) org
</div></div>