def update_chain(graph, loc, du, ud):
 ins = graph.get_ins_from_loc(loc)
 for var in ins.get_used_vars():
  for def_loc in set(ud[(var, loc)]):
   du[(var, def_loc)].remove(loc)
   ud[(var, loc)].remove(def_loc)
   if (not ud.get((var, loc))):
    ud.pop((var, loc))
   if ((def_loc >= 0) and (not du[(var, def_loc)])):
    du.pop((var, def_loc))
    def_ins = graph.get_ins_from_loc(def_loc)
    if def_ins.is_call():
     def_ins.remove_defined_var()
    elif def_ins.has_side_effect():
     continue
    else:
     update_chain(graph, def_loc, du, ud)
     graph.remove_ins(def_loc)

def update_chain ( graph , loc , du , ud ) : ins = graph . get_ins_from_loc ( loc ) for var in ins . get_used_vars ( ) : for def_loc in set ( ud [ ( var , loc ) ] ) : du [ ( var , def_loc ) ] . remove ( loc ) ud [ ( var , loc ) ] . remove ( def_loc ) if ( not ud . get ( ( var , loc ) ) ) : ud . pop ( ( var , loc ) ) if ( ( def_loc >= 0 ) and ( not du [ ( var , def_loc ) ] ) ) : du . pop ( ( var , def_loc ) ) def_ins = graph . get_ins_from_loc ( def_loc ) if def_ins . is_call ( ) : def_ins . remove_defined_var ( ) elif def_ins . has_side_effect ( ) : continue else : update_chain ( graph , def_loc , du , ud ) graph . remove_ins ( def_loc )
updates the du chain of the instruction located at loc such that there is no more reference to it so that we can remove it .