VN * IR_GVN::comp_sc_by_anon_domdef(IR const* exp, IR const* domdef, bool & change) { IS_TRUE0((IR_type(exp) == IR_LD || IR_type(exp) == IR_PR) && m_du->is_may_def(domdef, exp, false)); SCVNE2VN * vnexp_map = m_def2sctab.get(domdef); UINT dtsz = exp->get_dt_size(m_dm); MD const* md = exp->get_exact_ref(); IS_TRUE0(md); VNE_SC vexp(MD_id(md), exp->get_ofst(), dtsz); /* NOTE: foo(); v1; //s1 goo(); v1; //s2 vn of s1 should not same with s2. */ if (vnexp_map == NULL) { vnexp_map = new SCVNE2VN(m_pool, 16); //bsize to be evaluate. m_def2sctab.set(domdef, vnexp_map); } VN * vn = vnexp_map->get(&vexp); if (vn == NULL) { vn = new_vn(); VN_type(vn) = VN_VAR; vnexp_map->setv((OBJTY)&vexp, vn); } m_ir2vn.set(IR_id(exp), vn); change = true; return vn; }
//Try to generate a MD to represent dedicated string md. //In case, e.g: android/external/tagsoup/src/org/ccil/cowan/tagsoup/HTMLSchema.java //There is a function allocates 3000+ string variable. //Each string has been taken address. //That will inflate may_point_to_set too much. //In this situation, AA can be conservatively regard all string variables //as same unbounded MD. MD const* RegionMgr::genDedicateStrMD() { if (!m_is_regard_str_as_same_md) { return NULL; } //Regard all string variables as same unbound MD. if (m_str_md == NULL) { SYM * s = addToSymbolTab("DedicatedVarBeRegardedAsString"); VAR * sv = get_var_mgr()->registerStringVar("DedicatedStringVar", s, 1); VAR_allocable(sv) = false; VAR_is_addr_taken(sv) = true; MD md; MD_base(&md) = sv; MD_ty(&md) = MD_UNBOUND; ASSERT0(MD_base(&md)->is_string()); MD const* e = m_md_sys->registerMD(md); ASSERT0(MD_id(e) > 0); m_str_md = e; } return m_str_md; }