14 #ifndef MLIR_IR_BLOCKANDVALUEMAPPING_H 15 #define MLIR_IR_BLOCKANDVALUEMAPPING_H 34 typename S,
typename T,
37 void map(S &&from, T &&to) {
38 for (
auto pair : llvm::zip(from, to))
39 map(std::get<0>(pair), std::get<1>(pair));
53 return lookupOrValue(from, (
Block *)
nullptr);
60 return lookupOrValue(from, from);
66 template <
typename T> T
lookup(T from)
const {
68 assert(result &&
"expected 'from' to be contained within the map");
73 void clear() { valueMap.clear(); }
85 auto it = blockMap.find(from);
86 return it != blockMap.end() ? it->second :
value;
89 auto it = valueMap.find(from);
90 return it != valueMap.end() ? it->second :
value;
99 #endif // MLIR_IR_BLOCKANDVALUEMAPPING_H TODO: Remove this file when SCCP and integer range analysis have been ported to the new framework...
Block represents an ordered list of Operations.
void map(Value from, Value to)
Value lookupOrDefault(Value from) const
T lookup(T from) const
Lookup a mapped value within the map.
static constexpr const bool value
void map(Block *from, Block *to)
Inserts a new mapping for 'from' to 'to'.
void clear()
Clears all mappings held by the mapper.
Block * lookupOrNull(Block *from) const
Lookup a mapped value within the map.
void map(S &&from, T &&to)
void erase(Block *from)
Erases a mapping for 'from'.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
const DenseMap< Block *, Block * > & getBlockMap() const
Return the held block mapping.
const DenseMap< Value, Value > & getValueMap() const
Return the held value mapping.
bool contains(Block *from) const
Checks to see if a mapping for 'from' exists.
Value lookupOrNull(Value from) const
Block * lookupOrDefault(Block *from) const
Lookup a mapped value within the map.
bool contains(Value from) const