Hi everyone, It says in document 'The LLVM Target-Independent Code Generator ': "SelectionDAGs contain two different kinds of values: those that represent data flow and those that represent control flow dependencies. Data values are simple edges with an integer or floating point value type. Control edges are represented as "chain" edges which are of type MVT::Other. These edges provide an ordering between nodes that have side effects (such as loads, stores, calls, returns, etc). All nodes that have side effects should take a token chain as input and produce a new one as output. " Due to my poor knowledge of compiler i have several questions. 1 What side effects do operatios of loads/stores/calls/returns have? (maybe i don't understand concept of side effect ) 2 What's "control edge"/"chain"? 3 Why do loads/stores have control edges?(maybe i could get the answer by myself if i understand control edge/chain) Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091206/c66ec2f0/attachment.html>
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.
Thank Duncan for your patient explaining. It gives me a great help to read source code of ISellowering and selectionDAG and ISelDAG Thanks 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>