[LLVMdev] TableGen Hacking Help

Dan Gohman gohman at apple.com
Mon Oct 20 11:51:25 PDT 2008

On Mon, 2008-10-20 at 11:49 -0500, David Greene wrote:
> I tried hacking tblgen to call getTargetNode / ReplaceUses if any node in the 
> pattern has a chain by changing this line in tblgen:
>       bool InputHasChain = isRoot &&
>         NodeHasProperty(Pattern, SDNPHasChain, CGP);
> to call PatternHasProperty instead.  This does cause tblgen to emit 
> getTargetNode / ReplaceUses instead of SelectNodeTo but ReplaceUses doesn't 
> know how to handle a complex pattern like this.  It complains about having 
> two many operands:
>   assert(From->getNumValues() == 1 && FromN.ResNo == 0 && 
>          "Cannot replace with this method!");

I don't immediately know the answer to your other questions,
but for this specific question, there are multiple versions of
ReplaceUses. The assertion here is present in the
simplest one, but there are more advanced ones, which
may be what's needed here.

Also, could you post your modifications to tablegen itself?
That might make it easier for us to see what you're talking


More information about the llvm-dev mailing list