2008-09-26 05:00:45 +08:00
|
|
|
//===-- Attributes.cpp - Implement AttributesList -------------------------===//
|
2008-01-03 07:42:30 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2012-10-16 14:10:45 +08:00
|
|
|
// This file implements the Attributes, AttributeImpl, AttrBuilder,
|
|
|
|
// AttributeListImpl, and AttrListPtr classes.
|
2008-01-03 07:42:30 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2008-09-24 07:03:40 +08:00
|
|
|
#include "llvm/Attributes.h"
|
2012-10-15 13:40:12 +08:00
|
|
|
#include "AttributesImpl.h"
|
2012-09-27 05:07:29 +08:00
|
|
|
#include "LLVMContextImpl.h"
|
2008-03-13 01:45:29 +08:00
|
|
|
#include "llvm/Type.h"
|
2008-03-11 07:55:07 +08:00
|
|
|
#include "llvm/ADT/StringExtras.h"
|
2008-03-13 01:45:29 +08:00
|
|
|
#include "llvm/ADT/FoldingSet.h"
|
2010-11-30 02:16:10 +08:00
|
|
|
#include "llvm/Support/Atomic.h"
|
|
|
|
#include "llvm/Support/Mutex.h"
|
2010-01-05 09:29:58 +08:00
|
|
|
#include "llvm/Support/Debug.h"
|
2008-01-03 07:42:30 +08:00
|
|
|
#include "llvm/Support/ManagedStatic.h"
|
2009-08-23 19:37:21 +08:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
2008-01-03 07:42:30 +08:00
|
|
|
using namespace llvm;
|
|
|
|
|
2008-03-13 01:45:29 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2012-10-09 05:47:17 +08:00
|
|
|
// Attributes Implementation
|
2008-03-13 01:45:29 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2008-01-15 03:52:09 +08:00
|
|
|
|
2012-10-15 14:53:28 +08:00
|
|
|
Attributes Attributes::get(LLVMContext &Context, ArrayRef<AttrVal> Vals) {
|
2012-10-16 04:35:56 +08:00
|
|
|
AttrBuilder B;
|
2012-10-15 12:46:55 +08:00
|
|
|
for (ArrayRef<AttrVal>::iterator I = Vals.begin(), E = Vals.end();
|
|
|
|
I != E; ++I)
|
|
|
|
B.addAttribute(*I);
|
2012-10-15 14:53:28 +08:00
|
|
|
return Attributes::get(Context, B);
|
2012-10-15 12:46:55 +08:00
|
|
|
}
|
2012-10-11 09:05:52 +08:00
|
|
|
|
2012-10-16 04:35:56 +08:00
|
|
|
Attributes Attributes::get(LLVMContext &Context, AttrBuilder &B) {
|
2012-10-09 05:47:17 +08:00
|
|
|
// If there are no attributes, return an empty Attributes class.
|
2012-10-16 13:55:09 +08:00
|
|
|
if (!B.hasAttributes())
|
2012-10-09 05:47:17 +08:00
|
|
|
return Attributes();
|
|
|
|
|
|
|
|
// Otherwise, build a key to look up the existing attributes.
|
|
|
|
LLVMContextImpl *pImpl = Context.pImpl;
|
|
|
|
FoldingSetNodeID ID;
|
2012-10-16 13:55:09 +08:00
|
|
|
ID.AddInteger(B.Raw());
|
2012-10-09 05:47:17 +08:00
|
|
|
|
|
|
|
void *InsertPoint;
|
|
|
|
AttributesImpl *PA = pImpl->AttrsSet.FindNodeOrInsertPos(ID, InsertPoint);
|
|
|
|
|
|
|
|
if (!PA) {
|
|
|
|
// If we didn't find any existing attributes of the same shape then create a
|
|
|
|
// new one and insert it.
|
2012-10-16 13:55:09 +08:00
|
|
|
PA = new AttributesImpl(B.Raw());
|
2012-10-09 05:47:17 +08:00
|
|
|
pImpl->AttrsSet.InsertNode(PA, InsertPoint);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Return the AttributesList that we found or created.
|
|
|
|
return Attributes(PA);
|
|
|
|
}
|
|
|
|
|
2012-10-09 15:45:08 +08:00
|
|
|
bool Attributes::hasAttribute(AttrVal Val) const {
|
2012-10-15 12:46:55 +08:00
|
|
|
return Attrs && Attrs->hasAttribute(Val);
|
2012-10-05 14:44:41 +08:00
|
|
|
}
|
|
|
|
|
2012-10-15 13:40:12 +08:00
|
|
|
bool Attributes::hasAttributes() const {
|
|
|
|
return Attrs && Attrs->hasAttributes();
|
|
|
|
}
|
|
|
|
|
2012-10-09 17:11:20 +08:00
|
|
|
bool Attributes::hasAttributes(const Attributes &A) const {
|
2012-10-15 12:46:55 +08:00
|
|
|
return Attrs && Attrs->hasAttributes(A);
|
2012-10-09 17:11:20 +08:00
|
|
|
}
|
|
|
|
|
2012-10-05 14:44:41 +08:00
|
|
|
/// This returns the alignment field of an attribute as a byte alignment value.
|
|
|
|
unsigned Attributes::getAlignment() const {
|
2012-10-10 04:56:48 +08:00
|
|
|
if (!hasAttribute(Attributes::Alignment))
|
|
|
|
return 0;
|
2012-10-15 12:46:55 +08:00
|
|
|
return 1U << ((Attrs->getAlignment() >> 16) - 1);
|
2012-10-05 14:44:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/// This returns the stack alignment field of an attribute as a byte alignment
|
|
|
|
/// value.
|
|
|
|
unsigned Attributes::getStackAlignment() const {
|
2012-10-10 04:56:48 +08:00
|
|
|
if (!hasAttribute(Attributes::StackAlignment))
|
|
|
|
return 0;
|
2012-10-15 12:46:55 +08:00
|
|
|
return 1U << ((Attrs->getStackAlignment() >> 26) - 1);
|
2012-10-05 14:44:41 +08:00
|
|
|
}
|
|
|
|
|
2012-10-09 05:47:17 +08:00
|
|
|
uint64_t Attributes::Raw() const {
|
2012-10-16 13:57:28 +08:00
|
|
|
return Attrs ? Attrs->Raw() : 0;
|
2012-10-07 16:55:05 +08:00
|
|
|
}
|
|
|
|
|
2012-10-05 14:44:41 +08:00
|
|
|
Attributes Attributes::typeIncompatible(Type *Ty) {
|
2012-10-16 04:35:56 +08:00
|
|
|
AttrBuilder Incompatible;
|
2012-10-16 14:01:44 +08:00
|
|
|
|
2012-10-10 03:01:18 +08:00
|
|
|
if (!Ty->isIntegerTy())
|
2012-10-05 14:44:41 +08:00
|
|
|
// Attributes that only apply to integers.
|
2012-10-10 03:01:18 +08:00
|
|
|
Incompatible.addAttribute(Attributes::SExt)
|
|
|
|
.addAttribute(Attributes::ZExt);
|
2012-10-16 14:01:44 +08:00
|
|
|
|
2012-10-10 03:01:18 +08:00
|
|
|
if (!Ty->isPointerTy())
|
2012-10-05 14:44:41 +08:00
|
|
|
// Attributes that only apply to pointers.
|
2012-10-10 03:01:18 +08:00
|
|
|
Incompatible.addAttribute(Attributes::ByVal)
|
|
|
|
.addAttribute(Attributes::Nest)
|
|
|
|
.addAttribute(Attributes::NoAlias)
|
|
|
|
.addAttribute(Attributes::NoCapture)
|
|
|
|
.addAttribute(Attributes::StructRet);
|
2012-10-16 14:01:44 +08:00
|
|
|
|
2012-10-15 12:46:55 +08:00
|
|
|
return Attributes::get(Ty->getContext(), Incompatible);
|
2012-10-05 14:44:41 +08:00
|
|
|
}
|
|
|
|
|
2012-10-16 04:35:56 +08:00
|
|
|
/// encodeLLVMAttributesForBitcode - This returns an integer containing an
|
|
|
|
/// encoding of all the LLVM attributes found in the given attribute bitset.
|
|
|
|
/// Any change to this encoding is a breaking change to bitcode compatibility.
|
|
|
|
uint64_t Attributes::encodeLLVMAttributesForBitcode(Attributes Attrs) {
|
|
|
|
// FIXME: It doesn't make sense to store the alignment information as an
|
|
|
|
// expanded out value, we should store it as a log2 value. However, we can't
|
|
|
|
// just change that here without breaking bitcode compatibility. If this ever
|
|
|
|
// becomes a problem in practice, we should introduce new tag numbers in the
|
|
|
|
// bitcode file and have those tags use a more efficiently encoded alignment
|
|
|
|
// field.
|
|
|
|
|
|
|
|
// Store the alignment in the bitcode as a 16-bit raw value instead of a 5-bit
|
|
|
|
// log2 encoded value. Shift the bits above the alignment up by 11 bits.
|
|
|
|
uint64_t EncodedAttrs = Attrs.Raw() & 0xffff;
|
|
|
|
if (Attrs.hasAttribute(Attributes::Alignment))
|
|
|
|
EncodedAttrs |= Attrs.getAlignment() << 16;
|
2012-10-23 01:33:31 +08:00
|
|
|
EncodedAttrs |= (Attrs.Raw() & (0xffffULL << 21)) << 11;
|
2012-10-16 04:35:56 +08:00
|
|
|
return EncodedAttrs;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// decodeLLVMAttributesForBitcode - This returns an attribute bitset containing
|
|
|
|
/// the LLVM attributes that have been decoded from the given integer. This
|
|
|
|
/// function must stay in sync with 'encodeLLVMAttributesForBitcode'.
|
|
|
|
Attributes Attributes::decodeLLVMAttributesForBitcode(LLVMContext &C,
|
|
|
|
uint64_t EncodedAttrs) {
|
|
|
|
// The alignment is stored as a 16-bit raw value from bits 31--16. We shift
|
|
|
|
// the bits above 31 down by 11 bits.
|
|
|
|
unsigned Alignment = (EncodedAttrs & (0xffffULL << 16)) >> 16;
|
|
|
|
assert((!Alignment || isPowerOf2_32(Alignment)) &&
|
|
|
|
"Alignment must be a power of two.");
|
|
|
|
|
|
|
|
AttrBuilder B(EncodedAttrs & 0xffff);
|
|
|
|
if (Alignment)
|
|
|
|
B.addAlignmentAttr(Alignment);
|
2012-10-23 01:33:31 +08:00
|
|
|
B.addRawValue((EncodedAttrs & (0xffffULL << 32)) >> 11);
|
2012-10-16 04:35:56 +08:00
|
|
|
return Attributes::get(C, B);
|
|
|
|
}
|
|
|
|
|
2012-09-20 22:44:42 +08:00
|
|
|
std::string Attributes::getAsString() const {
|
2008-01-03 07:42:30 +08:00
|
|
|
std::string Result;
|
2012-10-09 15:45:08 +08:00
|
|
|
if (hasAttribute(Attributes::ZExt))
|
2008-01-03 07:42:30 +08:00
|
|
|
Result += "zeroext ";
|
2012-10-09 15:45:08 +08:00
|
|
|
if (hasAttribute(Attributes::SExt))
|
2008-01-03 07:42:30 +08:00
|
|
|
Result += "signext ";
|
2012-10-09 15:45:08 +08:00
|
|
|
if (hasAttribute(Attributes::NoReturn))
|
2008-01-03 07:42:30 +08:00
|
|
|
Result += "noreturn ";
|
2012-10-09 15:45:08 +08:00
|
|
|
if (hasAttribute(Attributes::NoUnwind))
|
2008-01-03 07:42:30 +08:00
|
|
|
Result += "nounwind ";
|
2012-10-09 15:45:08 +08:00
|
|
|
if (hasAttribute(Attributes::UWTable))
|
2011-05-25 11:44:17 +08:00
|
|
|
Result += "uwtable ";
|
2012-10-09 15:45:08 +08:00
|
|
|
if (hasAttribute(Attributes::ReturnsTwice))
|
2011-10-03 22:45:37 +08:00
|
|
|
Result += "returns_twice ";
|
2012-10-09 15:45:08 +08:00
|
|
|
if (hasAttribute(Attributes::InReg))
|
2008-01-03 07:42:30 +08:00
|
|
|
Result += "inreg ";
|
2012-10-09 15:45:08 +08:00
|
|
|
if (hasAttribute(Attributes::NoAlias))
|
2008-01-03 07:42:30 +08:00
|
|
|
Result += "noalias ";
|
2012-10-09 15:45:08 +08:00
|
|
|
if (hasAttribute(Attributes::NoCapture))
|
2008-12-19 17:38:31 +08:00
|
|
|
Result += "nocapture ";
|
2012-10-09 15:45:08 +08:00
|
|
|
if (hasAttribute(Attributes::StructRet))
|
2009-07-18 02:07:26 +08:00
|
|
|
Result += "sret ";
|
2012-10-09 15:45:08 +08:00
|
|
|
if (hasAttribute(Attributes::ByVal))
|
2008-01-03 07:42:30 +08:00
|
|
|
Result += "byval ";
|
2012-10-09 15:45:08 +08:00
|
|
|
if (hasAttribute(Attributes::Nest))
|
2008-01-03 07:42:30 +08:00
|
|
|
Result += "nest ";
|
2012-10-09 15:45:08 +08:00
|
|
|
if (hasAttribute(Attributes::ReadNone))
|
2008-01-03 07:42:30 +08:00
|
|
|
Result += "readnone ";
|
2012-10-09 15:45:08 +08:00
|
|
|
if (hasAttribute(Attributes::ReadOnly))
|
2008-01-03 07:42:30 +08:00
|
|
|
Result += "readonly ";
|
2012-10-09 15:45:08 +08:00
|
|
|
if (hasAttribute(Attributes::OptimizeForSize))
|
2008-09-27 06:53:05 +08:00
|
|
|
Result += "optsize ";
|
2012-10-09 15:45:08 +08:00
|
|
|
if (hasAttribute(Attributes::NoInline))
|
2008-09-27 06:53:05 +08:00
|
|
|
Result += "noinline ";
|
2012-10-09 15:45:08 +08:00
|
|
|
if (hasAttribute(Attributes::InlineHint))
|
2010-02-06 09:16:28 +08:00
|
|
|
Result += "inlinehint ";
|
2012-10-09 15:45:08 +08:00
|
|
|
if (hasAttribute(Attributes::AlwaysInline))
|
2008-09-27 06:53:05 +08:00
|
|
|
Result += "alwaysinline ";
|
2012-10-09 15:45:08 +08:00
|
|
|
if (hasAttribute(Attributes::StackProtect))
|
2008-11-13 09:02:14 +08:00
|
|
|
Result += "ssp ";
|
2012-10-09 15:45:08 +08:00
|
|
|
if (hasAttribute(Attributes::StackProtectReq))
|
2008-11-13 09:02:14 +08:00
|
|
|
Result += "sspreq ";
|
2012-10-09 15:45:08 +08:00
|
|
|
if (hasAttribute(Attributes::NoRedZone))
|
2009-06-05 06:05:33 +08:00
|
|
|
Result += "noredzone ";
|
2012-10-09 15:45:08 +08:00
|
|
|
if (hasAttribute(Attributes::NoImplicitFloat))
|
2009-06-06 05:57:13 +08:00
|
|
|
Result += "noimplicitfloat ";
|
2012-10-09 15:45:08 +08:00
|
|
|
if (hasAttribute(Attributes::Naked))
|
2009-07-18 02:07:26 +08:00
|
|
|
Result += "naked ";
|
2012-10-09 15:45:08 +08:00
|
|
|
if (hasAttribute(Attributes::NonLazyBind))
|
2011-06-16 04:36:13 +08:00
|
|
|
Result += "nonlazybind ";
|
2012-10-09 15:45:08 +08:00
|
|
|
if (hasAttribute(Attributes::AddressSafety))
|
2012-01-21 01:56:17 +08:00
|
|
|
Result += "address_safety ";
|
2012-10-31 00:32:52 +08:00
|
|
|
if (hasAttribute(Attributes::MinSize))
|
|
|
|
Result += "minsize ";
|
2012-10-09 15:45:08 +08:00
|
|
|
if (hasAttribute(Attributes::StackAlignment)) {
|
2010-02-12 08:31:15 +08:00
|
|
|
Result += "alignstack(";
|
2012-09-21 23:26:31 +08:00
|
|
|
Result += utostr(getStackAlignment());
|
2010-02-12 08:31:15 +08:00
|
|
|
Result += ") ";
|
|
|
|
}
|
2012-10-09 15:45:08 +08:00
|
|
|
if (hasAttribute(Attributes::Alignment)) {
|
2008-02-20 07:51:49 +08:00
|
|
|
Result += "align ";
|
2012-09-21 23:26:31 +08:00
|
|
|
Result += utostr(getAlignment());
|
2008-02-20 07:51:49 +08:00
|
|
|
Result += " ";
|
|
|
|
}
|
2008-08-05 23:51:44 +08:00
|
|
|
// Trim the trailing space.
|
2008-12-19 17:38:31 +08:00
|
|
|
assert(!Result.empty() && "Unknown attribute!");
|
2008-08-05 23:51:44 +08:00
|
|
|
Result.erase(Result.end()-1);
|
2008-01-03 07:42:30 +08:00
|
|
|
return Result;
|
|
|
|
}
|
|
|
|
|
2012-10-05 14:44:41 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2012-10-16 04:35:56 +08:00
|
|
|
// AttrBuilder Implementation
|
2012-10-05 14:44:41 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-10-16 04:35:56 +08:00
|
|
|
AttrBuilder &AttrBuilder::addAttribute(Attributes::AttrVal Val){
|
2012-10-09 17:11:20 +08:00
|
|
|
Bits |= AttributesImpl::getAttrMask(Val);
|
2012-10-10 03:01:18 +08:00
|
|
|
return *this;
|
2012-10-05 14:44:41 +08:00
|
|
|
}
|
|
|
|
|
2012-10-16 04:35:56 +08:00
|
|
|
AttrBuilder &AttrBuilder::addRawValue(uint64_t Val) {
|
2012-10-14 12:10:01 +08:00
|
|
|
Bits |= Val;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2012-10-16 04:35:56 +08:00
|
|
|
AttrBuilder &AttrBuilder::addAlignmentAttr(unsigned Align) {
|
2012-10-14 11:58:29 +08:00
|
|
|
if (Align == 0) return *this;
|
2012-10-05 14:44:41 +08:00
|
|
|
assert(isPowerOf2_32(Align) && "Alignment must be a power of two.");
|
|
|
|
assert(Align <= 0x40000000 && "Alignment too large.");
|
|
|
|
Bits |= (Log2_32(Align) + 1) << 16;
|
2012-10-14 11:58:29 +08:00
|
|
|
return *this;
|
2012-10-05 14:44:41 +08:00
|
|
|
}
|
2012-10-16 04:35:56 +08:00
|
|
|
AttrBuilder &AttrBuilder::addStackAlignmentAttr(unsigned Align){
|
2012-10-05 14:44:41 +08:00
|
|
|
// Default alignment, allow the target to define how to align it.
|
2012-10-14 11:58:29 +08:00
|
|
|
if (Align == 0) return *this;
|
2012-10-05 14:44:41 +08:00
|
|
|
assert(isPowerOf2_32(Align) && "Alignment must be a power of two.");
|
|
|
|
assert(Align <= 0x100 && "Alignment too large.");
|
|
|
|
Bits |= (Log2_32(Align) + 1) << 26;
|
2012-10-14 11:58:29 +08:00
|
|
|
return *this;
|
2008-01-03 07:42:30 +08:00
|
|
|
}
|
|
|
|
|
2012-10-16 13:22:28 +08:00
|
|
|
AttrBuilder &AttrBuilder::removeAttribute(Attributes::AttrVal Val) {
|
2012-10-09 17:11:20 +08:00
|
|
|
Bits &= ~AttributesImpl::getAttrMask(Val);
|
2012-10-10 03:01:18 +08:00
|
|
|
return *this;
|
2012-10-09 17:11:20 +08:00
|
|
|
}
|
|
|
|
|
2012-10-16 04:35:56 +08:00
|
|
|
AttrBuilder &AttrBuilder::addAttributes(const Attributes &A) {
|
2012-10-14 15:17:34 +08:00
|
|
|
Bits |= A.Raw();
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2012-10-16 04:35:56 +08:00
|
|
|
AttrBuilder &AttrBuilder::removeAttributes(const Attributes &A){
|
2012-10-09 08:01:21 +08:00
|
|
|
Bits &= ~A.Raw();
|
2012-10-14 14:39:53 +08:00
|
|
|
return *this;
|
2012-10-09 08:01:21 +08:00
|
|
|
}
|
|
|
|
|
2012-10-16 04:35:56 +08:00
|
|
|
bool AttrBuilder::hasAttribute(Attributes::AttrVal A) const {
|
2012-10-10 15:36:45 +08:00
|
|
|
return Bits & AttributesImpl::getAttrMask(A);
|
|
|
|
}
|
|
|
|
|
2012-10-16 04:35:56 +08:00
|
|
|
bool AttrBuilder::hasAttributes() const {
|
2012-10-09 07:27:46 +08:00
|
|
|
return Bits != 0;
|
|
|
|
}
|
2012-10-16 04:35:56 +08:00
|
|
|
bool AttrBuilder::hasAttributes(const Attributes &A) const {
|
2012-10-09 08:01:21 +08:00
|
|
|
return Bits & A.Raw();
|
|
|
|
}
|
2012-10-16 04:35:56 +08:00
|
|
|
bool AttrBuilder::hasAlignmentAttr() const {
|
2012-10-10 04:28:54 +08:00
|
|
|
return Bits & AttributesImpl::getAttrMask(Attributes::Alignment);
|
2012-10-09 07:27:46 +08:00
|
|
|
}
|
|
|
|
|
2012-10-16 04:35:56 +08:00
|
|
|
uint64_t AttrBuilder::getAlignment() const {
|
2012-10-10 04:56:48 +08:00
|
|
|
if (!hasAlignmentAttr())
|
|
|
|
return 0;
|
2012-10-10 04:28:54 +08:00
|
|
|
return 1U <<
|
|
|
|
(((Bits & AttributesImpl::getAttrMask(Attributes::Alignment)) >> 16) - 1);
|
2012-10-09 07:27:46 +08:00
|
|
|
}
|
|
|
|
|
2012-10-16 04:35:56 +08:00
|
|
|
uint64_t AttrBuilder::getStackAlignment() const {
|
2012-10-10 15:36:45 +08:00
|
|
|
if (!hasAlignmentAttr())
|
|
|
|
return 0;
|
|
|
|
return 1U <<
|
|
|
|
(((Bits & AttributesImpl::getAttrMask(Attributes::StackAlignment))>>26)-1);
|
|
|
|
}
|
|
|
|
|
2012-09-27 05:07:29 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// AttributeImpl Definition
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-10-09 17:11:20 +08:00
|
|
|
uint64_t AttributesImpl::getAttrMask(uint64_t Val) {
|
2012-10-09 15:45:08 +08:00
|
|
|
switch (Val) {
|
|
|
|
case Attributes::None: return 0;
|
|
|
|
case Attributes::ZExt: return 1 << 0;
|
|
|
|
case Attributes::SExt: return 1 << 1;
|
|
|
|
case Attributes::NoReturn: return 1 << 2;
|
|
|
|
case Attributes::InReg: return 1 << 3;
|
|
|
|
case Attributes::StructRet: return 1 << 4;
|
|
|
|
case Attributes::NoUnwind: return 1 << 5;
|
|
|
|
case Attributes::NoAlias: return 1 << 6;
|
|
|
|
case Attributes::ByVal: return 1 << 7;
|
|
|
|
case Attributes::Nest: return 1 << 8;
|
|
|
|
case Attributes::ReadNone: return 1 << 9;
|
|
|
|
case Attributes::ReadOnly: return 1 << 10;
|
|
|
|
case Attributes::NoInline: return 1 << 11;
|
|
|
|
case Attributes::AlwaysInline: return 1 << 12;
|
|
|
|
case Attributes::OptimizeForSize: return 1 << 13;
|
|
|
|
case Attributes::StackProtect: return 1 << 14;
|
|
|
|
case Attributes::StackProtectReq: return 1 << 15;
|
|
|
|
case Attributes::Alignment: return 31 << 16;
|
|
|
|
case Attributes::NoCapture: return 1 << 21;
|
|
|
|
case Attributes::NoRedZone: return 1 << 22;
|
|
|
|
case Attributes::NoImplicitFloat: return 1 << 23;
|
|
|
|
case Attributes::Naked: return 1 << 24;
|
|
|
|
case Attributes::InlineHint: return 1 << 25;
|
|
|
|
case Attributes::StackAlignment: return 7 << 26;
|
|
|
|
case Attributes::ReturnsTwice: return 1 << 29;
|
|
|
|
case Attributes::UWTable: return 1 << 30;
|
|
|
|
case Attributes::NonLazyBind: return 1U << 31;
|
|
|
|
case Attributes::AddressSafety: return 1ULL << 32;
|
2012-10-31 00:32:52 +08:00
|
|
|
case Attributes::MinSize: return 1ULL << 33;
|
2012-10-09 15:45:08 +08:00
|
|
|
}
|
|
|
|
llvm_unreachable("Unsupported attribute type");
|
|
|
|
}
|
|
|
|
|
2012-10-09 05:47:17 +08:00
|
|
|
bool AttributesImpl::hasAttribute(uint64_t A) const {
|
2012-10-09 15:45:08 +08:00
|
|
|
return (Bits & getAttrMask(A)) != 0;
|
2012-10-09 05:47:17 +08:00
|
|
|
}
|
2012-09-27 05:07:29 +08:00
|
|
|
|
2012-10-09 05:47:17 +08:00
|
|
|
bool AttributesImpl::hasAttributes() const {
|
|
|
|
return Bits != 0;
|
|
|
|
}
|
2012-09-27 05:07:29 +08:00
|
|
|
|
2012-10-09 05:47:17 +08:00
|
|
|
bool AttributesImpl::hasAttributes(const Attributes &A) const {
|
|
|
|
return Bits & A.Raw(); // FIXME: Raw() won't work here in the future.
|
|
|
|
}
|
2012-09-27 05:07:29 +08:00
|
|
|
|
2012-10-09 05:47:17 +08:00
|
|
|
uint64_t AttributesImpl::getAlignment() const {
|
2012-10-10 04:56:48 +08:00
|
|
|
return Bits & getAttrMask(Attributes::Alignment);
|
2012-10-09 05:47:17 +08:00
|
|
|
}
|
2012-09-27 05:07:29 +08:00
|
|
|
|
2012-10-09 05:47:17 +08:00
|
|
|
uint64_t AttributesImpl::getStackAlignment() const {
|
2012-10-10 04:56:48 +08:00
|
|
|
return Bits & getAttrMask(Attributes::StackAlignment);
|
2012-10-09 05:47:17 +08:00
|
|
|
}
|
2012-09-27 05:07:29 +08:00
|
|
|
|
2008-03-13 01:45:29 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2008-09-24 08:29:49 +08:00
|
|
|
// AttributeListImpl Definition
|
2008-03-13 01:45:29 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2010-11-19 02:59:13 +08:00
|
|
|
namespace llvm {
|
|
|
|
class AttributeListImpl;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ManagedStatic<FoldingSet<AttributeListImpl> > AttributesLists;
|
2010-11-09 08:27:03 +08:00
|
|
|
|
2008-03-13 01:45:29 +08:00
|
|
|
namespace llvm {
|
2010-11-09 08:27:03 +08:00
|
|
|
static ManagedStatic<sys::SmartMutex<true> > ALMutex;
|
|
|
|
|
2008-09-24 08:29:49 +08:00
|
|
|
class AttributeListImpl : public FoldingSetNode {
|
2009-08-21 03:03:20 +08:00
|
|
|
sys::cas_flag RefCount;
|
2012-10-16 14:01:44 +08:00
|
|
|
|
2008-09-26 05:00:45 +08:00
|
|
|
// AttributesList is uniqued, these should not be publicly available.
|
2012-09-18 10:01:41 +08:00
|
|
|
void operator=(const AttributeListImpl &) LLVM_DELETED_FUNCTION;
|
|
|
|
AttributeListImpl(const AttributeListImpl &) LLVM_DELETED_FUNCTION;
|
2008-09-24 08:29:49 +08:00
|
|
|
~AttributeListImpl(); // Private implementation
|
2008-03-13 01:45:29 +08:00
|
|
|
public:
|
2008-09-26 05:00:45 +08:00
|
|
|
SmallVector<AttributeWithIndex, 4> Attrs;
|
2012-10-16 14:01:44 +08:00
|
|
|
|
2012-05-28 09:47:44 +08:00
|
|
|
AttributeListImpl(ArrayRef<AttributeWithIndex> attrs)
|
|
|
|
: Attrs(attrs.begin(), attrs.end()) {
|
2008-03-13 01:45:29 +08:00
|
|
|
RefCount = 0;
|
|
|
|
}
|
2012-10-16 14:01:44 +08:00
|
|
|
|
2010-11-09 08:27:03 +08:00
|
|
|
void AddRef() {
|
|
|
|
sys::SmartScopedLock<true> Lock(*ALMutex);
|
|
|
|
++RefCount;
|
|
|
|
}
|
2009-08-21 03:03:20 +08:00
|
|
|
void DropRef() {
|
2010-11-09 08:27:03 +08:00
|
|
|
sys::SmartScopedLock<true> Lock(*ALMutex);
|
2010-11-19 02:59:13 +08:00
|
|
|
if (!AttributesLists.isConstructed())
|
|
|
|
return;
|
2010-11-10 01:47:10 +08:00
|
|
|
sys::cas_flag new_val = --RefCount;
|
2010-11-10 01:46:38 +08:00
|
|
|
if (new_val == 0)
|
2010-11-09 08:27:03 +08:00
|
|
|
delete this;
|
2009-08-21 03:03:20 +08:00
|
|
|
}
|
2012-10-16 14:01:44 +08:00
|
|
|
|
2008-03-13 01:45:29 +08:00
|
|
|
void Profile(FoldingSetNodeID &ID) const {
|
2012-05-28 09:47:44 +08:00
|
|
|
Profile(ID, Attrs);
|
2008-03-13 01:45:29 +08:00
|
|
|
}
|
2012-05-28 09:47:44 +08:00
|
|
|
static void Profile(FoldingSetNodeID &ID, ArrayRef<AttributeWithIndex> Attrs){
|
|
|
|
for (unsigned i = 0, e = Attrs.size(); i != e; ++i) {
|
|
|
|
ID.AddInteger(Attrs[i].Attrs.Raw());
|
|
|
|
ID.AddInteger(Attrs[i].Index);
|
2012-01-21 01:56:17 +08:00
|
|
|
}
|
2008-03-13 01:45:29 +08:00
|
|
|
}
|
|
|
|
};
|
2012-10-16 14:01:44 +08:00
|
|
|
|
|
|
|
} // end llvm namespace
|
2008-01-03 07:42:30 +08:00
|
|
|
|
2008-09-24 08:29:49 +08:00
|
|
|
AttributeListImpl::~AttributeListImpl() {
|
2010-11-09 08:27:03 +08:00
|
|
|
// NOTE: Lock must be acquired by caller.
|
2008-09-26 05:00:45 +08:00
|
|
|
AttributesLists->RemoveNode(this);
|
2008-03-13 01:45:29 +08:00
|
|
|
}
|
|
|
|
|
2012-05-28 09:47:44 +08:00
|
|
|
AttrListPtr AttrListPtr::get(ArrayRef<AttributeWithIndex> Attrs) {
|
2008-09-26 05:00:45 +08:00
|
|
|
// If there are no attributes then return a null AttributesList pointer.
|
2012-05-28 09:47:44 +08:00
|
|
|
if (Attrs.empty())
|
2008-09-26 05:00:45 +08:00
|
|
|
return AttrListPtr();
|
2012-10-16 14:01:44 +08:00
|
|
|
|
2008-01-03 07:42:30 +08:00
|
|
|
#ifndef NDEBUG
|
2012-05-28 09:47:44 +08:00
|
|
|
for (unsigned i = 0, e = Attrs.size(); i != e; ++i) {
|
2012-10-16 14:01:44 +08:00
|
|
|
assert(Attrs[i].Attrs.hasAttributes() &&
|
2008-09-26 05:00:45 +08:00
|
|
|
"Pointless attribute!");
|
2008-03-13 01:45:29 +08:00
|
|
|
assert((!i || Attrs[i-1].Index < Attrs[i].Index) &&
|
2008-09-26 05:00:45 +08:00
|
|
|
"Misordered AttributesList!");
|
2008-01-03 07:42:30 +08:00
|
|
|
}
|
|
|
|
#endif
|
2012-10-16 14:01:44 +08:00
|
|
|
|
2008-01-03 07:42:30 +08:00
|
|
|
// Otherwise, build a key to look up the existing attributes.
|
|
|
|
FoldingSetNodeID ID;
|
2012-05-28 09:47:44 +08:00
|
|
|
AttributeListImpl::Profile(ID, Attrs);
|
2008-01-03 07:42:30 +08:00
|
|
|
void *InsertPos;
|
2012-10-16 14:01:44 +08:00
|
|
|
|
2009-08-18 01:10:58 +08:00
|
|
|
sys::SmartScopedLock<true> Lock(*ALMutex);
|
2012-10-16 14:01:44 +08:00
|
|
|
|
2008-09-24 08:29:49 +08:00
|
|
|
AttributeListImpl *PAL =
|
2008-09-26 05:00:45 +08:00
|
|
|
AttributesLists->FindNodeOrInsertPos(ID, InsertPos);
|
2012-10-16 14:01:44 +08:00
|
|
|
|
2008-01-03 07:42:30 +08:00
|
|
|
// If we didn't find any existing attributes of the same shape then
|
|
|
|
// create a new one and insert it.
|
|
|
|
if (!PAL) {
|
2012-05-28 09:47:44 +08:00
|
|
|
PAL = new AttributeListImpl(Attrs);
|
2008-09-26 05:00:45 +08:00
|
|
|
AttributesLists->InsertNode(PAL, InsertPos);
|
2008-01-03 07:42:30 +08:00
|
|
|
}
|
2012-10-16 14:01:44 +08:00
|
|
|
|
2008-09-26 05:00:45 +08:00
|
|
|
// Return the AttributesList that we found or created.
|
|
|
|
return AttrListPtr(PAL);
|
2008-01-03 07:42:30 +08:00
|
|
|
}
|
|
|
|
|
2008-03-13 01:45:29 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2008-09-26 05:00:45 +08:00
|
|
|
// AttrListPtr Method Implementations
|
2008-03-13 01:45:29 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2008-01-03 07:42:30 +08:00
|
|
|
|
2008-09-26 05:00:45 +08:00
|
|
|
AttrListPtr::AttrListPtr(AttributeListImpl *LI) : AttrList(LI) {
|
2008-03-13 01:45:29 +08:00
|
|
|
if (LI) LI->AddRef();
|
|
|
|
}
|
2008-01-03 07:42:30 +08:00
|
|
|
|
2008-09-26 05:00:45 +08:00
|
|
|
AttrListPtr::AttrListPtr(const AttrListPtr &P) : AttrList(P.AttrList) {
|
2012-10-16 14:01:44 +08:00
|
|
|
if (AttrList) AttrList->AddRef();
|
2008-03-13 01:45:29 +08:00
|
|
|
}
|
|
|
|
|
2008-09-26 05:00:45 +08:00
|
|
|
const AttrListPtr &AttrListPtr::operator=(const AttrListPtr &RHS) {
|
2010-09-16 08:27:35 +08:00
|
|
|
sys::SmartScopedLock<true> Lock(*ALMutex);
|
2008-09-26 05:00:45 +08:00
|
|
|
if (AttrList == RHS.AttrList) return *this;
|
|
|
|
if (AttrList) AttrList->DropRef();
|
|
|
|
AttrList = RHS.AttrList;
|
|
|
|
if (AttrList) AttrList->AddRef();
|
2008-03-13 01:45:29 +08:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2008-09-26 05:00:45 +08:00
|
|
|
AttrListPtr::~AttrListPtr() {
|
|
|
|
if (AttrList) AttrList->DropRef();
|
2008-03-13 01:45:29 +08:00
|
|
|
}
|
|
|
|
|
2012-10-16 14:01:44 +08:00
|
|
|
/// getNumSlots - Return the number of slots used in this attribute list.
|
2008-03-13 01:45:29 +08:00
|
|
|
/// This is the number of arguments that have an attribute set on them
|
|
|
|
/// (including the function itself).
|
2008-09-26 05:00:45 +08:00
|
|
|
unsigned AttrListPtr::getNumSlots() const {
|
|
|
|
return AttrList ? AttrList->Attrs.size() : 0;
|
2008-03-13 01:45:29 +08:00
|
|
|
}
|
2008-01-03 07:42:30 +08:00
|
|
|
|
2008-09-26 05:00:45 +08:00
|
|
|
/// getSlot - Return the AttributeWithIndex at the specified slot. This
|
|
|
|
/// holds a number plus a set of attributes.
|
|
|
|
const AttributeWithIndex &AttrListPtr::getSlot(unsigned Slot) const {
|
|
|
|
assert(AttrList && Slot < AttrList->Attrs.size() && "Slot # out of range!");
|
|
|
|
return AttrList->Attrs[Slot];
|
2008-03-13 01:45:29 +08:00
|
|
|
}
|
|
|
|
|
2012-10-16 14:01:44 +08:00
|
|
|
/// getAttributes - The attributes for the specified index are returned.
|
|
|
|
/// Attributes for the result are denoted with Idx = 0. Function notes are
|
|
|
|
/// denoted with idx = ~0.
|
2008-09-26 05:00:45 +08:00
|
|
|
Attributes AttrListPtr::getAttributes(unsigned Idx) const {
|
2012-09-21 23:26:31 +08:00
|
|
|
if (AttrList == 0) return Attributes();
|
2012-10-16 14:01:44 +08:00
|
|
|
|
2008-09-26 05:00:45 +08:00
|
|
|
const SmallVector<AttributeWithIndex, 4> &Attrs = AttrList->Attrs;
|
2008-03-13 01:45:29 +08:00
|
|
|
for (unsigned i = 0, e = Attrs.size(); i != e && Attrs[i].Index <= Idx; ++i)
|
|
|
|
if (Attrs[i].Index == Idx)
|
|
|
|
return Attrs[i].Attrs;
|
2012-09-21 23:26:31 +08:00
|
|
|
|
|
|
|
return Attributes();
|
2008-03-13 01:45:29 +08:00
|
|
|
}
|
2008-01-03 07:42:30 +08:00
|
|
|
|
2008-03-13 01:45:29 +08:00
|
|
|
/// hasAttrSomewhere - Return true if the specified attribute is set for at
|
|
|
|
/// least one parameter or for the return value.
|
2012-10-10 15:36:45 +08:00
|
|
|
bool AttrListPtr::hasAttrSomewhere(Attributes::AttrVal Attr) const {
|
2008-09-26 05:00:45 +08:00
|
|
|
if (AttrList == 0) return false;
|
2012-10-10 15:36:45 +08:00
|
|
|
|
2008-09-26 05:00:45 +08:00
|
|
|
const SmallVector<AttributeWithIndex, 4> &Attrs = AttrList->Attrs;
|
2008-03-13 01:45:29 +08:00
|
|
|
for (unsigned i = 0, e = Attrs.size(); i != e; ++i)
|
2012-10-10 15:36:45 +08:00
|
|
|
if (Attrs[i].Attrs.hasAttribute(Attr))
|
2008-03-13 01:45:29 +08:00
|
|
|
return true;
|
|
|
|
return false;
|
2008-01-03 07:42:30 +08:00
|
|
|
}
|
|
|
|
|
2012-10-09 08:01:21 +08:00
|
|
|
unsigned AttrListPtr::getNumAttrs() const {
|
|
|
|
return AttrList ? AttrList->Attrs.size() : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
Attributes &AttrListPtr::getAttributesAtIndex(unsigned i) const {
|
|
|
|
assert(AttrList && "Trying to get an attribute from an empty list!");
|
|
|
|
assert(i < AttrList->Attrs.size() && "Index out of range!");
|
|
|
|
return AttrList->Attrs[i].Attrs;
|
|
|
|
}
|
2008-03-13 01:45:29 +08:00
|
|
|
|
2012-10-14 15:35:59 +08:00
|
|
|
AttrListPtr AttrListPtr::addAttr(LLVMContext &C, unsigned Idx,
|
|
|
|
Attributes Attrs) const {
|
2008-09-26 05:00:45 +08:00
|
|
|
Attributes OldAttrs = getAttributes(Idx);
|
2008-02-20 07:51:49 +08:00
|
|
|
#ifndef NDEBUG
|
|
|
|
// FIXME it is not obvious how this should work for alignment.
|
|
|
|
// For now, say we can't change a known alignment.
|
2012-09-21 23:26:31 +08:00
|
|
|
unsigned OldAlign = OldAttrs.getAlignment();
|
|
|
|
unsigned NewAlign = Attrs.getAlignment();
|
2008-02-20 20:07:57 +08:00
|
|
|
assert((!OldAlign || !NewAlign || OldAlign == NewAlign) &&
|
2008-02-20 07:51:49 +08:00
|
|
|
"Attempt to change alignment!");
|
|
|
|
#endif
|
2012-10-16 14:01:44 +08:00
|
|
|
|
2012-10-16 04:35:56 +08:00
|
|
|
AttrBuilder NewAttrs =
|
|
|
|
AttrBuilder(OldAttrs).addAttributes(Attrs);
|
|
|
|
if (NewAttrs == AttrBuilder(OldAttrs))
|
2008-03-13 01:45:29 +08:00
|
|
|
return *this;
|
2012-10-16 14:01:44 +08:00
|
|
|
|
2008-09-26 05:00:45 +08:00
|
|
|
SmallVector<AttributeWithIndex, 8> NewAttrList;
|
|
|
|
if (AttrList == 0)
|
|
|
|
NewAttrList.push_back(AttributeWithIndex::get(Idx, Attrs));
|
2008-03-13 01:45:29 +08:00
|
|
|
else {
|
2008-09-26 05:00:45 +08:00
|
|
|
const SmallVector<AttributeWithIndex, 4> &OldAttrList = AttrList->Attrs;
|
2008-03-13 01:45:29 +08:00
|
|
|
unsigned i = 0, e = OldAttrList.size();
|
|
|
|
// Copy attributes for arguments before this one.
|
|
|
|
for (; i != e && OldAttrList[i].Index < Idx; ++i)
|
|
|
|
NewAttrList.push_back(OldAttrList[i]);
|
|
|
|
|
|
|
|
// If there are attributes already at this index, merge them in.
|
|
|
|
if (i != e && OldAttrList[i].Index == Idx) {
|
2012-10-14 15:35:59 +08:00
|
|
|
Attrs =
|
2012-10-16 04:35:56 +08:00
|
|
|
Attributes::get(C, AttrBuilder(Attrs).
|
2012-10-14 15:35:59 +08:00
|
|
|
addAttributes(OldAttrList[i].Attrs));
|
2008-03-13 01:45:29 +08:00
|
|
|
++i;
|
|
|
|
}
|
2012-10-16 14:01:44 +08:00
|
|
|
|
2008-09-26 05:00:45 +08:00
|
|
|
NewAttrList.push_back(AttributeWithIndex::get(Idx, Attrs));
|
2012-10-16 14:01:44 +08:00
|
|
|
|
2008-03-13 01:45:29 +08:00
|
|
|
// Copy attributes for arguments after this one.
|
2012-10-16 14:01:44 +08:00
|
|
|
NewAttrList.insert(NewAttrList.end(),
|
2008-03-13 01:45:29 +08:00
|
|
|
OldAttrList.begin()+i, OldAttrList.end());
|
|
|
|
}
|
2012-10-16 14:01:44 +08:00
|
|
|
|
2012-05-28 09:47:44 +08:00
|
|
|
return get(NewAttrList);
|
2008-01-03 07:42:30 +08:00
|
|
|
}
|
|
|
|
|
2012-10-14 14:39:53 +08:00
|
|
|
AttrListPtr AttrListPtr::removeAttr(LLVMContext &C, unsigned Idx,
|
|
|
|
Attributes Attrs) const {
|
2008-02-20 07:51:49 +08:00
|
|
|
#ifndef NDEBUG
|
|
|
|
// FIXME it is not obvious how this should work for alignment.
|
|
|
|
// For now, say we can't pass in alignment, which no current use does.
|
2012-10-09 15:45:08 +08:00
|
|
|
assert(!Attrs.hasAttribute(Attributes::Alignment) &&
|
|
|
|
"Attempt to exclude alignment!");
|
2008-02-20 07:51:49 +08:00
|
|
|
#endif
|
2008-09-26 05:00:45 +08:00
|
|
|
if (AttrList == 0) return AttrListPtr();
|
2012-10-16 14:01:44 +08:00
|
|
|
|
2008-09-26 05:00:45 +08:00
|
|
|
Attributes OldAttrs = getAttributes(Idx);
|
2012-10-16 04:35:56 +08:00
|
|
|
AttrBuilder NewAttrs =
|
|
|
|
AttrBuilder(OldAttrs).removeAttributes(Attrs);
|
|
|
|
if (NewAttrs == AttrBuilder(OldAttrs))
|
2008-03-13 01:45:29 +08:00
|
|
|
return *this;
|
|
|
|
|
2008-09-26 05:00:45 +08:00
|
|
|
SmallVector<AttributeWithIndex, 8> NewAttrList;
|
|
|
|
const SmallVector<AttributeWithIndex, 4> &OldAttrList = AttrList->Attrs;
|
2008-03-13 01:45:29 +08:00
|
|
|
unsigned i = 0, e = OldAttrList.size();
|
2012-10-16 14:01:44 +08:00
|
|
|
|
2008-03-13 01:45:29 +08:00
|
|
|
// Copy attributes for arguments before this one.
|
|
|
|
for (; i != e && OldAttrList[i].Index < Idx; ++i)
|
|
|
|
NewAttrList.push_back(OldAttrList[i]);
|
2012-10-16 14:01:44 +08:00
|
|
|
|
2008-03-13 01:45:29 +08:00
|
|
|
// If there are attributes already at this index, merge them in.
|
|
|
|
assert(OldAttrList[i].Index == Idx && "Attribute isn't set?");
|
2012-10-16 04:35:56 +08:00
|
|
|
Attrs = Attributes::get(C, AttrBuilder(OldAttrList[i].Attrs).
|
2012-10-14 14:39:53 +08:00
|
|
|
removeAttributes(Attrs));
|
2008-03-13 01:45:29 +08:00
|
|
|
++i;
|
2012-10-14 16:54:26 +08:00
|
|
|
if (Attrs.hasAttributes()) // If any attributes left for this param, add them.
|
2008-09-26 05:00:45 +08:00
|
|
|
NewAttrList.push_back(AttributeWithIndex::get(Idx, Attrs));
|
2012-10-16 14:01:44 +08:00
|
|
|
|
2008-03-13 01:45:29 +08:00
|
|
|
// Copy attributes for arguments after this one.
|
2012-10-16 14:01:44 +08:00
|
|
|
NewAttrList.insert(NewAttrList.end(),
|
2008-03-13 01:45:29 +08:00
|
|
|
OldAttrList.begin()+i, OldAttrList.end());
|
2012-10-16 14:01:44 +08:00
|
|
|
|
2012-05-28 09:47:44 +08:00
|
|
|
return get(NewAttrList);
|
2008-01-03 07:42:30 +08:00
|
|
|
}
|
|
|
|
|
2008-09-26 05:00:45 +08:00
|
|
|
void AttrListPtr::dump() const {
|
2010-01-05 09:29:58 +08:00
|
|
|
dbgs() << "PAL[ ";
|
2008-03-13 01:45:29 +08:00
|
|
|
for (unsigned i = 0; i < getNumSlots(); ++i) {
|
2008-09-26 05:00:45 +08:00
|
|
|
const AttributeWithIndex &PAWI = getSlot(i);
|
2012-10-14 16:54:26 +08:00
|
|
|
dbgs() << "{" << PAWI.Index << "," << PAWI.Attrs.getAsString() << "} ";
|
2008-03-13 01:45:29 +08:00
|
|
|
}
|
2012-10-16 14:01:44 +08:00
|
|
|
|
2010-01-05 09:29:58 +08:00
|
|
|
dbgs() << "]\n";
|
2008-01-07 02:27:01 +08:00
|
|
|
}
|