I thought about this a while back but didn't have time to write about it until now.
For peephole, I think the easiest way is to just expose the instruction list as is, and offer some helper functions (things like if a label is used). We won't allow navigation to other labels, which will also avoid the cycle problem. I'm not sure how much benefit will come from navigation anyways; it's mainly if branching is useless, ie from assigning the same thing to a var regardless of the path. At that point it isn't really peephole
I thought about this a while back but didn't have time to write about it until now.
For peephole, I think the easiest way is to just expose the instruction list as is, and offer some helper functions (things like if a label is used). We won't allow navigation to other labels, which will also avoid the cycle problem. I'm not sure how much benefit will come from navigation anyways; it's mainly if branching is useless, ie from assigning the same thing to a var regardless of the path. At that point it isn't really peephole