blob: e9e30ef0656fa067c3d4fadbe428b5de36df2ad3 [file] [log] [blame]
Jeffrey Yasskin4cfb3a72010-03-21 21:17:34 +00001//===-- LLVMContextImpl.h - The LLVMContextImpl opaque class ----*- C++ -*-===//
Owen Anderson8e66e0b2009-06-30 00:48:55 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
Owen Anderson36f62e52009-06-30 17:06:46 +00009//
10// This file declares LLVMContextImpl, the opaque implementation
11// of LLVMContext.
12//
13//===----------------------------------------------------------------------===//
Owen Anderson8e66e0b2009-06-30 00:48:55 +000014
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000015#ifndef LLVM_LIB_IR_LLVMCONTEXTIMPL_H
16#define LLVM_LIB_IR_LLVMCONTEXTIMPL_H
Owen Anderson8e66e0b2009-06-30 00:48:55 +000017
Bill Wendling4607f4b2012-12-20 01:36:59 +000018#include "AttributeImpl.h"
Owen Andersonafd0c4c2009-08-04 22:41:48 +000019#include "ConstantsContext.h"
Owen Andersonc277dc42009-07-16 19:05:41 +000020#include "llvm/ADT/APFloat.h"
Owen Anderson20b34ac2009-07-16 18:04:31 +000021#include "llvm/ADT/APInt.h"
Jay Foadc365eea2011-06-22 08:50:06 +000022#include "llvm/ADT/ArrayRef.h"
Owen Anderson20b34ac2009-07-16 18:04:31 +000023#include "llvm/ADT/DenseMap.h"
Duncan P. N. Exon Smithf39c3b82014-11-17 23:28:21 +000024#include "llvm/ADT/DenseSet.h"
Owen Anderson4118dde2009-07-16 23:44:30 +000025#include "llvm/ADT/FoldingSet.h"
Chandler Carruth802d7552012-12-04 07:12:27 +000026#include "llvm/ADT/Hashing.h"
Jeffrey Yasskin28f24482009-12-17 19:55:06 +000027#include "llvm/ADT/SmallPtrSet.h"
Owen Anderson69ab4162009-07-16 22:11:26 +000028#include "llvm/ADT/StringMap.h"
Chandler Carruth9fb823b2013-01-02 11:36:10 +000029#include "llvm/IR/Constants.h"
Duncan P. N. Exon Smithd9901ff2015-02-02 18:53:21 +000030#include "llvm/IR/DebugInfoMetadata.h"
Chandler Carruth9fb823b2013-01-02 11:36:10 +000031#include "llvm/IR/DerivedTypes.h"
32#include "llvm/IR/LLVMContext.h"
33#include "llvm/IR/Metadata.h"
Chandler Carruth4220e9c2014-03-04 11:17:44 +000034#include "llvm/IR/ValueHandle.h"
Duncan P. N. Exon Smith05ebfd02016-04-17 02:30:20 +000035#include "llvm/Support/Dwarf.h"
Adam Nemeta62b7e12016-09-27 20:55:07 +000036#include "llvm/Support/YAMLTraits.h"
Duncan P. N. Exon Smith3eef9d12016-04-19 23:59:13 +000037#include <vector>
Owen Anderson39ede7b2009-07-21 20:13:12 +000038
Owen Anderson20b34ac2009-07-16 18:04:31 +000039namespace llvm {
Owen Andersonedb4a702009-07-24 23:12:02 +000040
Owen Anderson20b34ac2009-07-16 18:04:31 +000041class ConstantInt;
Owen Andersonc277dc42009-07-16 19:05:41 +000042class ConstantFP;
Diego Novillo7f8af8b2014-05-22 14:19:46 +000043class DiagnosticInfoOptimizationRemark;
44class DiagnosticInfoOptimizationRemarkMissed;
45class DiagnosticInfoOptimizationRemarkAnalysis;
Philip Reames2b453952015-01-16 20:07:33 +000046class GCStrategy;
Benjamin Kramer78c3bcb2009-08-11 17:45:13 +000047class LLVMContext;
Owen Anderson20b34ac2009-07-16 18:04:31 +000048class Type;
Owen Anderson4118dde2009-07-16 23:44:30 +000049class Value;
Owen Anderson20b34ac2009-07-16 18:04:31 +000050
Benjamin Kramer079b96e2013-09-11 18:05:11 +000051struct DenseMapAPIntKeyInfo {
Benjamin Kramer8e5dc532014-12-06 13:12:56 +000052 static inline APInt getEmptyKey() {
53 APInt V(nullptr, 0);
54 V.VAL = 0;
55 return V;
56 }
57 static inline APInt getTombstoneKey() {
58 APInt V(nullptr, 0);
59 V.VAL = 1;
60 return V;
61 }
62 static unsigned getHashValue(const APInt &Key) {
Chandler Carruth71bd7d12012-03-04 12:02:57 +000063 return static_cast<unsigned>(hash_value(Key));
Owen Anderson20b34ac2009-07-16 18:04:31 +000064 }
Benjamin Kramer8e5dc532014-12-06 13:12:56 +000065 static bool isEqual(const APInt &LHS, const APInt &RHS) {
66 return LHS.getBitWidth() == RHS.getBitWidth() && LHS == RHS;
67 }
Owen Anderson20b34ac2009-07-16 18:04:31 +000068};
69
Benjamin Kramer079b96e2013-09-11 18:05:11 +000070struct DenseMapAPFloatKeyInfo {
Stephan Bergmann17c7f702016-12-14 11:57:17 +000071 static inline APFloat getEmptyKey() { return APFloat(APFloat::Bogus(), 1); }
72 static inline APFloat getTombstoneKey() { return APFloat(APFloat::Bogus(), 2); }
Benjamin Kramer8e5dc532014-12-06 13:12:56 +000073 static unsigned getHashValue(const APFloat &Key) {
Chandler Carruth71bd7d12012-03-04 12:02:57 +000074 return static_cast<unsigned>(hash_value(Key));
Owen Andersonc277dc42009-07-16 19:05:41 +000075 }
Benjamin Kramer8e5dc532014-12-06 13:12:56 +000076 static bool isEqual(const APFloat &LHS, const APFloat &RHS) {
77 return LHS.bitwiseIsEqual(RHS);
78 }
Owen Andersonc277dc42009-07-16 19:05:41 +000079};
80
Benjamin Kramer079b96e2013-09-11 18:05:11 +000081struct AnonStructTypeKeyInfo {
Jay Foad529776c2012-02-23 09:17:40 +000082 struct KeyTy {
83 ArrayRef<Type*> ETypes;
84 bool isPacked;
85 KeyTy(const ArrayRef<Type*>& E, bool P) :
86 ETypes(E), isPacked(P) {}
Rafael Espindola334b73f2014-11-21 18:53:05 +000087 KeyTy(const StructType *ST)
88 : ETypes(ST->elements()), isPacked(ST->isPacked()) {}
Jay Foad529776c2012-02-23 09:17:40 +000089 bool operator==(const KeyTy& that) const {
90 if (isPacked != that.isPacked)
91 return false;
92 if (ETypes != that.ETypes)
93 return false;
94 return true;
95 }
96 bool operator!=(const KeyTy& that) const {
97 return !this->operator==(that);
98 }
99 };
100 static inline StructType* getEmptyKey() {
101 return DenseMapInfo<StructType*>::getEmptyKey();
102 }
103 static inline StructType* getTombstoneKey() {
104 return DenseMapInfo<StructType*>::getTombstoneKey();
105 }
106 static unsigned getHashValue(const KeyTy& Key) {
Chandler Carruth1d03a3b2012-03-01 18:55:25 +0000107 return hash_combine(hash_combine_range(Key.ETypes.begin(),
108 Key.ETypes.end()),
109 Key.isPacked);
Jay Foad529776c2012-02-23 09:17:40 +0000110 }
111 static unsigned getHashValue(const StructType *ST) {
112 return getHashValue(KeyTy(ST));
113 }
114 static bool isEqual(const KeyTy& LHS, const StructType *RHS) {
115 if (RHS == getEmptyKey() || RHS == getTombstoneKey())
116 return false;
117 return LHS == KeyTy(RHS);
118 }
119 static bool isEqual(const StructType *LHS, const StructType *RHS) {
120 return LHS == RHS;
121 }
122};
123
Benjamin Kramer079b96e2013-09-11 18:05:11 +0000124struct FunctionTypeKeyInfo {
Jay Foad529776c2012-02-23 09:17:40 +0000125 struct KeyTy {
126 const Type *ReturnType;
127 ArrayRef<Type*> Params;
128 bool isVarArg;
129 KeyTy(const Type* R, const ArrayRef<Type*>& P, bool V) :
130 ReturnType(R), Params(P), isVarArg(V) {}
Rafael Espindolae973fd42014-11-21 19:03:35 +0000131 KeyTy(const FunctionType *FT)
132 : ReturnType(FT->getReturnType()), Params(FT->params()),
133 isVarArg(FT->isVarArg()) {}
Jay Foad529776c2012-02-23 09:17:40 +0000134 bool operator==(const KeyTy& that) const {
135 if (ReturnType != that.ReturnType)
136 return false;
137 if (isVarArg != that.isVarArg)
138 return false;
139 if (Params != that.Params)
140 return false;
141 return true;
142 }
143 bool operator!=(const KeyTy& that) const {
144 return !this->operator==(that);
145 }
146 };
147 static inline FunctionType* getEmptyKey() {
148 return DenseMapInfo<FunctionType*>::getEmptyKey();
149 }
150 static inline FunctionType* getTombstoneKey() {
151 return DenseMapInfo<FunctionType*>::getTombstoneKey();
152 }
153 static unsigned getHashValue(const KeyTy& Key) {
Chandler Carruth1d03a3b2012-03-01 18:55:25 +0000154 return hash_combine(Key.ReturnType,
155 hash_combine_range(Key.Params.begin(),
156 Key.Params.end()),
157 Key.isVarArg);
Jay Foad529776c2012-02-23 09:17:40 +0000158 }
159 static unsigned getHashValue(const FunctionType *FT) {
160 return getHashValue(KeyTy(FT));
161 }
162 static bool isEqual(const KeyTy& LHS, const FunctionType *RHS) {
163 if (RHS == getEmptyKey() || RHS == getTombstoneKey())
164 return false;
165 return LHS == KeyTy(RHS);
166 }
167 static bool isEqual(const FunctionType *LHS, const FunctionType *RHS) {
168 return LHS == RHS;
169 }
170};
171
Duncan P. N. Exon Smith93e983e2015-01-19 22:53:18 +0000172/// \brief Structure for hashing arbitrary MDNode operands.
173class MDNodeOpsKey {
174 ArrayRef<Metadata *> RawOps;
175 ArrayRef<MDOperand> Ops;
176
177 unsigned Hash;
178
179protected:
180 MDNodeOpsKey(ArrayRef<Metadata *> Ops)
181 : RawOps(Ops), Hash(calculateHash(Ops)) {}
182
183 template <class NodeTy>
Duncan P. N. Exon Smith8af6cfc2015-02-04 22:08:30 +0000184 MDNodeOpsKey(const NodeTy *N, unsigned Offset = 0)
Duncan P. N. Exon Smithfed199a2015-01-20 00:01:43 +0000185 : Ops(N->op_begin() + Offset, N->op_end()), Hash(N->getHash()) {}
Duncan P. N. Exon Smith93e983e2015-01-19 22:53:18 +0000186
Duncan P. N. Exon Smithfed199a2015-01-20 00:01:43 +0000187 template <class NodeTy>
188 bool compareOps(const NodeTy *RHS, unsigned Offset = 0) const {
Duncan P. N. Exon Smith93e983e2015-01-19 22:53:18 +0000189 if (getHash() != RHS->getHash())
190 return false;
191
192 assert((RawOps.empty() || Ops.empty()) && "Two sets of operands?");
Duncan P. N. Exon Smithfed199a2015-01-20 00:01:43 +0000193 return RawOps.empty() ? compareOps(Ops, RHS, Offset)
194 : compareOps(RawOps, RHS, Offset);
Duncan P. N. Exon Smith93e983e2015-01-19 22:53:18 +0000195 }
196
Duncan P. N. Exon Smithfed199a2015-01-20 00:01:43 +0000197 static unsigned calculateHash(MDNode *N, unsigned Offset = 0);
Duncan P. N. Exon Smith93e983e2015-01-19 22:53:18 +0000198
199private:
200 template <class T>
Duncan P. N. Exon Smithfed199a2015-01-20 00:01:43 +0000201 static bool compareOps(ArrayRef<T> Ops, const MDNode *RHS, unsigned Offset) {
202 if (Ops.size() != RHS->getNumOperands() - Offset)
Duncan P. N. Exon Smith93e983e2015-01-19 22:53:18 +0000203 return false;
Duncan P. N. Exon Smithfed199a2015-01-20 00:01:43 +0000204 return std::equal(Ops.begin(), Ops.end(), RHS->op_begin() + Offset);
Duncan P. N. Exon Smith93e983e2015-01-19 22:53:18 +0000205 }
206
207 static unsigned calculateHash(ArrayRef<Metadata *> Ops);
208
209public:
210 unsigned getHash() const { return Hash; }
211};
212
Duncan P. N. Exon Smith8af6cfc2015-02-04 22:08:30 +0000213template <class NodeTy> struct MDNodeKeyImpl;
214template <class NodeTy> struct MDNodeInfo;
215
Duncan P. N. Exon Smithf2291272016-04-16 23:42:04 +0000216/// Configuration point for MDNodeInfo::isEqual().
217template <class NodeTy> struct MDNodeSubsetEqualImpl {
218 typedef MDNodeKeyImpl<NodeTy> KeyTy;
219 static bool isSubsetEqual(const KeyTy &LHS, const NodeTy *RHS) {
220 return false;
221 }
222 static bool isSubsetEqual(const NodeTy *LHS, const NodeTy *RHS) {
223 return false;
224 }
225};
226
Duncan P. N. Exon Smith118632d2015-01-12 20:09:34 +0000227/// \brief DenseMapInfo for MDTuple.
Duncan P. N. Exon Smithf39c3b82014-11-17 23:28:21 +0000228///
229/// Note that we don't need the is-function-local bit, since that's implicit in
230/// the operands.
Duncan P. N. Exon Smith8af6cfc2015-02-04 22:08:30 +0000231template <> struct MDNodeKeyImpl<MDTuple> : MDNodeOpsKey {
232 MDNodeKeyImpl(ArrayRef<Metadata *> Ops) : MDNodeOpsKey(Ops) {}
233 MDNodeKeyImpl(const MDTuple *N) : MDNodeOpsKey(N) {}
Duncan P. N. Exon Smithf39c3b82014-11-17 23:28:21 +0000234
Duncan P. N. Exon Smith9c26d802015-02-05 00:51:35 +0000235 bool isKeyOf(const MDTuple *RHS) const { return compareOps(RHS); }
Duncan P. N. Exon Smith93e983e2015-01-19 22:53:18 +0000236
Duncan P. N. Exon Smith8af6cfc2015-02-04 22:08:30 +0000237 unsigned getHashValue() const { return getHash(); }
238
239 static unsigned calculateHash(MDTuple *N) {
240 return MDNodeOpsKey::calculateHash(N);
Benjamin Kramer2335a5c2012-04-11 14:06:54 +0000241 }
242};
243
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000244/// \brief DenseMapInfo for DILocation.
245template <> struct MDNodeKeyImpl<DILocation> {
Duncan P. N. Exon Smith8af6cfc2015-02-04 22:08:30 +0000246 unsigned Line;
247 unsigned Column;
248 Metadata *Scope;
249 Metadata *InlinedAt;
Duncan P. N. Exon Smithde03ff52015-01-13 20:44:56 +0000250
Duncan P. N. Exon Smith8af6cfc2015-02-04 22:08:30 +0000251 MDNodeKeyImpl(unsigned Line, unsigned Column, Metadata *Scope,
252 Metadata *InlinedAt)
253 : Line(Line), Column(Column), Scope(Scope), InlinedAt(InlinedAt) {}
Duncan P. N. Exon Smithde03ff52015-01-13 20:44:56 +0000254
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000255 MDNodeKeyImpl(const DILocation *L)
Duncan P. N. Exon Smith26489982015-03-26 22:05:04 +0000256 : Line(L->getLine()), Column(L->getColumn()), Scope(L->getRawScope()),
257 InlinedAt(L->getRawInlinedAt()) {}
Duncan P. N. Exon Smithde03ff52015-01-13 20:44:56 +0000258
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000259 bool isKeyOf(const DILocation *RHS) const {
Duncan P. N. Exon Smith8af6cfc2015-02-04 22:08:30 +0000260 return Line == RHS->getLine() && Column == RHS->getColumn() &&
Duncan P. N. Exon Smith26489982015-03-26 22:05:04 +0000261 Scope == RHS->getRawScope() && InlinedAt == RHS->getRawInlinedAt();
Duncan P. N. Exon Smithde03ff52015-01-13 20:44:56 +0000262 }
Duncan P. N. Exon Smith8af6cfc2015-02-04 22:08:30 +0000263 unsigned getHashValue() const {
264 return hash_combine(Line, Column, Scope, InlinedAt);
Duncan P. N. Exon Smithde03ff52015-01-13 20:44:56 +0000265 }
266};
267
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000268/// \brief DenseMapInfo for GenericDINode.
269template <> struct MDNodeKeyImpl<GenericDINode> : MDNodeOpsKey {
Duncan P. N. Exon Smith8af6cfc2015-02-04 22:08:30 +0000270 unsigned Tag;
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000271 MDString *Header;
272 MDNodeKeyImpl(unsigned Tag, MDString *Header, ArrayRef<Metadata *> DwarfOps)
Duncan P. N. Exon Smith8af6cfc2015-02-04 22:08:30 +0000273 : MDNodeOpsKey(DwarfOps), Tag(Tag), Header(Header) {}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000274 MDNodeKeyImpl(const GenericDINode *N)
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000275 : MDNodeOpsKey(N, 1), Tag(N->getTag()), Header(N->getRawHeader()) {}
Duncan P. N. Exon Smithfed199a2015-01-20 00:01:43 +0000276
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000277 bool isKeyOf(const GenericDINode *RHS) const {
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000278 return Tag == RHS->getTag() && Header == RHS->getRawHeader() &&
Duncan P. N. Exon Smith8af6cfc2015-02-04 22:08:30 +0000279 compareOps(RHS, 1);
280 }
Duncan P. N. Exon Smithfed199a2015-01-20 00:01:43 +0000281
Duncan P. N. Exon Smith8af6cfc2015-02-04 22:08:30 +0000282 unsigned getHashValue() const { return hash_combine(getHash(), Tag, Header); }
283
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000284 static unsigned calculateHash(GenericDINode *N) {
Duncan P. N. Exon Smith8af6cfc2015-02-04 22:08:30 +0000285 return MDNodeOpsKey::calculateHash(N, 1);
Duncan P. N. Exon Smithfed199a2015-01-20 00:01:43 +0000286 }
Duncan P. N. Exon Smith8af6cfc2015-02-04 22:08:30 +0000287};
288
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000289template <> struct MDNodeKeyImpl<DISubrange> {
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000290 int64_t Count;
Duncan P. N. Exon Smith5dcf6212015-04-07 00:39:59 +0000291 int64_t LowerBound;
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000292
Duncan P. N. Exon Smith5dcf6212015-04-07 00:39:59 +0000293 MDNodeKeyImpl(int64_t Count, int64_t LowerBound)
294 : Count(Count), LowerBound(LowerBound) {}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000295 MDNodeKeyImpl(const DISubrange *N)
Duncan P. N. Exon Smith5dcf6212015-04-07 00:39:59 +0000296 : Count(N->getCount()), LowerBound(N->getLowerBound()) {}
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000297
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000298 bool isKeyOf(const DISubrange *RHS) const {
Duncan P. N. Exon Smith5dcf6212015-04-07 00:39:59 +0000299 return Count == RHS->getCount() && LowerBound == RHS->getLowerBound();
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000300 }
Duncan P. N. Exon Smith5dcf6212015-04-07 00:39:59 +0000301 unsigned getHashValue() const { return hash_combine(Count, LowerBound); }
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000302};
303
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000304template <> struct MDNodeKeyImpl<DIEnumerator> {
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000305 int64_t Value;
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000306 MDString *Name;
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000307
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000308 MDNodeKeyImpl(int64_t Value, MDString *Name) : Value(Value), Name(Name) {}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000309 MDNodeKeyImpl(const DIEnumerator *N)
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000310 : Value(N->getValue()), Name(N->getRawName()) {}
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000311
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000312 bool isKeyOf(const DIEnumerator *RHS) const {
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000313 return Value == RHS->getValue() && Name == RHS->getRawName();
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000314 }
315 unsigned getHashValue() const { return hash_combine(Value, Name); }
316};
317
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000318template <> struct MDNodeKeyImpl<DIBasicType> {
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000319 unsigned Tag;
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000320 MDString *Name;
Duncan P. N. Exon Smithd34db172015-02-19 23:56:07 +0000321 uint64_t SizeInBits;
Victor Leschuk197aa312016-10-18 14:31:22 +0000322 uint32_t AlignInBits;
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000323 unsigned Encoding;
324
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000325 MDNodeKeyImpl(unsigned Tag, MDString *Name, uint64_t SizeInBits,
Victor Leschuk197aa312016-10-18 14:31:22 +0000326 uint32_t AlignInBits, unsigned Encoding)
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000327 : Tag(Tag), Name(Name), SizeInBits(SizeInBits), AlignInBits(AlignInBits),
328 Encoding(Encoding) {}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000329 MDNodeKeyImpl(const DIBasicType *N)
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000330 : Tag(N->getTag()), Name(N->getRawName()), SizeInBits(N->getSizeInBits()),
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000331 AlignInBits(N->getAlignInBits()), Encoding(N->getEncoding()) {}
332
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000333 bool isKeyOf(const DIBasicType *RHS) const {
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000334 return Tag == RHS->getTag() && Name == RHS->getRawName() &&
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000335 SizeInBits == RHS->getSizeInBits() &&
336 AlignInBits == RHS->getAlignInBits() &&
337 Encoding == RHS->getEncoding();
338 }
339 unsigned getHashValue() const {
340 return hash_combine(Tag, Name, SizeInBits, AlignInBits, Encoding);
341 }
342};
343
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000344template <> struct MDNodeKeyImpl<DIDerivedType> {
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000345 unsigned Tag;
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000346 MDString *Name;
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000347 Metadata *File;
348 unsigned Line;
349 Metadata *Scope;
350 Metadata *BaseType;
Duncan P. N. Exon Smithd34db172015-02-19 23:56:07 +0000351 uint64_t SizeInBits;
Duncan P. N. Exon Smithd34db172015-02-19 23:56:07 +0000352 uint64_t OffsetInBits;
Victor Leschuk197aa312016-10-18 14:31:22 +0000353 uint32_t AlignInBits;
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000354 unsigned Flags;
355 Metadata *ExtraData;
356
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000357 MDNodeKeyImpl(unsigned Tag, MDString *Name, Metadata *File, unsigned Line,
Duncan P. N. Exon Smithd34db172015-02-19 23:56:07 +0000358 Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
Victor Leschuk197aa312016-10-18 14:31:22 +0000359 uint32_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000360 Metadata *ExtraData)
361 : Tag(Tag), Name(Name), File(File), Line(Line), Scope(Scope),
Victor Leschuk197aa312016-10-18 14:31:22 +0000362 BaseType(BaseType), SizeInBits(SizeInBits), OffsetInBits(OffsetInBits),
363 AlignInBits(AlignInBits), Flags(Flags), ExtraData(ExtraData) {}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000364 MDNodeKeyImpl(const DIDerivedType *N)
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000365 : Tag(N->getTag()), Name(N->getRawName()), File(N->getRawFile()),
Duncan P. N. Exon Smith53855f02015-03-27 23:05:04 +0000366 Line(N->getLine()), Scope(N->getRawScope()),
367 BaseType(N->getRawBaseType()), SizeInBits(N->getSizeInBits()),
Victor Leschuk197aa312016-10-18 14:31:22 +0000368 OffsetInBits(N->getOffsetInBits()), AlignInBits(N->getAlignInBits()),
Duncan P. N. Exon Smith53855f02015-03-27 23:05:04 +0000369 Flags(N->getFlags()), ExtraData(N->getRawExtraData()) {}
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000370
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000371 bool isKeyOf(const DIDerivedType *RHS) const {
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000372 return Tag == RHS->getTag() && Name == RHS->getRawName() &&
Duncan P. N. Exon Smith53855f02015-03-27 23:05:04 +0000373 File == RHS->getRawFile() && Line == RHS->getLine() &&
374 Scope == RHS->getRawScope() && BaseType == RHS->getRawBaseType() &&
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000375 SizeInBits == RHS->getSizeInBits() &&
376 AlignInBits == RHS->getAlignInBits() &&
377 OffsetInBits == RHS->getOffsetInBits() && Flags == RHS->getFlags() &&
Duncan P. N. Exon Smith53855f02015-03-27 23:05:04 +0000378 ExtraData == RHS->getRawExtraData();
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000379 }
380 unsigned getHashValue() const {
Duncan P. N. Exon Smith05ebfd02016-04-17 02:30:20 +0000381 // If this is a member inside an ODR type, only hash the type and the name.
382 // Otherwise the hash will be stronger than
383 // MDNodeSubsetEqualImpl::isODRMember().
Duncan P. N. Exon Smitha59d3e52016-04-23 21:08:00 +0000384 if (Tag == dwarf::DW_TAG_member && Name)
385 if (auto *CT = dyn_cast_or_null<DICompositeType>(Scope))
386 if (CT->getRawIdentifier())
387 return hash_combine(Name, Scope);
Duncan P. N. Exon Smith05ebfd02016-04-17 02:30:20 +0000388
Mehdi Amini9bc362a2016-03-19 01:06:24 +0000389 // Intentionally computes the hash on a subset of the operands for
390 // performance reason. The subset has to be significant enough to avoid
391 // collision "most of the time". There is no correctness issue in case of
392 // collision because of the full check above.
Mehdi Amini53fc3892016-03-19 00:59:26 +0000393 return hash_combine(Tag, Name, File, Line, Scope, BaseType, Flags);
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000394 }
395};
396
Duncan P. N. Exon Smith05ebfd02016-04-17 02:30:20 +0000397template <> struct MDNodeSubsetEqualImpl<DIDerivedType> {
398 typedef MDNodeKeyImpl<DIDerivedType> KeyTy;
399 static bool isSubsetEqual(const KeyTy &LHS, const DIDerivedType *RHS) {
400 return isODRMember(LHS.Tag, LHS.Scope, LHS.Name, RHS);
401 }
402 static bool isSubsetEqual(const DIDerivedType *LHS, const DIDerivedType *RHS) {
403 return isODRMember(LHS->getTag(), LHS->getRawScope(), LHS->getRawName(),
404 RHS);
405 }
406
407 /// Subprograms compare equal if they declare the same function in an ODR
408 /// type.
409 static bool isODRMember(unsigned Tag, const Metadata *Scope,
410 const MDString *Name, const DIDerivedType *RHS) {
411 // Check whether the LHS is eligible.
Duncan P. N. Exon Smitha59d3e52016-04-23 21:08:00 +0000412 if (Tag != dwarf::DW_TAG_member || !Name)
413 return false;
414
415 auto *CT = dyn_cast_or_null<DICompositeType>(Scope);
416 if (!CT || !CT->getRawIdentifier())
Duncan P. N. Exon Smith05ebfd02016-04-17 02:30:20 +0000417 return false;
418
419 // Compare to the RHS.
420 return Tag == RHS->getTag() && Name == RHS->getRawName() &&
421 Scope == RHS->getRawScope();
422 }
423};
424
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000425template <> struct MDNodeKeyImpl<DICompositeType> {
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000426 unsigned Tag;
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000427 MDString *Name;
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000428 Metadata *File;
429 unsigned Line;
430 Metadata *Scope;
431 Metadata *BaseType;
Duncan P. N. Exon Smithd34db172015-02-19 23:56:07 +0000432 uint64_t SizeInBits;
Duncan P. N. Exon Smithd34db172015-02-19 23:56:07 +0000433 uint64_t OffsetInBits;
Victor Leschuk197aa312016-10-18 14:31:22 +0000434 uint32_t AlignInBits;
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000435 unsigned Flags;
436 Metadata *Elements;
437 unsigned RuntimeLang;
438 Metadata *VTableHolder;
439 Metadata *TemplateParams;
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000440 MDString *Identifier;
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000441
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000442 MDNodeKeyImpl(unsigned Tag, MDString *Name, Metadata *File, unsigned Line,
Duncan P. N. Exon Smithd34db172015-02-19 23:56:07 +0000443 Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
Victor Leschuk197aa312016-10-18 14:31:22 +0000444 uint32_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000445 Metadata *Elements, unsigned RuntimeLang,
446 Metadata *VTableHolder, Metadata *TemplateParams,
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000447 MDString *Identifier)
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000448 : Tag(Tag), Name(Name), File(File), Line(Line), Scope(Scope),
Victor Leschuk197aa312016-10-18 14:31:22 +0000449 BaseType(BaseType), SizeInBits(SizeInBits), OffsetInBits(OffsetInBits),
450 AlignInBits(AlignInBits), Flags(Flags), Elements(Elements),
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000451 RuntimeLang(RuntimeLang), VTableHolder(VTableHolder),
452 TemplateParams(TemplateParams), Identifier(Identifier) {}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000453 MDNodeKeyImpl(const DICompositeType *N)
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000454 : Tag(N->getTag()), Name(N->getRawName()), File(N->getRawFile()),
Duncan P. N. Exon Smith53855f02015-03-27 23:05:04 +0000455 Line(N->getLine()), Scope(N->getRawScope()),
456 BaseType(N->getRawBaseType()), SizeInBits(N->getSizeInBits()),
Victor Leschuk197aa312016-10-18 14:31:22 +0000457 OffsetInBits(N->getOffsetInBits()), AlignInBits(N->getAlignInBits()),
Duncan P. N. Exon Smith53855f02015-03-27 23:05:04 +0000458 Flags(N->getFlags()), Elements(N->getRawElements()),
459 RuntimeLang(N->getRuntimeLang()), VTableHolder(N->getRawVTableHolder()),
460 TemplateParams(N->getRawTemplateParams()),
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000461 Identifier(N->getRawIdentifier()) {}
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000462
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000463 bool isKeyOf(const DICompositeType *RHS) const {
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000464 return Tag == RHS->getTag() && Name == RHS->getRawName() &&
Duncan P. N. Exon Smith53855f02015-03-27 23:05:04 +0000465 File == RHS->getRawFile() && Line == RHS->getLine() &&
466 Scope == RHS->getRawScope() && BaseType == RHS->getRawBaseType() &&
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000467 SizeInBits == RHS->getSizeInBits() &&
468 AlignInBits == RHS->getAlignInBits() &&
469 OffsetInBits == RHS->getOffsetInBits() && Flags == RHS->getFlags() &&
Duncan P. N. Exon Smith53855f02015-03-27 23:05:04 +0000470 Elements == RHS->getRawElements() &&
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000471 RuntimeLang == RHS->getRuntimeLang() &&
Duncan P. N. Exon Smith53855f02015-03-27 23:05:04 +0000472 VTableHolder == RHS->getRawVTableHolder() &&
473 TemplateParams == RHS->getRawTemplateParams() &&
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000474 Identifier == RHS->getRawIdentifier();
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000475 }
476 unsigned getHashValue() const {
Mehdi Amini9bc362a2016-03-19 01:06:24 +0000477 // Intentionally computes the hash on a subset of the operands for
478 // performance reason. The subset has to be significant enough to avoid
479 // collision "most of the time". There is no correctness issue in case of
480 // collision because of the full check above.
Mehdi Amini53fc3892016-03-19 00:59:26 +0000481 return hash_combine(Name, File, Line, BaseType, Scope, Elements,
482 TemplateParams);
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000483 }
484};
485
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000486template <> struct MDNodeKeyImpl<DISubroutineType> {
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000487 unsigned Flags;
Reid Klecknerde3d8b52016-06-08 20:34:29 +0000488 uint8_t CC;
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000489 Metadata *TypeArray;
490
Reid Klecknerde3d8b52016-06-08 20:34:29 +0000491 MDNodeKeyImpl(unsigned Flags, uint8_t CC, Metadata *TypeArray)
492 : Flags(Flags), CC(CC), TypeArray(TypeArray) {}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000493 MDNodeKeyImpl(const DISubroutineType *N)
Reid Klecknerde3d8b52016-06-08 20:34:29 +0000494 : Flags(N->getFlags()), CC(N->getCC()), TypeArray(N->getRawTypeArray()) {}
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000495
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000496 bool isKeyOf(const DISubroutineType *RHS) const {
Reid Klecknerde3d8b52016-06-08 20:34:29 +0000497 return Flags == RHS->getFlags() && CC == RHS->getCC() &&
498 TypeArray == RHS->getRawTypeArray();
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000499 }
Reid Klecknerde3d8b52016-06-08 20:34:29 +0000500 unsigned getHashValue() const { return hash_combine(Flags, CC, TypeArray); }
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000501};
502
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000503template <> struct MDNodeKeyImpl<DIFile> {
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000504 MDString *Filename;
505 MDString *Directory;
Amjad Aboud7faeecc2016-12-25 10:12:09 +0000506 DIFile::ChecksumKind CSKind;
507 MDString *Checksum;
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000508
Amjad Aboud7faeecc2016-12-25 10:12:09 +0000509 MDNodeKeyImpl(MDString *Filename, MDString *Directory,
510 DIFile::ChecksumKind CSKind, MDString *Checksum)
511 : Filename(Filename), Directory(Directory), CSKind(CSKind),
512 Checksum(Checksum) {}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000513 MDNodeKeyImpl(const DIFile *N)
Amjad Aboud7faeecc2016-12-25 10:12:09 +0000514 : Filename(N->getRawFilename()), Directory(N->getRawDirectory()),
515 CSKind(N->getChecksumKind()), Checksum(N->getRawChecksum()) {}
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000516
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000517 bool isKeyOf(const DIFile *RHS) const {
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000518 return Filename == RHS->getRawFilename() &&
Amjad Aboud7faeecc2016-12-25 10:12:09 +0000519 Directory == RHS->getRawDirectory() &&
520 CSKind == RHS->getChecksumKind() &&
521 Checksum == RHS->getRawChecksum();
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000522 }
Amjad Aboud7faeecc2016-12-25 10:12:09 +0000523 unsigned getHashValue() const {
524 return hash_combine(Filename, Directory, CSKind, Checksum);
525 }
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000526};
527
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000528template <> struct MDNodeKeyImpl<DISubprogram> {
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000529 Metadata *Scope;
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000530 MDString *Name;
531 MDString *LinkageName;
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000532 Metadata *File;
533 unsigned Line;
534 Metadata *Type;
535 bool IsLocalToUnit;
536 bool IsDefinition;
537 unsigned ScopeLine;
538 Metadata *ContainingType;
539 unsigned Virtuality;
540 unsigned VirtualIndex;
Reid Klecknerb5af11d2016-07-01 02:41:21 +0000541 int ThisAdjustment;
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000542 unsigned Flags;
543 bool IsOptimized;
Adrian Prantl75819ae2016-04-15 15:57:41 +0000544 Metadata *Unit;
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000545 Metadata *TemplateParams;
546 Metadata *Declaration;
547 Metadata *Variables;
548
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000549 MDNodeKeyImpl(Metadata *Scope, MDString *Name, MDString *LinkageName,
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000550 Metadata *File, unsigned Line, Metadata *Type,
551 bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
552 Metadata *ContainingType, unsigned Virtuality,
Reid Klecknerb5af11d2016-07-01 02:41:21 +0000553 unsigned VirtualIndex, int ThisAdjustment, unsigned Flags,
554 bool IsOptimized, Metadata *Unit, Metadata *TemplateParams,
555 Metadata *Declaration, Metadata *Variables)
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000556 : Scope(Scope), Name(Name), LinkageName(LinkageName), File(File),
557 Line(Line), Type(Type), IsLocalToUnit(IsLocalToUnit),
558 IsDefinition(IsDefinition), ScopeLine(ScopeLine),
559 ContainingType(ContainingType), Virtuality(Virtuality),
Reid Klecknerb5af11d2016-07-01 02:41:21 +0000560 VirtualIndex(VirtualIndex), ThisAdjustment(ThisAdjustment),
561 Flags(Flags), IsOptimized(IsOptimized), Unit(Unit),
562 TemplateParams(TemplateParams), Declaration(Declaration),
Peter Collingbourned4bff302015-11-05 22:03:56 +0000563 Variables(Variables) {}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000564 MDNodeKeyImpl(const DISubprogram *N)
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000565 : Scope(N->getRawScope()), Name(N->getRawName()),
566 LinkageName(N->getRawLinkageName()), File(N->getRawFile()),
Duncan P. N. Exon Smith869db502015-03-30 16:19:15 +0000567 Line(N->getLine()), Type(N->getRawType()),
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000568 IsLocalToUnit(N->isLocalToUnit()), IsDefinition(N->isDefinition()),
Duncan P. N. Exon Smith869db502015-03-30 16:19:15 +0000569 ScopeLine(N->getScopeLine()), ContainingType(N->getRawContainingType()),
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000570 Virtuality(N->getVirtuality()), VirtualIndex(N->getVirtualIndex()),
Reid Klecknerb5af11d2016-07-01 02:41:21 +0000571 ThisAdjustment(N->getThisAdjustment()), Flags(N->getFlags()),
572 IsOptimized(N->isOptimized()), Unit(N->getRawUnit()),
573 TemplateParams(N->getRawTemplateParams()),
Duncan P. N. Exon Smith869db502015-03-30 16:19:15 +0000574 Declaration(N->getRawDeclaration()), Variables(N->getRawVariables()) {}
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000575
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000576 bool isKeyOf(const DISubprogram *RHS) const {
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000577 return Scope == RHS->getRawScope() && Name == RHS->getRawName() &&
578 LinkageName == RHS->getRawLinkageName() &&
579 File == RHS->getRawFile() && Line == RHS->getLine() &&
580 Type == RHS->getRawType() && IsLocalToUnit == RHS->isLocalToUnit() &&
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000581 IsDefinition == RHS->isDefinition() &&
582 ScopeLine == RHS->getScopeLine() &&
Duncan P. N. Exon Smith869db502015-03-30 16:19:15 +0000583 ContainingType == RHS->getRawContainingType() &&
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000584 Virtuality == RHS->getVirtuality() &&
Reid Klecknerb5af11d2016-07-01 02:41:21 +0000585 VirtualIndex == RHS->getVirtualIndex() &&
586 ThisAdjustment == RHS->getThisAdjustment() &&
587 Flags == RHS->getFlags() && IsOptimized == RHS->isOptimized() &&
588 Unit == RHS->getUnit() &&
Duncan P. N. Exon Smith869db502015-03-30 16:19:15 +0000589 TemplateParams == RHS->getRawTemplateParams() &&
590 Declaration == RHS->getRawDeclaration() &&
591 Variables == RHS->getRawVariables();
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000592 }
593 unsigned getHashValue() const {
Duncan P. N. Exon Smith05ebfd02016-04-17 02:30:20 +0000594 // If this is a declaration inside an ODR type, only hash the type and the
595 // name. Otherwise the hash will be stronger than
596 // MDNodeSubsetEqualImpl::isDeclarationOfODRMember().
Duncan P. N. Exon Smitha59d3e52016-04-23 21:08:00 +0000597 if (!IsDefinition && LinkageName)
598 if (auto *CT = dyn_cast_or_null<DICompositeType>(Scope))
599 if (CT->getRawIdentifier())
600 return hash_combine(LinkageName, Scope);
Duncan P. N. Exon Smith05ebfd02016-04-17 02:30:20 +0000601
Mehdi Amini9bc362a2016-03-19 01:06:24 +0000602 // Intentionally computes the hash on a subset of the operands for
603 // performance reason. The subset has to be significant enough to avoid
604 // collision "most of the time". There is no correctness issue in case of
605 // collision because of the full check above.
Mehdi Amini53fc3892016-03-19 00:59:26 +0000606 return hash_combine(Name, Scope, File, Type, Line);
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000607 }
608};
609
Duncan P. N. Exon Smith05ebfd02016-04-17 02:30:20 +0000610template <> struct MDNodeSubsetEqualImpl<DISubprogram> {
611 typedef MDNodeKeyImpl<DISubprogram> KeyTy;
612 static bool isSubsetEqual(const KeyTy &LHS, const DISubprogram *RHS) {
613 return isDeclarationOfODRMember(LHS.IsDefinition, LHS.Scope,
614 LHS.LinkageName, RHS);
615 }
616 static bool isSubsetEqual(const DISubprogram *LHS, const DISubprogram *RHS) {
617 return isDeclarationOfODRMember(LHS->isDefinition(), LHS->getRawScope(),
618 LHS->getRawLinkageName(), RHS);
619 }
620
621 /// Subprograms compare equal if they declare the same function in an ODR
622 /// type.
623 static bool isDeclarationOfODRMember(bool IsDefinition, const Metadata *Scope,
624 const MDString *LinkageName,
625 const DISubprogram *RHS) {
626 // Check whether the LHS is eligible.
Duncan P. N. Exon Smitha59d3e52016-04-23 21:08:00 +0000627 if (IsDefinition || !Scope || !LinkageName)
628 return false;
629
630 auto *CT = dyn_cast_or_null<DICompositeType>(Scope);
631 if (!CT || !CT->getRawIdentifier())
Duncan P. N. Exon Smith05ebfd02016-04-17 02:30:20 +0000632 return false;
633
634 // Compare to the RHS.
635 return IsDefinition == RHS->isDefinition() && Scope == RHS->getRawScope() &&
636 LinkageName == RHS->getRawLinkageName();
637 }
638};
639
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000640template <> struct MDNodeKeyImpl<DILexicalBlock> {
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000641 Metadata *Scope;
642 Metadata *File;
643 unsigned Line;
644 unsigned Column;
645
646 MDNodeKeyImpl(Metadata *Scope, Metadata *File, unsigned Line, unsigned Column)
647 : Scope(Scope), File(File), Line(Line), Column(Column) {}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000648 MDNodeKeyImpl(const DILexicalBlock *N)
Duncan P. N. Exon Smith0e202b92015-03-30 16:37:48 +0000649 : Scope(N->getRawScope()), File(N->getRawFile()), Line(N->getLine()),
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000650 Column(N->getColumn()) {}
651
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000652 bool isKeyOf(const DILexicalBlock *RHS) const {
Duncan P. N. Exon Smith0e202b92015-03-30 16:37:48 +0000653 return Scope == RHS->getRawScope() && File == RHS->getRawFile() &&
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000654 Line == RHS->getLine() && Column == RHS->getColumn();
655 }
656 unsigned getHashValue() const {
657 return hash_combine(Scope, File, Line, Column);
658 }
659};
660
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000661template <> struct MDNodeKeyImpl<DILexicalBlockFile> {
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000662 Metadata *Scope;
663 Metadata *File;
664 unsigned Discriminator;
665
666 MDNodeKeyImpl(Metadata *Scope, Metadata *File, unsigned Discriminator)
667 : Scope(Scope), File(File), Discriminator(Discriminator) {}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000668 MDNodeKeyImpl(const DILexicalBlockFile *N)
Duncan P. N. Exon Smith0e202b92015-03-30 16:37:48 +0000669 : Scope(N->getRawScope()), File(N->getRawFile()),
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000670 Discriminator(N->getDiscriminator()) {}
671
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000672 bool isKeyOf(const DILexicalBlockFile *RHS) const {
Duncan P. N. Exon Smith0e202b92015-03-30 16:37:48 +0000673 return Scope == RHS->getRawScope() && File == RHS->getRawFile() &&
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000674 Discriminator == RHS->getDiscriminator();
675 }
676 unsigned getHashValue() const {
677 return hash_combine(Scope, File, Discriminator);
678 }
679};
680
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000681template <> struct MDNodeKeyImpl<DINamespace> {
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000682 Metadata *Scope;
683 Metadata *File;
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000684 MDString *Name;
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000685 unsigned Line;
Adrian Prantldbfda632016-11-03 19:42:02 +0000686 bool ExportSymbols;
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000687
Adrian Prantldbfda632016-11-03 19:42:02 +0000688 MDNodeKeyImpl(Metadata *Scope, Metadata *File, MDString *Name, unsigned Line,
689 bool ExportSymbols)
690 : Scope(Scope), File(File), Name(Name), Line(Line),
691 ExportSymbols(ExportSymbols) {}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000692 MDNodeKeyImpl(const DINamespace *N)
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000693 : Scope(N->getRawScope()), File(N->getRawFile()), Name(N->getRawName()),
Adrian Prantldbfda632016-11-03 19:42:02 +0000694 Line(N->getLine()), ExportSymbols(N->getExportSymbols()) {}
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000695
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000696 bool isKeyOf(const DINamespace *RHS) const {
Duncan P. N. Exon Smithf9b47752015-03-30 17:21:38 +0000697 return Scope == RHS->getRawScope() && File == RHS->getRawFile() &&
Adrian Prantldbfda632016-11-03 19:42:02 +0000698 Name == RHS->getRawName() && Line == RHS->getLine() &&
699 ExportSymbols == RHS->getExportSymbols();
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000700 }
701 unsigned getHashValue() const {
702 return hash_combine(Scope, File, Name, Line);
703 }
704};
705
Adrian Prantlab1243f2015-06-29 23:03:47 +0000706template <> struct MDNodeKeyImpl<DIModule> {
707 Metadata *Scope;
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000708 MDString *Name;
709 MDString *ConfigurationMacros;
710 MDString *IncludePath;
711 MDString *ISysRoot;
712 MDNodeKeyImpl(Metadata *Scope, MDString *Name, MDString *ConfigurationMacros,
713 MDString *IncludePath, MDString *ISysRoot)
714 : Scope(Scope), Name(Name), ConfigurationMacros(ConfigurationMacros),
715 IncludePath(IncludePath), ISysRoot(ISysRoot) {}
Adrian Prantlab1243f2015-06-29 23:03:47 +0000716 MDNodeKeyImpl(const DIModule *N)
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000717 : Scope(N->getRawScope()), Name(N->getRawName()),
718 ConfigurationMacros(N->getRawConfigurationMacros()),
719 IncludePath(N->getRawIncludePath()), ISysRoot(N->getRawISysRoot()) {}
Adrian Prantlab1243f2015-06-29 23:03:47 +0000720
721 bool isKeyOf(const DIModule *RHS) const {
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000722 return Scope == RHS->getRawScope() && Name == RHS->getRawName() &&
723 ConfigurationMacros == RHS->getRawConfigurationMacros() &&
724 IncludePath == RHS->getRawIncludePath() &&
725 ISysRoot == RHS->getRawISysRoot();
Adrian Prantlab1243f2015-06-29 23:03:47 +0000726 }
727 unsigned getHashValue() const {
728 return hash_combine(Scope, Name,
729 ConfigurationMacros, IncludePath, ISysRoot);
730 }
731};
732
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000733template <> struct MDNodeKeyImpl<DITemplateTypeParameter> {
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000734 MDString *Name;
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000735 Metadata *Type;
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000736
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000737 MDNodeKeyImpl(MDString *Name, Metadata *Type) : Name(Name), Type(Type) {}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000738 MDNodeKeyImpl(const DITemplateTypeParameter *N)
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000739 : Name(N->getRawName()), Type(N->getRawType()) {}
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000740
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000741 bool isKeyOf(const DITemplateTypeParameter *RHS) const {
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000742 return Name == RHS->getRawName() && Type == RHS->getRawType();
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000743 }
Duncan P. N. Exon Smith3d62bba2015-02-19 00:37:21 +0000744 unsigned getHashValue() const { return hash_combine(Name, Type); }
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000745};
746
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000747template <> struct MDNodeKeyImpl<DITemplateValueParameter> {
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000748 unsigned Tag;
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000749 MDString *Name;
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000750 Metadata *Type;
751 Metadata *Value;
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000752
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000753 MDNodeKeyImpl(unsigned Tag, MDString *Name, Metadata *Type, Metadata *Value)
Duncan P. N. Exon Smith3d62bba2015-02-19 00:37:21 +0000754 : Tag(Tag), Name(Name), Type(Type), Value(Value) {}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000755 MDNodeKeyImpl(const DITemplateValueParameter *N)
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000756 : Tag(N->getTag()), Name(N->getRawName()), Type(N->getRawType()),
Duncan P. N. Exon Smith3d62bba2015-02-19 00:37:21 +0000757 Value(N->getValue()) {}
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000758
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000759 bool isKeyOf(const DITemplateValueParameter *RHS) const {
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000760 return Tag == RHS->getTag() && Name == RHS->getRawName() &&
Duncan P. N. Exon Smith3ec5fa62015-04-06 19:03:45 +0000761 Type == RHS->getRawType() && Value == RHS->getValue();
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000762 }
Duncan P. N. Exon Smith3d62bba2015-02-19 00:37:21 +0000763 unsigned getHashValue() const { return hash_combine(Tag, Name, Type, Value); }
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000764};
765
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000766template <> struct MDNodeKeyImpl<DIGlobalVariable> {
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000767 Metadata *Scope;
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000768 MDString *Name;
769 MDString *LinkageName;
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000770 Metadata *File;
771 unsigned Line;
772 Metadata *Type;
773 bool IsLocalToUnit;
774 bool IsDefinition;
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000775 Metadata *StaticDataMemberDeclaration;
Victor Leschuka37660c2016-10-26 21:32:29 +0000776 uint32_t AlignInBits;
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000777
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000778 MDNodeKeyImpl(Metadata *Scope, MDString *Name, MDString *LinkageName,
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000779 Metadata *File, unsigned Line, Metadata *Type,
Victor Leschuk2ede1262016-10-20 00:13:12 +0000780 bool IsLocalToUnit, bool IsDefinition,
Adrian Prantlbceaaa92016-12-20 02:09:43 +0000781 Metadata *StaticDataMemberDeclaration, uint32_t AlignInBits)
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000782 : Scope(Scope), Name(Name), LinkageName(LinkageName), File(File),
783 Line(Line), Type(Type), IsLocalToUnit(IsLocalToUnit),
Adrian Prantlbceaaa92016-12-20 02:09:43 +0000784 IsDefinition(IsDefinition),
Victor Leschuk2ede1262016-10-20 00:13:12 +0000785 StaticDataMemberDeclaration(StaticDataMemberDeclaration),
786 AlignInBits(AlignInBits) {}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000787 MDNodeKeyImpl(const DIGlobalVariable *N)
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000788 : Scope(N->getRawScope()), Name(N->getRawName()),
789 LinkageName(N->getRawLinkageName()), File(N->getRawFile()),
Duncan P. N. Exon Smith3d2afaa2015-03-27 17:29:58 +0000790 Line(N->getLine()), Type(N->getRawType()),
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000791 IsLocalToUnit(N->isLocalToUnit()), IsDefinition(N->isDefinition()),
Victor Leschuk2ede1262016-10-20 00:13:12 +0000792 StaticDataMemberDeclaration(N->getRawStaticDataMemberDeclaration()),
793 AlignInBits(N->getAlignInBits()) {}
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000794
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000795 bool isKeyOf(const DIGlobalVariable *RHS) const {
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000796 return Scope == RHS->getRawScope() && Name == RHS->getRawName() &&
797 LinkageName == RHS->getRawLinkageName() &&
798 File == RHS->getRawFile() && Line == RHS->getLine() &&
799 Type == RHS->getRawType() && IsLocalToUnit == RHS->isLocalToUnit() &&
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000800 IsDefinition == RHS->isDefinition() &&
Duncan P. N. Exon Smith3d2afaa2015-03-27 17:29:58 +0000801 StaticDataMemberDeclaration ==
Victor Leschuk2ede1262016-10-20 00:13:12 +0000802 RHS->getRawStaticDataMemberDeclaration() &&
803 AlignInBits == RHS->getAlignInBits();
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000804 }
805 unsigned getHashValue() const {
Victor Leschuk2ede1262016-10-20 00:13:12 +0000806 // We do not use AlignInBits in hashing function here on purpose:
807 // in most cases this param for local variable is zero (for function param
808 // it is always zero). This leads to lots of hash collisions and errors on
809 // cases with lots of similar variables.
810 // clang/test/CodeGen/debug-info-257-args.c is an example of this problem,
811 // generated IR is random for each run and test fails with Align included.
812 // TODO: make hashing work fine with such situations
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000813 return hash_combine(Scope, Name, LinkageName, File, Line, Type,
Adrian Prantlbceaaa92016-12-20 02:09:43 +0000814 IsLocalToUnit, IsDefinition, /* AlignInBits, */
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000815 StaticDataMemberDeclaration);
816 }
817};
818
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000819template <> struct MDNodeKeyImpl<DILocalVariable> {
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000820 Metadata *Scope;
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000821 MDString *Name;
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000822 Metadata *File;
823 unsigned Line;
824 Metadata *Type;
825 unsigned Arg;
826 unsigned Flags;
Victor Leschuka37660c2016-10-26 21:32:29 +0000827 uint32_t AlignInBits;
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000828
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000829 MDNodeKeyImpl(Metadata *Scope, MDString *Name, Metadata *File, unsigned Line,
Victor Leschuk2ede1262016-10-20 00:13:12 +0000830 Metadata *Type, unsigned Arg, unsigned Flags,
Victor Leschuka37660c2016-10-26 21:32:29 +0000831 uint32_t AlignInBits)
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +0000832 : Scope(Scope), Name(Name), File(File), Line(Line), Type(Type), Arg(Arg),
Victor Leschuk2ede1262016-10-20 00:13:12 +0000833 Flags(Flags), AlignInBits(AlignInBits) {}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000834 MDNodeKeyImpl(const DILocalVariable *N)
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000835 : Scope(N->getRawScope()), Name(N->getRawName()), File(N->getRawFile()),
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +0000836 Line(N->getLine()), Type(N->getRawType()), Arg(N->getArg()),
Victor Leschuk2ede1262016-10-20 00:13:12 +0000837 Flags(N->getFlags()), AlignInBits(N->getAlignInBits()) {}
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000838
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000839 bool isKeyOf(const DILocalVariable *RHS) const {
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000840 return Scope == RHS->getRawScope() && Name == RHS->getRawName() &&
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +0000841 File == RHS->getRawFile() && Line == RHS->getLine() &&
842 Type == RHS->getRawType() && Arg == RHS->getArg() &&
Victor Leschuk2ede1262016-10-20 00:13:12 +0000843 Flags == RHS->getFlags() && AlignInBits == RHS->getAlignInBits();
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000844 }
845 unsigned getHashValue() const {
Victor Leschuk2ede1262016-10-20 00:13:12 +0000846 // We do not use AlignInBits in hashing function here on purpose:
847 // in most cases this param for local variable is zero (for function param
848 // it is always zero). This leads to lots of hash collisions and errors on
849 // cases with lots of similar variables.
850 // clang/test/CodeGen/debug-info-257-args.c is an example of this problem,
851 // generated IR is random for each run and test fails with Align included.
852 // TODO: make hashing work fine with such situations
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +0000853 return hash_combine(Scope, Name, File, Line, Type, Arg, Flags);
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000854 }
855};
856
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000857template <> struct MDNodeKeyImpl<DIExpression> {
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000858 ArrayRef<uint64_t> Elements;
859
860 MDNodeKeyImpl(ArrayRef<uint64_t> Elements) : Elements(Elements) {}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000861 MDNodeKeyImpl(const DIExpression *N) : Elements(N->getElements()) {}
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000862
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000863 bool isKeyOf(const DIExpression *RHS) const {
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000864 return Elements == RHS->getElements();
865 }
866 unsigned getHashValue() const {
867 return hash_combine_range(Elements.begin(), Elements.end());
868 }
869};
870
Adrian Prantlbceaaa92016-12-20 02:09:43 +0000871template <> struct MDNodeKeyImpl<DIGlobalVariableExpression> {
872 Metadata *Variable;
873 Metadata *Expression;
874
875 MDNodeKeyImpl(Metadata *Variable, Metadata *Expression)
876 : Variable(Variable), Expression(Expression) {}
877 MDNodeKeyImpl(const DIGlobalVariableExpression *N)
878 : Variable(N->getRawVariable()), Expression(N->getRawExpression()) {}
879
880 bool isKeyOf(const DIGlobalVariableExpression *RHS) const {
881 return Variable == RHS->getRawVariable() &&
882 Expression == RHS->getRawExpression();
883 }
884 unsigned getHashValue() const { return hash_combine(Variable, Expression); }
885};
886
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000887template <> struct MDNodeKeyImpl<DIObjCProperty> {
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000888 MDString *Name;
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000889 Metadata *File;
890 unsigned Line;
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000891 MDString *GetterName;
892 MDString *SetterName;
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000893 unsigned Attributes;
894 Metadata *Type;
895
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000896 MDNodeKeyImpl(MDString *Name, Metadata *File, unsigned Line,
897 MDString *GetterName, MDString *SetterName, unsigned Attributes,
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000898 Metadata *Type)
899 : Name(Name), File(File), Line(Line), GetterName(GetterName),
900 SetterName(SetterName), Attributes(Attributes), Type(Type) {}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000901 MDNodeKeyImpl(const DIObjCProperty *N)
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000902 : Name(N->getRawName()), File(N->getRawFile()), Line(N->getLine()),
903 GetterName(N->getRawGetterName()), SetterName(N->getRawSetterName()),
Duncan P. N. Exon Smithf9b47752015-03-30 17:21:38 +0000904 Attributes(N->getAttributes()), Type(N->getRawType()) {}
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000905
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000906 bool isKeyOf(const DIObjCProperty *RHS) const {
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000907 return Name == RHS->getRawName() && File == RHS->getRawFile() &&
908 Line == RHS->getLine() && GetterName == RHS->getRawGetterName() &&
909 SetterName == RHS->getRawSetterName() &&
Duncan P. N. Exon Smithf9b47752015-03-30 17:21:38 +0000910 Attributes == RHS->getAttributes() && Type == RHS->getRawType();
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000911 }
912 unsigned getHashValue() const {
913 return hash_combine(Name, File, Line, GetterName, SetterName, Attributes,
914 Type);
915 }
916};
917
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000918template <> struct MDNodeKeyImpl<DIImportedEntity> {
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000919 unsigned Tag;
920 Metadata *Scope;
921 Metadata *Entity;
922 unsigned Line;
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000923 MDString *Name;
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000924
925 MDNodeKeyImpl(unsigned Tag, Metadata *Scope, Metadata *Entity, unsigned Line,
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000926 MDString *Name)
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000927 : Tag(Tag), Scope(Scope), Entity(Entity), Line(Line), Name(Name) {}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000928 MDNodeKeyImpl(const DIImportedEntity *N)
Duncan P. N. Exon Smithf9b47752015-03-30 17:21:38 +0000929 : Tag(N->getTag()), Scope(N->getRawScope()), Entity(N->getRawEntity()),
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000930 Line(N->getLine()), Name(N->getRawName()) {}
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000931
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000932 bool isKeyOf(const DIImportedEntity *RHS) const {
Duncan P. N. Exon Smithf9b47752015-03-30 17:21:38 +0000933 return Tag == RHS->getTag() && Scope == RHS->getRawScope() &&
934 Entity == RHS->getRawEntity() && Line == RHS->getLine() &&
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000935 Name == RHS->getRawName();
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000936 }
937 unsigned getHashValue() const {
938 return hash_combine(Tag, Scope, Entity, Line, Name);
939 }
940};
941
Amjad Abouda9bcf162015-12-10 12:56:35 +0000942template <> struct MDNodeKeyImpl<DIMacro> {
943 unsigned MIType;
944 unsigned Line;
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000945 MDString *Name;
946 MDString *Value;
Amjad Abouda9bcf162015-12-10 12:56:35 +0000947
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000948 MDNodeKeyImpl(unsigned MIType, unsigned Line, MDString *Name, MDString *Value)
Amjad Abouda9bcf162015-12-10 12:56:35 +0000949 : MIType(MIType), Line(Line), Name(Name), Value(Value) {}
950 MDNodeKeyImpl(const DIMacro *N)
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000951 : MIType(N->getMacinfoType()), Line(N->getLine()), Name(N->getRawName()),
952 Value(N->getRawValue()) {}
Amjad Abouda9bcf162015-12-10 12:56:35 +0000953
954 bool isKeyOf(const DIMacro *RHS) const {
955 return MIType == RHS->getMacinfoType() && Line == RHS->getLine() &&
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000956 Name == RHS->getRawName() && Value == RHS->getRawValue();
Amjad Abouda9bcf162015-12-10 12:56:35 +0000957 }
958 unsigned getHashValue() const {
959 return hash_combine(MIType, Line, Name, Value);
960 }
961};
962
963template <> struct MDNodeKeyImpl<DIMacroFile> {
964 unsigned MIType;
965 unsigned Line;
966 Metadata *File;
967 Metadata *Elements;
968
969 MDNodeKeyImpl(unsigned MIType, unsigned Line, Metadata *File,
970 Metadata *Elements)
971 : MIType(MIType), Line(Line), File(File), Elements(Elements) {}
972 MDNodeKeyImpl(const DIMacroFile *N)
973 : MIType(N->getMacinfoType()), Line(N->getLine()), File(N->getRawFile()),
974 Elements(N->getRawElements()) {}
975
976 bool isKeyOf(const DIMacroFile *RHS) const {
977 return MIType == RHS->getMacinfoType() && Line == RHS->getLine() &&
Amjad Aboud580498d2016-07-31 14:41:50 +0000978 File == RHS->getRawFile() && Elements == RHS->getRawElements();
Amjad Abouda9bcf162015-12-10 12:56:35 +0000979 }
980 unsigned getHashValue() const {
981 return hash_combine(MIType, Line, File, Elements);
982 }
983};
984
Duncan P. N. Exon Smith8af6cfc2015-02-04 22:08:30 +0000985/// \brief DenseMapInfo for MDNode subclasses.
986template <class NodeTy> struct MDNodeInfo {
987 typedef MDNodeKeyImpl<NodeTy> KeyTy;
Duncan P. N. Exon Smithf2291272016-04-16 23:42:04 +0000988 typedef MDNodeSubsetEqualImpl<NodeTy> SubsetEqualTy;
Duncan P. N. Exon Smith8af6cfc2015-02-04 22:08:30 +0000989 static inline NodeTy *getEmptyKey() {
990 return DenseMapInfo<NodeTy *>::getEmptyKey();
Duncan P. N. Exon Smithfed199a2015-01-20 00:01:43 +0000991 }
Duncan P. N. Exon Smith8af6cfc2015-02-04 22:08:30 +0000992 static inline NodeTy *getTombstoneKey() {
993 return DenseMapInfo<NodeTy *>::getTombstoneKey();
Duncan P. N. Exon Smithfed199a2015-01-20 00:01:43 +0000994 }
Duncan P. N. Exon Smith8af6cfc2015-02-04 22:08:30 +0000995 static unsigned getHashValue(const KeyTy &Key) { return Key.getHashValue(); }
996 static unsigned getHashValue(const NodeTy *N) {
997 return KeyTy(N).getHashValue();
Duncan P. N. Exon Smithfed199a2015-01-20 00:01:43 +0000998 }
Duncan P. N. Exon Smith8af6cfc2015-02-04 22:08:30 +0000999 static bool isEqual(const KeyTy &LHS, const NodeTy *RHS) {
1000 if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1001 return false;
Duncan P. N. Exon Smithf2291272016-04-16 23:42:04 +00001002 return SubsetEqualTy::isSubsetEqual(LHS, RHS) || LHS.isKeyOf(RHS);
Duncan P. N. Exon Smithfed199a2015-01-20 00:01:43 +00001003 }
Duncan P. N. Exon Smith8af6cfc2015-02-04 22:08:30 +00001004 static bool isEqual(const NodeTy *LHS, const NodeTy *RHS) {
Duncan P. N. Exon Smithf2291272016-04-16 23:42:04 +00001005 if (LHS == RHS)
1006 return true;
1007 if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1008 return false;
1009 return SubsetEqualTy::isSubsetEqual(LHS, RHS);
Duncan P. N. Exon Smithfed199a2015-01-20 00:01:43 +00001010 }
1011};
1012
Duncan P. N. Exon Smith8af6cfc2015-02-04 22:08:30 +00001013#define HANDLE_MDNODE_LEAF(CLASS) typedef MDNodeInfo<CLASS> CLASS##Info;
1014#include "llvm/IR/Metadata.def"
1015
Duncan P. N. Exon Smithcbc28dc2015-04-24 20:36:25 +00001016/// \brief Map-like storage for metadata attachments.
1017class MDAttachmentMap {
1018 SmallVector<std::pair<unsigned, TrackingMDNodeRef>, 2> Attachments;
1019
1020public:
1021 bool empty() const { return Attachments.empty(); }
1022 size_t size() const { return Attachments.size(); }
1023
1024 /// \brief Get a particular attachment (if any).
1025 MDNode *lookup(unsigned ID) const;
1026
1027 /// \brief Set an attachment to a particular node.
1028 ///
1029 /// Set the \c ID attachment to \c MD, replacing the current attachment at \c
1030 /// ID (if anyway).
1031 void set(unsigned ID, MDNode &MD);
1032
1033 /// \brief Remove an attachment.
1034 ///
1035 /// Remove the attachment at \c ID, if any.
1036 void erase(unsigned ID);
1037
1038 /// \brief Copy out all the attachments.
1039 ///
1040 /// Copies all the current attachments into \c Result, sorting by attachment
1041 /// ID. This function does \em not clear \c Result.
1042 void getAll(SmallVectorImpl<std::pair<unsigned, MDNode *>> &Result) const;
1043
1044 /// \brief Erase matching attachments.
1045 ///
1046 /// Erases all attachments matching the \c shouldRemove predicate.
1047 template <class PredTy> void remove_if(PredTy shouldRemove) {
David Majnemer2d006e72016-08-12 04:32:42 +00001048 Attachments.erase(llvm::remove_if(Attachments, shouldRemove),
1049 Attachments.end());
Duncan P. N. Exon Smithcbc28dc2015-04-24 20:36:25 +00001050 }
1051};
1052
Peter Collingbourne382d81c2016-06-01 01:17:57 +00001053/// Multimap-like storage for metadata attachments for globals. This differs
1054/// from MDAttachmentMap in that it allows multiple attachments per metadata
1055/// kind.
1056class MDGlobalAttachmentMap {
1057 struct Attachment {
1058 unsigned MDKind;
1059 TrackingMDNodeRef Node;
1060 };
1061 SmallVector<Attachment, 1> Attachments;
1062
1063public:
1064 bool empty() const { return Attachments.empty(); }
1065
1066 /// Appends all attachments with the given ID to \c Result in insertion order.
1067 /// If the global has no attachments with the given ID, or if ID is invalid,
1068 /// leaves Result unchanged.
1069 void get(unsigned ID, SmallVectorImpl<MDNode *> &Result);
1070
1071 void insert(unsigned ID, MDNode &MD);
1072 void erase(unsigned ID);
1073
1074 /// Appends all attachments for the global to \c Result, sorting by attachment
1075 /// ID. Attachments with the same ID appear in insertion order. This function
1076 /// does \em not clear \c Result.
1077 void getAll(SmallVectorImpl<std::pair<unsigned, MDNode *>> &Result) const;
1078};
1079
Benjamin Kramer079b96e2013-09-11 18:05:11 +00001080class LLVMContextImpl {
Benjamin Kramer78c3bcb2009-08-11 17:45:13 +00001081public:
Owen Anderson8e89e412010-09-08 18:03:32 +00001082 /// OwnedModules - The set of modules instantiated in this context, and which
1083 /// will be automatically deleted if this context is deleted.
1084 SmallPtrSet<Module*, 4> OwnedModules;
1085
Bob Wilsona594fab2013-02-11 05:37:07 +00001086 LLVMContext::InlineAsmDiagHandlerTy InlineAsmDiagHandler;
1087 void *InlineAsmDiagContext;
Quentin Colombetb4c44d22013-12-17 17:47:22 +00001088
1089 LLVMContext::DiagnosticHandlerTy DiagnosticHandler;
1090 void *DiagnosticContext;
Duncan P. N. Exon Smith30c92422014-10-01 18:36:03 +00001091 bool RespectDiagnosticFilters;
Adam Nemetaad81602016-07-15 17:23:20 +00001092 bool DiagnosticHotnessRequested;
Adam Nemeta62b7e12016-09-27 20:55:07 +00001093 std::unique_ptr<yaml::Output> DiagnosticsOutputFile;
Quentin Colombetb4c44d22013-12-17 17:47:22 +00001094
Juergen Ributzka34390c72014-05-16 02:33:15 +00001095 LLVMContext::YieldCallbackTy YieldCallback;
1096 void *YieldOpaqueHandle;
1097
Justin Lebar611c5c22016-10-10 16:26:13 +00001098 typedef DenseMap<APInt, std::unique_ptr<ConstantInt>, DenseMapAPIntKeyInfo>
1099 IntMapTy;
Owen Anderson20b34ac2009-07-16 18:04:31 +00001100 IntMapTy IntConstants;
NAKAMURA Takumifc3062f2014-12-06 05:57:06 +00001101
Justin Lebar611c5c22016-10-10 16:26:13 +00001102 typedef DenseMap<APFloat, std::unique_ptr<ConstantFP>, DenseMapAPFloatKeyInfo>
1103 FPMapTy;
Owen Andersonc277dc42009-07-16 19:05:41 +00001104 FPMapTy FPConstants;
Bill Wendlinge38b8042012-09-26 21:07:29 +00001105
Bill Wendling4607f4b2012-12-20 01:36:59 +00001106 FoldingSet<AttributeImpl> AttrsSet;
Bill Wendling6848e382012-12-19 22:42:22 +00001107 FoldingSet<AttributeSetImpl> AttrsLists;
Bill Wendlingd2e493b2013-01-24 00:06:56 +00001108 FoldingSet<AttributeSetNode> AttrsSetNodes;
Bill Wendlingf86efb92012-11-20 05:09:20 +00001109
Duncan P. N. Exon Smith3e0430e2016-04-06 06:41:54 +00001110 StringMap<MDString, BumpPtrAllocator> MDStringCache;
Duncan P. N. Exon Smith5bf8fef2014-12-09 18:38:53 +00001111 DenseMap<Value *, ValueAsMetadata *> ValuesAsMetadata;
1112 DenseMap<Metadata *, MetadataAsValue *> MetadataAsValues;
Bill Wendlinge38b8042012-09-26 21:07:29 +00001113
Owen Anderson7349ab92015-06-01 22:24:01 +00001114 DenseMap<const Value*, ValueName*> ValueNames;
1115
Duncan P. N. Exon Smith55ca9642015-08-03 17:26:41 +00001116#define HANDLE_MDNODE_LEAF_UNIQUABLE(CLASS) \
1117 DenseSet<CLASS *, CLASS##Info> CLASS##s;
Duncan P. N. Exon Smith104e4022015-02-04 21:46:12 +00001118#include "llvm/IR/Metadata.def"
Bill Wendlinge38b8042012-09-26 21:07:29 +00001119
Duncan P. N. Exon Smith5ab2be02016-04-17 03:58:21 +00001120 // Optional map for looking up composite types by identifier.
Duncan P. N. Exon Smithe8b555c2016-04-19 16:06:50 +00001121 Optional<DenseMap<const MDString *, DICompositeType *>> DITypeMap;
Duncan P. N. Exon Smith5ab2be02016-04-17 03:58:21 +00001122
Jeffrey Yasskin2cc24762010-03-13 01:26:15 +00001123 // MDNodes may be uniqued or not uniqued. When they're not uniqued, they
1124 // aren't in the MDNodeSet, but they're still shared between objects, so no
Duncan P. N. Exon Smith3eef9d12016-04-19 23:59:13 +00001125 // one object can destroy them. Keep track of them here so we can delete
1126 // them on context teardown.
1127 std::vector<MDNode *> DistinctMDNodes;
Duncan P. N. Exon Smith50846f82014-11-18 00:37:17 +00001128
Justin Lebar611c5c22016-10-10 16:26:13 +00001129 DenseMap<Type *, std::unique_ptr<ConstantAggregateZero>> CAZConstants;
Owen Anderson13234f82009-08-10 18:16:08 +00001130
Duncan P. N. Exon Smith317c1392014-08-19 16:39:58 +00001131 typedef ConstantUniqueMap<ConstantArray> ArrayConstantsTy;
Owen Andersonedb4a702009-07-24 23:12:02 +00001132 ArrayConstantsTy ArrayConstants;
Owen Anderson39ede7b2009-07-21 20:13:12 +00001133
Duncan P. N. Exon Smith317c1392014-08-19 16:39:58 +00001134 typedef ConstantUniqueMap<ConstantStruct> StructConstantsTy;
Owen Andersonedb4a702009-07-24 23:12:02 +00001135 StructConstantsTy StructConstants;
Owen Anderson909f6002009-07-23 23:25:33 +00001136
Duncan P. N. Exon Smith317c1392014-08-19 16:39:58 +00001137 typedef ConstantUniqueMap<ConstantVector> VectorConstantsTy;
Owen Andersonedb4a702009-07-24 23:12:02 +00001138 VectorConstantsTy VectorConstants;
Chris Lattnerc7f9fd42012-01-23 15:20:12 +00001139
Justin Lebar611c5c22016-10-10 16:26:13 +00001140 DenseMap<PointerType *, std::unique_ptr<ConstantPointerNull>> CPNConstants;
1141
1142 DenseMap<Type *, std::unique_ptr<UndefValue>> UVConstants;
1143
Chris Lattner3756b912012-01-23 22:57:10 +00001144 StringMap<ConstantDataSequential*> CDSConstants;
1145
Chandler Carruth6a936922014-01-19 02:13:50 +00001146 DenseMap<std::pair<const Function *, const BasicBlock *>, BlockAddress *>
1147 BlockAddresses;
Duncan P. N. Exon Smith317c1392014-08-19 16:39:58 +00001148 ConstantUniqueMap<ConstantExpr> ExprConstants;
Jeffrey Yasskinade270e2010-03-21 20:37:19 +00001149
Duncan P. N. Exon Smith317c1392014-08-19 16:39:58 +00001150 ConstantUniqueMap<InlineAsm> InlineAsms;
1151
Owen Anderson2ad52172009-07-21 02:47:59 +00001152 ConstantInt *TheTrueVal;
1153 ConstantInt *TheFalseVal;
Duncan P. N. Exon Smith5bf8fef2014-12-09 18:38:53 +00001154
David Majnemer2dd41c52015-11-16 20:55:57 +00001155 std::unique_ptr<ConstantTokenNone> TheNoneToken;
David Majnemerf0f224d2015-11-11 21:57:16 +00001156
Dan Gohman97d2cb82009-08-25 16:00:35 +00001157 // Basic type instances.
David Majnemerb611e3f2015-08-14 05:09:07 +00001158 Type VoidTy, LabelTy, HalfTy, FloatTy, DoubleTy, MetadataTy, TokenTy;
Chris Lattnerb1ed91f2011-07-09 17:41:24 +00001159 Type X86_FP80Ty, FP128Ty, PPC_FP128Ty, X86_MMXTy;
Kit Barton72918022015-04-17 15:32:15 +00001160 IntegerType Int1Ty, Int8Ty, Int16Ty, Int32Ty, Int64Ty, Int128Ty;
Dan Gohman97d2cb82009-08-25 16:00:35 +00001161
Chris Lattner07bd69c2011-07-15 05:49:15 +00001162
1163 /// TypeAllocator - All dynamically allocated types are allocated from this.
1164 /// They live forever until the context is torn down.
1165 BumpPtrAllocator TypeAllocator;
1166
Chris Lattnerb1ed91f2011-07-09 17:41:24 +00001167 DenseMap<unsigned, IntegerType*> IntegerTypes;
Benjamin Kramer3280a5d2014-12-06 19:22:54 +00001168
1169 typedef DenseSet<FunctionType *, FunctionTypeKeyInfo> FunctionTypeSet;
1170 FunctionTypeSet FunctionTypes;
1171 typedef DenseSet<StructType *, AnonStructTypeKeyInfo> StructTypeSet;
1172 StructTypeSet AnonStructTypes;
Chris Lattnerb1ed91f2011-07-09 17:41:24 +00001173 StringMap<StructType*> NamedStructTypes;
1174 unsigned NamedStructTypesUniqueID;
1175
1176 DenseMap<std::pair<Type *, uint64_t>, ArrayType*> ArrayTypes;
1177 DenseMap<std::pair<Type *, unsigned>, VectorType*> VectorTypes;
1178 DenseMap<Type*, PointerType*> PointerTypes; // Pointers in AddrSpace = 0
1179 DenseMap<std::pair<Type*, unsigned>, PointerType*> ASPointerTypes;
Jeffrey Yasskinc660b232010-02-11 06:41:30 +00001180
Jeffrey Yasskin28f24482009-12-17 19:55:06 +00001181
Owen Andersone8f21852009-08-18 18:28:58 +00001182 /// ValueHandles - This map keeps track of all of the value handles that are
1183 /// watching a Value*. The Value::HasValueHandle bit is used to know
Michael Ilseman516d7032013-03-01 18:48:54 +00001184 /// whether or not a value has an entry in this map.
Owen Andersone8f21852009-08-18 18:28:58 +00001185 typedef DenseMap<Value*, ValueHandleBase*> ValueHandlesTy;
1186 ValueHandlesTy ValueHandles;
1187
Chris Lattnera0566972009-12-29 09:01:33 +00001188 /// CustomMDKindNames - Map to hold the metadata string to ID mapping.
1189 StringMap<unsigned> CustomMDKindNames;
Duncan P. N. Exon Smith5bf8fef2014-12-09 18:38:53 +00001190
Duncan P. N. Exon Smith391fc562015-04-24 20:16:42 +00001191 /// Collection of per-instruction metadata used in this context.
Duncan P. N. Exon Smithcbc28dc2015-04-24 20:36:25 +00001192 DenseMap<const Instruction *, MDAttachmentMap> InstructionMetadata;
Duncan P. N. Exon Smith391fc562015-04-24 20:16:42 +00001193
Peter Collingbournecceae7f2016-05-31 23:01:54 +00001194 /// Collection of per-GlobalObject metadata used in this context.
Peter Collingbourne382d81c2016-06-01 01:17:57 +00001195 DenseMap<const GlobalObject *, MDGlobalAttachmentMap> GlobalObjectMetadata;
Duncan P. N. Exon Smithe2510cd2015-04-24 21:51:02 +00001196
Diego Novillof5041ce2014-03-03 20:06:11 +00001197 /// DiscriminatorTable - This table maps file:line locations to an
1198 /// integer representing the next DWARF path discriminator to assign to
1199 /// instructions in different blocks at the same location.
1200 DenseMap<std::pair<const char *, unsigned>, unsigned> DiscriminatorTable;
1201
Chris Lattner8cb2aeb2010-04-01 00:37:44 +00001202 int getOrAddScopeRecordIdxEntry(MDNode *N, int ExistingIdx);
1203 int getOrAddScopeInlinedAtIdxEntry(MDNode *Scope, MDNode *IA,int ExistingIdx);
Philip Reames2b453952015-01-16 20:07:33 +00001204
Sanjoy Das9303c242015-09-24 19:14:18 +00001205 /// \brief A set of interned tags for operand bundles. The StringMap maps
1206 /// bundle tags to their IDs.
1207 ///
1208 /// \see LLVMContext::getOperandBundleTagID
1209 StringMap<uint32_t> BundleTagCache;
1210
1211 StringMapEntry<uint32_t> *getOrInsertBundleTag(StringRef Tag);
1212 void getOperandBundleTags(SmallVectorImpl<StringRef> &Tags) const;
1213 uint32_t getOperandBundleTagID(StringRef Tag) const;
1214
Mehdi Amini599ebf22016-01-08 02:28:20 +00001215 /// Maintain the GC name for each function.
1216 ///
1217 /// This saves allocating an additional word in Function for programs which
1218 /// do not use GC (i.e., most programs) at the cost of increased overhead for
1219 /// clients which do use GC.
1220 DenseMap<const Function*, std::string> GCNames;
1221
Mehdi Amini09b4a8d2016-03-10 01:28:54 +00001222 /// Flag to indicate if Value (other than GlobalValue) retains their name or
1223 /// not.
1224 bool DiscardValueNames = false;
1225
Jeffrey Yasskin4cfb3a72010-03-21 21:17:34 +00001226 LLVMContextImpl(LLVMContext &C);
1227 ~LLVMContextImpl();
Manman Rendab999d2015-01-20 19:24:59 +00001228
1229 /// Destroy the ConstantArrays if they are not used.
1230 void dropTriviallyDeadConstantArrays();
Andrew Kayloraa641a52016-04-22 22:06:11 +00001231
1232 /// \brief Access the object which manages optimization bisection for failure
1233 /// analysis.
1234 OptBisect &getOptBisect();
Owen Anderson8e66e0b2009-06-30 00:48:55 +00001235};
1236
Alexander Kornienkof00654e2015-06-23 09:49:53 +00001237}
Owen Anderson8e66e0b2009-06-30 00:48:55 +00001238
Owen Anderson36f62e52009-06-30 17:06:46 +00001239#endif