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

Duncan Sands baldrick at free.fr
Sun Dec 6 08:50:17 CST 2009


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.


More information about the LLVMdev mailing list