#include #include namespace willow { ConstantInt *ConstantPool::getInt(Type ty, uint64_t val) { assert(ty.isInt() && "Expected integer type"); ConstantInt::Key &&k{ty.getImpl(), ty.getNumBits()}; std::lock_guard lock(int_mutex); auto [it, _] = icache.try_emplace(k, std::make_unique(ty, val)); return it->second.get(); } PoisonVal *ConstantPool::getPoisonVal(Type ty) { std::lock_guard lock(poison_mutex); auto [it, _] = pcache.try_emplace(ty.getImpl(), std::make_unique(ty)); return it->second.get(); } }