Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions include/circt/Dialect/FIRRTL/FIRRTLAnnotations.h
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ struct AnnoTargetImpl {
/// An annotation target is used to keep track of something that is targeted by
/// an Annotation.
struct AnnoTarget {
AnnoTarget(detail::AnnoTargetImpl impl = nullptr) : impl(impl){};
AnnoTarget(detail::AnnoTargetImpl impl = nullptr) : impl(impl) {};

operator bool() const { return impl; }
bool operator==(const AnnoTarget &other) const { return impl == other.impl; }
Expand Down Expand Up @@ -485,11 +485,6 @@ struct DenseMapInfo<circt::firrtl::Annotation> {
mlir::DictionaryAttr(static_cast<mlir::Attribute::ImplType *>(
DenseMapInfo<void *>::getEmptyKey())));
}
static Annotation getTombstoneKey() {
return Annotation(
mlir::DictionaryAttr(static_cast<mlir::Attribute::ImplType *>(
llvm::DenseMapInfo<void *>::getTombstoneKey())));
}
static unsigned getHashValue(Annotation val) {
return mlir::hash_value(val.getAttr());
}
Expand All @@ -506,11 +501,6 @@ struct DenseMapInfo<circt::firrtl::AnnoTarget> {
auto i = DenseMapInfo<unsigned>::getEmptyKey();
return AnnoTarget(AnnoTargetImpl(o, i));
}
static AnnoTarget getTombstoneKey() {
auto *o = DenseMapInfo<mlir::Operation *>::getTombstoneKey();
auto i = DenseMapInfo<unsigned>::getTombstoneKey();
return AnnoTarget(AnnoTargetImpl(o, i));
}
static unsigned getHashValue(AnnoTarget val) {
auto impl = val.getImpl();
return hash_combine(impl.getOp(), impl.getPortNo());
Expand Down
4 changes: 0 additions & 4 deletions include/circt/Dialect/FIRRTL/FIRRTLOps.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,6 @@ struct DenseMapInfo<circt::firrtl::FModuleOp> {
return FModuleOp::getFromOpaquePointer(
DenseMapInfo<Operation *>::getEmptyKey());
}
static inline FModuleOp getTombstoneKey() {
return FModuleOp::getFromOpaquePointer(
DenseMapInfo<Operation *>::getTombstoneKey());
}
static unsigned getHashValue(const FModuleOp &val) {
return DenseMapInfo<Operation *>::getHashValue(val);
}
Expand Down
4 changes: 0 additions & 4 deletions include/circt/Dialect/FIRRTL/FIRRTLTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -416,10 +416,6 @@ struct DenseMapInfo<circt::firrtl::FIRRTLType> {
auto pointer = llvm::DenseMapInfo<void *>::getEmptyKey();
return FIRRTLType(static_cast<mlir::Type::ImplType *>(pointer));
}
static FIRRTLType getTombstoneKey() {
auto pointer = llvm::DenseMapInfo<void *>::getTombstoneKey();
return FIRRTLType(static_cast<mlir::Type::ImplType *>(pointer));
}
static unsigned getHashValue(FIRRTLType val) { return mlir::hash_value(val); }
static bool isEqual(FIRRTLType LHS, FIRRTLType RHS) { return LHS == RHS; }
};
Expand Down
7 changes: 1 addition & 6 deletions include/circt/Dialect/Synth/Analysis/LongestPathAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ class IncrementalLongestPathAnalysis : private LongestPathAnalysis,
// for computing statistics and CAPI.
class LongestPathCollection {
public:
LongestPathCollection(MLIRContext *ctx) : ctx(ctx){};
LongestPathCollection(MLIRContext *ctx) : ctx(ctx) {};
const DataflowPath &getPath(unsigned index) const { return paths[index]; }
MLIRContext *getContext() const { return ctx; }
llvm::SmallVector<DataflowPath, 64> paths;
Expand Down Expand Up @@ -381,11 +381,6 @@ struct DenseMapInfo<circt::synth::Object> {
auto [path, value, bitPos] = Info::getEmptyKey();
return Object(path, value, bitPos);
}

static Object getTombstoneKey() {
auto [path, value, bitPos] = Info::getTombstoneKey();
return Object(path, value, bitPos);
}
static llvm::hash_code getHashValue(Object object) {
return Info::getHashValue(
{object.instancePath, object.value, object.bitPos});
Expand Down
4 changes: 0 additions & 4 deletions include/circt/Scheduling/DependenceIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,6 @@ struct DenseMapInfo<Dependence> {
static inline Dependence getEmptyKey() {
return Dependence(DenseMapInfo<mlir::Operation *>::getEmptyKey(), nullptr);
}
static inline Dependence getTombstoneKey() {
return Dependence(DenseMapInfo<mlir::Operation *>::getTombstoneKey(),
nullptr);
}
static unsigned getHashValue(const Dependence &val) {
return llvm::hash_value(val.getAsTuple());
}
Expand Down
10 changes: 0 additions & 10 deletions include/circt/Scheduling/Problems.h
Original file line number Diff line number Diff line change
Expand Up @@ -581,11 +581,6 @@ struct DenseMapInfo<circt::scheduling::Problem::OperatorType> {
DenseMapInfo<mlir::StringAttr>::getEmptyKey());
}

static inline circt::scheduling::Problem::OperatorType getTombstoneKey() {
return circt::scheduling::Problem::OperatorType{
DenseMapInfo<mlir::StringAttr>::getTombstoneKey()};
}

static unsigned
getHashValue(const circt::scheduling::Problem::OperatorType &val) {
return DenseMapInfo<mlir::StringAttr>::getHashValue(val.attr);
Expand All @@ -604,11 +599,6 @@ struct DenseMapInfo<circt::scheduling::Problem::ResourceType> {
DenseMapInfo<mlir::StringAttr>::getEmptyKey());
}

static inline circt::scheduling::Problem::ResourceType getTombstoneKey() {
return circt::scheduling::Problem::ResourceType(
DenseMapInfo<mlir::StringAttr>::getTombstoneKey());
}

static unsigned
getHashValue(const circt::scheduling::Problem::ResourceType &val) {
return DenseMapInfo<mlir::StringAttr>::getHashValue(val.attr);
Expand Down
4 changes: 0 additions & 4 deletions include/circt/Support/FVInt.h
Original file line number Diff line number Diff line change
Expand Up @@ -728,10 +728,6 @@ struct DenseMapInfo<circt::FVInt, void> {
return circt::FVInt(DenseMapInfo<APInt>::getEmptyKey());
}

static inline circt::FVInt getTombstoneKey() {
return circt::FVInt(DenseMapInfo<APInt>::getTombstoneKey());
}

static unsigned getHashValue(const circt::FVInt &Key);

static bool isEqual(const circt::FVInt &LHS, const circt::FVInt &RHS) {
Expand Down
3 changes: 0 additions & 3 deletions include/circt/Support/FieldRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,6 @@ struct DenseMapInfo<circt::FieldRef> {
static inline circt::FieldRef getEmptyKey() {
return circt::FieldRef(DenseMapInfo<mlir::Value>::getEmptyKey(), 0);
}
static inline circt::FieldRef getTombstoneKey() {
return circt::FieldRef(DenseMapInfo<mlir::Value>::getTombstoneKey(), 0);
}
static unsigned getHashValue(const circt::FieldRef &val) {
return circt::hash_value(val);
}
Expand Down
4 changes: 0 additions & 4 deletions include/circt/Support/InstanceGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -590,10 +590,6 @@ struct llvm::DenseMapInfo<circt::igraph::InstancePath> {
return circt::igraph::InstancePath(ArrayRefInfo::getEmptyKey());
}

static circt::igraph::InstancePath getTombstoneKey() {
return circt::igraph::InstancePath(ArrayRefInfo::getTombstoneKey());
}

static llvm::hash_code getHashValue(circt::igraph::InstancePath path) {
auto range =
llvm::map_range(path, [](auto op) { return op.getAsOpaquePointer(); });
Expand Down
4 changes: 2 additions & 2 deletions lib/Conversion/DCToHW/DCToHW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static Type toESIHWType(Type t) {
return esi::ChannelType::get(vt.getContext(),
toHWType(vt.getInnerType()));
})
.Case([](TokenType tt) {
.Case([](dc::TokenType tt) {
return esi::ChannelType::get(tt.getContext(),
IntegerType::get(tt.getContext(), 0));
})
Expand Down Expand Up @@ -837,7 +837,7 @@ class BufferConversionPattern : public OpConversionPattern<BufferOp> {

} // namespace

static bool isDCType(Type type) { return isa<TokenType, ValueType>(type); }
static bool isDCType(Type type) { return isa<dc::TokenType, ValueType>(type); }

/// Returns true if the given `op` is considered as legal - i.e. it does not
/// contain any dc-typed values.
Expand Down
2 changes: 1 addition & 1 deletion lib/Conversion/HandshakeToDC/HandshakeToDC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class DCTypeConverter : public TypeConverter {
return dc::ValueType::get(type.getContext(), type);
});
addConversion([](ValueType type) { return type; });
addConversion([](TokenType type) { return type; });
addConversion([](dc::TokenType type) { return type; });

addTargetMaterialization([](mlir::OpBuilder &builder, mlir::Type resultType,
mlir::ValueRange inputs,
Expand Down
4 changes: 0 additions & 4 deletions lib/Conversion/ImportVerilog/ImportVerilog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,6 @@ namespace llvm {
template <>
struct DenseMapInfo<slang::BufferID> {
static slang::BufferID getEmptyKey() { return slang::BufferID(); }
static slang::BufferID getTombstoneKey() {
return slang::BufferID(UINT32_MAX - 1, ""sv);
// UINT32_MAX is already used by `BufferID::getPlaceholder`.
}
static unsigned getHashValue(slang::BufferID id) {
return llvm::hash_value(id.getId());
}
Expand Down
5 changes: 0 additions & 5 deletions lib/Conversion/SeqToSV/FirMemLowering.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,6 @@ struct DenseMapInfo<circt::FirMemConfig> {
cfg.depth = DenseMapInfo<size_t>::getEmptyKey();
return cfg;
}
static inline circt::FirMemConfig getTombstoneKey() {
circt::FirMemConfig cfg;
cfg.depth = DenseMapInfo<size_t>::getTombstoneKey();
return cfg;
}
static unsigned getHashValue(const circt::FirMemConfig &cfg) {
return cfg.hashValue();
}
Expand Down
4 changes: 0 additions & 4 deletions lib/Dialect/Arc/Transforms/ArcCanonicalizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -739,10 +739,6 @@ struct DenseMapInfo<SmallVector<Value>> {
return SmallVector<Value>();
}

static inline SmallVector<Value> getTombstoneKey() {
return SmallVector<Value>();
}

static unsigned getHashValue(const SmallVector<Value> &inputs) {
return hashValue(inputs);
}
Expand Down
7 changes: 0 additions & 7 deletions lib/Dialect/Arc/Transforms/FindInitialVectors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,6 @@ struct DenseMapInfo<Key> {
DictionaryAttr());
}

static inline Key getTombstoneKey() {
static StringRef tombStoneKeyOpName =
DenseMapInfo<StringRef>::getTombstoneKey();
return Key(1, tombStoneKeyOpName, SmallVector<Type>(), SmallVector<Type>(),
DictionaryAttr());
}

static unsigned getHashValue(const Key &key) {
return hash_value(std::get<0>(key)) ^ hash_value(std::get<1>(key)) ^
hash_value(std::get<2>(key)) ^ hash_value(std::get<3>(key)) ^
Expand Down
4 changes: 0 additions & 4 deletions lib/Dialect/Calyx/Transforms/AffineParallelUnroll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ struct DenseMapInfo<AffineAccessExpr> {
return {DenseMapInfo<Value>::getEmptyKey(), {}, {}};
}

static AffineAccessExpr getTombstoneKey() {
return {DenseMapInfo<Value>::getTombstoneKey(), {}, {}};
}

static unsigned getHashValue(const AffineAccessExpr &expr) {
unsigned h = DenseMapInfo<Value>::getHashValue(expr.memref);
h = llvm::hash_combine(h, DenseMapInfo<AffineMap>::getHashValue(expr.map));
Expand Down
2 changes: 1 addition & 1 deletion lib/Dialect/DC/DCOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ LogicalResult UnpackOp::inferReturnTypes(
DictionaryAttr attrs, mlir::PropertyRef properties,
mlir::RegionRange regions, SmallVectorImpl<Type> &results) {
auto inputType = cast<ValueType>(operands.front().getType());
results.push_back(TokenType::get(context));
results.push_back(dc::TokenType::get(context));
results.push_back(inputType.getInnerType());
return success();
}
Expand Down
8 changes: 1 addition & 7 deletions lib/Dialect/FIRRTL/Transforms/Dedup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,6 @@ struct llvm::DenseMapInfo<ModuleInfoRef> {
return DenseMapInfo<ModuleInfo *>::getEmptyKey();
}

static inline ModuleInfoRef getTombstoneKey() {
return DenseMapInfo<ModuleInfo *>::getTombstoneKey();
}

static unsigned getHashValue(const ModuleInfoRef &ref) {
// We assume SHA256 is already a good hash and just truncate down to the
// number of bytes we need for DenseMap.
Expand All @@ -450,9 +446,7 @@ struct llvm::DenseMapInfo<ModuleInfoRef> {

static bool isEqual(const ModuleInfoRef &lhs, const ModuleInfoRef &rhs) {
auto *empty = getEmptyKey().info;
auto *tombstone = getTombstoneKey().info;
if (lhs.info == empty || rhs.info == empty || lhs.info == tombstone ||
rhs.info == tombstone)
if (lhs.info == empty || rhs.info == empty)
return lhs.info == rhs.info;
return *lhs.info == *rhs.info;
}
Expand Down
3 changes: 0 additions & 3 deletions lib/Dialect/FIRRTL/Transforms/InferResets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,6 @@ struct DenseMapInfo<ResetSignal> {
static inline ResetSignal getEmptyKey() {
return ResetSignal{DenseMapInfo<FieldRef>::getEmptyKey(), {}};
}
static inline ResetSignal getTombstoneKey() {
return ResetSignal{DenseMapInfo<FieldRef>::getTombstoneKey(), {}};
}
static unsigned getHashValue(const ResetSignal &x) {
return circt::hash_value(x.field);
}
Expand Down
7 changes: 1 addition & 6 deletions lib/Dialect/FIRRTL/Transforms/InferWidths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,15 +336,10 @@ struct InternedSlotInfo : DenseMapInfo<T *> {
auto *pointer = llvm::DenseMapInfo<void *>::getEmptyKey();
return static_cast<T *>(pointer);
}
static T *getTombstoneKey() {
auto *pointer = llvm::DenseMapInfo<void *>::getTombstoneKey();
return static_cast<T *>(pointer);
}
static unsigned getHashValue(const T *val) { return mlir::hash_value(*val); }
static bool isEqual(const T *lhs, const T *rhs) {
auto empty = getEmptyKey();
auto tombstone = getTombstoneKey();
if (lhs == empty || rhs == empty || lhs == tombstone || rhs == tombstone)
if (lhs == empty || rhs == empty)
return lhs == rhs;
return *lhs == *rhs;
}
Expand Down
1 change: 0 additions & 1 deletion lib/Dialect/FIRRTL/Transforms/ModuleSummary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ template <>
struct DenseMapInfo<ModuleSummaryPass::KeyTy> {
using KeyTy = ModuleSummaryPass::KeyTy;
static KeyTy getEmptyKey() { return {{}, ~0ULL}; }
static KeyTy getTombstoneKey() { return {{}, ~0ULL - 1}; }
static unsigned getHashValue(const KeyTy &val) {
return mlir::hash_value(val);
}
Expand Down
9 changes: 0 additions & 9 deletions lib/Dialect/LLHD/Transforms/DeseqUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,6 @@ struct DenseMapInfo<circt::llhd::deseq::FixedValue> {
static inline FixedValue getEmptyKey() {
return FixedValue{DenseMapInfo<Value>::getEmptyKey(), false, false};
}
static inline FixedValue getTombstoneKey() {
return FixedValue{DenseMapInfo<Value>::getTombstoneKey(), false, false};
}
static unsigned getHashValue(const FixedValue &key) {
return hash_value(key);
}
Expand All @@ -336,9 +333,6 @@ struct DenseMapInfo<circt::llhd::deseq::FixedValues> {
static inline FixedValues getEmptyKey() {
return {DenseMapInfo<FixedValue>::getEmptyKey()};
}
static inline FixedValues getTombstoneKey() {
return {DenseMapInfo<FixedValue>::getTombstoneKey()};
}
static unsigned getHashValue(const FixedValues &key) {
return hash_value(key);
}
Expand All @@ -354,9 +348,6 @@ struct DenseMapInfo<circt::llhd::deseq::ValueField> {
static inline VF getEmptyKey() {
return VF(DenseMapInfo<mlir::Value>::getEmptyKey(), ~0ULL);
}
static inline VF getTombstoneKey() {
return VF(DenseMapInfo<mlir::Value>::getTombstoneKey(), ~0ULL - 1);
}
static unsigned getHashValue(const VF &key) {
return DenseMapInfo<mlir::Value>::getHashValue(key.value) ^
DenseMapInfo<uint64_t>::getHashValue(key.fieldID) ^
Expand Down
3 changes: 0 additions & 3 deletions lib/Dialect/LLHD/Transforms/Mem2Reg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,6 @@ struct llvm::DenseMapInfo<DriveCondition> {
static DriveCondition getEmptyKey() {
return DenseMapInfo<DriveCondition::ConditionAndMode>::getEmptyKey();
}
static DriveCondition getTombstoneKey() {
return DenseMapInfo<DriveCondition::ConditionAndMode>::getTombstoneKey();
}
static unsigned getHashValue(DriveCondition d) {
return DenseMapInfo<DriveCondition::ConditionAndMode>::getHashValue(
d.conditionAndMode);
Expand Down
7 changes: 1 addition & 6 deletions lib/Dialect/RTG/Transforms/ElaborationPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ namespace llvm {
template <>
struct DenseMapInfo<bool> {
static inline unsigned getEmptyKey() { return false; }
static inline unsigned getTombstoneKey() { return true; }
static unsigned getHashValue(const bool &val) { return val * 37U; }

static bool isEqual(const bool &lhs, const bool &rhs) { return lhs == rhs; }
Expand Down Expand Up @@ -174,10 +173,6 @@ struct StorageKeyInfo {
return HashedStorage<StorageTy>(0,
DenseMapInfo<StorageTy *>::getEmptyKey());
}
static inline HashedStorage<StorageTy> getTombstoneKey() {
return HashedStorage<StorageTy>(
0, DenseMapInfo<StorageTy *>::getTombstoneKey());
}

static inline unsigned getHashValue(const HashedStorage<StorageTy> &key) {
return key.hashcode;
Expand All @@ -192,7 +187,7 @@ struct StorageKeyInfo {
}
static inline bool isEqual(const StorageTy &lhs,
const HashedStorage<StorageTy> &rhs) {
if (isEqual(rhs, getEmptyKey()) || isEqual(rhs, getTombstoneKey()))
if (isEqual(rhs, getEmptyKey()))
return false;

return lhs.isEqual(rhs.storage);
Expand Down
5 changes: 2 additions & 3 deletions lib/Dialect/SV/Transforms/HWCleanup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ struct AlwaysLikeOpInfo : public llvm::DenseMapInfo<Operation *> {
// Trivially the same.
if (lhs == rhs)
return true;
// Filter out tombstones and empty ops.
if (lhs == getTombstoneKey() || lhs == getEmptyKey() ||
rhs == getTombstoneKey() || rhs == getEmptyKey())
// Filter out empty ops.
if (lhs == getEmptyKey() || rhs == getEmptyKey())
return false;
// Compare attributes.
if (lhs->getName() != rhs->getName() ||
Expand Down
5 changes: 0 additions & 5 deletions lib/Dialect/Synth/Transforms/LowerVariadic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,6 @@ struct DenseMapInfo<OperandKey> {
return {{DenseMapInfo<mlir::Value>::getEmptyKey(), false}};
}

static OperandKey getTombstoneKey() {
// Return a vector containing the mlir::Value tombstone key
return {{DenseMapInfo<mlir::Value>::getTombstoneKey(), false}};
}

static unsigned getHashValue(const OperandKey &val) {
llvm::hash_code hash = 0;
// Iteratively combine the hash of each pair in the vector
Expand Down
5 changes: 0 additions & 5 deletions lib/Dialect/Synth/Transforms/StructuralHash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ struct llvm::DenseMapInfo<StructuralHashKey> {
{});
}

static StructuralHashKey getTombstoneKey() {
return StructuralHashKey(
llvm::DenseMapInfo<OperationName>::getTombstoneKey(), {});
}

static unsigned getHashValue(const StructuralHashKey &key) {
auto hash = hash_value(key.opName);
for (const auto &operand : key.operandPairs)
Expand Down
Loading
Loading