[llvm-commits] [llvm] r126538 - in /llvm/trunk/utils/TableGen: AsmWriterEmitter.cpp AsmWriterEmitter.h

Bill Wendling isanbard at gmail.com
Sun May 22 16:58:37 PDT 2011


On May 22, 2011, at 9:37 AM, Chris Lattner wrote:

>> Dan pointed out that some of the aliases are not as nice as what they're aliasing. We can disable them on a case-by-case basis by adding '0' to the end of the InstAlias. (Same for the MOVSD you mentioned below.)
> 
> That makes sense for the movsx vs movswl, but the point of this is that tblgen should be able to automatically prune these things out as well.  This is good because it reduces the code size of the generated alias stuff.
> 
Okay. The simplest heuristic would be to omit printing an alias which has more operands than the thing it's aliasing. I'll do that and then we can adjust the heuristic afterwards.

> What do you mean impossible?  My point is this instruction *always* has zero instructions, so this check is always true and shouldn't be generated.
> 
Sure. If I can get the information that an instruction will always take a specific number of instructions, then I'll omit that check.

>>> Also, this is another example of an alias that isn't worth it.  This is giving us "movsd" instead of "movsl" which isn't cheaper or better in terms of understandability.  This is bloating out the alias table.  I think you need a cost model or something to decide if an alias is better than the aliasee.
>>> 
>>> case X86::IDIV32r:
>>>  if (MI->getNumOperands() == 1 &&
>>>      MI->getOperand(0).isReg() &&
>>>      regIsInRegisterClass(RC_GR32, MI->getOperand(0).getReg())) {
>>>    // (IDIV32r GR32:$src)
>>>    AsmString = "idivl $src, %eax";
>>>    OpMap["src"] = 0;
>>>    break;
>>>  }
>>>  return false;
>>> 
>>> This is another example of a case where the alias is longer than the aliased instruction.  A cost model should trim these out.
>>> 
>> In my opinion, it's not necessarily the length that's a factor, but which form of the instruction gives the best information. I'm hoping that the "opt-out" works sufficiently. If it doesn't, then I can try to come up with a heuristic that can.
> 
> We need some heuristic that is better than what is in there now.  I agree that manually opting out on specific cases makes sense (because movsx is shorter and worse than movswl), but tblgen should default to not doing silly things.

-bw





More information about the llvm-commits mailing list