blob: e8c6b2a01c8200fac3b0145bbc83b35486c2c7d9 [file] [log] [blame]
Bill Wendling3d7b0b82012-12-19 07:18:57 +00001//===-- Attribute.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//
Bill Wendling3d7b0b82012-12-19 07:18:57 +000010// This file implements the Attribute, AttributeImpl, AttrBuilder,
Bill Wendling6848e382012-12-19 22:42:22 +000011// AttributeSetImpl, and AttributeSet classes.
Chris Lattner3e13b8c2008-01-02 23:42:30 +000012//
13//===----------------------------------------------------------------------===//
14
Devang Patelba3fa6c2008-09-23 23:03:40 +000015#include "llvm/Attributes.h"
Bill Wendling4607f4b2012-12-20 01:36:59 +000016#include "AttributeImpl.h"
Bill Wendlinge38b8042012-09-26 21:07:29 +000017#include "LLVMContextImpl.h"
Chris Lattner8a923e72008-03-12 17:45:29 +000018#include "llvm/ADT/FoldingSet.h"
Chandler Carruthed0881b2012-12-03 16:50:05 +000019#include "llvm/ADT/StringExtras.h"
Michael J. Spencer447762d2010-11-29 18:16:10 +000020#include "llvm/Support/Atomic.h"
David Greenef7014732010-01-05 01:29:58 +000021#include "llvm/Support/Debug.h"
Chris Lattner3e13b8c2008-01-02 23:42:30 +000022#include "llvm/Support/ManagedStatic.h"
Chandler Carruthed0881b2012-12-03 16:50:05 +000023#include "llvm/Support/Mutex.h"
Benjamin Kramer1a25d732009-08-23 11:37:21 +000024#include "llvm/Support/raw_ostream.h"
Chandler Carruthed0881b2012-12-03 16:50:05 +000025#include "llvm/Type.h"
Chris Lattner3e13b8c2008-01-02 23:42:30 +000026using namespace llvm;
27
Chris Lattner8a923e72008-03-12 17:45:29 +000028//===----------------------------------------------------------------------===//
Bill Wendling3d7b0b82012-12-19 07:18:57 +000029// Attribute Implementation
Chris Lattner8a923e72008-03-12 17:45:29 +000030//===----------------------------------------------------------------------===//
Chris Lattnerd0e1f102008-01-03 00:10:22 +000031
Bill Wendlingc79e42c2012-12-22 00:37:52 +000032Attribute Attribute::get(LLVMContext &Context, ArrayRef<AttrKind> Vals) {
Bill Wendling50d27842012-10-15 20:35:56 +000033 AttrBuilder B;
Bill Wendlingc79e42c2012-12-22 00:37:52 +000034 for (ArrayRef<AttrKind>::iterator I = Vals.begin(), E = Vals.end();
Bill Wendlingd079a442012-10-15 04:46:55 +000035 I != E; ++I)
36 B.addAttribute(*I);
Bill Wendling3d7b0b82012-12-19 07:18:57 +000037 return Attribute::get(Context, B);
Bill Wendlingd079a442012-10-15 04:46:55 +000038}
Bill Wendling73ea2de2012-10-08 21:47:17 +000039
Bill Wendling3d7b0b82012-12-19 07:18:57 +000040Attribute Attribute::get(LLVMContext &Context, AttrBuilder &B) {
41 // If there are no attributes, return an empty Attribute class.
Bill Wendling3ffbac42012-10-16 05:55:09 +000042 if (!B.hasAttributes())
Bill Wendling3d7b0b82012-12-19 07:18:57 +000043 return Attribute();
Bill Wendling73ea2de2012-10-08 21:47:17 +000044
45 // Otherwise, build a key to look up the existing attributes.
46 LLVMContextImpl *pImpl = Context.pImpl;
47 FoldingSetNodeID ID;
Bill Wendling3e4c4c92012-12-30 01:05:42 +000048 ID.AddInteger(B.getBitMask());
Bill Wendling73ea2de2012-10-08 21:47:17 +000049
50 void *InsertPoint;
Bill Wendling4607f4b2012-12-20 01:36:59 +000051 AttributeImpl *PA = pImpl->AttrsSet.FindNodeOrInsertPos(ID, InsertPoint);
Bill Wendling73ea2de2012-10-08 21:47:17 +000052
53 if (!PA) {
54 // If we didn't find any existing attributes of the same shape then create a
55 // new one and insert it.
Bill Wendling3e4c4c92012-12-30 01:05:42 +000056 PA = new AttributeImpl(Context, B.getBitMask());
Bill Wendling73ea2de2012-10-08 21:47:17 +000057 pImpl->AttrsSet.InsertNode(PA, InsertPoint);
58 }
59
60 // Return the AttributesList that we found or created.
Bill Wendling3d7b0b82012-12-19 07:18:57 +000061 return Attribute(PA);
Bill Wendling73ea2de2012-10-08 21:47:17 +000062}
63
Bill Wendlingc79e42c2012-12-22 00:37:52 +000064bool Attribute::hasAttribute(AttrKind Val) const {
Bill Wendling66e978f2012-12-20 21:28:43 +000065 return pImpl && pImpl->hasAttribute(Val);
Bill Wendlingabf3feb2012-10-05 06:44:41 +000066}
67
Bill Wendling3d7b0b82012-12-19 07:18:57 +000068bool Attribute::hasAttributes() const {
Bill Wendling66e978f2012-12-20 21:28:43 +000069 return pImpl && pImpl->hasAttributes();
Bill Wendling8c3e65d2012-10-15 05:40:12 +000070}
71
Bill Wendling3d7b0b82012-12-19 07:18:57 +000072bool Attribute::hasAttributes(const Attribute &A) const {
Bill Wendling66e978f2012-12-20 21:28:43 +000073 return pImpl && pImpl->hasAttributes(A);
Bill Wendling93f70b72012-10-09 09:11:20 +000074}
75
Bill Wendlingabf3feb2012-10-05 06:44:41 +000076/// This returns the alignment field of an attribute as a byte alignment value.
Bill Wendling3d7b0b82012-12-19 07:18:57 +000077unsigned Attribute::getAlignment() const {
78 if (!hasAttribute(Attribute::Alignment))
Bill Wendlingb3723342012-10-09 20:56:48 +000079 return 0;
Bill Wendling66e978f2012-12-20 21:28:43 +000080 return 1U << ((pImpl->getAlignment() >> 16) - 1);
Bill Wendlingabf3feb2012-10-05 06:44:41 +000081}
82
83/// This returns the stack alignment field of an attribute as a byte alignment
84/// value.
Bill Wendling3d7b0b82012-12-19 07:18:57 +000085unsigned Attribute::getStackAlignment() const {
86 if (!hasAttribute(Attribute::StackAlignment))
Bill Wendlingb3723342012-10-09 20:56:48 +000087 return 0;
Bill Wendling66e978f2012-12-20 21:28:43 +000088 return 1U << ((pImpl->getStackAlignment() >> 26) - 1);
Bill Wendlingabf3feb2012-10-05 06:44:41 +000089}
90
Bill Wendling3e4c4c92012-12-30 01:05:42 +000091uint64_t Attribute::getBitMask() const {
92 return pImpl ? pImpl->getBitMask() : 0;
Bill Wendlingbe7c6f22012-10-07 08:55:05 +000093}
94
Bill Wendling3d7b0b82012-12-19 07:18:57 +000095Attribute Attribute::typeIncompatible(Type *Ty) {
Bill Wendling50d27842012-10-15 20:35:56 +000096 AttrBuilder Incompatible;
Bill Wendlinga529ade2012-10-16 06:01:44 +000097
Bill Wendling7c04e042012-10-09 19:01:18 +000098 if (!Ty->isIntegerTy())
Bill Wendling3d7b0b82012-12-19 07:18:57 +000099 // Attribute that only apply to integers.
100 Incompatible.addAttribute(Attribute::SExt)
101 .addAttribute(Attribute::ZExt);
Bill Wendlinga529ade2012-10-16 06:01:44 +0000102
Bill Wendling7c04e042012-10-09 19:01:18 +0000103 if (!Ty->isPointerTy())
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000104 // Attribute that only apply to pointers.
105 Incompatible.addAttribute(Attribute::ByVal)
106 .addAttribute(Attribute::Nest)
107 .addAttribute(Attribute::NoAlias)
108 .addAttribute(Attribute::NoCapture)
109 .addAttribute(Attribute::StructRet);
Bill Wendlinga529ade2012-10-16 06:01:44 +0000110
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000111 return Attribute::get(Ty->getContext(), Incompatible);
Bill Wendlingabf3feb2012-10-05 06:44:41 +0000112}
113
Bill Wendling50d27842012-10-15 20:35:56 +0000114/// encodeLLVMAttributesForBitcode - This returns an integer containing an
115/// encoding of all the LLVM attributes found in the given attribute bitset.
116/// Any change to this encoding is a breaking change to bitcode compatibility.
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000117uint64_t Attribute::encodeLLVMAttributesForBitcode(Attribute Attrs) {
Bill Wendling50d27842012-10-15 20:35:56 +0000118 // FIXME: It doesn't make sense to store the alignment information as an
119 // expanded out value, we should store it as a log2 value. However, we can't
120 // just change that here without breaking bitcode compatibility. If this ever
121 // becomes a problem in practice, we should introduce new tag numbers in the
122 // bitcode file and have those tags use a more efficiently encoded alignment
123 // field.
124
125 // Store the alignment in the bitcode as a 16-bit raw value instead of a 5-bit
126 // log2 encoded value. Shift the bits above the alignment up by 11 bits.
Bill Wendling3e4c4c92012-12-30 01:05:42 +0000127 uint64_t EncodedAttrs = Attrs.getBitMask() & 0xffff;
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000128 if (Attrs.hasAttribute(Attribute::Alignment))
Bill Wendling50d27842012-10-15 20:35:56 +0000129 EncodedAttrs |= Attrs.getAlignment() << 16;
Bill Wendling3e4c4c92012-12-30 01:05:42 +0000130 EncodedAttrs |= (Attrs.getBitMask() & (0xffffULL << 21)) << 11;
Bill Wendling50d27842012-10-15 20:35:56 +0000131 return EncodedAttrs;
132}
133
134/// decodeLLVMAttributesForBitcode - This returns an attribute bitset containing
135/// the LLVM attributes that have been decoded from the given integer. This
136/// function must stay in sync with 'encodeLLVMAttributesForBitcode'.
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000137Attribute Attribute::decodeLLVMAttributesForBitcode(LLVMContext &C,
Bill Wendling50d27842012-10-15 20:35:56 +0000138 uint64_t EncodedAttrs) {
139 // The alignment is stored as a 16-bit raw value from bits 31--16. We shift
140 // the bits above 31 down by 11 bits.
141 unsigned Alignment = (EncodedAttrs & (0xffffULL << 16)) >> 16;
142 assert((!Alignment || isPowerOf2_32(Alignment)) &&
143 "Alignment must be a power of two.");
144
145 AttrBuilder B(EncodedAttrs & 0xffff);
146 if (Alignment)
147 B.addAlignmentAttr(Alignment);
Nadav Rotemdbf47832012-10-22 17:33:31 +0000148 B.addRawValue((EncodedAttrs & (0xffffULL << 32)) >> 11);
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000149 return Attribute::get(C, B);
Bill Wendling50d27842012-10-15 20:35:56 +0000150}
151
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000152std::string Attribute::getAsString() const {
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000153 std::string Result;
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000154 if (hasAttribute(Attribute::ZExt))
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000155 Result += "zeroext ";
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000156 if (hasAttribute(Attribute::SExt))
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000157 Result += "signext ";
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000158 if (hasAttribute(Attribute::NoReturn))
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000159 Result += "noreturn ";
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000160 if (hasAttribute(Attribute::NoUnwind))
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000161 Result += "nounwind ";
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000162 if (hasAttribute(Attribute::UWTable))
Rafael Espindolafc9bae62011-05-25 03:44:17 +0000163 Result += "uwtable ";
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000164 if (hasAttribute(Attribute::ReturnsTwice))
Rafael Espindolacc349c82011-10-03 14:45:37 +0000165 Result += "returns_twice ";
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000166 if (hasAttribute(Attribute::InReg))
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000167 Result += "inreg ";
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000168 if (hasAttribute(Attribute::NoAlias))
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000169 Result += "noalias ";
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000170 if (hasAttribute(Attribute::NoCapture))
Nick Lewycky8d69f482008-12-19 09:38:31 +0000171 Result += "nocapture ";
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000172 if (hasAttribute(Attribute::StructRet))
Anton Korobeynikovc8ce7b082009-07-17 18:07:26 +0000173 Result += "sret ";
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000174 if (hasAttribute(Attribute::ByVal))
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000175 Result += "byval ";
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000176 if (hasAttribute(Attribute::Nest))
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000177 Result += "nest ";
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000178 if (hasAttribute(Attribute::ReadNone))
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000179 Result += "readnone ";
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000180 if (hasAttribute(Attribute::ReadOnly))
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000181 Result += "readonly ";
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000182 if (hasAttribute(Attribute::OptimizeForSize))
Devang Patela05633e2008-09-26 22:53:05 +0000183 Result += "optsize ";
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000184 if (hasAttribute(Attribute::NoInline))
Devang Patela05633e2008-09-26 22:53:05 +0000185 Result += "noinline ";
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000186 if (hasAttribute(Attribute::InlineHint))
Jakob Stoklund Olesen74bb06c2010-02-06 01:16:28 +0000187 Result += "inlinehint ";
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000188 if (hasAttribute(Attribute::AlwaysInline))
Devang Patela05633e2008-09-26 22:53:05 +0000189 Result += "alwaysinline ";
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000190 if (hasAttribute(Attribute::StackProtect))
Bill Wendlingccb67a3d2008-11-13 01:02:14 +0000191 Result += "ssp ";
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000192 if (hasAttribute(Attribute::StackProtectReq))
Bill Wendlingccb67a3d2008-11-13 01:02:14 +0000193 Result += "sspreq ";
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000194 if (hasAttribute(Attribute::NoRedZone))
Devang Patel72a4d2f2009-06-04 22:05:33 +0000195 Result += "noredzone ";
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000196 if (hasAttribute(Attribute::NoImplicitFloat))
Devang Pateld1c7d342009-06-05 21:57:13 +0000197 Result += "noimplicitfloat ";
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000198 if (hasAttribute(Attribute::Naked))
Anton Korobeynikovc8ce7b082009-07-17 18:07:26 +0000199 Result += "naked ";
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000200 if (hasAttribute(Attribute::NonLazyBind))
John McCall4b7a8d62011-06-15 20:36:13 +0000201 Result += "nonlazybind ";
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000202 if (hasAttribute(Attribute::AddressSafety))
Kostya Serebryanya5054ad2012-01-20 17:56:17 +0000203 Result += "address_safety ";
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000204 if (hasAttribute(Attribute::MinSize))
Quentin Colombet5799e9f2012-10-30 16:32:52 +0000205 Result += "minsize ";
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000206 if (hasAttribute(Attribute::StackAlignment)) {
Charles Davisbe5557e2010-02-12 00:31:15 +0000207 Result += "alignstack(";
Bill Wendling9be77592012-09-21 15:26:31 +0000208 Result += utostr(getStackAlignment());
Charles Davisbe5557e2010-02-12 00:31:15 +0000209 Result += ") ";
210 }
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000211 if (hasAttribute(Attribute::Alignment)) {
Dale Johannesen11a555e2008-02-19 23:51:49 +0000212 Result += "align ";
Bill Wendling9be77592012-09-21 15:26:31 +0000213 Result += utostr(getAlignment());
Dale Johannesen11a555e2008-02-19 23:51:49 +0000214 Result += " ";
215 }
James Molloy4f6fb952012-12-20 16:04:27 +0000216 if (hasAttribute(Attribute::NoDuplicate))
217 Result += "noduplicate ";
Dan Gohman1a70bcc2008-08-05 15:51:44 +0000218 // Trim the trailing space.
Nick Lewycky8d69f482008-12-19 09:38:31 +0000219 assert(!Result.empty() && "Unknown attribute!");
Dan Gohman1a70bcc2008-08-05 15:51:44 +0000220 Result.erase(Result.end()-1);
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000221 return Result;
222}
223
Bill Wendlingabf3feb2012-10-05 06:44:41 +0000224//===----------------------------------------------------------------------===//
Bill Wendling50d27842012-10-15 20:35:56 +0000225// AttrBuilder Implementation
Bill Wendlingabf3feb2012-10-05 06:44:41 +0000226//===----------------------------------------------------------------------===//
227
Bill Wendlingc79e42c2012-12-22 00:37:52 +0000228AttrBuilder &AttrBuilder::addAttribute(Attribute::AttrKind Val){
Bill Wendling4607f4b2012-12-20 01:36:59 +0000229 Bits |= AttributeImpl::getAttrMask(Val);
Bill Wendling7c04e042012-10-09 19:01:18 +0000230 return *this;
Bill Wendlingabf3feb2012-10-05 06:44:41 +0000231}
232
Bill Wendling50d27842012-10-15 20:35:56 +0000233AttrBuilder &AttrBuilder::addRawValue(uint64_t Val) {
Bill Wendling1fcc8222012-10-14 04:10:01 +0000234 Bits |= Val;
235 return *this;
236}
237
Bill Wendling50d27842012-10-15 20:35:56 +0000238AttrBuilder &AttrBuilder::addAlignmentAttr(unsigned Align) {
Bill Wendlingabd5ba22012-10-14 03:58:29 +0000239 if (Align == 0) return *this;
Bill Wendlingabf3feb2012-10-05 06:44:41 +0000240 assert(isPowerOf2_32(Align) && "Alignment must be a power of two.");
241 assert(Align <= 0x40000000 && "Alignment too large.");
242 Bits |= (Log2_32(Align) + 1) << 16;
Bill Wendlingabd5ba22012-10-14 03:58:29 +0000243 return *this;
Bill Wendlingabf3feb2012-10-05 06:44:41 +0000244}
Bill Wendling50d27842012-10-15 20:35:56 +0000245AttrBuilder &AttrBuilder::addStackAlignmentAttr(unsigned Align){
Bill Wendlingabf3feb2012-10-05 06:44:41 +0000246 // Default alignment, allow the target to define how to align it.
Bill Wendlingabd5ba22012-10-14 03:58:29 +0000247 if (Align == 0) return *this;
Bill Wendlingabf3feb2012-10-05 06:44:41 +0000248 assert(isPowerOf2_32(Align) && "Alignment must be a power of two.");
249 assert(Align <= 0x100 && "Alignment too large.");
250 Bits |= (Log2_32(Align) + 1) << 26;
Bill Wendlingabd5ba22012-10-14 03:58:29 +0000251 return *this;
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000252}
253
Bill Wendlingc79e42c2012-12-22 00:37:52 +0000254AttrBuilder &AttrBuilder::removeAttribute(Attribute::AttrKind Val) {
Bill Wendling4607f4b2012-12-20 01:36:59 +0000255 Bits &= ~AttributeImpl::getAttrMask(Val);
Bill Wendling7c04e042012-10-09 19:01:18 +0000256 return *this;
Bill Wendling93f70b72012-10-09 09:11:20 +0000257}
258
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000259AttrBuilder &AttrBuilder::addAttributes(const Attribute &A) {
Bill Wendling3e4c4c92012-12-30 01:05:42 +0000260 Bits |= A.getBitMask();
Bill Wendling5c407ed2012-10-14 07:17:34 +0000261 return *this;
262}
263
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000264AttrBuilder &AttrBuilder::removeAttributes(const Attribute &A){
Bill Wendling3e4c4c92012-12-30 01:05:42 +0000265 Bits &= ~A.getBitMask();
Bill Wendling85a64c22012-10-14 06:39:53 +0000266 return *this;
Bill Wendling70f39172012-10-09 00:01:21 +0000267}
268
Bill Wendling61902542012-12-30 09:17:46 +0000269bool AttrBuilder::contains(Attribute::AttrKind A) const {
Bill Wendling4607f4b2012-12-20 01:36:59 +0000270 return Bits & AttributeImpl::getAttrMask(A);
Bill Wendlingbbcdf4e2012-10-10 07:36:45 +0000271}
272
Bill Wendling50d27842012-10-15 20:35:56 +0000273bool AttrBuilder::hasAttributes() const {
Bill Wendlingc6daefa2012-10-08 23:27:46 +0000274 return Bits != 0;
275}
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000276bool AttrBuilder::hasAttributes(const Attribute &A) const {
Bill Wendling3e4c4c92012-12-30 01:05:42 +0000277 return Bits & A.getBitMask();
Bill Wendling70f39172012-10-09 00:01:21 +0000278}
Bill Wendling50d27842012-10-15 20:35:56 +0000279bool AttrBuilder::hasAlignmentAttr() const {
Bill Wendling4607f4b2012-12-20 01:36:59 +0000280 return Bits & AttributeImpl::getAttrMask(Attribute::Alignment);
Bill Wendlingc6daefa2012-10-08 23:27:46 +0000281}
282
Bill Wendling50d27842012-10-15 20:35:56 +0000283uint64_t AttrBuilder::getAlignment() const {
Bill Wendlingb3723342012-10-09 20:56:48 +0000284 if (!hasAlignmentAttr())
285 return 0;
NAKAMURA Takumib54ac212012-11-19 10:03:09 +0000286 return 1ULL <<
Bill Wendling4607f4b2012-12-20 01:36:59 +0000287 (((Bits & AttributeImpl::getAttrMask(Attribute::Alignment)) >> 16) - 1);
Bill Wendlingc6daefa2012-10-08 23:27:46 +0000288}
289
Bill Wendling50d27842012-10-15 20:35:56 +0000290uint64_t AttrBuilder::getStackAlignment() const {
Bill Wendlingbbcdf4e2012-10-10 07:36:45 +0000291 if (!hasAlignmentAttr())
292 return 0;
NAKAMURA Takumib54ac212012-11-19 10:03:09 +0000293 return 1ULL <<
Bill Wendling4607f4b2012-12-20 01:36:59 +0000294 (((Bits & AttributeImpl::getAttrMask(Attribute::StackAlignment))>>26)-1);
Bill Wendlingbbcdf4e2012-10-10 07:36:45 +0000295}
296
Chris Lattner8a923e72008-03-12 17:45:29 +0000297//===----------------------------------------------------------------------===//
Bill Wendlinge38b8042012-09-26 21:07:29 +0000298// AttributeImpl Definition
299//===----------------------------------------------------------------------===//
300
Bill Wendling0cd0f7f2012-12-29 12:29:38 +0000301AttributeImpl::AttributeImpl(LLVMContext &C, uint64_t data) {
302 Data = ConstantInt::get(Type::getInt64Ty(C), data);
303}
Bill Wendling3a554ac2012-12-30 02:22:16 +0000304AttributeImpl::AttributeImpl(LLVMContext &C, Attribute::AttrKind data) {
305 Data = ConstantInt::get(Type::getInt64Ty(C), data);
306}
307AttributeImpl::AttributeImpl(LLVMContext &C, Attribute::AttrKind data,
308 ArrayRef<Constant*> values) {
309 Data = ConstantInt::get(Type::getInt64Ty(C), data);
310 Vals.reserve(values.size());
311 Vals.append(values.begin(), values.end());
312}
313AttributeImpl::AttributeImpl(LLVMContext &C, StringRef data) {
314 Data = ConstantDataArray::getString(C, data);
315}
Bill Wendling0cd0f7f2012-12-29 12:29:38 +0000316
Bill Wendlingb1d12612012-12-30 01:38:39 +0000317bool AttributeImpl::contains(Attribute::AttrKind Kind) const {
318 if (ConstantInt *CI = dyn_cast<ConstantInt>(Data))
319 return CI->getZExtValue() == Kind;
320 return false;
321}
322
323bool AttributeImpl::contains(StringRef Kind) const {
324 if (ConstantDataArray *CDA = dyn_cast<ConstantDataArray>(Data))
325 if (CDA->isString())
326 return CDA->getAsString() == Kind;
327 return false;
328}
329
Bill Wendling3e4c4c92012-12-30 01:05:42 +0000330uint64_t AttributeImpl::getBitMask() const {
Bill Wendlingb1d12612012-12-30 01:38:39 +0000331 // FIXME: Remove this.
Bill Wendling0cd0f7f2012-12-29 12:29:38 +0000332 return cast<ConstantInt>(Data)->getZExtValue();
333}
334
Bill Wendling4607f4b2012-12-20 01:36:59 +0000335uint64_t AttributeImpl::getAttrMask(uint64_t Val) {
Bill Wendlingc9b22d72012-10-09 07:45:08 +0000336 switch (Val) {
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000337 case Attribute::None: return 0;
338 case Attribute::ZExt: return 1 << 0;
339 case Attribute::SExt: return 1 << 1;
340 case Attribute::NoReturn: return 1 << 2;
341 case Attribute::InReg: return 1 << 3;
342 case Attribute::StructRet: return 1 << 4;
343 case Attribute::NoUnwind: return 1 << 5;
344 case Attribute::NoAlias: return 1 << 6;
345 case Attribute::ByVal: return 1 << 7;
346 case Attribute::Nest: return 1 << 8;
347 case Attribute::ReadNone: return 1 << 9;
348 case Attribute::ReadOnly: return 1 << 10;
349 case Attribute::NoInline: return 1 << 11;
350 case Attribute::AlwaysInline: return 1 << 12;
351 case Attribute::OptimizeForSize: return 1 << 13;
352 case Attribute::StackProtect: return 1 << 14;
353 case Attribute::StackProtectReq: return 1 << 15;
354 case Attribute::Alignment: return 31 << 16;
355 case Attribute::NoCapture: return 1 << 21;
356 case Attribute::NoRedZone: return 1 << 22;
357 case Attribute::NoImplicitFloat: return 1 << 23;
358 case Attribute::Naked: return 1 << 24;
359 case Attribute::InlineHint: return 1 << 25;
360 case Attribute::StackAlignment: return 7 << 26;
361 case Attribute::ReturnsTwice: return 1 << 29;
362 case Attribute::UWTable: return 1 << 30;
363 case Attribute::NonLazyBind: return 1U << 31;
364 case Attribute::AddressSafety: return 1ULL << 32;
365 case Attribute::MinSize: return 1ULL << 33;
James Molloy4f6fb952012-12-20 16:04:27 +0000366 case Attribute::NoDuplicate: return 1ULL << 34;
Bill Wendlingc9b22d72012-10-09 07:45:08 +0000367 }
368 llvm_unreachable("Unsupported attribute type");
369}
370
Bill Wendling4607f4b2012-12-20 01:36:59 +0000371bool AttributeImpl::hasAttribute(uint64_t A) const {
Bill Wendling3e4c4c92012-12-30 01:05:42 +0000372 return (getBitMask() & getAttrMask(A)) != 0;
Bill Wendling73ea2de2012-10-08 21:47:17 +0000373}
Bill Wendlinge38b8042012-09-26 21:07:29 +0000374
Bill Wendling4607f4b2012-12-20 01:36:59 +0000375bool AttributeImpl::hasAttributes() const {
Bill Wendling3e4c4c92012-12-30 01:05:42 +0000376 return getBitMask() != 0;
Bill Wendling73ea2de2012-10-08 21:47:17 +0000377}
Bill Wendlinge38b8042012-09-26 21:07:29 +0000378
Bill Wendling4607f4b2012-12-20 01:36:59 +0000379bool AttributeImpl::hasAttributes(const Attribute &A) const {
Bill Wendling3e4c4c92012-12-30 01:05:42 +0000380 // FIXME: getBitMask() won't work here in the future.
381 return getBitMask() & A.getBitMask();
Bill Wendling73ea2de2012-10-08 21:47:17 +0000382}
Bill Wendlinge38b8042012-09-26 21:07:29 +0000383
Bill Wendling4607f4b2012-12-20 01:36:59 +0000384uint64_t AttributeImpl::getAlignment() const {
Bill Wendling3e4c4c92012-12-30 01:05:42 +0000385 return getBitMask() & getAttrMask(Attribute::Alignment);
Bill Wendling73ea2de2012-10-08 21:47:17 +0000386}
Bill Wendlinge38b8042012-09-26 21:07:29 +0000387
Bill Wendling4607f4b2012-12-20 01:36:59 +0000388uint64_t AttributeImpl::getStackAlignment() const {
Bill Wendling3e4c4c92012-12-30 01:05:42 +0000389 return getBitMask() & getAttrMask(Attribute::StackAlignment);
Bill Wendling73ea2de2012-10-08 21:47:17 +0000390}
Bill Wendlinge38b8042012-09-26 21:07:29 +0000391
Bill Wendlinge38b8042012-09-26 21:07:29 +0000392//===----------------------------------------------------------------------===//
Bill Wendling6848e382012-12-19 22:42:22 +0000393// AttributeSetImpl Definition
Chris Lattner8a923e72008-03-12 17:45:29 +0000394//===----------------------------------------------------------------------===//
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000395
Bill Wendlinge94d8432012-12-07 23:16:57 +0000396AttributeSet AttributeSet::get(LLVMContext &C,
Bill Wendling623d8ce2012-12-12 19:21:53 +0000397 ArrayRef<AttributeWithIndex> Attrs) {
Devang Patel4c758ea2008-09-25 21:00:45 +0000398 // If there are no attributes then return a null AttributesList pointer.
Chris Lattner3cb6f832012-05-28 01:47:44 +0000399 if (Attrs.empty())
Bill Wendlinge94d8432012-12-07 23:16:57 +0000400 return AttributeSet();
Bill Wendlinga529ade2012-10-16 06:01:44 +0000401
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000402#ifndef NDEBUG
Chris Lattner3cb6f832012-05-28 01:47:44 +0000403 for (unsigned i = 0, e = Attrs.size(); i != e; ++i) {
Bill Wendlinga529ade2012-10-16 06:01:44 +0000404 assert(Attrs[i].Attrs.hasAttributes() &&
Devang Patel4c758ea2008-09-25 21:00:45 +0000405 "Pointless attribute!");
Chris Lattner8a923e72008-03-12 17:45:29 +0000406 assert((!i || Attrs[i-1].Index < Attrs[i].Index) &&
Devang Patel4c758ea2008-09-25 21:00:45 +0000407 "Misordered AttributesList!");
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000408 }
409#endif
Bill Wendlinga529ade2012-10-16 06:01:44 +0000410
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000411 // Otherwise, build a key to look up the existing attributes.
Bill Wendlingf86efb92012-11-20 05:09:20 +0000412 LLVMContextImpl *pImpl = C.pImpl;
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000413 FoldingSetNodeID ID;
Bill Wendling6848e382012-12-19 22:42:22 +0000414 AttributeSetImpl::Profile(ID, Attrs);
Bill Wendlinga529ade2012-10-16 06:01:44 +0000415
Bill Wendlingf86efb92012-11-20 05:09:20 +0000416 void *InsertPoint;
Bill Wendling6848e382012-12-19 22:42:22 +0000417 AttributeSetImpl *PA = pImpl->AttrsLists.FindNodeOrInsertPos(ID,
Bill Wendlingf86efb92012-11-20 05:09:20 +0000418 InsertPoint);
Bill Wendlinga529ade2012-10-16 06:01:44 +0000419
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000420 // If we didn't find any existing attributes of the same shape then
421 // create a new one and insert it.
Bill Wendlingf86efb92012-11-20 05:09:20 +0000422 if (!PA) {
Bill Wendling6ad6c3b2012-12-19 23:55:43 +0000423 PA = new AttributeSetImpl(C, Attrs);
Bill Wendlingf86efb92012-11-20 05:09:20 +0000424 pImpl->AttrsLists.InsertNode(PA, InsertPoint);
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000425 }
Bill Wendlinga529ade2012-10-16 06:01:44 +0000426
Devang Patel4c758ea2008-09-25 21:00:45 +0000427 // Return the AttributesList that we found or created.
Bill Wendlinge94d8432012-12-07 23:16:57 +0000428 return AttributeSet(PA);
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000429}
430
Chris Lattner8a923e72008-03-12 17:45:29 +0000431//===----------------------------------------------------------------------===//
Bill Wendlinge94d8432012-12-07 23:16:57 +0000432// AttributeSet Method Implementations
Chris Lattner8a923e72008-03-12 17:45:29 +0000433//===----------------------------------------------------------------------===//
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000434
Bill Wendlinge94d8432012-12-07 23:16:57 +0000435const AttributeSet &AttributeSet::operator=(const AttributeSet &RHS) {
Bill Wendlingf86efb92012-11-20 05:09:20 +0000436 AttrList = RHS.AttrList;
437 return *this;
Chris Lattner8a923e72008-03-12 17:45:29 +0000438}
439
Bill Wendlinga529ade2012-10-16 06:01:44 +0000440/// getNumSlots - Return the number of slots used in this attribute list.
Chris Lattner8a923e72008-03-12 17:45:29 +0000441/// This is the number of arguments that have an attribute set on them
442/// (including the function itself).
Bill Wendlinge94d8432012-12-07 23:16:57 +0000443unsigned AttributeSet::getNumSlots() const {
Devang Patel4c758ea2008-09-25 21:00:45 +0000444 return AttrList ? AttrList->Attrs.size() : 0;
Chris Lattner8a923e72008-03-12 17:45:29 +0000445}
446
Devang Patel4c758ea2008-09-25 21:00:45 +0000447/// getSlot - Return the AttributeWithIndex at the specified slot. This
448/// holds a number plus a set of attributes.
Bill Wendlinge94d8432012-12-07 23:16:57 +0000449const AttributeWithIndex &AttributeSet::getSlot(unsigned Slot) const {
Devang Patel4c758ea2008-09-25 21:00:45 +0000450 assert(AttrList && Slot < AttrList->Attrs.size() && "Slot # out of range!");
451 return AttrList->Attrs[Slot];
Chris Lattner8a923e72008-03-12 17:45:29 +0000452}
453
Bill Wendling698e84f2012-12-30 10:32:01 +0000454bool AttributeSet::hasAttribute(unsigned Index, Attribute::AttrKind Kind) const{
455 return getAttributes(Index).hasAttribute(Kind);
456}
457
458bool AttributeSet::hasAttributes(unsigned Index) const {
459 return getAttributes(Index).hasAttributes();
460}
461
462std::string AttributeSet::getAsString(unsigned Index) const {
463 return getAttributes(Index).getAsString();
464}
465
466unsigned AttributeSet::getStackAlignment(unsigned Index) const {
467 return getAttributes(Index).getStackAlignment();
468}
469
470uint64_t AttributeSet::getBitMask(unsigned Index) const {
471 // FIXME: Remove this.
472 return getAttributes(Index).getBitMask();
473}
474
Bill Wendlinga529ade2012-10-16 06:01:44 +0000475/// getAttributes - The attributes for the specified index are returned.
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000476/// Attribute for the result are denoted with Idx = 0. Function notes are
Bill Wendlinga529ade2012-10-16 06:01:44 +0000477/// denoted with idx = ~0.
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000478Attribute AttributeSet::getAttributes(unsigned Idx) const {
479 if (AttrList == 0) return Attribute();
Bill Wendlinga529ade2012-10-16 06:01:44 +0000480
Bill Wendling6e95ae82012-12-31 00:49:59 +0000481 const SmallVectorImpl<AttributeWithIndex> &Attrs = AttrList->Attrs;
Chris Lattner8a923e72008-03-12 17:45:29 +0000482 for (unsigned i = 0, e = Attrs.size(); i != e && Attrs[i].Index <= Idx; ++i)
483 if (Attrs[i].Index == Idx)
484 return Attrs[i].Attrs;
Bill Wendling9be77592012-09-21 15:26:31 +0000485
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000486 return Attribute();
Chris Lattner8a923e72008-03-12 17:45:29 +0000487}
488
489/// hasAttrSomewhere - Return true if the specified attribute is set for at
490/// least one parameter or for the return value.
Bill Wendlingc79e42c2012-12-22 00:37:52 +0000491bool AttributeSet::hasAttrSomewhere(Attribute::AttrKind Attr) const {
Devang Patel4c758ea2008-09-25 21:00:45 +0000492 if (AttrList == 0) return false;
Bill Wendlingbbcdf4e2012-10-10 07:36:45 +0000493
Devang Patel4c758ea2008-09-25 21:00:45 +0000494 const SmallVector<AttributeWithIndex, 4> &Attrs = AttrList->Attrs;
Chris Lattner8a923e72008-03-12 17:45:29 +0000495 for (unsigned i = 0, e = Attrs.size(); i != e; ++i)
Bill Wendlingbbcdf4e2012-10-10 07:36:45 +0000496 if (Attrs[i].Attrs.hasAttribute(Attr))
Chris Lattner8a923e72008-03-12 17:45:29 +0000497 return true;
Bill Wendlingf86efb92012-11-20 05:09:20 +0000498
Chris Lattner8a923e72008-03-12 17:45:29 +0000499 return false;
500}
501
Bill Wendlinge94d8432012-12-07 23:16:57 +0000502AttributeSet AttributeSet::addAttr(LLVMContext &C, unsigned Idx,
Bill Wendling6e95ae82012-12-31 00:49:59 +0000503 Attribute Attrs) const {
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000504 Attribute OldAttrs = getAttributes(Idx);
Dale Johannesen11a555e2008-02-19 23:51:49 +0000505#ifndef NDEBUG
506 // FIXME it is not obvious how this should work for alignment.
507 // For now, say we can't change a known alignment.
Bill Wendling9be77592012-09-21 15:26:31 +0000508 unsigned OldAlign = OldAttrs.getAlignment();
509 unsigned NewAlign = Attrs.getAlignment();
Anton Korobeynikov18991d72008-02-20 12:07:57 +0000510 assert((!OldAlign || !NewAlign || OldAlign == NewAlign) &&
Dale Johannesen11a555e2008-02-19 23:51:49 +0000511 "Attempt to change alignment!");
512#endif
Bill Wendlinga529ade2012-10-16 06:01:44 +0000513
Bill Wendling50d27842012-10-15 20:35:56 +0000514 AttrBuilder NewAttrs =
515 AttrBuilder(OldAttrs).addAttributes(Attrs);
516 if (NewAttrs == AttrBuilder(OldAttrs))
Chris Lattner8a923e72008-03-12 17:45:29 +0000517 return *this;
Bill Wendlinga529ade2012-10-16 06:01:44 +0000518
Devang Patel4c758ea2008-09-25 21:00:45 +0000519 SmallVector<AttributeWithIndex, 8> NewAttrList;
520 if (AttrList == 0)
521 NewAttrList.push_back(AttributeWithIndex::get(Idx, Attrs));
Chris Lattner8a923e72008-03-12 17:45:29 +0000522 else {
Devang Patel4c758ea2008-09-25 21:00:45 +0000523 const SmallVector<AttributeWithIndex, 4> &OldAttrList = AttrList->Attrs;
Chris Lattner8a923e72008-03-12 17:45:29 +0000524 unsigned i = 0, e = OldAttrList.size();
525 // Copy attributes for arguments before this one.
526 for (; i != e && OldAttrList[i].Index < Idx; ++i)
527 NewAttrList.push_back(OldAttrList[i]);
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000528
Chris Lattner8a923e72008-03-12 17:45:29 +0000529 // If there are attributes already at this index, merge them in.
530 if (i != e && OldAttrList[i].Index == Idx) {
Bill Wendling722b26c2012-10-14 07:35:59 +0000531 Attrs =
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000532 Attribute::get(C, AttrBuilder(Attrs).
Bill Wendling722b26c2012-10-14 07:35:59 +0000533 addAttributes(OldAttrList[i].Attrs));
Chris Lattner8a923e72008-03-12 17:45:29 +0000534 ++i;
535 }
Bill Wendlinga529ade2012-10-16 06:01:44 +0000536
Devang Patel4c758ea2008-09-25 21:00:45 +0000537 NewAttrList.push_back(AttributeWithIndex::get(Idx, Attrs));
Bill Wendlinga529ade2012-10-16 06:01:44 +0000538
Chris Lattner8a923e72008-03-12 17:45:29 +0000539 // Copy attributes for arguments after this one.
Bill Wendlinga529ade2012-10-16 06:01:44 +0000540 NewAttrList.insert(NewAttrList.end(),
Chris Lattner8a923e72008-03-12 17:45:29 +0000541 OldAttrList.begin()+i, OldAttrList.end());
542 }
Bill Wendlinga529ade2012-10-16 06:01:44 +0000543
Bill Wendlingf86efb92012-11-20 05:09:20 +0000544 return get(C, NewAttrList);
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000545}
546
Bill Wendlinge94d8432012-12-07 23:16:57 +0000547AttributeSet AttributeSet::removeAttr(LLVMContext &C, unsigned Idx,
Bill Wendling6e95ae82012-12-31 00:49:59 +0000548 Attribute Attrs) const {
Dale Johannesen11a555e2008-02-19 23:51:49 +0000549#ifndef NDEBUG
550 // FIXME it is not obvious how this should work for alignment.
551 // For now, say we can't pass in alignment, which no current use does.
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000552 assert(!Attrs.hasAttribute(Attribute::Alignment) &&
Bill Wendlingc9b22d72012-10-09 07:45:08 +0000553 "Attempt to exclude alignment!");
Dale Johannesen11a555e2008-02-19 23:51:49 +0000554#endif
Bill Wendlinge94d8432012-12-07 23:16:57 +0000555 if (AttrList == 0) return AttributeSet();
Bill Wendlinga529ade2012-10-16 06:01:44 +0000556
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000557 Attribute OldAttrs = getAttributes(Idx);
Bill Wendling50d27842012-10-15 20:35:56 +0000558 AttrBuilder NewAttrs =
559 AttrBuilder(OldAttrs).removeAttributes(Attrs);
560 if (NewAttrs == AttrBuilder(OldAttrs))
Chris Lattner8a923e72008-03-12 17:45:29 +0000561 return *this;
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000562
Devang Patel4c758ea2008-09-25 21:00:45 +0000563 SmallVector<AttributeWithIndex, 8> NewAttrList;
564 const SmallVector<AttributeWithIndex, 4> &OldAttrList = AttrList->Attrs;
Chris Lattner8a923e72008-03-12 17:45:29 +0000565 unsigned i = 0, e = OldAttrList.size();
Bill Wendlinga529ade2012-10-16 06:01:44 +0000566
Chris Lattner8a923e72008-03-12 17:45:29 +0000567 // Copy attributes for arguments before this one.
568 for (; i != e && OldAttrList[i].Index < Idx; ++i)
569 NewAttrList.push_back(OldAttrList[i]);
Bill Wendlinga529ade2012-10-16 06:01:44 +0000570
Chris Lattner8a923e72008-03-12 17:45:29 +0000571 // If there are attributes already at this index, merge them in.
572 assert(OldAttrList[i].Index == Idx && "Attribute isn't set?");
Bill Wendling3d7b0b82012-12-19 07:18:57 +0000573 Attrs = Attribute::get(C, AttrBuilder(OldAttrList[i].Attrs).
Bill Wendling85a64c22012-10-14 06:39:53 +0000574 removeAttributes(Attrs));
Chris Lattner8a923e72008-03-12 17:45:29 +0000575 ++i;
Bill Wendling76d2cd22012-10-14 08:54:26 +0000576 if (Attrs.hasAttributes()) // If any attributes left for this param, add them.
Devang Patel4c758ea2008-09-25 21:00:45 +0000577 NewAttrList.push_back(AttributeWithIndex::get(Idx, Attrs));
Bill Wendlinga529ade2012-10-16 06:01:44 +0000578
Chris Lattner8a923e72008-03-12 17:45:29 +0000579 // Copy attributes for arguments after this one.
Bill Wendlinga529ade2012-10-16 06:01:44 +0000580 NewAttrList.insert(NewAttrList.end(),
Chris Lattner8a923e72008-03-12 17:45:29 +0000581 OldAttrList.begin()+i, OldAttrList.end());
Bill Wendlinga529ade2012-10-16 06:01:44 +0000582
Bill Wendlingf86efb92012-11-20 05:09:20 +0000583 return get(C, NewAttrList);
Chris Lattner3e13b8c2008-01-02 23:42:30 +0000584}
585
Bill Wendlinge94d8432012-12-07 23:16:57 +0000586void AttributeSet::dump() const {
David Greenef7014732010-01-05 01:29:58 +0000587 dbgs() << "PAL[ ";
Chris Lattner8a923e72008-03-12 17:45:29 +0000588 for (unsigned i = 0; i < getNumSlots(); ++i) {
Devang Patel4c758ea2008-09-25 21:00:45 +0000589 const AttributeWithIndex &PAWI = getSlot(i);
Bill Wendling76d2cd22012-10-14 08:54:26 +0000590 dbgs() << "{" << PAWI.Index << "," << PAWI.Attrs.getAsString() << "} ";
Chris Lattner8a923e72008-03-12 17:45:29 +0000591 }
Bill Wendlinga529ade2012-10-16 06:01:44 +0000592
David Greenef7014732010-01-05 01:29:58 +0000593 dbgs() << "]\n";
Duncan Sands404eb052008-01-06 18:27:01 +0000594}