<div dir="ltr"><div><div>Thank you for your quick response.<br><br>Could you be more specific? I am not sure if I understand what you mean when you say there is a bigger problem. <br><br></div>- Do you mean it is a mistake to have two aliases with the same .s format in the .td file, and neither AsmWriterEmitter nor AsmMatcherEmitter should have to deal with two aliases?<br>
<br></div>- Or we should leave InstAlias intact and define another class specifically for AsmWriterEmitter or instPrinter? This way, we can define as many aliases as we wish for instPrinter.<br><br></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Fri, Jul 19, 2013 at 1:12 PM, Jim Grosbach <span dir="ltr"><<a href="mailto:grosbach@apple.com" target="_blank">grosbach@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
This should be solved differently. InstAliases are for the parser and should never be ignored, so ambiguous aliases is an indication of a bigger problem.<br>
<br>
-Jim<br>
<div><div class="h5"><br>
<br>
On Jul 19, 2013, at 12:51 PM, Akira Hatanaka <<a href="mailto:ahatanak@gmail.com">ahatanak@gmail.com</a>> wrote:<br>
<br>
> The attached patch (instalias1.patch) adds field "Assemble", which AsmMatcherEmitter can use to decide whether it should ignore the alias.<br>
><br>
> This is needed when there are two InstAlias patterns with the same AsmString. For example, in MipsInstrInfo.td, there are two patterns which have the .s format, "move $dst, $src":<br>
><br>
> def : InstAlias<"move $dst, $src",<br>
>                 (ADDu CPURegsOpnd:$dst, CPURegsOpnd:$src,ZERO), 1>,<br>
>       Requires<[NotMips64]>;<br>
> def : InstAlias<"move $dst, $src",<br>
>                 (OR CPURegsOpnd:$dst, CPURegsOpnd:$src,ZERO), 1>,<br>
><br>
> We need two aliases here because we want to have instPrinter print a "move" instruction instead of an "addu" or "or" when one of the operands is $zero:<br>
><br>
> "addu $2, $3, $zero" or "or $2, $3, $zero" =>  "move $2, $3"<br>
><br>
> However, this causes tablegen to place two entries in array MatchTable in MipsGenAsmMatcher.inc:<br>
><br>
>   { 1364 /* move */, Mips::OR, Convert__CPURegsAsm1_0__CPURegsAsm1_1__regZERO, Feature_NotMips64, { MCK_CPURegsAsm, MCK_CPURegsAsm }, 0},<br>
>   { 1364 /* move */, Mips::ADDu, Convert__CPURegsAsm1_0__CPURegsAsm1_1__regZERO, Feature_NotMips64, { MCK_CPURegsAsm, MCK_CPURegsAsm }, 0},<br>
><br>
> The order in which these entries appear in the table seems arbitrary, as I discovered when  I made completely unrelated changes in other places. We want to have the assembler generate an "ADDu" instruction and ignore the pattern with "OR".<br>

><br>
> Please review.<br>
><br>
</div></div>> <instalias1.patch><instalias-mips.patch>_______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br>
</blockquote></div><br></div>