cloud9_root/src/cloud9/lib/Core/Executor_CSCA.cpp
// generate tag inequality constraints for <symbolic, constant> address pairs
generate tag inequality constraints for  address pairs
generate tag inequality constraints for address pairs
ref<Expr> Executor::createCacheTagCompareConstraintSC(ref<Expr> &addr1, ref<Expr> &addr2) {
	int tag;
	ref<Expr> tag_addr;
	std::pair<ref<Expr>, ref<Expr> > tagPair(addr1, addr2);
	if (tagPairCache.count(tagPair)) {
		return tagPairCache[tagPair];
	}
	if (addr1->getKind() == Expr::Constant) {
		ConstantExpr* CE = dyn_cast<ConstantExpr>(addr1);
		uint64_t addr_mem = CE->getZExtValue();
		tag = getCacheTag(addr_mem);
		if (tagCache.count(addr2)) tag_addr = tagCache[addr2];
		else { 
			tag_addr = this->getCacheTag(addr2);
			tagCache[addr2] = tag_addr;
		}
	} else {
		ConstantExpr* CE = dyn_cast<ConstantExpr>(addr2);
		uint64_t addr_mem = CE->getZExtValue();
		tag = getCacheTag(addr_mem);
		if (tagCache.count(addr1)) tag_addr = tagCache[addr1];
		else { 
			tag_addr = getCacheTag(addr1);
			tagCache[addr1] = tag_addr;
		}
	}
	tagPairCache[tagPair] = EqExpr::create(tag_addr, ConstantExpr::alloc(tag, tag_addr->getWidth()));
	return tagPairCache[tagPair];
}
ref < Expr > Executor :: createCacheTagCompareConstraintSC ( ref < Expr > & addr1 , ref < Expr > & addr2 ) { int tag ; ref < Expr > tag_addr ; std :: pair < ref < Expr > , ref < Expr > > tagPair ( addr1 , addr2 ) ; if ( tagPairCache . count ( tagPair ) ) { return tagPairCache [ tagPair ] ; } if ( addr1 -> getKind ( ) == Expr :: Constant ) { ConstantExpr * CE = dyn_cast < ConstantExpr > ( addr1 ) ; uint64_t addr_mem = CE -> getZExtValue ( ) ; tag = getCacheTag ( addr_mem ) ; if ( tagCache . count ( addr2 ) ) tag_addr = tagCache [ addr2 ] ; else { tag_addr = this -> getCacheTag ( addr2 ) ; tagCache [ addr2 ] = tag_addr ; } } else { ConstantExpr * CE = dyn_cast < ConstantExpr > ( addr2 ) ; uint64_t addr_mem = CE -> getZExtValue ( ) ; tag = getCacheTag ( addr_mem ) ; if ( tagCache . count ( addr1 ) ) tag_addr = tagCache [ addr1 ] ; else { tag_addr = getCacheTag ( addr1 ) ; tagCache [ addr1 ] = tag_addr ; } } tagPairCache [ tagPair ] = EqExpr :: create ( tag_addr , ConstantExpr :: alloc ( tag , tag_addr -> getWidth ( ) ) ) ; return tagPairCache [ tagPair ] ; }
generate tag inequality constraints for <symbolic, constant> address pairs
generate tag inequality constraints for <symbolic constant > address pairs
// look up the cache // either addr1 or addr2 is constant expr /* allocate new memory and store in the cache */ /* allocate new memory and store in the cache */