Do they really need to be chained with each other or anything else?
The case I know of is when they get lowered to a libcall. That libcall
has effects that mean it needs a chain of some kind, but it doesn't
really matter in any other way where in the basic block it happens.
As long as it's after its inputs have been created and before its
outputs are consumed, everything is fine. And that's handled by the
normal value operands.
Cheers.
Tim.
_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
_______________________________________________
On Jul 16, 2020, at 14:10, Hendrik Greving via llvm-dev <llvm...@lists.llvm.org> wrote:I scanned other architectures, haven't found an example where somebody creates a chain out of thin air. Do you know any?
On Jul 16, 2020, at 14:47, Hendrik Greving <hgre...@google.com> wrote:I think their originating node already has a chain (i.e. mem operand or side effect in llvm-ir)
> On Jul 16, 2020, at 17:00, Hendrik Greving <hgre...@google.com> wrote:
>
> > No, non-sideeffecting operations can be legalized as compiler-rt calls
>
> Right, but not as "regular" nodes with side-effects? I guess you could search and analyze the DAG manually but that seems hacky. Maybe something that one day LLVM could support natively.
You can’t add arbitrary chains or glue to the regular nodes, but you can define a custom node you select the same way with your chain/glue. You don’t need to preprocess the IR and can do in the custom lowering. This is what AMDGPU does for FDIV (see AMDGPUISD::FMA_W_CHAIN). GlobalISel avoids these complications by not having nodes or chains, and just instructions with side effects, so in that sense this is a solved problem.
-Matt
Still sounds to me as Glue might help (as already proposed by Craig), but maybe I’ve misunderstood something.
Another option is to do a simple lowering into pseudo instructions that you expand after ISel.
(might be easier than doing something before ISel and then having to bother about chains, glue etc)
Regards,
Björn
_______________________________________________