mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-07 14:33:15 +00:00
unique_ptrify LLVMContextImpl::CAZConstants
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222714 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b932ed3c3d
commit
bf3afab75a
@ -1330,12 +1330,12 @@ bool ConstantFP::isValueValidForType(Type *Ty, const APFloat& Val) {
|
|||||||
ConstantAggregateZero *ConstantAggregateZero::get(Type *Ty) {
|
ConstantAggregateZero *ConstantAggregateZero::get(Type *Ty) {
|
||||||
assert((Ty->isStructTy() || Ty->isArrayTy() || Ty->isVectorTy()) &&
|
assert((Ty->isStructTy() || Ty->isArrayTy() || Ty->isVectorTy()) &&
|
||||||
"Cannot create an aggregate zero of non-aggregate type!");
|
"Cannot create an aggregate zero of non-aggregate type!");
|
||||||
|
|
||||||
ConstantAggregateZero *&Entry = Ty->getContext().pImpl->CAZConstants[Ty];
|
|
||||||
if (!Entry)
|
|
||||||
Entry = new ConstantAggregateZero(Ty);
|
|
||||||
|
|
||||||
return Entry;
|
auto &Entry = Ty->getContext().pImpl->CAZConstants[Ty];
|
||||||
|
if (!Entry)
|
||||||
|
Entry.reset(new ConstantAggregateZero(Ty));
|
||||||
|
|
||||||
|
return Entry.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// destroyConstant - Remove the constant from the constant table.
|
/// destroyConstant - Remove the constant from the constant table.
|
||||||
|
@ -87,7 +87,7 @@ LLVMContextImpl::~LLVMContextImpl() {
|
|||||||
ArrayConstants.freeConstants();
|
ArrayConstants.freeConstants();
|
||||||
StructConstants.freeConstants();
|
StructConstants.freeConstants();
|
||||||
VectorConstants.freeConstants();
|
VectorConstants.freeConstants();
|
||||||
DeleteContainerSeconds(CAZConstants);
|
CAZConstants.clear();
|
||||||
DeleteContainerSeconds(CPNConstants);
|
DeleteContainerSeconds(CPNConstants);
|
||||||
DeleteContainerSeconds(UVConstants);
|
DeleteContainerSeconds(UVConstants);
|
||||||
InlineAsms.freeConstants();
|
InlineAsms.freeConstants();
|
||||||
|
@ -299,7 +299,10 @@ public:
|
|||||||
// on Context destruction.
|
// on Context destruction.
|
||||||
SmallPtrSet<GenericMDNode *, 1> NonUniquedMDNodes;
|
SmallPtrSet<GenericMDNode *, 1> NonUniquedMDNodes;
|
||||||
|
|
||||||
DenseMap<Type*, ConstantAggregateZero*> CAZConstants;
|
// Value is indirected through pointer to keep pointer validity over mutations
|
||||||
|
// of this map. Replace if/when we have an efficient map that guarantees
|
||||||
|
// pointer validity over mutations.
|
||||||
|
DenseMap<Type*, std::unique_ptr<ConstantAggregateZero>> CAZConstants;
|
||||||
|
|
||||||
typedef ConstantUniqueMap<ConstantArray> ArrayConstantsTy;
|
typedef ConstantUniqueMap<ConstantArray> ArrayConstantsTy;
|
||||||
ArrayConstantsTy ArrayConstants;
|
ArrayConstantsTy ArrayConstants;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user