#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
-#include "llvm/ADT/StringSet.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/TrackingMDRef.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Casting.h"
+#include "llvm/Support/StringSaver.h"
#include "llvm/Support/YAMLTraits.h"
#include <algorithm>
#include <cassert>
Type X86_FP80Ty, FP128Ty, PPC_FP128Ty, X86_MMXTy;
IntegerType Int1Ty, Int8Ty, Int16Ty, Int32Ty, Int64Ty, Int128Ty;
- /// TypeAllocator - All dynamically allocated types are allocated from this.
- /// They live forever until the context is torn down.
- BumpPtrAllocator TypeAllocator;
+ BumpPtrAllocator Alloc;
+ UniqueStringSaver Saver{Alloc};
DenseMap<unsigned, IntegerType*> IntegerTypes;
/// Collection of per-GlobalObject sections used in this context.
DenseMap<const GlobalObject *, StringRef> GlobalObjectSections;
- /// Stable collection of section strings.
- StringSet<> SectionStrings;
-
/// DiscriminatorTable - This table maps file:line locations to an
/// integer representing the next DWARF path discriminator to assign to
/// instructions in different blocks at the same location.
IntegerType *&Entry = C.pImpl->IntegerTypes[NumBits];
if (!Entry)
- Entry = new (C.pImpl->TypeAllocator) IntegerType(C, NumBits);
+ Entry = new (C.pImpl->Alloc) IntegerType(C, NumBits);
return Entry;
}
if (Insertion.second) {
// The function type was not found. Allocate one and update FunctionTypes
// in-place.
- FT = (FunctionType *)pImpl->TypeAllocator.Allocate(
+ FT = (FunctionType *)pImpl->Alloc.Allocate(
sizeof(FunctionType) + sizeof(Type *) * (Params.size() + 1),
alignof(FunctionType));
new (FT) FunctionType(ReturnType, Params, isVarArg);
if (Insertion.second) {
// The struct type was not found. Allocate one and update AnonStructTypes
// in-place.
- ST = new (Context.pImpl->TypeAllocator) StructType(Context);
+ ST = new (Context.pImpl->Alloc) StructType(Context);
ST->setSubclassData(SCDB_IsLiteral); // Literal struct.
ST->setBody(ETypes, isPacked);
*Insertion.first = ST;
return;
}
- ContainedTys = Elements.copy(getContext().pImpl->TypeAllocator).data();
+ ContainedTys = Elements.copy(getContext().pImpl->Alloc).data();
}
void StructType::setName(StringRef Name) {
// StructType Helper functions.
StructType *StructType::create(LLVMContext &Context, StringRef Name) {
- StructType *ST = new (Context.pImpl->TypeAllocator) StructType(Context);
+ StructType *ST = new (Context.pImpl->Alloc) StructType(Context);
if (!Name.empty())
ST->setName(Name);
return ST;
pImpl->ArrayTypes[std::make_pair(ElementType, NumElements)];
if (!Entry)
- Entry = new (pImpl->TypeAllocator) ArrayType(ElementType, NumElements);
+ Entry = new (pImpl->Alloc) ArrayType(ElementType, NumElements);
return Entry;
}
->VectorTypes[std::make_pair(ElementType, NumElements)];
if (!Entry)
- Entry = new (pImpl->TypeAllocator) VectorType(ElementType, NumElements);
+ Entry = new (pImpl->Alloc) VectorType(ElementType, NumElements);
return Entry;
}
: CImpl->ASPointerTypes[std::make_pair(EltTy, AddressSpace)];
if (!Entry)
- Entry = new (CImpl->TypeAllocator) PointerType(EltTy, AddressSpace);
+ Entry = new (CImpl->Alloc) PointerType(EltTy, AddressSpace);
return Entry;
}