diff options
Diffstat (limited to 'lib/IR/LLVMContextImpl.h')
-rw-r--r-- | lib/IR/LLVMContextImpl.h | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/lib/IR/LLVMContextImpl.h b/lib/IR/LLVMContextImpl.h index 2d120869860a..78cf707e0e74 100644 --- a/lib/IR/LLVMContextImpl.h +++ b/lib/IR/LLVMContextImpl.h @@ -1,9 +1,8 @@ //===- LLVMContextImpl.h - The LLVMContextImpl opaque class -----*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // @@ -31,16 +30,17 @@ #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/DerivedTypes.h" #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Metadata.h" +#include "llvm/IR/RemarkStreamer.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> @@ -789,6 +789,31 @@ template <> struct MDNodeKeyImpl<DINamespace> { } }; +template <> struct MDNodeKeyImpl<DICommonBlock> { + Metadata *Scope; + Metadata *Decl; + MDString *Name; + Metadata *File; + unsigned LineNo; + + MDNodeKeyImpl(Metadata *Scope, Metadata *Decl, MDString *Name, + Metadata *File, unsigned LineNo) + : Scope(Scope), Decl(Decl), Name(Name), File(File), LineNo(LineNo) {} + MDNodeKeyImpl(const DICommonBlock *N) + : Scope(N->getRawScope()), Decl(N->getRawDecl()), Name(N->getRawName()), + File(N->getRawFile()), LineNo(N->getLineNo()) {} + + bool isKeyOf(const DICommonBlock *RHS) const { + return Scope == RHS->getRawScope() && Decl == RHS->getRawDecl() && + Name == RHS->getRawName() && File == RHS->getRawFile() && + LineNo == RHS->getLineNo(); + } + + unsigned getHashValue() const { + return hash_combine(Scope, Decl, Name, File, LineNo); + } +}; + template <> struct MDNodeKeyImpl<DIModule> { Metadata *Scope; MDString *Name; @@ -1227,7 +1252,7 @@ public: bool RespectDiagnosticFilters = false; bool DiagnosticsHotnessRequested = false; uint64_t DiagnosticsHotnessThreshold = 0; - std::unique_ptr<yaml::Output> DiagnosticsOutputFile; + std::unique_ptr<RemarkStreamer> RemarkDiagStreamer; LLVMContext::YieldCallbackTy YieldCallback = nullptr; void *YieldOpaqueHandle = nullptr; @@ -1296,9 +1321,8 @@ public: 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; @@ -1310,7 +1334,7 @@ public: unsigned NamedStructTypesUniqueID = 0; DenseMap<std::pair<Type *, uint64_t>, ArrayType*> ArrayTypes; - DenseMap<std::pair<Type *, unsigned>, VectorType*> VectorTypes; + DenseMap<std::pair<Type *, ElementCount>, VectorType*> VectorTypes; DenseMap<Type*, PointerType*> PointerTypes; // Pointers in AddrSpace = 0 DenseMap<std::pair<Type*, unsigned>, PointerType*> ASPointerTypes; @@ -1332,8 +1356,8 @@ public: /// Collection of per-GlobalObject sections used in this context. DenseMap<const GlobalObject *, StringRef> GlobalObjectSections; - /// Stable collection of section strings. - StringSet<> SectionStrings; + /// Collection of per-GlobalValue partitions used in this context. + DenseMap<const GlobalValue *, StringRef> GlobalValuePartitions; /// DiscriminatorTable - This table maps file:line locations to an /// integer representing the next DWARF path discriminator to assign to |