<div dir="ltr"><div>The attached patch (instalias1.patch) adds field "Assemble", which AsmMatcherEmitter can use to decide whether it should ignore the alias.<br><br></div><div>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":</div>
<div><br></div><div>def : InstAlias<"move $dst, $src",</div>
<div>                (ADDu CPURegsOpnd:$dst, CPURegsOpnd:$src,ZERO), 1>,</div><div>      Requires<[NotMips64]>;</div><div>def : InstAlias<"move $dst, $src",</div><div>                (OR CPURegsOpnd:$dst, CPURegsOpnd:$src,ZERO), 1>,</div>

<div><br></div><div>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:</div><div><br></div>

<div>"addu $2, $3, $zero" or "or $2, $3, $zero" =>  "move $2, $3"</div><div><br></div><div>However, this causes tablegen to place two entries in array MatchTable in MipsGenAsmMatcher.inc:</div>

<div><br></div><div><div>  { 1364 /* move */, Mips::OR, Convert__CPURegsAsm1_0__CPURegsAsm1_1__regZERO, Feature_NotMips64, { MCK_CPURegsAsm, MCK_CPURegsAsm }, 0},</div><div>  { 1364 /* move */, Mips::ADDu, Convert__CPURegsAsm1_0__CPURegsAsm1_1__regZERO, Feature_NotMips64, { MCK_CPURegsAsm, MCK_CPURegsAsm }, 0},</div>

</div><div><br></div><div>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></div><div>Please review.<br><br></div></div>