Add a doubly-linked DAG data structure

This will be useful for various parallelization-related dependency
analysis.

Auditors: benjy