public void buildIG(ControlFlowGraph cfg) {
    BasicBlock curBB = null;
    Set<SSA> live = new HashSet<SSA>();

    curBB = cfg.getFirstBlock();
    this.buildIGRecursive(curBB, live);

    for (BasicBlock bb : cfg.getFirstBlockOfFuncs()) {
      curBB = bb;
      this.buildIGRecursive(curBB, live);
    }
  }
  private void insertSpillCode(Cluster x) {
    for (int i = 0; i < x.getSSAList().size(); i++) {
      Instruction assignInst = ControlFlowGraph.getInstruction(x.getSSAList().get(i).getVersion());
      BasicBlock blockOfAssign = ControlFlowGraph.findBlockOf(assignInst);

      Operand storeAddr = Operand.makeConst(spillMemory);
      if (assignInst.getOperand1().kind == Operand.constant) {
        Operand temp = Operand.makeReg(25);
        Instruction store = Instruction.noUseInstruction(Instruction.store, temp, storeAddr);
        store.setId(assignInst.getId());
        blockOfAssign.replaceInst(assignInst, store);
        Instruction move =
            Instruction.noUseInstruction(Instruction.move, assignInst.getOperand1(), temp);
        move.setId(store.getId() - 1);
        blockOfAssign.insertBefore(store, move);
      } else {
        Instruction store =
            Instruction.noUseInstruction(Instruction.store, assignInst.getOperand1(), storeAddr);
        store.setId(assignInst.getId());
        blockOfAssign.replaceInst(assignInst, store);
      }

      for (Operand use : x.getSSAList().get(i).getUseChain()) {
        Instruction useInst = ControlFlowGraph.getInstruction(use.inst);
        if (useInst != null && use.inst != x.getSSAList().get(i).getVersion()) {
          BasicBlock blockOfUse = ControlFlowGraph.findBlockOf(useInst);

          Operand loadAddr = Operand.makeConst(spillMemory);
          Operand loadTemp = Operand.makeReg(26);

          Instruction load = Instruction.noUseInstruction(Instruction.load, loadAddr, loadTemp);
          blockOfUse.insertBefore(useInst, load);

          if (useInst.getOperand1() != null && useInst.getOperand1().ssa == x.getSSAList().get(i)) {
            useInst.setOperand1(loadTemp);
          }
          if (useInst.getOperand2() != null && useInst.getOperand2().ssa == x.getSSAList().get(i)) {
            useInst.setOperand2(loadTemp);
          }
        }
      }
    }
  }