Question on selection DAG

Hello,

I want to have an operation foo with variable number of operands, and
I am trying to achieve it using multiple operations. Let's say I want
to have [FOO r1, r2], I am constructing the DAG as follows :

consumeArg(r1) -> consumeArg(r2) -> FOO -> arg(r1) -> arg(r2)

Note that the arrows are all "Chain"s. I need to have consumeArg(r1)
because, I don't want the producer of r1 to be scheduled between FOO
and arg(r1). Similarly I need to have consumeArg(r2). However, I am
not able to prevent some unrelated operation from getting scheduled
between FOO and arg(r1). If BAR1 and BAR2 are unrelated operations,
the following is a legal schedule :

consumeArg(r1)
consumeArg(r2)
FOO
BAR1
arg(r1)
BAR2
arg(r2)

This leads to illegal assembly program because the assembler expects
FOO r1, r2 to appear together.
How can I make the subgraph FOO->arg(r1)->arg(r2) be always scheduled
as a group, i.e., prevent unrelated ops from getting scheduled in
between?

Thanks,
Manjunath

There are two ways to enforce ordering. One is to make use of MVT::Flag operands, the other is to isel to a pseudo opcode which is expanded into a series of machine instructions at the end of pre-regalloc scheduling.

Evan