@Override
    public void assignValue(Designator d, BasicBlock cur, BasicBlock join, Environment env, Value newVal)
        throws Exception {
        if(global) {
            used = true;
            Adda ad = new Adda(getGBP(), getAddr(d));
            cur.addInstruction(ad);
            Store st = new Store(d.getVarName(), ad, newVal);
            cur.addInstruction(st);
            if(join != null) {
                join.addAtEndBeforeBranch(new Kill(d.getVarName()));
            }
        } else {
            Identifier var = d.getVarName();
            Value old = env.get(var);
            // generate a move instruction to indicate the value assignment
            Move move = new Move(newVal);
            cur.addInstruction(move);
            env.put(var, move);
            // get the variable reference to replace old references with
            Value replaceWith = env.get(var);
            if(join != null) {
                join.addPhi(var, old, replaceWith);
            }
        }
    }