public void runBreadthFirstPass(Pass p) throws Exception {
        LinkedList<BasicBlock> blocks = new LinkedList<BasicBlock>();
        blocks.add(this);       // start on current BB
        while(!blocks.isEmpty()) {
            BasicBlock bb = blocks.pop();
            if(bb.localPass == currentPass) {
                continue;
            }
            bb.localPass = currentPass;
            // run pass on instructions in basic block
            ListIterator<Instruction> i = bb.instructions.listIterator(0);
            while(i.hasNext()) {
                p.run(i);
            }
            BasicBlock ch1 = bb.getFallThrough();
            BasicBlock ch2 = bb.getBranchTarget();
            if(ch1 != null) {
                blocks.add(ch1);
            }
            if(ch2 != null) {
                blocks.add(ch2);
            }
        }
    }