[llvm-dev] TableGen error message: top-level forms in instruction pattern should have void types

Krzysztof Parzyszek via llvm-dev llvm-dev at lists.llvm.org
Thu Jan 7 13:35:42 PST 2016


On 1/7/2016 3:25 PM, Phil Tomson wrote:
>
> That's better, but now I get:
>
>   XSTGInstrInfo.td:902:3: error: In RelAddr: XSTGRELADDR node requires
> exactly 2 operands!
>
> Which makes some sense as XSTGRELADDR is defined as:
> def SDT_RELADDR       : SDTypeProfile<1, 2, [SDTCisInt<0>,
> SDTCisSameAs<0, 1>]>;
> def XSTGRELADDR       : SDNode<"XSTGISD::RELADDR", SDT_RELADDR>;

The problem is that the pattern that you use in the instruction 
definition cannot have any value.  That is, the top node has to consume 
all values produced by the nodes below it.  The node XSTGRELADDR does 
have a value, and so it cannot be the top node.
If the intent is to have the second operand as the target register for 
that value, it shouldn't be an operand to the SDNode, and in the 
instruction definition it should be listed in the (outs) list.  If the 
second operand is not an output operand, then the RelAddr instruction 
should have some additional operand in (outs) and use "set ..." in the 
pattern, or have some other consumer as the top node in the selection 
pattern.

-Krzysztof


-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation


More information about the llvm-dev mailing list