[LLVMdev] Directive parsing for AsmParser
Jim Grosbach
grosbach at apple.com
Wed May 9 11:36:12 PDT 2012
Hi Vladimir,
This sounds reasonable to me. Allowing a target to hook into otherwise generic directives seems a good thing. Copious testing to make sure there's nothing subtle going on would be a good idea, of course. :)
-Jim
On May 9, 2012, at 6:26 AM, Medic, Vladimir wrote:
> I'm trying to build a standalone assembler for Mips using AsmParser and I'm facing a problem with assembly directives. Mips assembler has following syntax for .set directive
>
> .set reorder
>
> or
>
> .set noreorder
>
> which allow/disallow assembler to change the order of instructions in the block that follows. As the implemented AsmParser requires .set directive to have the following syntax:
>
> /// ParseDirectiveSet:
> /// ::= .set identifier ',' expression
>
> I am getting an error reported when '.set reoeder/noreorder' is met in the code. After some investigation it seems reasonable for me to move the code which handles target specific directive parsing from the end to the beginning of the block, like this (AsmParser::ParseStatement, AsmParser.cpp line 1225):
>
> // Otherwise, we have a normal instruction or directive.
> if (IDVal[0] == '.' && IDVal != ".") {
>
> // Target hook for parsing target specific directives.
> if (!getTargetParser().ParseDirective(ID))
> return false;
> .
> .
> .
> .
> }
> thus allowing the target specific directives to be handled first rather then at the end.
>
> What is your opinion regarding this change?
>
> Kind regards
>
> Vladimir
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120509/2eac62b9/attachment.html>
More information about the llvm-dev
mailing list