19 using namespace circt;
21 if (mapping.count(from) == 0) {
22 assert(bb &&
"Trying to 'get' a mapped value without any value set. No "
23 "BackedgeBuilder was provided, so cannot provide any mapped "
27 mapping[from] = bb->get(typeTransformer(from.getType()));
29 auto operandMapping = mapping[from];
31 if (
auto *v = std::get_if<Value>(&operandMapping))
34 mappedOperand = std::get<Backedge>(operandMapping);
39 TypeTransformer typeTransformer) {
40 llvm::SmallVector<Value> to;
42 to.push_back(
get(f, typeTransformer));
46 void ValueMapper::set(Value from, Value to,
bool replace) {
47 auto it = mapping.find(from);
48 if (it != mapping.end()) {
49 if (
auto *backedge = std::get_if<Backedge>(&it->second))
50 backedge->setValue(to);
52 assert(
false &&
"'from' was already mapped to a final value!");
58 void ValueMapper::set(ValueRange from, ValueRange to,
bool replace) {
59 assert(from.size() == to.size() &&
60 "Expected # of 'from' values and # of 'to' values to be identical.");
61 for (
auto [f, t] : llvm::zip(from, to))
assert(baseType &&"element must be base type")
Direction get(bool isOutput)
Returns an output direction if isOutput is true, otherwise returns an input direction.
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.