[LLVMdev] Non-Chain Chains

David A. Greene greened at obbligato.org
Thu Jan 5 11:01:12 PST 2012


Following up on my call schedule posting from yesterday, I am now trying
to add edges from the call to the instruction before it.

This seemed easiest to do in SelectionDAGBuilder but it is troublesome.

A couple of questions:

  - How do I get the previous instruction that was translated?
    prior(CS.getInstruction()) in visitCall returns something invalid.
    When I try to call getValue on the returned Instruction it blows up.
    I really need the SDValue produced as a result of translating that
    last instruction.  Is there some other way to get it?

  - Can a TokenFactor node take a non-chain input?  Consider:

    r1 = load ...
    r2 = add
    r3 = call

    The call will naturally take the chain input from the load but I
    also want to add a dependence from the add to the call.  I was going
    to do something like this:

    Chain = TokenFactor(load chain, r2)
    LowerCallTo(Chain, ...)

    Is that legal?  If not, is there any way to express this dependence?
    I could use flag/glue nodes in SUnits but it somehow seems uglier.
    For one thing, we don't have the original instruction order once
    we've created SDNodes so I can't imagine how I'd find the right
    SUnit to glue to the call.

Thanks!

                       -Dave



More information about the llvm-dev mailing list