2

I am trying to understand more deeply the instruction selection process in llvm and for that I am debuging step-by-step the CodeGenAndEmitDAG function. I have printed a small function (see below) just before the combine step - the first step in the above function. In the graph I see blue lines and it seems that they are always pointing at "ch" , which I think means "other" machine value type. What I don't understand is the meaning of the blue lines... what is this dependency ? And, am I right about the meaning of "ch" ? is it "other" ? enter image description here

yehudahs
  • 2,488
  • 8
  • 34
  • 54
  • I'm trying to understand this nodes, lines and types too, can you please provide any helpful links or keywords. Thanks in advance. – Ahmed Ghoneim Jan 04 '16 at 08:41
  • 1
    you can check the next file in the llvm code : include/llvm/CodeGen/ISDOpcodes.h - there are some explanation there. – yehudahs Jan 04 '16 at 16:01

1 Answers1

3

Dashed blue arrows represent non-dataflow dependencies between instructions and enforce specific order between them. For example, stores and loads which may access the same memory shouldn't be reordered, though there's no data dependency between them. In such cases blue arrows are used to represent such hidden dependency. These blue arrows consume chain values (ch) of type Other.

Every DAG has a special EntryToken of type Other which supplies the initial chain value for the basic block.

Consider the following example. Notice the control dependency (blue arrow) between load and store because they're allowed to point to the same memory. Also notice the red arrow (Glue) which glues two instructions together.

int foo(int *a, int *b) {
  a[0] = 42;
  return b[0];
}

enter image description here

Nikolai
  • 1,499
  • 12
  • 24
  • make sense, but about the blue line between copyToReg (0x2efac80 - after the load instruction) to the store instruction ? the load instruction indeed depends on the store but the instructions after the load need to depend on the load and not the store... – yehudahs Nov 01 '14 at 09:55