Created classes for the CFG and basic block abstractions.
Also changed some logic for building the CFG:
No more "root" node. The root is always self.blocks[0], or node 0 in the DiGraph.
Keep track of control flow instructions separately from fallthrough instructions. Since control flow instructions effectively define out-edges from nodes, we'll keep track of them in the out_edges field of QuilBlock. In particular, this cleans up the CFG a bit in certain cases -- previously, we could have blocks containing only control flow instructions. See updates to test cases for examples.
QuilBlock gets printed out prettily now. I also imagine we might need to make some changes to these two classes to keep track of measurements and classical control flow.
Created classes for the CFG and basic block abstractions. Also changed some logic for building the CFG:
self.blocks[0]
, or node 0 in the DiGraph.out_edges
field of QuilBlock. In particular, this cleans up the CFG a bit in certain cases -- previously, we could have blocks containing only control flow instructions. See updates to test cases for examples.QuilBlock gets printed out prettily now. I also imagine we might need to make some changes to these two classes to keep track of measurements and classical control flow.