core/instrlist.c
/* replace oldinst with newinst, remove oldinst from ilist, and return oldinst 
   (newinst can be a chain of insts) */
replace oldinst with newinst, remove oldinst from ilist, and return oldinst
(newinst can be a chain of insts)
replace oldinst with newinst remove oldinst from ilist and return oldinst ( newinst can be a chain of insts )
instr_t*
instrlist_replace(instrlist_t *ilist, instr_t *oldinst, instr_t *newinst)
{
    instr_t *where;
    CLIENT_ASSERT(oldinst != NULL, "instrlist_replace: oldinst cannot be NULL");
    CLIENT_ASSERT(instr_get_prev(newinst) == NULL,
                  "instrlist_replace: cannot add middle of list");
    where = instr_get_prev(oldinst);
    instrlist_remove(ilist, oldinst);
    if (where)
        instrlist_postinsert(ilist, where, newinst);
    else
        instrlist_prepend(ilist, newinst);
    return oldinst;
}
instr_t * instrlist_replace ( instrlist_t * ilist , instr_t * oldinst , instr_t * newinst ) { instr_t * where ; CLIENT_ASSERT ( oldinst != NULL , " " ) ; CLIENT_ASSERT ( instr_get_prev ( newinst ) == NULL , " " ) ; where = instr_get_prev ( oldinst ) ; instrlist_remove ( ilist , oldinst ) ; if ( where ) instrlist_postinsert ( ilist , where , newinst ) ; else instrlist_prepend ( ilist , newinst ) ; return oldinst ; }
replace oldinst with newinst, remove oldinst from ilist, and return oldinst
(newinst can be a chain of insts)
replace oldinst with newinst remove oldinst from ilist and return oldinst ( newinst can be a chain of insts )