valueMap[from.getAsOpaquePointer()] = to.getAsOpaquePointer();
}
+ template <
+ typename S, typename T,
+ std::enable_if_t<!std::is_assignable<Value, S>::value &&
+ !std::is_assignable<Block *, S>::value> * = nullptr>
+ void map(S &&from, T &&to) {
+ for (auto pair : llvm::zip(from, to))
+ map(std::get<0>(pair), std::get<1>(pair));
+ }
+
/// Erases a mapping for 'from'.
void erase(Block *from) { valueMap.erase(from); }
void erase(Value from) { valueMap.erase(from.getAsOpaquePointer()); }
// 2. Inline region, currently only works for a single basic block.
BlockAndValueMapping map;
auto &block = genericOp.region().front();
- for (auto it : llvm::zip(block.getArguments(), indexedValues))
- map.map(std::get<0>(it), std::get<1>(it));
+ map.map(block.getArguments(), indexedValues);
for (auto &op : block.without_terminator()) {
assert(op.getNumRegions() == 0);
auto *newOp = b.clone(op, map);
- for (auto it : llvm::zip(op.getResults(), newOp->getResults()))
- map.map(std::get<0>(it), std::get<1>(it));
+ map.map(op.getResults(), newOp->getResults());
}
// 3. Emit std_store.
// 2. Inline region, currently only works for a single basic block.
BlockAndValueMapping map;
auto &block = indexedGenericOp.region().front();
- for (auto it : llvm::zip(block.getArguments(), indexedValues))
- map.map(std::get<0>(it), std::get<1>(it));
+ map.map(block.getArguments(), indexedValues);
for (auto &op : block.without_terminator()) {
assert(op.getNumRegions() == 0);
auto *newOp = b.clone(op, map);
- for (auto it : llvm::zip(op.getResults(), newOp->getResults()))
- map.map(std::get<0>(it), std::get<1>(it));
+ map.map(op.getResults(), newOp->getResults());
}
// 3. Emit std_store.