diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-11-18 00:37:17 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-11-18 00:37:17 +0000 |
commit | 50846f80acea3d2e2e74d472ae22ddbae0984930 (patch) | |
tree | ea98a752c8216e1abd7fb700f337c9a34d1b0da0 /llvm/lib/IR/LLVMContextImpl.h | |
parent | 94d384e4231e5e1e511873e421fdb63b175d64f0 (diff) | |
download | bcm5719-llvm-50846f80acea3d2e2e74d472ae22ddbae0984930.tar.gz bcm5719-llvm-50846f80acea3d2e2e74d472ae22ddbae0984930.zip |
IR: Split MDNode into GenericMDNode and MDNodeFwdDecl
Split `MDNode` into two classes:
- `GenericMDNode`, which is uniquable (and for now, always starts
uniqued). Once `Metadata` is split from the `Value` hierarchy, this
class will lose the ability to RAUW itself.
- `MDNodeFwdDecl`, which is used for the "temporary" interface, is
never uniqued, and isn't managed by `LLVMContext` at all.
I've left most of the guts in `MDNode` for now, but I'll incrementally
move things to the right places (or delete the functionality, as
appropriate).
Part of PR21532.
llvm-svn: 222205
Diffstat (limited to 'llvm/lib/IR/LLVMContextImpl.h')
-rw-r--r-- | llvm/lib/IR/LLVMContextImpl.h | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h index 48343b2989e..e743ec3abc4 100644 --- a/llvm/lib/IR/LLVMContextImpl.h +++ b/llvm/lib/IR/LLVMContextImpl.h @@ -191,7 +191,7 @@ struct FunctionTypeKeyInfo { } }; -/// \brief DenseMapInfo for MDNode. +/// \brief DenseMapInfo for GenericMDNode. /// /// Note that we don't need the is-function-local bit, since that's implicit in /// the operands. @@ -203,7 +203,7 @@ struct GenericMDNodeInfo { KeyTy(ArrayRef<Value *> Ops) : Ops(Ops), Hash(hash_combine_range(Ops.begin(), Ops.end())) {} - KeyTy(MDNode *N, SmallVectorImpl<Value *> &Storage) { + KeyTy(GenericMDNode *N, SmallVectorImpl<Value *> &Storage) { Storage.resize(N->getNumOperands()); for (unsigned I = 0, E = N->getNumOperands(); I != E; ++I) Storage[I] = N->getOperand(I); @@ -211,7 +211,7 @@ struct GenericMDNodeInfo { Hash = hash_combine_range(Ops.begin(), Ops.end()); } - bool operator==(const MDNode *RHS) const { + bool operator==(const GenericMDNode *RHS) const { if (RHS == getEmptyKey() || RHS == getTombstoneKey()) return false; if (Hash != RHS->getHash() || Ops.size() != RHS->getNumOperands()) @@ -222,20 +222,20 @@ struct GenericMDNodeInfo { return true; } }; - static inline MDNode *getEmptyKey() { - return DenseMapInfo<MDNode *>::getEmptyKey(); + static inline GenericMDNode *getEmptyKey() { + return DenseMapInfo<GenericMDNode *>::getEmptyKey(); } - static inline MDNode *getTombstoneKey() { - return DenseMapInfo<MDNode *>::getTombstoneKey(); + static inline GenericMDNode *getTombstoneKey() { + return DenseMapInfo<GenericMDNode *>::getTombstoneKey(); } static unsigned getHashValue(const KeyTy &Key) { return Key.Hash; } - static unsigned getHashValue(const MDNode *U) { + static unsigned getHashValue(const GenericMDNode *U) { return U->getHash(); } - static bool isEqual(const KeyTy &LHS, const MDNode *RHS) { + static bool isEqual(const KeyTy &LHS, const GenericMDNode *RHS) { return LHS == RHS; } - static bool isEqual(const MDNode *LHS, const MDNode *RHS) { + static bool isEqual(const GenericMDNode *LHS, const GenericMDNode *RHS) { return LHS == RHS; } }; @@ -293,14 +293,14 @@ public: StringMap<MDString> MDStringCache; - DenseSet<MDNode *, GenericMDNodeInfo> MDNodeSet; + DenseSet<GenericMDNode *, GenericMDNodeInfo> MDNodeSet; // MDNodes may be uniqued or not uniqued. When they're not uniqued, they // aren't in the MDNodeSet, but they're still shared between objects, so no // one object can destroy them. This set allows us to at least destroy them // on Context destruction. - SmallPtrSet<MDNode*, 1> NonUniquedMDNodes; - + SmallPtrSet<GenericMDNode *, 1> NonUniquedMDNodes; + DenseMap<Type*, ConstantAggregateZero*> CAZConstants; typedef ConstantUniqueMap<ConstantArray> ArrayConstantsTy; |