blob: 45d61a15a6b6c93d3001a2661aa6f7dc306b6dd0 [file] [log] [blame]
Devang Patela4f43fb2009-07-28 21:49:47 +00001//===-- Metadata.cpp - Implement Metadata classes -------------------------===//
2//
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//===----------------------------------------------------------------------===//
9//
10// This file implements the Metadata classes.
11//
12//===----------------------------------------------------------------------===//
13
Chandler Carruth9fb823b2013-01-02 11:36:10 +000014#include "llvm/IR/Metadata.h"
Chris Lattner1300f452009-12-28 08:24:16 +000015#include "LLVMContextImpl.h"
Chandler Carruthed0881b2012-12-03 16:50:05 +000016#include "SymbolTableListTraitsImpl.h"
17#include "llvm/ADT/DenseMap.h"
18#include "llvm/ADT/STLExtras.h"
Rafael Espindolaab73c492014-01-28 16:56:46 +000019#include "llvm/ADT/SmallSet.h"
Chandler Carruthed0881b2012-12-03 16:50:05 +000020#include "llvm/ADT/SmallString.h"
21#include "llvm/ADT/StringMap.h"
Chandler Carruth8cd041e2014-03-04 12:24:34 +000022#include "llvm/IR/ConstantRange.h"
Chandler Carruth9fb823b2013-01-02 11:36:10 +000023#include "llvm/IR/Instruction.h"
24#include "llvm/IR/LLVMContext.h"
Chandler Carruth4b6845c2014-03-04 12:46:06 +000025#include "llvm/IR/LeakDetector.h"
Chandler Carruth9fb823b2013-01-02 11:36:10 +000026#include "llvm/IR/Module.h"
Chandler Carruth4220e9c2014-03-04 11:17:44 +000027#include "llvm/IR/ValueHandle.h"
Duncan P. N. Exon Smith46d91ad2014-11-14 18:42:06 +000028
Devang Patela4f43fb2009-07-28 21:49:47 +000029using namespace llvm;
30
Duncan P. N. Exon Smitha69934f2014-11-14 18:42:09 +000031Metadata::Metadata(LLVMContext &Context, unsigned ID)
32 : Value(Type::getMetadataTy(Context), ID) {}
33
Devang Patela4f43fb2009-07-28 21:49:47 +000034//===----------------------------------------------------------------------===//
Chris Lattnerb0c23e82009-10-19 07:10:59 +000035// MDString implementation.
Owen Anderson0087fe62009-07-31 21:35:40 +000036//
Chris Lattner5a409bd2009-12-28 08:30:43 +000037
David Blaikiea379b1812011-12-20 02:50:00 +000038void MDString::anchor() { }
39
Devang Pateldcb99d32009-10-22 00:10:15 +000040MDString *MDString::get(LLVMContext &Context, StringRef Str) {
Duncan P. N. Exon Smithf17e7402014-11-14 01:17:09 +000041 auto &Store = Context.pImpl->MDStringCache;
42 auto I = Store.find(Str);
43 if (I != Store.end())
44 return &I->second;
45
46 auto *Entry =
47 StringMapEntry<MDString>::Create(Str, Store.getAllocator(), Context);
48 bool WasInserted = Store.insert(Entry);
49 (void)WasInserted;
50 assert(WasInserted && "Expected entry to be inserted");
Duncan P. N. Exon Smithc1a664f2014-12-05 01:41:34 +000051 Entry->second.Entry = Entry;
Duncan P. N. Exon Smithf17e7402014-11-14 01:17:09 +000052 return &Entry->second;
53}
54
55StringRef MDString::getString() const {
Duncan P. N. Exon Smithc1a664f2014-12-05 01:41:34 +000056 assert(Entry && "Expected to find string map entry");
57 return Entry->first();
Owen Anderson0087fe62009-07-31 21:35:40 +000058}
59
60//===----------------------------------------------------------------------===//
Chris Lattner9b493022009-12-31 01:22:29 +000061// MDNodeOperand implementation.
Chris Lattner74a6ad62009-12-28 07:41:54 +000062//
63
Chris Lattner9b493022009-12-31 01:22:29 +000064// Use CallbackVH to hold MDNode operands.
Chris Lattner74a6ad62009-12-28 07:41:54 +000065namespace llvm {
Chris Lattner9b493022009-12-31 01:22:29 +000066class MDNodeOperand : public CallbackVH {
Bill Wendling5c0068f2012-04-08 10:20:49 +000067 MDNode *getParent() {
68 MDNodeOperand *Cur = this;
69
70 while (Cur->getValPtrInt() != 1)
Duncan P. N. Exon Smithc23610b2014-11-18 01:56:14 +000071 ++Cur;
Bill Wendling5c0068f2012-04-08 10:20:49 +000072
73 assert(Cur->getValPtrInt() == 1 &&
Duncan P. N. Exon Smithc23610b2014-11-18 01:56:14 +000074 "Couldn't find the end of the operand list!");
75 return reinterpret_cast<MDNode *>(Cur + 1);
Bill Wendling5c0068f2012-04-08 10:20:49 +000076 }
77
Chris Lattner74a6ad62009-12-28 07:41:54 +000078public:
Duncan P. N. Exon Smithc23610b2014-11-18 01:56:14 +000079 MDNodeOperand() {}
Juergen Ributzkad12ccbd2013-11-19 00:57:56 +000080 virtual ~MDNodeOperand();
Mikhail Glushenkoved3bd132010-01-10 18:48:49 +000081
Bill Wendling0156f442012-04-26 00:38:42 +000082 void set(Value *V) {
Duncan P. N. Exon Smithc23610b2014-11-18 01:56:14 +000083 unsigned IsLast = this->getValPtrInt();
Bill Wendling0156f442012-04-26 00:38:42 +000084 this->setValPtr(V);
Duncan P. N. Exon Smithc23610b2014-11-18 01:56:14 +000085 this->setAsLastOperand(IsLast);
Bill Wendling0156f442012-04-26 00:38:42 +000086 }
Bill Wendling5c0068f2012-04-08 10:20:49 +000087
Duncan P. N. Exon Smithfcece4d2014-10-15 20:28:31 +000088 /// \brief Accessor method to mark the operand as the first in the list.
Duncan P. N. Exon Smithc23610b2014-11-18 01:56:14 +000089 void setAsLastOperand(unsigned I) { this->setValPtrInt(I); }
Mikhail Glushenkoved3bd132010-01-10 18:48:49 +000090
Craig Topperf398d7c2014-03-05 06:35:38 +000091 void deleted() override;
92 void allUsesReplacedWith(Value *NV) override;
Chris Lattner74a6ad62009-12-28 07:41:54 +000093};
94} // end namespace llvm.
95
Juergen Ributzkad12ccbd2013-11-19 00:57:56 +000096// Provide out-of-line definition to prevent weak vtable.
97MDNodeOperand::~MDNodeOperand() {}
Chris Lattner74a6ad62009-12-28 07:41:54 +000098
Chris Lattner9b493022009-12-31 01:22:29 +000099void MDNodeOperand::deleted() {
Craig Topperc6207612014-04-09 06:08:46 +0000100 getParent()->replaceOperand(this, nullptr);
Chris Lattner74a6ad62009-12-28 07:41:54 +0000101}
102
Chris Lattner9b493022009-12-31 01:22:29 +0000103void MDNodeOperand::allUsesReplacedWith(Value *NV) {
Bill Wendling5c0068f2012-04-08 10:20:49 +0000104 getParent()->replaceOperand(this, NV);
Chris Lattner74a6ad62009-12-28 07:41:54 +0000105}
106
Chris Lattner74a6ad62009-12-28 07:41:54 +0000107//===----------------------------------------------------------------------===//
Chris Lattnerb0c23e82009-10-19 07:10:59 +0000108// MDNode implementation.
Devang Patela4f43fb2009-07-28 21:49:47 +0000109//
Chris Lattner74a6ad62009-12-28 07:41:54 +0000110
Duncan P. N. Exon Smithfcece4d2014-10-15 20:28:31 +0000111/// \brief Get the MDNodeOperand's coallocated on the end of the MDNode.
Chris Lattner9b493022009-12-31 01:22:29 +0000112static MDNodeOperand *getOperandPtr(MDNode *N, unsigned Op) {
Dan Gohman1e0213a2010-07-13 19:33:27 +0000113 // Use <= instead of < to permit a one-past-the-end address.
114 assert(Op <= N->getNumOperands() && "Invalid operand number");
Duncan P. N. Exon Smithc23610b2014-11-18 01:56:14 +0000115 return reinterpret_cast<MDNodeOperand *>(N) - N->getNumOperands() + Op;
Chris Lattnerf543eff2009-12-28 09:12:35 +0000116}
117
Eric Christopher24e51b72012-02-15 09:09:29 +0000118void MDNode::replaceOperandWith(unsigned i, Value *Val) {
119 MDNodeOperand *Op = getOperandPtr(this, i);
120 replaceOperand(Op, Val);
121}
122
Duncan P. N. Exon Smithc23610b2014-11-18 01:56:14 +0000123void *MDNode::operator new(size_t Size, unsigned NumOps) {
124 void *Ptr = ::operator new(Size + NumOps * sizeof(MDNodeOperand));
125 MDNodeOperand *Op = static_cast<MDNodeOperand *>(Ptr);
126 if (NumOps) {
127 MDNodeOperand *Last = Op + NumOps;
128 for (; Op != Last; ++Op)
129 new (Op) MDNodeOperand();
130 (Op - 1)->setAsLastOperand(1);
131 }
132 return Op;
133}
134
135void MDNode::operator delete(void *Mem) {
136 MDNode *N = static_cast<MDNode *>(Mem);
137 MDNodeOperand *Op = static_cast<MDNodeOperand *>(Mem);
138 for (unsigned I = 0, E = N->NumOperands; I != E; ++I)
139 (--Op)->~MDNodeOperand();
140 ::operator delete(Op);
141}
142
Duncan P. N. Exon Smith50846f82014-11-18 00:37:17 +0000143MDNode::MDNode(LLVMContext &C, unsigned ID, ArrayRef<Value *> Vals,
144 bool isFunctionLocal)
Duncan P. N. Exon Smith4db24cc2014-11-18 02:20:29 +0000145 : Metadata(C, ID) {
Jay Foad5514afe2011-04-21 19:59:31 +0000146 NumOperands = Vals.size();
Mikhail Glushenkoved3bd132010-01-10 18:48:49 +0000147
Victor Hernandez0471abd2009-12-18 20:09:14 +0000148 if (isFunctionLocal)
Chris Lattnerb9c86512009-12-29 02:14:09 +0000149 setValueSubclassData(getSubclassDataFromValue() | FunctionLocalBit);
Chris Lattner8cb6c342009-12-31 01:05:46 +0000150
Duncan P. N. Exon Smithc23610b2014-11-18 01:56:14 +0000151 // Initialize the operand list.
Jay Foad5514afe2011-04-21 19:59:31 +0000152 unsigned i = 0;
Duncan P. N. Exon Smithc23610b2014-11-18 01:56:14 +0000153 for (MDNodeOperand *Op = getOperandPtr(this, 0), *E = Op + NumOperands;
154 Op != E; ++Op, ++i)
155 Op->set(Vals[i]);
Devang Patela4f43fb2009-07-28 21:49:47 +0000156}
157
Duncan P. N. Exon Smith50846f82014-11-18 00:37:17 +0000158GenericMDNode::~GenericMDNode() {
Jeffrey Yasskin2cc24762010-03-13 01:26:15 +0000159 LLVMContextImpl *pImpl = getType()->getContext().pImpl;
160 if (isNotUniqued()) {
161 pImpl->NonUniquedMDNodes.erase(this);
162 } else {
Duncan P. N. Exon Smithf39c3b82014-11-17 23:28:21 +0000163 pImpl->MDNodeSet.erase(this);
Chris Lattner8cb6c342009-12-31 01:05:46 +0000164 }
Duncan P. N. Exon Smith50846f82014-11-18 00:37:17 +0000165}
166
Duncan P. N. Exon Smithc23610b2014-11-18 01:56:14 +0000167void GenericMDNode::dropAllReferences() {
168 for (MDNodeOperand *Op = getOperandPtr(this, 0), *E = Op + NumOperands;
Chris Lattner8cb6c342009-12-31 01:05:46 +0000169 Op != E; ++Op)
Duncan P. N. Exon Smithc23610b2014-11-18 01:56:14 +0000170 Op->set(nullptr);
Chris Lattner8cb6c342009-12-31 01:05:46 +0000171}
172
Victor Hernandeze5f2af72010-01-20 04:45:57 +0000173static const Function *getFunctionForValue(Value *V) {
Craig Topperc6207612014-04-09 06:08:46 +0000174 if (!V) return nullptr;
Duncan Sandsc2928c62010-05-04 12:43:36 +0000175 if (Instruction *I = dyn_cast<Instruction>(V)) {
176 BasicBlock *BB = I->getParent();
Craig Topperc6207612014-04-09 06:08:46 +0000177 return BB ? BB->getParent() : nullptr;
Duncan Sandsc2928c62010-05-04 12:43:36 +0000178 }
Chris Lattner5522f052010-01-21 21:01:47 +0000179 if (Argument *A = dyn_cast<Argument>(V))
180 return A->getParent();
Duncan Sandsc2928c62010-05-04 12:43:36 +0000181 if (BasicBlock *BB = dyn_cast<BasicBlock>(V))
182 return BB->getParent();
183 if (MDNode *MD = dyn_cast<MDNode>(V))
184 return MD->getFunction();
Craig Topperc6207612014-04-09 06:08:46 +0000185 return nullptr;
Victor Hernandeze5f2af72010-01-20 04:45:57 +0000186}
187
Victor Hernandez8c85e252010-01-14 01:45:14 +0000188// getFunction - If this metadata is function-local and recursively has a
189// function-local operand, return the first such operand's parent function.
Victor Hernandez06828f02010-01-18 22:55:08 +0000190// Otherwise, return null. getFunction() should not be used for performance-
191// critical code because it recursively visits all the MDNode's operands.
Victor Hernandeze5f2af72010-01-20 04:45:57 +0000192const Function *MDNode::getFunction() const {
Duncan P. N. Exon Smithda41af92014-12-06 01:26:49 +0000193 if (!isFunctionLocal())
194 return nullptr;
195 assert(getNumOperands() == 1 &&
196 "Expected one operand for function-local metadata");
197 assert(getOperand(0) &&
198 "Expected non-null operand for function-local metadata");
199 assert(!getOperand(0)->getType()->isMetadataTy() &&
200 "Expected non-metadata as operand of function-local metadata");
201 return getFunctionForValue(getOperand(0));
Victor Hernandez8c85e252010-01-14 01:45:14 +0000202}
203
Duncan P. N. Exon Smithfcece4d2014-10-15 20:28:31 +0000204/// \brief Check if the Value would require a function-local MDNode.
Chris Lattner450e29c2010-04-28 20:16:12 +0000205static bool isFunctionLocalValue(Value *V) {
206 return isa<Instruction>(V) || isa<Argument>(V) || isa<BasicBlock>(V) ||
207 (isa<MDNode>(V) && cast<MDNode>(V)->isFunctionLocal());
208}
209
Jay Foad5514afe2011-04-21 19:59:31 +0000210MDNode *MDNode::getMDNode(LLVMContext &Context, ArrayRef<Value*> Vals,
211 FunctionLocalness FL, bool Insert) {
Duncan P. N. Exon Smithf39c3b82014-11-17 23:28:21 +0000212 auto &Store = Context.pImpl->MDNodeSet;
Dan Gohman01579b22010-08-24 23:21:12 +0000213
Duncan P. N. Exon Smithf39c3b82014-11-17 23:28:21 +0000214 GenericMDNodeInfo::KeyTy Key(Vals);
215 auto I = Store.find_as(Key);
216 if (I != Store.end())
217 return *I;
218 if (!Insert)
219 return nullptr;
Duncan Sands26a80f32012-03-31 08:20:11 +0000220
Victor Hernandez7e8ce9a2010-01-26 02:36:35 +0000221 bool isFunctionLocal = false;
222 switch (FL) {
223 case FL_Unknown:
Benjamin Kramer3ad5c962014-03-10 15:03:06 +0000224 for (Value *V : Vals) {
Victor Hernandez7e8ce9a2010-01-26 02:36:35 +0000225 if (!V) continue;
Chris Lattner450e29c2010-04-28 20:16:12 +0000226 if (isFunctionLocalValue(V)) {
Victor Hernandez7e8ce9a2010-01-26 02:36:35 +0000227 isFunctionLocal = true;
228 break;
Victor Hernandezb8fd1522010-01-10 07:14:18 +0000229 }
Victor Hernandezb8fd1522010-01-10 07:14:18 +0000230 }
Victor Hernandez7e8ce9a2010-01-26 02:36:35 +0000231 break;
232 case FL_No:
233 isFunctionLocal = false;
234 break;
235 case FL_Yes:
236 isFunctionLocal = true;
237 break;
Devang Patelf7188322009-09-03 01:39:20 +0000238 }
Victor Hernandez7e8ce9a2010-01-26 02:36:35 +0000239
Duncan P. N. Exon Smithda41af92014-12-06 01:26:49 +0000240 if (isFunctionLocal) {
241 assert(Vals.size() == 1 &&
242 "Expected exactly one operand for function-local metadata");
243 assert(Vals[0] && "Expected non-null operand for function-local metadata");
244 assert(!Vals[0]->getType()->isMetadataTy() &&
245 "Expected non-metadata as operand of function-local metadata");
246 }
247
Victor Hernandez7e8ce9a2010-01-26 02:36:35 +0000248 // Coallocate space for the node and Operands together, then placement new.
Duncan P. N. Exon Smithc23610b2014-11-18 01:56:14 +0000249 GenericMDNode *N =
250 new (Vals.size()) GenericMDNode(Context, Vals, isFunctionLocal);
Victor Hernandez7e8ce9a2010-01-26 02:36:35 +0000251
Duncan P. N. Exon Smithf39c3b82014-11-17 23:28:21 +0000252 N->Hash = Key.Hash;
253 Store.insert(N);
Devang Patelf7188322009-09-03 01:39:20 +0000254 return N;
Owen Anderson0087fe62009-07-31 21:35:40 +0000255}
256
Devang Patel213264c2011-03-04 01:20:33 +0000257MDNode *MDNode::get(LLVMContext &Context, ArrayRef<Value*> Vals) {
Jay Foad5514afe2011-04-21 19:59:31 +0000258 return getMDNode(Context, Vals, FL_Unknown);
Victor Hernandezb8fd1522010-01-10 07:14:18 +0000259}
260
Jay Foad5514afe2011-04-21 19:59:31 +0000261MDNode *MDNode::getWhenValsUnresolved(LLVMContext &Context,
262 ArrayRef<Value*> Vals,
263 bool isFunctionLocal) {
264 return getMDNode(Context, Vals, isFunctionLocal ? FL_Yes : FL_No);
Victor Hernandezb8fd1522010-01-10 07:14:18 +0000265}
266
Jay Foad5514afe2011-04-21 19:59:31 +0000267MDNode *MDNode::getIfExists(LLVMContext &Context, ArrayRef<Value*> Vals) {
268 return getMDNode(Context, Vals, FL_Unknown, false);
Victor Hernandez7e8ce9a2010-01-26 02:36:35 +0000269}
270
Jay Foad5514afe2011-04-21 19:59:31 +0000271MDNode *MDNode::getTemporary(LLVMContext &Context, ArrayRef<Value*> Vals) {
Duncan P. N. Exon Smithc23610b2014-11-18 01:56:14 +0000272 MDNode *N = new (Vals.size()) MDNodeFwdDecl(Context, Vals, FL_No);
273 N->setValueSubclassData(N->getSubclassDataFromValue() | NotUniquedBit);
Dan Gohman16a5d982010-08-20 22:02:26 +0000274 LeakDetector::addGarbageObject(N);
275 return N;
276}
277
278void MDNode::deleteTemporary(MDNode *N) {
279 assert(N->use_empty() && "Temporary MDNode has uses!");
Duncan P. N. Exon Smith50846f82014-11-18 00:37:17 +0000280 assert(isa<MDNodeFwdDecl>(N) && "Expected forward declaration");
Dan Gohman16a5d982010-08-20 22:02:26 +0000281 assert((N->getSubclassDataFromValue() & NotUniquedBit) &&
282 "Temporary MDNode does not have NotUniquedBit set!");
Dan Gohman16a5d982010-08-20 22:02:26 +0000283 LeakDetector::removeGarbageObject(N);
Duncan P. N. Exon Smithc23610b2014-11-18 01:56:14 +0000284 delete cast<MDNodeFwdDecl>(N);
Dan Gohman16a5d982010-08-20 22:02:26 +0000285}
286
Duncan P. N. Exon Smithfcece4d2014-10-15 20:28:31 +0000287/// \brief Return specified operand.
Chris Lattner9b493022009-12-31 01:22:29 +0000288Value *MDNode::getOperand(unsigned i) const {
David Blaikie58462392013-03-08 21:08:23 +0000289 assert(i < getNumOperands() && "Invalid operand number");
Chris Lattner8cb6c342009-12-31 01:05:46 +0000290 return *getOperandPtr(const_cast<MDNode*>(this), i);
291}
292
Jeffrey Yasskin2cc24762010-03-13 01:26:15 +0000293void MDNode::setIsNotUniqued() {
294 setValueSubclassData(getSubclassDataFromValue() | NotUniquedBit);
295 LLVMContextImpl *pImpl = getType()->getContext().pImpl;
Duncan P. N. Exon Smith50846f82014-11-18 00:37:17 +0000296 auto *G = cast<GenericMDNode>(this);
297 G->Hash = 0;
298 pImpl->NonUniquedMDNodes.insert(G);
Devang Patel82ab3f82010-02-18 20:53:16 +0000299}
Chris Lattnerf543eff2009-12-28 09:12:35 +0000300
Chris Lattner9b493022009-12-31 01:22:29 +0000301// Replace value from this node's operand list.
302void MDNode::replaceOperand(MDNodeOperand *Op, Value *To) {
Chris Lattner95c445d2009-12-28 09:32:10 +0000303 Value *From = *Op;
Mikhail Glushenkoved3bd132010-01-10 18:48:49 +0000304
Chris Lattner450e29c2010-04-28 20:16:12 +0000305 // If is possible that someone did GV->RAUW(inst), replacing a global variable
306 // with an instruction or some other function-local object. If this is a
307 // non-function-local MDNode, it can't point to a function-local object.
308 // Handle this case by implicitly dropping the MDNode reference to null.
Duncan Sandsc2928c62010-05-04 12:43:36 +0000309 // Likewise if the MDNode is function-local but for a different function.
310 if (To && isFunctionLocalValue(To)) {
Duncan P. N. Exon Smithda41af92014-12-06 01:26:49 +0000311 assert(!To->getType()->isMetadataTy() &&
312 "Expected non-metadata as operand of function-local metadata");
Duncan Sandsc2928c62010-05-04 12:43:36 +0000313 if (!isFunctionLocal())
Craig Topperc6207612014-04-09 06:08:46 +0000314 To = nullptr;
Duncan Sandsc2928c62010-05-04 12:43:36 +0000315 else {
316 const Function *F = getFunction();
317 const Function *FV = getFunctionForValue(To);
318 // Metadata can be function-local without having an associated function.
319 // So only consider functions to have changed if non-null.
320 if (F && FV && F != FV)
Craig Topperc6207612014-04-09 06:08:46 +0000321 To = nullptr;
Duncan Sandsc2928c62010-05-04 12:43:36 +0000322 }
323 }
Chris Lattner450e29c2010-04-28 20:16:12 +0000324
Chris Lattner95c445d2009-12-28 09:32:10 +0000325 if (From == To)
Devang Patelf7188322009-09-03 01:39:20 +0000326 return;
Devang Patelf7188322009-09-03 01:39:20 +0000327
Duncan P. N. Exon Smithda41af92014-12-06 01:26:49 +0000328 // If this MDValue was previously function-local but no longer is, clear
329 // its function-local flag.
330 if (isFunctionLocal() && !(To && isFunctionLocalValue(To))) {
331 assert(getNumOperands() == 1 &&
332 "Expected function-local metadata to have exactly one operand");
333 setValueSubclassData(getSubclassDataFromValue() & ~FunctionLocalBit);
334 }
335
Chris Lattner30ae06b2009-12-30 21:42:11 +0000336 // If this node is already not being uniqued (because one of the operands
337 // already went to null), then there is nothing else to do here.
Duncan P. N. Exon Smithf39c3b82014-11-17 23:28:21 +0000338 if (isNotUniqued()) {
339 Op->set(To);
340 return;
341 }
Mikhail Glushenkoved3bd132010-01-10 18:48:49 +0000342
Duncan P. N. Exon Smithf39c3b82014-11-17 23:28:21 +0000343 auto &Store = getContext().pImpl->MDNodeSet;
Duncan P. N. Exon Smith50846f82014-11-18 00:37:17 +0000344 auto *N = cast<GenericMDNode>(this);
Chris Lattnerc6d17e22009-12-28 09:24:53 +0000345
Duncan P. N. Exon Smithf39c3b82014-11-17 23:28:21 +0000346 // Remove "this" from the context map.
Duncan P. N. Exon Smith50846f82014-11-18 00:37:17 +0000347 Store.erase(N);
Duncan P. N. Exon Smithf39c3b82014-11-17 23:28:21 +0000348
349 // Update the operand.
350 Op->set(To);
Chris Lattner95c445d2009-12-28 09:32:10 +0000351
Chris Lattner30ae06b2009-12-30 21:42:11 +0000352 // If we are dropping an argument to null, we choose to not unique the MDNode
353 // anymore. This commonly occurs during destruction, and uniquing these
Dan Gohman62ddc152010-08-30 21:18:41 +0000354 // brings little reuse. Also, this means we don't need to include
Duncan P. N. Exon Smithf39c3b82014-11-17 23:28:21 +0000355 // isFunctionLocal bits in the hash for MDNodes.
Craig Topperc6207612014-04-09 06:08:46 +0000356 if (!To) {
Chris Lattner30ae06b2009-12-30 21:42:11 +0000357 setIsNotUniqued();
358 return;
359 }
Mikhail Glushenkoved3bd132010-01-10 18:48:49 +0000360
Duncan P. N. Exon Smithf39c3b82014-11-17 23:28:21 +0000361 // Now that the node is out of the table, get ready to reinsert it. First,
362 // check to see if another node with the same operands already exists in the
363 // set. If so, then this node is redundant.
364 SmallVector<Value *, 8> Vals;
Duncan P. N. Exon Smith50846f82014-11-18 00:37:17 +0000365 GenericMDNodeInfo::KeyTy Key(N, Vals);
Duncan P. N. Exon Smithf39c3b82014-11-17 23:28:21 +0000366 auto I = Store.find_as(Key);
367 if (I != Store.end()) {
Duncan P. N. Exon Smith50846f82014-11-18 00:37:17 +0000368 N->replaceAllUsesWith(*I);
Duncan P. N. Exon Smithc23610b2014-11-18 01:56:14 +0000369 delete N;
Dan Gohman25a7bc92010-09-28 22:07:19 +0000370 return;
Devang Patelf7188322009-09-03 01:39:20 +0000371 }
372
Duncan P. N. Exon Smith50846f82014-11-18 00:37:17 +0000373 N->Hash = Key.Hash;
374 Store.insert(N);
Devang Patelf7188322009-09-03 01:39:20 +0000375}
376
Hal Finkel94146652014-07-24 14:25:39 +0000377MDNode *MDNode::concatenate(MDNode *A, MDNode *B) {
378 if (!A)
379 return B;
380 if (!B)
381 return A;
382
383 SmallVector<Value *, 4> Vals(A->getNumOperands() +
384 B->getNumOperands());
385
386 unsigned j = 0;
387 for (unsigned i = 0, ie = A->getNumOperands(); i != ie; ++i)
388 Vals[j++] = A->getOperand(i);
389 for (unsigned i = 0, ie = B->getNumOperands(); i != ie; ++i)
390 Vals[j++] = B->getOperand(i);
391
392 return MDNode::get(A->getContext(), Vals);
393}
394
395MDNode *MDNode::intersect(MDNode *A, MDNode *B) {
396 if (!A || !B)
397 return nullptr;
398
399 SmallVector<Value *, 4> Vals;
400 for (unsigned i = 0, ie = A->getNumOperands(); i != ie; ++i) {
401 Value *V = A->getOperand(i);
402 for (unsigned j = 0, je = B->getNumOperands(); j != je; ++j)
403 if (V == B->getOperand(j)) {
404 Vals.push_back(V);
405 break;
406 }
407 }
408
409 return MDNode::get(A->getContext(), Vals);
410}
411
Hal Finkel16ddd4b2012-06-16 20:33:37 +0000412MDNode *MDNode::getMostGenericFPMath(MDNode *A, MDNode *B) {
413 if (!A || !B)
Craig Topperc6207612014-04-09 06:08:46 +0000414 return nullptr;
Hal Finkel16ddd4b2012-06-16 20:33:37 +0000415
416 APFloat AVal = cast<ConstantFP>(A->getOperand(0))->getValueAPF();
417 APFloat BVal = cast<ConstantFP>(B->getOperand(0))->getValueAPF();
418 if (AVal.compare(BVal) == APFloat::cmpLessThan)
419 return A;
420 return B;
421}
422
423static bool isContiguous(const ConstantRange &A, const ConstantRange &B) {
424 return A.getUpper() == B.getLower() || A.getLower() == B.getUpper();
425}
426
427static bool canBeMerged(const ConstantRange &A, const ConstantRange &B) {
428 return !A.intersectWith(B).isEmptySet() || isContiguous(A, B);
429}
430
Craig Topperb94011f2013-07-14 04:42:23 +0000431static bool tryMergeRange(SmallVectorImpl<Value *> &EndPoints, ConstantInt *Low,
Hal Finkel16ddd4b2012-06-16 20:33:37 +0000432 ConstantInt *High) {
433 ConstantRange NewRange(Low->getValue(), High->getValue());
434 unsigned Size = EndPoints.size();
435 APInt LB = cast<ConstantInt>(EndPoints[Size - 2])->getValue();
436 APInt LE = cast<ConstantInt>(EndPoints[Size - 1])->getValue();
437 ConstantRange LastRange(LB, LE);
438 if (canBeMerged(NewRange, LastRange)) {
439 ConstantRange Union = LastRange.unionWith(NewRange);
440 Type *Ty = High->getType();
441 EndPoints[Size - 2] = ConstantInt::get(Ty, Union.getLower());
442 EndPoints[Size - 1] = ConstantInt::get(Ty, Union.getUpper());
443 return true;
444 }
445 return false;
446}
447
Craig Topperb94011f2013-07-14 04:42:23 +0000448static void addRange(SmallVectorImpl<Value *> &EndPoints, ConstantInt *Low,
Hal Finkel16ddd4b2012-06-16 20:33:37 +0000449 ConstantInt *High) {
450 if (!EndPoints.empty())
451 if (tryMergeRange(EndPoints, Low, High))
452 return;
453
454 EndPoints.push_back(Low);
455 EndPoints.push_back(High);
456}
457
458MDNode *MDNode::getMostGenericRange(MDNode *A, MDNode *B) {
459 // Given two ranges, we want to compute the union of the ranges. This
460 // is slightly complitade by having to combine the intervals and merge
461 // the ones that overlap.
462
463 if (!A || !B)
Craig Topperc6207612014-04-09 06:08:46 +0000464 return nullptr;
Hal Finkel16ddd4b2012-06-16 20:33:37 +0000465
466 if (A == B)
467 return A;
468
469 // First, walk both lists in older of the lower boundary of each interval.
470 // At each step, try to merge the new interval to the last one we adedd.
471 SmallVector<Value*, 4> EndPoints;
472 int AI = 0;
473 int BI = 0;
474 int AN = A->getNumOperands() / 2;
475 int BN = B->getNumOperands() / 2;
476 while (AI < AN && BI < BN) {
477 ConstantInt *ALow = cast<ConstantInt>(A->getOperand(2 * AI));
478 ConstantInt *BLow = cast<ConstantInt>(B->getOperand(2 * BI));
479
480 if (ALow->getValue().slt(BLow->getValue())) {
481 addRange(EndPoints, ALow, cast<ConstantInt>(A->getOperand(2 * AI + 1)));
482 ++AI;
483 } else {
484 addRange(EndPoints, BLow, cast<ConstantInt>(B->getOperand(2 * BI + 1)));
485 ++BI;
486 }
487 }
488 while (AI < AN) {
489 addRange(EndPoints, cast<ConstantInt>(A->getOperand(2 * AI)),
490 cast<ConstantInt>(A->getOperand(2 * AI + 1)));
491 ++AI;
492 }
493 while (BI < BN) {
494 addRange(EndPoints, cast<ConstantInt>(B->getOperand(2 * BI)),
495 cast<ConstantInt>(B->getOperand(2 * BI + 1)));
496 ++BI;
497 }
498
499 // If we have more than 2 ranges (4 endpoints) we have to try to merge
500 // the last and first ones.
501 unsigned Size = EndPoints.size();
502 if (Size > 4) {
503 ConstantInt *FB = cast<ConstantInt>(EndPoints[0]);
504 ConstantInt *FE = cast<ConstantInt>(EndPoints[1]);
505 if (tryMergeRange(EndPoints, FB, FE)) {
506 for (unsigned i = 0; i < Size - 2; ++i) {
507 EndPoints[i] = EndPoints[i + 2];
508 }
509 EndPoints.resize(Size - 2);
510 }
511 }
512
513 // If in the end we have a single range, it is possible that it is now the
514 // full range. Just drop the metadata in that case.
515 if (EndPoints.size() == 2) {
516 ConstantRange Range(cast<ConstantInt>(EndPoints[0])->getValue(),
517 cast<ConstantInt>(EndPoints[1])->getValue());
518 if (Range.isFullSet())
Craig Topperc6207612014-04-09 06:08:46 +0000519 return nullptr;
Hal Finkel16ddd4b2012-06-16 20:33:37 +0000520 }
521
522 return MDNode::get(A->getContext(), EndPoints);
523}
524
Devang Patel05a26fb2009-07-29 00:33:07 +0000525//===----------------------------------------------------------------------===//
Chris Lattnerb0c23e82009-10-19 07:10:59 +0000526// NamedMDNode implementation.
Devang Patel05a26fb2009-07-29 00:33:07 +0000527//
Devang Patel943ddf62010-01-12 18:34:06 +0000528
Duncan P. N. Exon Smithde36e802014-11-11 21:30:22 +0000529static SmallVector<TrackingVH<MDNode>, 4> &getNMDOps(void *Operands) {
530 return *(SmallVector<TrackingVH<MDNode>, 4> *)Operands;
Chris Lattner1bc810b2009-12-28 08:07:14 +0000531}
532
Dan Gohman2637cc12010-07-21 23:38:33 +0000533NamedMDNode::NamedMDNode(const Twine &N)
Duncan P. N. Exon Smithc5754a62014-11-05 18:16:03 +0000534 : Name(N.str()), Parent(nullptr),
Duncan P. N. Exon Smithde36e802014-11-11 21:30:22 +0000535 Operands(new SmallVector<TrackingVH<MDNode>, 4>()) {}
Devang Patel5c310be2009-08-11 18:01:24 +0000536
Chris Lattner1bc810b2009-12-28 08:07:14 +0000537NamedMDNode::~NamedMDNode() {
538 dropAllReferences();
539 delete &getNMDOps(Operands);
540}
541
Chris Lattner9b493022009-12-31 01:22:29 +0000542unsigned NamedMDNode::getNumOperands() const {
Chris Lattner1bc810b2009-12-28 08:07:14 +0000543 return (unsigned)getNMDOps(Operands).size();
544}
545
Duncan P. N. Exon Smithde36e802014-11-11 21:30:22 +0000546MDNode *NamedMDNode::getOperand(unsigned i) const {
Chris Lattner9b493022009-12-31 01:22:29 +0000547 assert(i < getNumOperands() && "Invalid Operand number!");
Duncan P. N. Exon Smithb28deb12014-11-05 01:55:06 +0000548 return &*getNMDOps(Operands)[i];
Chris Lattner1bc810b2009-12-28 08:07:14 +0000549}
550
Duncan P. N. Exon Smithde36e802014-11-11 21:30:22 +0000551void NamedMDNode::addOperand(MDNode *M) {
Dan Gohmane1328dc2010-09-14 01:37:57 +0000552 assert(!M->isFunctionLocal() &&
553 "NamedMDNode operands must not be function-local!");
Duncan P. N. Exon Smithde36e802014-11-11 21:30:22 +0000554 getNMDOps(Operands).push_back(TrackingVH<MDNode>(M));
Chris Lattner1bc810b2009-12-28 08:07:14 +0000555}
556
Devang Patel79238d72009-08-03 06:19:01 +0000557void NamedMDNode::eraseFromParent() {
Dan Gohman2637cc12010-07-21 23:38:33 +0000558 getParent()->eraseNamedMetadata(this);
Devang Patel79238d72009-08-03 06:19:01 +0000559}
560
Devang Patel79238d72009-08-03 06:19:01 +0000561void NamedMDNode::dropAllReferences() {
Chris Lattner1bc810b2009-12-28 08:07:14 +0000562 getNMDOps(Operands).clear();
Devang Patel79238d72009-08-03 06:19:01 +0000563}
564
Devang Patelfcfee0f2010-01-07 19:39:36 +0000565StringRef NamedMDNode::getName() const {
566 return StringRef(Name);
567}
Devang Pateld5497a4b2009-09-16 18:09:00 +0000568
569//===----------------------------------------------------------------------===//
Chris Lattner2f2aa2b2009-12-28 23:41:32 +0000570// Instruction Metadata method implementations.
571//
572
Duncan P. N. Exon Smithde36e802014-11-11 21:30:22 +0000573void Instruction::setMetadata(StringRef Kind, MDNode *Node) {
574 if (!Node && !hasMetadata())
575 return;
576 setMetadata(getContext().getMDKindID(Kind), Node);
Chris Lattner2f2aa2b2009-12-28 23:41:32 +0000577}
578
Duncan P. N. Exon Smithde36e802014-11-11 21:30:22 +0000579MDNode *Instruction::getMetadataImpl(StringRef Kind) const {
Chris Lattnera0566972009-12-29 09:01:33 +0000580 return getMetadataImpl(getContext().getMDKindID(Kind));
Chris Lattner2f2aa2b2009-12-28 23:41:32 +0000581}
582
Rafael Espindolaab73c492014-01-28 16:56:46 +0000583void Instruction::dropUnknownMetadata(ArrayRef<unsigned> KnownIDs) {
584 SmallSet<unsigned, 5> KnownSet;
585 KnownSet.insert(KnownIDs.begin(), KnownIDs.end());
586
587 // Drop debug if needed
588 if (KnownSet.erase(LLVMContext::MD_dbg))
589 DbgLoc = DebugLoc();
590
591 if (!hasMetadataHashEntry())
592 return; // Nothing to remove!
593
594 DenseMap<const Instruction *, LLVMContextImpl::MDMapTy> &MetadataStore =
595 getContext().pImpl->MetadataStore;
596
597 if (KnownSet.empty()) {
598 // Just drop our entry at the store.
599 MetadataStore.erase(this);
600 setHasMetadataHashEntry(false);
601 return;
602 }
603
604 LLVMContextImpl::MDMapTy &Info = MetadataStore[this];
605 unsigned I;
606 unsigned E;
607 // Walk the array and drop any metadata we don't know.
608 for (I = 0, E = Info.size(); I != E;) {
609 if (KnownSet.count(Info[I].first)) {
610 ++I;
611 continue;
612 }
613
614 Info[I] = Info.back();
615 Info.pop_back();
616 --E;
617 }
618 assert(E == Info.size());
619
620 if (E == 0) {
621 // Drop our entry at the store.
622 MetadataStore.erase(this);
623 setHasMetadataHashEntry(false);
624 }
625}
626
Chris Lattner2f2aa2b2009-12-28 23:41:32 +0000627/// setMetadata - Set the metadata of of the specified kind to the specified
628/// node. This updates/replaces metadata if already present, or removes it if
Duncan P. N. Exon Smithde36e802014-11-11 21:30:22 +0000629/// Node is null.
630void Instruction::setMetadata(unsigned KindID, MDNode *Node) {
631 if (!Node && !hasMetadata())
632 return;
Mikhail Glushenkoved3bd132010-01-10 18:48:49 +0000633
Chris Lattnerc263b422010-03-30 23:03:27 +0000634 // Handle 'dbg' as a special case since it is not stored in the hash table.
635 if (KindID == LLVMContext::MD_dbg) {
Chris Lattner593916d2010-04-02 20:21:22 +0000636 DbgLoc = DebugLoc::getFromDILocation(Node);
Chris Lattnerc263b422010-03-30 23:03:27 +0000637 return;
638 }
639
Chris Lattnera0566972009-12-29 09:01:33 +0000640 // Handle the case when we're adding/updating metadata on an instruction.
641 if (Node) {
642 LLVMContextImpl::MDMapTy &Info = getContext().pImpl->MetadataStore[this];
Chris Lattnerc263b422010-03-30 23:03:27 +0000643 assert(!Info.empty() == hasMetadataHashEntry() &&
644 "HasMetadata bit is wonked");
Chris Lattnera0566972009-12-29 09:01:33 +0000645 if (Info.empty()) {
Chris Lattnerc263b422010-03-30 23:03:27 +0000646 setHasMetadataHashEntry(true);
Chris Lattnera0566972009-12-29 09:01:33 +0000647 } else {
648 // Handle replacement of an existing value.
Benjamin Kramer3ad5c962014-03-10 15:03:06 +0000649 for (auto &P : Info)
650 if (P.first == KindID) {
651 P.second = Node;
Chris Lattnera0566972009-12-29 09:01:33 +0000652 return;
653 }
654 }
Mikhail Glushenkoved3bd132010-01-10 18:48:49 +0000655
Chris Lattnera0566972009-12-29 09:01:33 +0000656 // No replacement, just add it to the list.
657 Info.push_back(std::make_pair(KindID, Node));
658 return;
659 }
Mikhail Glushenkoved3bd132010-01-10 18:48:49 +0000660
Chris Lattnera0566972009-12-29 09:01:33 +0000661 // Otherwise, we're removing metadata from an instruction.
Nick Lewycky4c131382011-12-27 01:17:40 +0000662 assert((hasMetadataHashEntry() ==
Yaron Keren6d3194f2014-06-20 10:26:56 +0000663 (getContext().pImpl->MetadataStore.count(this) > 0)) &&
Chris Lattnera0566972009-12-29 09:01:33 +0000664 "HasMetadata bit out of date!");
Nick Lewycky4c131382011-12-27 01:17:40 +0000665 if (!hasMetadataHashEntry())
666 return; // Nothing to remove!
Chris Lattnera0566972009-12-29 09:01:33 +0000667 LLVMContextImpl::MDMapTy &Info = getContext().pImpl->MetadataStore[this];
Mikhail Glushenkoved3bd132010-01-10 18:48:49 +0000668
Chris Lattnera0566972009-12-29 09:01:33 +0000669 // Common case is removing the only entry.
670 if (Info.size() == 1 && Info[0].first == KindID) {
671 getContext().pImpl->MetadataStore.erase(this);
Chris Lattnerc263b422010-03-30 23:03:27 +0000672 setHasMetadataHashEntry(false);
Chris Lattnera0566972009-12-29 09:01:33 +0000673 return;
674 }
Mikhail Glushenkoved3bd132010-01-10 18:48:49 +0000675
Chris Lattnerc263b422010-03-30 23:03:27 +0000676 // Handle removal of an existing value.
Chris Lattnera0566972009-12-29 09:01:33 +0000677 for (unsigned i = 0, e = Info.size(); i != e; ++i)
678 if (Info[i].first == KindID) {
679 Info[i] = Info.back();
680 Info.pop_back();
681 assert(!Info.empty() && "Removing last entry should be handled above");
682 return;
683 }
684 // Otherwise, removing an entry that doesn't exist on the instruction.
Chris Lattner2f2aa2b2009-12-28 23:41:32 +0000685}
686
Hal Finkelcc39b672014-07-24 12:16:19 +0000687void Instruction::setAAMetadata(const AAMDNodes &N) {
688 setMetadata(LLVMContext::MD_tbaa, N.TBAA);
Hal Finkel94146652014-07-24 14:25:39 +0000689 setMetadata(LLVMContext::MD_alias_scope, N.Scope);
690 setMetadata(LLVMContext::MD_noalias, N.NoAlias);
Hal Finkelcc39b672014-07-24 12:16:19 +0000691}
692
Duncan P. N. Exon Smithde36e802014-11-11 21:30:22 +0000693MDNode *Instruction::getMetadataImpl(unsigned KindID) const {
Chris Lattnerc263b422010-03-30 23:03:27 +0000694 // Handle 'dbg' as a special case since it is not stored in the hash table.
695 if (KindID == LLVMContext::MD_dbg)
Chris Lattnerc0f5ce32010-04-01 05:23:13 +0000696 return DbgLoc.getAsMDNode(getContext());
Chris Lattnerc263b422010-03-30 23:03:27 +0000697
Craig Topperc6207612014-04-09 06:08:46 +0000698 if (!hasMetadataHashEntry()) return nullptr;
Chris Lattnerc263b422010-03-30 23:03:27 +0000699
Chris Lattnera0566972009-12-29 09:01:33 +0000700 LLVMContextImpl::MDMapTy &Info = getContext().pImpl->MetadataStore[this];
Chris Lattnerc263b422010-03-30 23:03:27 +0000701 assert(!Info.empty() && "bit out of sync with hash table");
Mikhail Glushenkoved3bd132010-01-10 18:48:49 +0000702
Benjamin Kramer3ad5c962014-03-10 15:03:06 +0000703 for (const auto &I : Info)
704 if (I.first == KindID)
705 return I.second;
Craig Topperc6207612014-04-09 06:08:46 +0000706 return nullptr;
Chris Lattner2f2aa2b2009-12-28 23:41:32 +0000707}
708
Duncan P. N. Exon Smith4abd1a02014-11-01 00:26:42 +0000709void Instruction::getAllMetadataImpl(
Duncan P. N. Exon Smithde36e802014-11-11 21:30:22 +0000710 SmallVectorImpl<std::pair<unsigned, MDNode *>> &Result) const {
Chris Lattnerc263b422010-03-30 23:03:27 +0000711 Result.clear();
712
713 // Handle 'dbg' as a special case since it is not stored in the hash table.
Chris Lattnerc0f5ce32010-04-01 05:23:13 +0000714 if (!DbgLoc.isUnknown()) {
715 Result.push_back(std::make_pair((unsigned)LLVMContext::MD_dbg,
716 DbgLoc.getAsMDNode(getContext())));
Chris Lattnerc263b422010-03-30 23:03:27 +0000717 if (!hasMetadataHashEntry()) return;
718 }
719
720 assert(hasMetadataHashEntry() &&
721 getContext().pImpl->MetadataStore.count(this) &&
Chris Lattnera0566972009-12-29 09:01:33 +0000722 "Shouldn't have called this");
723 const LLVMContextImpl::MDMapTy &Info =
724 getContext().pImpl->MetadataStore.find(this)->second;
725 assert(!Info.empty() && "Shouldn't have called this");
Mikhail Glushenkoved3bd132010-01-10 18:48:49 +0000726
Chris Lattnera0566972009-12-29 09:01:33 +0000727 Result.append(Info.begin(), Info.end());
Mikhail Glushenkoved3bd132010-01-10 18:48:49 +0000728
Chris Lattnera0566972009-12-29 09:01:33 +0000729 // Sort the resulting array so it is stable.
730 if (Result.size() > 1)
731 array_pod_sort(Result.begin(), Result.end());
Chris Lattner2f2aa2b2009-12-28 23:41:32 +0000732}
733
Duncan P. N. Exon Smith3d5a02f2014-11-03 18:13:57 +0000734void Instruction::getAllMetadataOtherThanDebugLocImpl(
Duncan P. N. Exon Smithde36e802014-11-11 21:30:22 +0000735 SmallVectorImpl<std::pair<unsigned, MDNode *>> &Result) const {
Chris Lattnerc0f5ce32010-04-01 05:23:13 +0000736 Result.clear();
737 assert(hasMetadataHashEntry() &&
738 getContext().pImpl->MetadataStore.count(this) &&
739 "Shouldn't have called this");
740 const LLVMContextImpl::MDMapTy &Info =
Bill Wendlingdd91e732012-04-03 10:50:09 +0000741 getContext().pImpl->MetadataStore.find(this)->second;
Chris Lattnerc0f5ce32010-04-01 05:23:13 +0000742 assert(!Info.empty() && "Shouldn't have called this");
Chris Lattnerc0f5ce32010-04-01 05:23:13 +0000743 Result.append(Info.begin(), Info.end());
Bill Wendlingdd91e732012-04-03 10:50:09 +0000744
Chris Lattnerc0f5ce32010-04-01 05:23:13 +0000745 // Sort the resulting array so it is stable.
746 if (Result.size() > 1)
747 array_pod_sort(Result.begin(), Result.end());
748}
749
Dan Gohman48a995f2010-07-20 22:25:04 +0000750/// clearMetadataHashEntries - Clear all hashtable-based metadata from
751/// this instruction.
752void Instruction::clearMetadataHashEntries() {
753 assert(hasMetadataHashEntry() && "Caller should check");
754 getContext().pImpl->MetadataStore.erase(this);
755 setHasMetadataHashEntry(false);
Chris Lattner68017802009-12-29 07:44:16 +0000756}
757