This patch adds a new VPMultiValue, which can be used to wrap a VPValue
from a producer that produces multiple values, like VPInterleaveRecipe,
which produces a value for each member in an interleave group.
Note that it would also be possible to model the results as sub-values
by creating concatenating all results and extracting the relevant parts.
However, this would mean that we need to create values that might not be
used in the end and make analysis more complicated than necessary.
This patch adds the notion of a 'defining value', which is the actual
instance producing the (multi) value. The defining value for regular
VPValues is the VPValue itself. VPMultiValues keep track of their
defining value. Currently the defining value is a VPValue to keep things
simple. In practice this means the producer of a multi-value needs to
inherit from VPValue itself. This VPValue should not be referenced by
any other VPValues and only acts as convenient way to access all users
of all VPMultiValues by the same defining value.
With this scheme, it is possible to traverse the def-use chains as
- To walk upwards given a VP(Multi)Value, use getDefiningValue to get the producer. Use the operands of the producer to continue the walk upwards.
- To walk downwards, just iterate over all users of the producer. This can be done by iterating over all users of all VPMultiValues of the producer. Given that the producer is a VPValue itself, all users of the individual VPMultiValues are added as users of the producer.