[llvm-dev] Purpose of glue nodes in call lowering

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Tue Jul 24 23:33:29 PDT 2018


Hi Jon,

On Wed, 25 Jul 2018 at 00:12, Jon Chesterfield via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> My understanding is that glue nodes are used to "stick" other nodes together, increasing the probability that they end up near each other at scheduling. I think that would make them optional in the sense that codegen would be correct in their absence.

I think the main purpose of the Glue is to represent the data
dependency between the register copies and the call instruction
itself. Most other nodes will end up using virtual registers and so
it'd be harmless if they were scheduled in the middle, but that's not
really something I'd want to rely on.

> The second query is whether each copy needs to be dependent on the previous argument. I expected each copy to take the same chain node, with the the chain nodes returned by getCopyToReg merged using a TokenFactor.

That probably is valid, though I wouldn't be surprised if the Glue
overrode any attempt to exploit that.

> The goal would be to allow the register allocator / scheduler to rearrange the instructions used to pass arguments.

I'd expect them to be pretty free anyway.

Cheers.

Tim.


More information about the llvm-dev mailing list