<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Jul 19, 2013, at 1:40 PM, Akira Hatanaka <<a href="mailto:ahatanak@gmail.com">ahatanak@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><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.<span class="Apple-converted-space"> </span><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></div></div></div></blockquote><div><br></div><div>This is correct. If you’re finding it necessary to define ambiguous aliases, that implies there’s something deeper in how the assembly syntax is modeled that should be looked at(1).</div><div><br></div><div>-Jim</div><div><br></div><div>(1) I’ll grant that MIPS has lots of really strange historical legacy syntax, assembler pseudo instructions, etc. that it needs to live with that could make this hard.</div><br><blockquote type="cite"><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr"><div><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 class="Apple-converted-space"> </span><span dir="ltr"><<a href="mailto:grosbach@apple.com" target="_blank">grosbach@apple.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: 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>><span class="Apple-converted-space"> </span><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>><span class="Apple-converted-space"> </span><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a></blockquote></div></div></div></blockquote></div><br></body></html>