3 ms·
Is the intermediate representation documented/described somewhere?
by judofyr 8y ago
Is the intermediate representation documented/described somewhere?
- WalterBright 8y ago"Use the Source, Luke!" https://github.com/DigitalMars/Compiler/blob/master/dm/src/dmc/el.d https://github.com/DigitalMars/Compiler/blob/master/dm/src/d...
- judofyr 8y agoWell, I did look at it, but it was difficult to figure out how control-flow is structured. Is every “basic block” a single “el”, or is the CFG structured inside the binary tree? How are variables handled? Are there load expressions? Do you use something similar to phi-nodes to merge values from different branches? How do you do analysis? Do you walk over the expression tree and store the results (e.g. in constant propagation) on the nodes themselves? Do you use a separate cache/hashmap?
- WalterBright 8y agoBasic blocks form a linked list (block*), and each basic block has a tree of elem's. Control flow is done with the basic block "predecessor" and "successor" lists.