[LLVMdev] Chain and glue operands should occur at end of operand list

Tim Northover t.p.northover at gmail.com
Sun Feb 3 11:29:27 PST 2013


Hi Sebastien,

> Could someone give me some pointers to understand what's going on. For
> example, something to read about what is "chain & glue".

The documentation in this area is a little terse, but there's *some*
relevant information at http://llvm.org/docs/CodeGenerator.html
(search for "chain").

My guess is that your "N" already has a chain attached as input
operand 0; when LLVM goes to use the Base and Imm you provide provide
it calls something like:

DAG.getMachineNode(SOME_LOAD, dl, MVT::whatever, Chain, Base, OffImm);

If Base ends up as another chain then LLVM will probably complain as
you're describing because the node being created has two input chains.

Now, the next question is whether N should have a chain in the first
place. That rather depends on what it is and where it comes from, but
it is a little suspicious.

The best advice is probably to make sure you understand exactly what
kind of node N is (more than one possibility may exist) and what its
operands mean before deciding what to write here. Notice that the
current ARM backend checks for exact node types it understands when
deciding where the base lives.

Either a conventional debugger ("call N.dump()") or the llc options
"-view-isel-dags" and friends can be very useful here.

Tim.



More information about the llvm-dev mailing list