blob: a371c6f92eb45ad51c4498357965073c8ebc66b5 [file] [log] [blame]
Devang Patel4c758ea2008-09-25 21:00:45 +00001//===-- Attributes.cpp - Implement AttributesList -------------------------===//
Chris Lattner3e13b8c2008-01-02 23:42:30 +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//===----------------------------------------------------------------------===//
9//
Devang Patel4c758ea2008-09-25 21:00:45 +000010// This file implements the AttributesList class and Attribute utilities.
Chris Lattner3e13b8c2008-01-02 23:42:30 +000011//
12//===----------------------------------------------------------------------===//
13
Devang Patelba3fa6c2008-09-23 23:03:40 +000014#include "llvm/Attributes.h"
Chris Lattner8a923e72008-03-12 17:45:29 +000015#include "llvm/Type.h"
Dan Gohmanfc429612008-03-10 23:55:07 +000016#include "llvm/ADT/StringExtras.h"
Chris Lattner8a923e72008-03-12 17:45:29 +000017#include "llvm/ADT/FoldingSet.h"
Owen Andersonc1a3a472009-08-20 19:03:20 +000018#include "llvm/System/Atomic.h"
Owen Andersond91e6b02009-08-17 17:10:58 +000019#include "llvm/System/Mutex.h"
David Greenef7014732010-01-05 01:29:58 +000020#include "llvm/Support/Debug.h"
Chris Lattner3e13b8c2008-01-02 23:42:30 +000021#include "llvm/Support/ManagedStatic.h"
Benjamin Kramer1a25d732009-08-23 11:37:21 +000022#include "llvm/Support/raw_ostream.h"
Chris Lattner3e13b8c2008-01-02 23:42:30 +000023using namespace llvm;
24
Chris Lattner8a923e72008-03-12 17:45:29 +000025//===----------------------------------------------------------------------===//
Devang Patel4c758ea2008-09-25 21:00:45 +000026// Attribute Function Definitions
Chris Lattner8a923e72008-03-12 17:45:29 +000027//===----------------------------------------------------------------------===//
Chris Lattnerd0e1f102008-01-03 00:10:22 +000028
Devang Patel4c758ea2008-09-25 21:00:45 +000029std::string Attribute::getAsString(Attributes Attrs) {
Chris Lattner3e13b8c2008-01-02 23:42:30 +000030 std::string Result;
Devang Patel4c758ea2008-09-25 21:00:45 +000031 if (Attrs & Attribute::ZExt)
Chris Lattner3e13b8c2008-01-02 23:42:30 +000032 Result += "zeroext ";
Devang Patel4c758ea2008-09-25 21:00:45 +000033 if (Attrs & Attribute::SExt)
Chris Lattner3e13b8c2008-01-02 23:42:30 +000034 Result += "signext ";
Devang Patel4c758ea2008-09-25 21:00:45 +000035 if (Attrs & Attribute::NoReturn)
Chris Lattner3e13b8c2008-01-02 23:42:30 +000036 Result += "noreturn ";
Devang Patel4c758ea2008-09-25 21:00:45 +000037 if (Attrs & Attribute::NoUnwind)
Chris Lattner3e13b8c2008-01-02 23:42:30 +000038 Result += "nounwind ";
Devang Patel4c758ea2008-09-25 21:00:45 +000039 if (Attrs & Attribute::InReg)
Chris Lattner3e13b8c2008-01-02 23:42:30 +000040 Result += "inreg ";
Devang Patel4c758ea2008-09-25 21:00:45 +000041 if (Attrs & Attribute::NoAlias)
Chris Lattner3e13b8c2008-01-02 23:42:30 +000042 Result += "noalias ";
Nick Lewycky8d69f482008-12-19 09:38:31 +000043 if (Attrs & Attribute::NoCapture)
44 Result += "nocapture ";
Devang Patel4c758ea2008-09-25 21:00:45 +000045 if (Attrs & Attribute::StructRet)
Anton Korobeynikovc8ce7b082009-07-17 18:07:26 +000046 Result += "sret ";
Devang Patel4c758ea2008-09-25 21:00:45 +000047 if (Attrs & Attribute::ByVal)
Chris Lattner3e13b8c2008-01-02 23:42:30 +000048 Result += "byval ";
Devang Patel4c758ea2008-09-25 21:00:45 +000049 if (Attrs & Attribute::Nest)
Chris Lattner3e13b8c2008-01-02 23:42:30 +000050 Result += "nest ";
Devang Patel4c758ea2008-09-25 21:00:45 +000051 if (Attrs & Attribute::ReadNone)
Chris Lattner3e13b8c2008-01-02 23:42:30 +000052 Result += "readnone ";
Devang Patel4c758ea2008-09-25 21:00:45 +000053 if (Attrs & Attribute::ReadOnly)
Chris Lattner3e13b8c2008-01-02 23:42:30 +000054 Result += "readonly ";
Devang Patela05633e2008-09-26 22:53:05 +000055 if (Attrs & Attribute::OptimizeForSize)
56 Result += "optsize ";
57 if (Attrs & Attribute::NoInline)
58 Result += "noinline ";
Jakob Stoklund Olesen74bb06c2010-02-06 01:16:28 +000059 if (Attrs & Attribute::InlineHint)
60 Result += "inlinehint ";
Devang Patela05633e2008-09-26 22:53:05 +000061 if (Attrs & Attribute::AlwaysInline)
62 Result += "alwaysinline ";
Bill Wendlingccb67a3d2008-11-13 01:02:14 +000063 if (Attrs & Attribute::StackProtect)
64 Result += "ssp ";
65 if (Attrs & Attribute::StackProtectReq)
66 Result += "sspreq ";
Devang Patel72a4d2f2009-06-04 22:05:33 +000067 if (Attrs & Attribute::NoRedZone)
68 Result += "noredzone ";
Devang Pateld1c7d342009-06-05 21:57:13 +000069 if (Attrs & Attribute::NoImplicitFloat)
70 Result += "noimplicitfloat ";
Anton Korobeynikovc8ce7b082009-07-17 18:07:26 +000071 if (Attrs & Attribute::Naked)
72 Result += "naked ";
Devang Patel4c758ea2008-09-25 21:00:45 +000073 if (Attrs & Attribute::Alignment) {
Dale Johannesen11a555e2008-02-19 23:51:49 +000074 Result += "align ";
Nick Lewycky93787d12009-01-11 17:02:06 +000075 Result += utostr(Attribute::getAlignmentFromAttrs(Attrs));
Dale Johannesen11a555e2008-02-19 23:51:49 +000076 Result += " ";
77 }
Dan Gohman1a70bcc2008-08-05 15:51:44 +000078 // Trim the trailing space.
Nick Lewycky8d69f482008-12-19 09:38:31 +000079 assert(!Result.empty() && "Unknown attribute!");
Dan Gohman1a70bcc2008-08-05 15:51:44 +000080 Result.erase(Result.end()-1);
Chris Lattner3e13b8c2008-01-02 23:42:30 +000081 return Result;
82}
83
Devang Patel4c758ea2008-09-25 21:00:45 +000084Attributes Attribute::typeIncompatible(const Type *Ty) {
Devang Patelba3fa6c2008-09-23 23:03:40 +000085 Attributes Incompatible = None;
Chris Lattner8a923e72008-03-12 17:45:29 +000086
87 if (!Ty->isInteger())
88 // Attributes that only apply to integers.
89 Incompatible |= SExt | ZExt;
90
91 if (!isa<PointerType>(Ty))
92 // Attributes that only apply to pointers.
Nick Lewycky8d69f482008-12-19 09:38:31 +000093 Incompatible |= ByVal | Nest | NoAlias | StructRet | NoCapture;
Chris Lattner8a923e72008-03-12 17:45:29 +000094
95 return Incompatible;
Chris Lattner3e13b8c2008-01-02 23:42:30 +000096}
97
Chris Lattner8a923e72008-03-12 17:45:29 +000098//===----------------------------------------------------------------------===//
Devang Patel00095052008-09-24 00:29:49 +000099// AttributeListImpl Definition
Chris Lattner8a923e72008-03-12 17:45:29 +0000100//===----------------------------------------------------------------------===//
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000101
Chris Lattner8a923e72008-03-12 17:45:29 +0000102namespace llvm {
Devang Patel00095052008-09-24 00:29:49 +0000103class AttributeListImpl : public FoldingSetNode {
Owen Andersonc1a3a472009-08-20 19:03:20 +0000104 sys::cas_flag RefCount;
Chris Lattner8a923e72008-03-12 17:45:29 +0000105
Devang Patel4c758ea2008-09-25 21:00:45 +0000106 // AttributesList is uniqued, these should not be publicly available.
Devang Patel00095052008-09-24 00:29:49 +0000107 void operator=(const AttributeListImpl &); // Do not implement
108 AttributeListImpl(const AttributeListImpl &); // Do not implement
109 ~AttributeListImpl(); // Private implementation
Chris Lattner8a923e72008-03-12 17:45:29 +0000110public:
Devang Patel4c758ea2008-09-25 21:00:45 +0000111 SmallVector<AttributeWithIndex, 4> Attrs;
Chris Lattner8a923e72008-03-12 17:45:29 +0000112
Devang Patel4c758ea2008-09-25 21:00:45 +0000113 AttributeListImpl(const AttributeWithIndex *Attr, unsigned NumAttrs)
Chris Lattner8a923e72008-03-12 17:45:29 +0000114 : Attrs(Attr, Attr+NumAttrs) {
115 RefCount = 0;
116 }
117
Owen Andersonc1a3a472009-08-20 19:03:20 +0000118 void AddRef() { sys::AtomicIncrement(&RefCount); }
119 void DropRef() {
120 sys::cas_flag old = sys::AtomicDecrement(&RefCount);
121 if (old == 0) delete this;
122 }
Chris Lattner8a923e72008-03-12 17:45:29 +0000123
124 void Profile(FoldingSetNodeID &ID) const {
Jay Foad7d0479f2009-05-21 09:52:38 +0000125 Profile(ID, Attrs.data(), Attrs.size());
Chris Lattner8a923e72008-03-12 17:45:29 +0000126 }
Devang Patel4c758ea2008-09-25 21:00:45 +0000127 static void Profile(FoldingSetNodeID &ID, const AttributeWithIndex *Attr,
Chris Lattner8a923e72008-03-12 17:45:29 +0000128 unsigned NumAttrs) {
129 for (unsigned i = 0; i != NumAttrs; ++i)
130 ID.AddInteger(uint64_t(Attr[i].Attrs) << 32 | unsigned(Attr[i].Index));
131 }
132};
133}
134
Owen Andersond91e6b02009-08-17 17:10:58 +0000135static ManagedStatic<sys::SmartMutex<true> > ALMutex;
Devang Patel4c758ea2008-09-25 21:00:45 +0000136static ManagedStatic<FoldingSet<AttributeListImpl> > AttributesLists;
Chris Lattner8a923e72008-03-12 17:45:29 +0000137
Devang Patel00095052008-09-24 00:29:49 +0000138AttributeListImpl::~AttributeListImpl() {
Owen Andersond91e6b02009-08-17 17:10:58 +0000139 sys::SmartScopedLock<true> Lock(*ALMutex);
Devang Patel4c758ea2008-09-25 21:00:45 +0000140 AttributesLists->RemoveNode(this);
Chris Lattner8a923e72008-03-12 17:45:29 +0000141}
142
143
Devang Patel4c758ea2008-09-25 21:00:45 +0000144AttrListPtr AttrListPtr::get(const AttributeWithIndex *Attrs, unsigned NumAttrs) {
145 // If there are no attributes then return a null AttributesList pointer.
Chris Lattner8a923e72008-03-12 17:45:29 +0000146 if (NumAttrs == 0)
Devang Patel4c758ea2008-09-25 21:00:45 +0000147 return AttrListPtr();
Chris Lattner8a923e72008-03-12 17:45:29 +0000148
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000149#ifndef NDEBUG
Chris Lattner8a923e72008-03-12 17:45:29 +0000150 for (unsigned i = 0; i != NumAttrs; ++i) {
Devang Patel4c758ea2008-09-25 21:00:45 +0000151 assert(Attrs[i].Attrs != Attribute::None &&
152 "Pointless attribute!");
Chris Lattner8a923e72008-03-12 17:45:29 +0000153 assert((!i || Attrs[i-1].Index < Attrs[i].Index) &&
Devang Patel4c758ea2008-09-25 21:00:45 +0000154 "Misordered AttributesList!");
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000155 }
156#endif
Chris Lattner8a923e72008-03-12 17:45:29 +0000157
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000158 // Otherwise, build a key to look up the existing attributes.
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000159 FoldingSetNodeID ID;
Devang Patel00095052008-09-24 00:29:49 +0000160 AttributeListImpl::Profile(ID, Attrs, NumAttrs);
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000161 void *InsertPos;
Owen Andersond91e6b02009-08-17 17:10:58 +0000162
163 sys::SmartScopedLock<true> Lock(*ALMutex);
164
Devang Patel00095052008-09-24 00:29:49 +0000165 AttributeListImpl *PAL =
Devang Patel4c758ea2008-09-25 21:00:45 +0000166 AttributesLists->FindNodeOrInsertPos(ID, InsertPos);
Chris Lattner8a923e72008-03-12 17:45:29 +0000167
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000168 // If we didn't find any existing attributes of the same shape then
169 // create a new one and insert it.
170 if (!PAL) {
Devang Patel00095052008-09-24 00:29:49 +0000171 PAL = new AttributeListImpl(Attrs, NumAttrs);
Devang Patel4c758ea2008-09-25 21:00:45 +0000172 AttributesLists->InsertNode(PAL, InsertPos);
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000173 }
Chris Lattner8a923e72008-03-12 17:45:29 +0000174
Devang Patel4c758ea2008-09-25 21:00:45 +0000175 // Return the AttributesList that we found or created.
176 return AttrListPtr(PAL);
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000177}
178
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000179
Chris Lattner8a923e72008-03-12 17:45:29 +0000180//===----------------------------------------------------------------------===//
Devang Patel4c758ea2008-09-25 21:00:45 +0000181// AttrListPtr Method Implementations
Chris Lattner8a923e72008-03-12 17:45:29 +0000182//===----------------------------------------------------------------------===//
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000183
Devang Patel4c758ea2008-09-25 21:00:45 +0000184AttrListPtr::AttrListPtr(AttributeListImpl *LI) : AttrList(LI) {
Chris Lattner8a923e72008-03-12 17:45:29 +0000185 if (LI) LI->AddRef();
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000186}
187
Devang Patel4c758ea2008-09-25 21:00:45 +0000188AttrListPtr::AttrListPtr(const AttrListPtr &P) : AttrList(P.AttrList) {
189 if (AttrList) AttrList->AddRef();
Chris Lattner8a923e72008-03-12 17:45:29 +0000190}
191
Devang Patel4c758ea2008-09-25 21:00:45 +0000192const AttrListPtr &AttrListPtr::operator=(const AttrListPtr &RHS) {
193 if (AttrList == RHS.AttrList) return *this;
194 if (AttrList) AttrList->DropRef();
195 AttrList = RHS.AttrList;
196 if (AttrList) AttrList->AddRef();
Chris Lattner8a923e72008-03-12 17:45:29 +0000197 return *this;
198}
199
Devang Patel4c758ea2008-09-25 21:00:45 +0000200AttrListPtr::~AttrListPtr() {
201 if (AttrList) AttrList->DropRef();
Chris Lattner8a923e72008-03-12 17:45:29 +0000202}
203
204/// getNumSlots - Return the number of slots used in this attribute list.
205/// This is the number of arguments that have an attribute set on them
206/// (including the function itself).
Devang Patel4c758ea2008-09-25 21:00:45 +0000207unsigned AttrListPtr::getNumSlots() const {
208 return AttrList ? AttrList->Attrs.size() : 0;
Chris Lattner8a923e72008-03-12 17:45:29 +0000209}
210
Devang Patel4c758ea2008-09-25 21:00:45 +0000211/// getSlot - Return the AttributeWithIndex at the specified slot. This
212/// holds a number plus a set of attributes.
213const AttributeWithIndex &AttrListPtr::getSlot(unsigned Slot) const {
214 assert(AttrList && Slot < AttrList->Attrs.size() && "Slot # out of range!");
215 return AttrList->Attrs[Slot];
Chris Lattner8a923e72008-03-12 17:45:29 +0000216}
217
218
Devang Patel4c758ea2008-09-25 21:00:45 +0000219/// getAttributes - The attributes for the specified index are
220/// returned. Attributes for the result are denoted with Idx = 0.
Devang Patel82fed672008-09-23 22:35:17 +0000221/// Function notes are denoted with idx = ~0.
Devang Patel4c758ea2008-09-25 21:00:45 +0000222Attributes AttrListPtr::getAttributes(unsigned Idx) const {
223 if (AttrList == 0) return Attribute::None;
Chris Lattner8a923e72008-03-12 17:45:29 +0000224
Devang Patel4c758ea2008-09-25 21:00:45 +0000225 const SmallVector<AttributeWithIndex, 4> &Attrs = AttrList->Attrs;
Chris Lattner8a923e72008-03-12 17:45:29 +0000226 for (unsigned i = 0, e = Attrs.size(); i != e && Attrs[i].Index <= Idx; ++i)
227 if (Attrs[i].Index == Idx)
228 return Attrs[i].Attrs;
Devang Patel4c758ea2008-09-25 21:00:45 +0000229 return Attribute::None;
Chris Lattner8a923e72008-03-12 17:45:29 +0000230}
231
232/// hasAttrSomewhere - Return true if the specified attribute is set for at
233/// least one parameter or for the return value.
Devang Patel4c758ea2008-09-25 21:00:45 +0000234bool AttrListPtr::hasAttrSomewhere(Attributes Attr) const {
235 if (AttrList == 0) return false;
Chris Lattner8a923e72008-03-12 17:45:29 +0000236
Devang Patel4c758ea2008-09-25 21:00:45 +0000237 const SmallVector<AttributeWithIndex, 4> &Attrs = AttrList->Attrs;
Chris Lattner8a923e72008-03-12 17:45:29 +0000238 for (unsigned i = 0, e = Attrs.size(); i != e; ++i)
239 if (Attrs[i].Attrs & Attr)
240 return true;
241 return false;
242}
243
244
Devang Patel4c758ea2008-09-25 21:00:45 +0000245AttrListPtr AttrListPtr::addAttr(unsigned Idx, Attributes Attrs) const {
246 Attributes OldAttrs = getAttributes(Idx);
Dale Johannesen11a555e2008-02-19 23:51:49 +0000247#ifndef NDEBUG
248 // FIXME it is not obvious how this should work for alignment.
249 // For now, say we can't change a known alignment.
Devang Patel4c758ea2008-09-25 21:00:45 +0000250 Attributes OldAlign = OldAttrs & Attribute::Alignment;
251 Attributes NewAlign = Attrs & Attribute::Alignment;
Anton Korobeynikov18991d72008-02-20 12:07:57 +0000252 assert((!OldAlign || !NewAlign || OldAlign == NewAlign) &&
Dale Johannesen11a555e2008-02-19 23:51:49 +0000253 "Attempt to change alignment!");
254#endif
Chris Lattner8a923e72008-03-12 17:45:29 +0000255
Devang Patelba3fa6c2008-09-23 23:03:40 +0000256 Attributes NewAttrs = OldAttrs | Attrs;
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000257 if (NewAttrs == OldAttrs)
Chris Lattner8a923e72008-03-12 17:45:29 +0000258 return *this;
259
Devang Patel4c758ea2008-09-25 21:00:45 +0000260 SmallVector<AttributeWithIndex, 8> NewAttrList;
261 if (AttrList == 0)
262 NewAttrList.push_back(AttributeWithIndex::get(Idx, Attrs));
Chris Lattner8a923e72008-03-12 17:45:29 +0000263 else {
Devang Patel4c758ea2008-09-25 21:00:45 +0000264 const SmallVector<AttributeWithIndex, 4> &OldAttrList = AttrList->Attrs;
Chris Lattner8a923e72008-03-12 17:45:29 +0000265 unsigned i = 0, e = OldAttrList.size();
266 // Copy attributes for arguments before this one.
267 for (; i != e && OldAttrList[i].Index < Idx; ++i)
268 NewAttrList.push_back(OldAttrList[i]);
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000269
Chris Lattner8a923e72008-03-12 17:45:29 +0000270 // If there are attributes already at this index, merge them in.
271 if (i != e && OldAttrList[i].Index == Idx) {
272 Attrs |= OldAttrList[i].Attrs;
273 ++i;
274 }
275
Devang Patel4c758ea2008-09-25 21:00:45 +0000276 NewAttrList.push_back(AttributeWithIndex::get(Idx, Attrs));
Chris Lattner8a923e72008-03-12 17:45:29 +0000277
278 // Copy attributes for arguments after this one.
279 NewAttrList.insert(NewAttrList.end(),
280 OldAttrList.begin()+i, OldAttrList.end());
281 }
282
Jay Foad7d0479f2009-05-21 09:52:38 +0000283 return get(NewAttrList.data(), NewAttrList.size());
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000284}
285
Devang Patel4c758ea2008-09-25 21:00:45 +0000286AttrListPtr AttrListPtr::removeAttr(unsigned Idx, Attributes Attrs) const {
Dale Johannesen11a555e2008-02-19 23:51:49 +0000287#ifndef NDEBUG
288 // FIXME it is not obvious how this should work for alignment.
289 // For now, say we can't pass in alignment, which no current use does.
Devang Patel4c758ea2008-09-25 21:00:45 +0000290 assert(!(Attrs & Attribute::Alignment) && "Attempt to exclude alignment!");
Dale Johannesen11a555e2008-02-19 23:51:49 +0000291#endif
Devang Patel4c758ea2008-09-25 21:00:45 +0000292 if (AttrList == 0) return AttrListPtr();
Chris Lattner8a923e72008-03-12 17:45:29 +0000293
Devang Patel4c758ea2008-09-25 21:00:45 +0000294 Attributes OldAttrs = getAttributes(Idx);
Devang Patelba3fa6c2008-09-23 23:03:40 +0000295 Attributes NewAttrs = OldAttrs & ~Attrs;
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000296 if (NewAttrs == OldAttrs)
Chris Lattner8a923e72008-03-12 17:45:29 +0000297 return *this;
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000298
Devang Patel4c758ea2008-09-25 21:00:45 +0000299 SmallVector<AttributeWithIndex, 8> NewAttrList;
300 const SmallVector<AttributeWithIndex, 4> &OldAttrList = AttrList->Attrs;
Chris Lattner8a923e72008-03-12 17:45:29 +0000301 unsigned i = 0, e = OldAttrList.size();
302
303 // Copy attributes for arguments before this one.
304 for (; i != e && OldAttrList[i].Index < Idx; ++i)
305 NewAttrList.push_back(OldAttrList[i]);
306
307 // If there are attributes already at this index, merge them in.
308 assert(OldAttrList[i].Index == Idx && "Attribute isn't set?");
309 Attrs = OldAttrList[i].Attrs & ~Attrs;
310 ++i;
311 if (Attrs) // If any attributes left for this parameter, add them.
Devang Patel4c758ea2008-09-25 21:00:45 +0000312 NewAttrList.push_back(AttributeWithIndex::get(Idx, Attrs));
Chris Lattner8a923e72008-03-12 17:45:29 +0000313
314 // Copy attributes for arguments after this one.
315 NewAttrList.insert(NewAttrList.end(),
316 OldAttrList.begin()+i, OldAttrList.end());
317
Jay Foad7d0479f2009-05-21 09:52:38 +0000318 return get(NewAttrList.data(), NewAttrList.size());
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000319}
320
Devang Patel4c758ea2008-09-25 21:00:45 +0000321void AttrListPtr::dump() const {
David Greenef7014732010-01-05 01:29:58 +0000322 dbgs() << "PAL[ ";
Chris Lattner8a923e72008-03-12 17:45:29 +0000323 for (unsigned i = 0; i < getNumSlots(); ++i) {
Devang Patel4c758ea2008-09-25 21:00:45 +0000324 const AttributeWithIndex &PAWI = getSlot(i);
David Greenef7014732010-01-05 01:29:58 +0000325 dbgs() << "{" << PAWI.Index << "," << PAWI.Attrs << "} ";
Chris Lattner8a923e72008-03-12 17:45:29 +0000326 }
327
David Greenef7014732010-01-05 01:29:58 +0000328 dbgs() << "]\n";
Duncan Sands404eb052008-01-06 18:27:01 +0000329}