/**
   * Construct a value graph from an IR.
   *
   * <p><b> PRECONDITION:</b> The IR <em> must </em> be in SSA form.
   *
   * @param ir the IR
   */
  ValueGraph(IR ir) {
    graph = new SpaceEffGraph();
    nameMap = new HashMap<Object, ValueGraphVertex>();
    // TODO!!: compute register lists incrementally
    // we need register lists in order to call Register.getFirstDef()
    DefUse.computeDU(ir);
    // add value graph nodes for each symbolic register
    addRegisterNodes(ir);
    // go through the IR and add nodes and edges to the value graph
    // for each instruction, as needed
    for (Enumeration<Instruction> e = ir.forwardInstrEnumerator(); e.hasMoreElements(); ) {
      Instruction s = e.nextElement();
      processInstruction(s);
    }

    computeClosure();
  }