[LLVMdev] Question about 'side-effect' and 'chain'

Heyu Zhu zhu.heyu at gmail.com
Sun Dec 6 21:06:09 PST 2009

Thank Duncan for your patient explaining. It gives me a great help to read
code of  ISellowering and  selectionDAG and  ISelDAG


2009/12/6, Duncan Sands <baldrick at free.fr>:
> Hi,
> 1 What side effects do operatios of  loads/stores/calls/returns have?
>> (maybe i don't understand concept of side effect )
> suppose you do a store to a memory location, and then load from the
> memory location.  This is not the same as first doing the load and
> then only afterwards doing the store!  How to represent the order in the
> SDAG?  The SDAG is not a linear sequence of instructions like LLVM IR
> in a basic block.  In the SDAG things are related only via "uses", eg:
> node A uses a result of node B.  So to represent order relationships
> (this load must occur after that store), nodes are given an additional
> artificial result (the "chain"), just so it can be used by another node.
> So store nodes have a result, the chain, which can be used by a load.
> As a general rule, if node A uses a result of node B, then B has to be
> executed before A.  This, if a load uses the chain result of a store,
> then the load will occur after the store.
> Ciao,
> Duncan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091207/4bace011/attachment.html>

More information about the llvm-dev mailing list