summaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-12-19 07:18:57 +0000
committerBill Wendling <isanbard@gmail.com>2012-12-19 07:18:57 +0000
commit034b94b17006f51722886b0f2283fb6fb19aca1f (patch)
treee42e091c12137e9599d0e58bfa4336c4af7333b3 /lib/VMCore
parent85022561f9c78446bbc5f745cd9b58f4e5dc92ec (diff)
downloadexternal_llvm-034b94b17006f51722886b0f2283fb6fb19aca1f.zip
external_llvm-034b94b17006f51722886b0f2283fb6fb19aca1f.tar.gz
external_llvm-034b94b17006f51722886b0f2283fb6fb19aca1f.tar.bz2
Rename the 'Attributes' class to 'Attribute'. It's going to represent a single attribute in the future.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170502 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/AsmWriter.cpp14
-rw-r--r--lib/VMCore/Attributes.cpp230
-rw-r--r--lib/VMCore/AttributesImpl.h4
-rw-r--r--lib/VMCore/Core.cpp20
-rw-r--r--lib/VMCore/Function.cpp18
-rw-r--r--lib/VMCore/Instructions.cpp16
-rw-r--r--lib/VMCore/Verifier.cpp104
7 files changed, 203 insertions, 203 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index 4ad08ff..da92c85 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -1197,7 +1197,7 @@ public:
void printModule(const Module *M);
void writeOperand(const Value *Op, bool PrintType);
- void writeParamOperand(const Value *Operand, Attributes Attrs);
+ void writeParamOperand(const Value *Operand, Attribute Attrs);
void writeAtomic(AtomicOrdering Ordering, SynchronizationScope SynchScope);
void writeAllMDNodes();
@@ -1206,7 +1206,7 @@ public:
void printGlobal(const GlobalVariable *GV);
void printAlias(const GlobalAlias *GV);
void printFunction(const Function *F);
- void printArgument(const Argument *FA, Attributes Attrs);
+ void printArgument(const Argument *FA, Attribute Attrs);
void printBasicBlock(const BasicBlock *BB);
void printInstruction(const Instruction &I);
@@ -1251,7 +1251,7 @@ void AssemblyWriter::writeAtomic(AtomicOrdering Ordering,
}
void AssemblyWriter::writeParamOperand(const Value *Operand,
- Attributes Attrs) {
+ Attribute Attrs) {
if (Operand == 0) {
Out << "<null operand!>";
return;
@@ -1557,7 +1557,7 @@ void AssemblyWriter::printFunction(const Function *F) {
FunctionType *FT = F->getFunctionType();
const AttributeSet &Attrs = F->getAttributes();
- Attributes RetAttrs = Attrs.getRetAttributes();
+ Attribute RetAttrs = Attrs.getRetAttributes();
if (RetAttrs.hasAttributes())
Out << Attrs.getRetAttributes().getAsString() << ' ';
TypePrinter.print(F->getReturnType(), Out);
@@ -1587,7 +1587,7 @@ void AssemblyWriter::printFunction(const Function *F) {
// Output type...
TypePrinter.print(FT->getParamType(i), Out);
- Attributes ArgAttrs = Attrs.getParamAttributes(i+1);
+ Attribute ArgAttrs = Attrs.getParamAttributes(i+1);
if (ArgAttrs.hasAttributes())
Out << ' ' << ArgAttrs.getAsString();
}
@@ -1601,7 +1601,7 @@ void AssemblyWriter::printFunction(const Function *F) {
Out << ')';
if (F->hasUnnamedAddr())
Out << " unnamed_addr";
- Attributes FnAttrs = Attrs.getFnAttributes();
+ Attribute FnAttrs = Attrs.getFnAttributes();
if (FnAttrs.hasAttributes())
Out << ' ' << Attrs.getFnAttributes().getAsString();
if (F->hasSection()) {
@@ -1631,7 +1631,7 @@ void AssemblyWriter::printFunction(const Function *F) {
/// the function. Simply print it out
///
void AssemblyWriter::printArgument(const Argument *Arg,
- Attributes Attrs) {
+ Attribute Attrs) {
// Output type...
TypePrinter.print(Arg->getType(), Out);
diff --git a/lib/VMCore/Attributes.cpp b/lib/VMCore/Attributes.cpp
index 02c8aae..8402e82 100644
--- a/lib/VMCore/Attributes.cpp
+++ b/lib/VMCore/Attributes.cpp
@@ -1,4 +1,4 @@
-//===-- Attributes.cpp - Implement AttributesList -------------------------===//
+//===-- Attribute.cpp - Implement AttributesList -------------------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// This file implements the Attributes, AttributeImpl, AttrBuilder,
+// This file implements the Attribute, AttributeImpl, AttrBuilder,
// AttributeListImpl, and AttributeSet classes.
//
//===----------------------------------------------------------------------===//
@@ -26,21 +26,21 @@
using namespace llvm;
//===----------------------------------------------------------------------===//
-// Attributes Implementation
+// Attribute Implementation
//===----------------------------------------------------------------------===//
-Attributes Attributes::get(LLVMContext &Context, ArrayRef<AttrVal> Vals) {
+Attribute Attribute::get(LLVMContext &Context, ArrayRef<AttrVal> Vals) {
AttrBuilder B;
for (ArrayRef<AttrVal>::iterator I = Vals.begin(), E = Vals.end();
I != E; ++I)
B.addAttribute(*I);
- return Attributes::get(Context, B);
+ return Attribute::get(Context, B);
}
-Attributes Attributes::get(LLVMContext &Context, AttrBuilder &B) {
- // If there are no attributes, return an empty Attributes class.
+Attribute Attribute::get(LLVMContext &Context, AttrBuilder &B) {
+ // If there are no attributes, return an empty Attribute class.
if (!B.hasAttributes())
- return Attributes();
+ return Attribute();
// Otherwise, build a key to look up the existing attributes.
LLVMContextImpl *pImpl = Context.pImpl;
@@ -58,63 +58,63 @@ Attributes Attributes::get(LLVMContext &Context, AttrBuilder &B) {
}
// Return the AttributesList that we found or created.
- return Attributes(PA);
+ return Attribute(PA);
}
-bool Attributes::hasAttribute(AttrVal Val) const {
+bool Attribute::hasAttribute(AttrVal Val) const {
return Attrs && Attrs->hasAttribute(Val);
}
-bool Attributes::hasAttributes() const {
+bool Attribute::hasAttributes() const {
return Attrs && Attrs->hasAttributes();
}
-bool Attributes::hasAttributes(const Attributes &A) const {
+bool Attribute::hasAttributes(const Attribute &A) const {
return Attrs && Attrs->hasAttributes(A);
}
/// This returns the alignment field of an attribute as a byte alignment value.
-unsigned Attributes::getAlignment() const {
- if (!hasAttribute(Attributes::Alignment))
+unsigned Attribute::getAlignment() const {
+ if (!hasAttribute(Attribute::Alignment))
return 0;
return 1U << ((Attrs->getAlignment() >> 16) - 1);
}
/// This returns the stack alignment field of an attribute as a byte alignment
/// value.
-unsigned Attributes::getStackAlignment() const {
- if (!hasAttribute(Attributes::StackAlignment))
+unsigned Attribute::getStackAlignment() const {
+ if (!hasAttribute(Attribute::StackAlignment))
return 0;
return 1U << ((Attrs->getStackAlignment() >> 26) - 1);
}
-uint64_t Attributes::Raw() const {
+uint64_t Attribute::Raw() const {
return Attrs ? Attrs->Raw() : 0;
}
-Attributes Attributes::typeIncompatible(Type *Ty) {
+Attribute Attribute::typeIncompatible(Type *Ty) {
AttrBuilder Incompatible;
if (!Ty->isIntegerTy())
- // Attributes that only apply to integers.
- Incompatible.addAttribute(Attributes::SExt)
- .addAttribute(Attributes::ZExt);
+ // Attribute that only apply to integers.
+ Incompatible.addAttribute(Attribute::SExt)
+ .addAttribute(Attribute::ZExt);
if (!Ty->isPointerTy())
- // Attributes that only apply to pointers.
- Incompatible.addAttribute(Attributes::ByVal)
- .addAttribute(Attributes::Nest)
- .addAttribute(Attributes::NoAlias)
- .addAttribute(Attributes::NoCapture)
- .addAttribute(Attributes::StructRet);
+ // Attribute that only apply to pointers.
+ Incompatible.addAttribute(Attribute::ByVal)
+ .addAttribute(Attribute::Nest)
+ .addAttribute(Attribute::NoAlias)
+ .addAttribute(Attribute::NoCapture)
+ .addAttribute(Attribute::StructRet);
- return Attributes::get(Ty->getContext(), Incompatible);
+ return Attribute::get(Ty->getContext(), Incompatible);
}
/// 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) {
+uint64_t Attribute::encodeLLVMAttributesForBitcode(Attribute 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
@@ -125,7 +125,7 @@ uint64_t Attributes::encodeLLVMAttributesForBitcode(Attributes Attrs) {
// 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))
+ if (Attrs.hasAttribute(Attribute::Alignment))
EncodedAttrs |= Attrs.getAlignment() << 16;
EncodedAttrs |= (Attrs.Raw() & (0xffffULL << 21)) << 11;
return EncodedAttrs;
@@ -134,7 +134,7 @@ uint64_t Attributes::encodeLLVMAttributesForBitcode(Attributes Attrs) {
/// 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,
+Attribute Attribute::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.
@@ -146,69 +146,69 @@ Attributes Attributes::decodeLLVMAttributesForBitcode(LLVMContext &C,
if (Alignment)
B.addAlignmentAttr(Alignment);
B.addRawValue((EncodedAttrs & (0xffffULL << 32)) >> 11);
- return Attributes::get(C, B);
+ return Attribute::get(C, B);
}
-std::string Attributes::getAsString() const {
+std::string Attribute::getAsString() const {
std::string Result;
- if (hasAttribute(Attributes::ZExt))
+ if (hasAttribute(Attribute::ZExt))
Result += "zeroext ";
- if (hasAttribute(Attributes::SExt))
+ if (hasAttribute(Attribute::SExt))
Result += "signext ";
- if (hasAttribute(Attributes::NoReturn))
+ if (hasAttribute(Attribute::NoReturn))
Result += "noreturn ";
- if (hasAttribute(Attributes::NoUnwind))
+ if (hasAttribute(Attribute::NoUnwind))
Result += "nounwind ";
- if (hasAttribute(Attributes::UWTable))
+ if (hasAttribute(Attribute::UWTable))
Result += "uwtable ";
- if (hasAttribute(Attributes::ReturnsTwice))
+ if (hasAttribute(Attribute::ReturnsTwice))
Result += "returns_twice ";
- if (hasAttribute(Attributes::InReg))
+ if (hasAttribute(Attribute::InReg))
Result += "inreg ";
- if (hasAttribute(Attributes::NoAlias))
+ if (hasAttribute(Attribute::NoAlias))
Result += "noalias ";
- if (hasAttribute(Attributes::NoCapture))
+ if (hasAttribute(Attribute::NoCapture))
Result += "nocapture ";
- if (hasAttribute(Attributes::StructRet))
+ if (hasAttribute(Attribute::StructRet))
Result += "sret ";
- if (hasAttribute(Attributes::ByVal))
+ if (hasAttribute(Attribute::ByVal))
Result += "byval ";
- if (hasAttribute(Attributes::Nest))
+ if (hasAttribute(Attribute::Nest))
Result += "nest ";
- if (hasAttribute(Attributes::ReadNone))
+ if (hasAttribute(Attribute::ReadNone))
Result += "readnone ";
- if (hasAttribute(Attributes::ReadOnly))
+ if (hasAttribute(Attribute::ReadOnly))
Result += "readonly ";
- if (hasAttribute(Attributes::OptimizeForSize))
+ if (hasAttribute(Attribute::OptimizeForSize))
Result += "optsize ";
- if (hasAttribute(Attributes::NoInline))
+ if (hasAttribute(Attribute::NoInline))
Result += "noinline ";
- if (hasAttribute(Attributes::InlineHint))
+ if (hasAttribute(Attribute::InlineHint))
Result += "inlinehint ";
- if (hasAttribute(Attributes::AlwaysInline))
+ if (hasAttribute(Attribute::AlwaysInline))
Result += "alwaysinline ";
- if (hasAttribute(Attributes::StackProtect))
+ if (hasAttribute(Attribute::StackProtect))
Result += "ssp ";
- if (hasAttribute(Attributes::StackProtectReq))
+ if (hasAttribute(Attribute::StackProtectReq))
Result += "sspreq ";
- if (hasAttribute(Attributes::NoRedZone))
+ if (hasAttribute(Attribute::NoRedZone))
Result += "noredzone ";
- if (hasAttribute(Attributes::NoImplicitFloat))
+ if (hasAttribute(Attribute::NoImplicitFloat))
Result += "noimplicitfloat ";
- if (hasAttribute(Attributes::Naked))
+ if (hasAttribute(Attribute::Naked))
Result += "naked ";
- if (hasAttribute(Attributes::NonLazyBind))
+ if (hasAttribute(Attribute::NonLazyBind))
Result += "nonlazybind ";
- if (hasAttribute(Attributes::AddressSafety))
+ if (hasAttribute(Attribute::AddressSafety))
Result += "address_safety ";
- if (hasAttribute(Attributes::MinSize))
+ if (hasAttribute(Attribute::MinSize))
Result += "minsize ";
- if (hasAttribute(Attributes::StackAlignment)) {
+ if (hasAttribute(Attribute::StackAlignment)) {
Result += "alignstack(";
Result += utostr(getStackAlignment());
Result += ") ";
}
- if (hasAttribute(Attributes::Alignment)) {
+ if (hasAttribute(Attribute::Alignment)) {
Result += "align ";
Result += utostr(getAlignment());
Result += " ";
@@ -223,7 +223,7 @@ std::string Attributes::getAsString() const {
// AttrBuilder Implementation
//===----------------------------------------------------------------------===//
-AttrBuilder &AttrBuilder::addAttribute(Attributes::AttrVal Val){
+AttrBuilder &AttrBuilder::addAttribute(Attribute::AttrVal Val){
Bits |= AttributesImpl::getAttrMask(Val);
return *this;
}
@@ -249,47 +249,47 @@ AttrBuilder &AttrBuilder::addStackAlignmentAttr(unsigned Align){
return *this;
}
-AttrBuilder &AttrBuilder::removeAttribute(Attributes::AttrVal Val) {
+AttrBuilder &AttrBuilder::removeAttribute(Attribute::AttrVal Val) {
Bits &= ~AttributesImpl::getAttrMask(Val);
return *this;
}
-AttrBuilder &AttrBuilder::addAttributes(const Attributes &A) {
+AttrBuilder &AttrBuilder::addAttributes(const Attribute &A) {
Bits |= A.Raw();
return *this;
}
-AttrBuilder &AttrBuilder::removeAttributes(const Attributes &A){
+AttrBuilder &AttrBuilder::removeAttributes(const Attribute &A){
Bits &= ~A.Raw();
return *this;
}
-bool AttrBuilder::hasAttribute(Attributes::AttrVal A) const {
+bool AttrBuilder::hasAttribute(Attribute::AttrVal A) const {
return Bits & AttributesImpl::getAttrMask(A);
}
bool AttrBuilder::hasAttributes() const {
return Bits != 0;
}
-bool AttrBuilder::hasAttributes(const Attributes &A) const {
+bool AttrBuilder::hasAttributes(const Attribute &A) const {
return Bits & A.Raw();
}
bool AttrBuilder::hasAlignmentAttr() const {
- return Bits & AttributesImpl::getAttrMask(Attributes::Alignment);
+ return Bits & AttributesImpl::getAttrMask(Attribute::Alignment);
}
uint64_t AttrBuilder::getAlignment() const {
if (!hasAlignmentAttr())
return 0;
return 1ULL <<
- (((Bits & AttributesImpl::getAttrMask(Attributes::Alignment)) >> 16) - 1);
+ (((Bits & AttributesImpl::getAttrMask(Attribute::Alignment)) >> 16) - 1);
}
uint64_t AttrBuilder::getStackAlignment() const {
if (!hasAlignmentAttr())
return 0;
return 1ULL <<
- (((Bits & AttributesImpl::getAttrMask(Attributes::StackAlignment))>>26)-1);
+ (((Bits & AttributesImpl::getAttrMask(Attribute::StackAlignment))>>26)-1);
}
//===----------------------------------------------------------------------===//
@@ -298,35 +298,35 @@ uint64_t AttrBuilder::getStackAlignment() const {
uint64_t AttributesImpl::getAttrMask(uint64_t Val) {
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;
- case Attributes::MinSize: return 1ULL << 33;
+ case Attribute::None: return 0;
+ case Attribute::ZExt: return 1 << 0;
+ case Attribute::SExt: return 1 << 1;
+ case Attribute::NoReturn: return 1 << 2;
+ case Attribute::InReg: return 1 << 3;
+ case Attribute::StructRet: return 1 << 4;
+ case Attribute::NoUnwind: return 1 << 5;
+ case Attribute::NoAlias: return 1 << 6;
+ case Attribute::ByVal: return 1 << 7;
+ case Attribute::Nest: return 1 << 8;
+ case Attribute::ReadNone: return 1 << 9;
+ case Attribute::ReadOnly: return 1 << 10;
+ case Attribute::NoInline: return 1 << 11;
+ case Attribute::AlwaysInline: return 1 << 12;
+ case Attribute::OptimizeForSize: return 1 << 13;
+ case Attribute::StackProtect: return 1 << 14;
+ case Attribute::StackProtectReq: return 1 << 15;
+ case Attribute::Alignment: return 31 << 16;
+ case Attribute::NoCapture: return 1 << 21;
+ case Attribute::NoRedZone: return 1 << 22;
+ case Attribute::NoImplicitFloat: return 1 << 23;
+ case Attribute::Naked: return 1 << 24;
+ case Attribute::InlineHint: return 1 << 25;
+ case Attribute::StackAlignment: return 7 << 26;
+ case Attribute::ReturnsTwice: return 1 << 29;
+ case Attribute::UWTable: return 1 << 30;
+ case Attribute::NonLazyBind: return 1U << 31;
+ case Attribute::AddressSafety: return 1ULL << 32;
+ case Attribute::MinSize: return 1ULL << 33;
}
llvm_unreachable("Unsupported attribute type");
}
@@ -339,16 +339,16 @@ bool AttributesImpl::hasAttributes() const {
return Bits != 0;
}
-bool AttributesImpl::hasAttributes(const Attributes &A) const {
+bool AttributesImpl::hasAttributes(const Attribute &A) const {
return Bits & A.Raw(); // FIXME: Raw() won't work here in the future.
}
uint64_t AttributesImpl::getAlignment() const {
- return Bits & getAttrMask(Attributes::Alignment);
+ return Bits & getAttrMask(Attribute::Alignment);
}
uint64_t AttributesImpl::getStackAlignment() const {
- return Bits & getAttrMask(Attributes::StackAlignment);
+ return Bits & getAttrMask(Attribute::StackAlignment);
}
//===----------------------------------------------------------------------===//
@@ -416,22 +416,22 @@ const AttributeWithIndex &AttributeSet::getSlot(unsigned Slot) const {
}
/// getAttributes - The attributes for the specified index are returned.
-/// Attributes for the result are denoted with Idx = 0. Function notes are
+/// Attribute for the result are denoted with Idx = 0. Function notes are
/// denoted with idx = ~0.
-Attributes AttributeSet::getAttributes(unsigned Idx) const {
- if (AttrList == 0) return Attributes();
+Attribute AttributeSet::getAttributes(unsigned Idx) const {
+ if (AttrList == 0) return Attribute();
const SmallVector<AttributeWithIndex, 4> &Attrs = AttrList->Attrs;
for (unsigned i = 0, e = Attrs.size(); i != e && Attrs[i].Index <= Idx; ++i)
if (Attrs[i].Index == Idx)
return Attrs[i].Attrs;
- return Attributes();
+ return Attribute();
}
/// hasAttrSomewhere - Return true if the specified attribute is set for at
/// least one parameter or for the return value.
-bool AttributeSet::hasAttrSomewhere(Attributes::AttrVal Attr) const {
+bool AttributeSet::hasAttrSomewhere(Attribute::AttrVal Attr) const {
if (AttrList == 0) return false;
const SmallVector<AttributeWithIndex, 4> &Attrs = AttrList->Attrs;
@@ -446,15 +446,15 @@ unsigned AttributeSet::getNumAttrs() const {
return AttrList ? AttrList->Attrs.size() : 0;
}
-Attributes &AttributeSet::getAttributesAtIndex(unsigned i) const {
+Attribute &AttributeSet::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;
}
AttributeSet AttributeSet::addAttr(LLVMContext &C, unsigned Idx,
- Attributes Attrs) const {
- Attributes OldAttrs = getAttributes(Idx);
+ Attribute Attrs) const {
+ Attribute OldAttrs = getAttributes(Idx);
#ifndef NDEBUG
// FIXME it is not obvious how this should work for alignment.
// For now, say we can't change a known alignment.
@@ -482,7 +482,7 @@ AttributeSet AttributeSet::addAttr(LLVMContext &C, unsigned Idx,
// If there are attributes already at this index, merge them in.
if (i != e && OldAttrList[i].Index == Idx) {
Attrs =
- Attributes::get(C, AttrBuilder(Attrs).
+ Attribute::get(C, AttrBuilder(Attrs).
addAttributes(OldAttrList[i].Attrs));
++i;
}
@@ -498,16 +498,16 @@ AttributeSet AttributeSet::addAttr(LLVMContext &C, unsigned Idx,
}
AttributeSet AttributeSet::removeAttr(LLVMContext &C, unsigned Idx,
- Attributes Attrs) const {
+ Attribute Attrs) const {
#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.
- assert(!Attrs.hasAttribute(Attributes::Alignment) &&
+ assert(!Attrs.hasAttribute(Attribute::Alignment) &&
"Attempt to exclude alignment!");
#endif
if (AttrList == 0) return AttributeSet();
- Attributes OldAttrs = getAttributes(Idx);
+ Attribute OldAttrs = getAttributes(Idx);
AttrBuilder NewAttrs =
AttrBuilder(OldAttrs).removeAttributes(Attrs);
if (NewAttrs == AttrBuilder(OldAttrs))
@@ -523,7 +523,7 @@ AttributeSet AttributeSet::removeAttr(LLVMContext &C, unsigned Idx,
// If there are attributes already at this index, merge them in.
assert(OldAttrList[i].Index == Idx && "Attribute isn't set?");
- Attrs = Attributes::get(C, AttrBuilder(OldAttrList[i].Attrs).
+ Attrs = Attribute::get(C, AttrBuilder(OldAttrList[i].Attrs).
removeAttributes(Attrs));
++i;
if (Attrs.hasAttributes()) // If any attributes left for this param, add them.
diff --git a/lib/VMCore/AttributesImpl.h b/lib/VMCore/AttributesImpl.h
index 193e873..7bc5c50 100644
--- a/lib/VMCore/AttributesImpl.h
+++ b/lib/VMCore/AttributesImpl.h
@@ -1,4 +1,4 @@
-//===-- AttributesImpl.h - Attributes Internals -----------------*- C++ -*-===//
+//===-- AttributesImpl.h - Attribute Internals -----------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -28,7 +28,7 @@ public:
bool hasAttribute(uint64_t A) const;
bool hasAttributes() const;
- bool hasAttributes(const Attributes &A) const;
+ bool hasAttributes(const Attribute &A) const;
uint64_t getAlignment() const;
uint64_t getStackAlignment() const;
diff --git a/lib/VMCore/Core.cpp b/lib/VMCore/Core.cpp
index 0fb37cb..71098bf 100644
--- a/lib/VMCore/Core.cpp
+++ b/lib/VMCore/Core.cpp
@@ -1384,7 +1384,7 @@ void LLVMAddFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA) {
AttrBuilder B(PA);
const AttributeSet PALnew =
PAL.addAttr(Func->getContext(), AttributeSet::FunctionIndex,
- Attributes::get(Func->getContext(), B));
+ Attribute::get(Func->getContext(), B));
Func->setAttributes(PALnew);
}
@@ -1394,14 +1394,14 @@ void LLVMRemoveFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA) {
AttrBuilder B(PA);
const AttributeSet PALnew =
PAL.removeAttr(Func->getContext(), AttributeSet::FunctionIndex,
- Attributes::get(Func->getContext(), B));
+ Attribute::get(Func->getContext(), B));
Func->setAttributes(PALnew);
}
LLVMAttribute LLVMGetFunctionAttr(LLVMValueRef Fn) {
Function *Func = unwrap<Function>(Fn);
const AttributeSet PAL = Func->getAttributes();
- Attributes attr = PAL.getFnAttributes();
+ Attribute attr = PAL.getFnAttributes();
return (LLVMAttribute)attr.Raw();
}
@@ -1466,18 +1466,18 @@ LLVMValueRef LLVMGetPreviousParam(LLVMValueRef Arg) {
void LLVMAddAttribute(LLVMValueRef Arg, LLVMAttribute PA) {
Argument *A = unwrap<Argument>(Arg);
AttrBuilder B(PA);
- A->addAttr(Attributes::get(A->getContext(), B));
+ A->addAttr(Attribute::get(A->getContext(), B));
}
void LLVMRemoveAttribute(LLVMValueRef Arg, LLVMAttribute PA) {
Argument *A = unwrap<Argument>(Arg);
AttrBuilder B(PA);
- A->removeAttr(Attributes::get(A->getContext(), B));
+ A->removeAttr(Attribute::get(A->getContext(), B));
}
LLVMAttribute LLVMGetAttribute(LLVMValueRef Arg) {
Argument *A = unwrap<Argument>(Arg);
- Attributes attr = A->getParent()->getAttributes().getParamAttributes(
+ Attribute attr = A->getParent()->getAttributes().getParamAttributes(
A->getArgNo()+1);
return (LLVMAttribute)attr.Raw();
}
@@ -1486,7 +1486,7 @@ LLVMAttribute LLVMGetAttribute(LLVMValueRef Arg) {
void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align) {
AttrBuilder B;
B.addAlignmentAttr(align);
- unwrap<Argument>(Arg)->addAttr(Attributes::
+ unwrap<Argument>(Arg)->addAttr(Attribute::
get(unwrap<Argument>(Arg)->getContext(), B));
}
@@ -1679,7 +1679,7 @@ void LLVMAddInstrAttribute(LLVMValueRef Instr, unsigned index,
AttrBuilder B(PA);
Call.setAttributes(
Call.getAttributes().addAttr(Call->getContext(), index,
- Attributes::get(Call->getContext(), B)));
+ Attribute::get(Call->getContext(), B)));
}
void LLVMRemoveInstrAttribute(LLVMValueRef Instr, unsigned index,
@@ -1688,7 +1688,7 @@ void LLVMRemoveInstrAttribute(LLVMValueRef Instr, unsigned index,
AttrBuilder B(PA);
Call.setAttributes(
Call.getAttributes().removeAttr(Call->getContext(), index,
- Attributes::get(Call->getContext(), B)));
+ Attribute::get(Call->getContext(), B)));
}
void LLVMSetInstrParamAlignment(LLVMValueRef Instr, unsigned index,
@@ -1697,7 +1697,7 @@ void LLVMSetInstrParamAlignment(LLVMValueRef Instr, unsigned index,
AttrBuilder B;
B.addAlignmentAttr(align);
Call.setAttributes(Call.getAttributes().addAttr(Call->getContext(), index,
- Attributes::get(Call->getContext(), B)));
+ Attribute::get(Call->getContext(), B)));
}
/*--.. Operations on call instructions (only) ..............................--*/
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp
index 013299e..cd3b663 100644
--- a/lib/VMCore/Function.cpp
+++ b/lib/VMCore/Function.cpp
@@ -80,7 +80,7 @@ unsigned Argument::getArgNo() const {
bool Argument::hasByValAttr() const {
if (!getType()->isPointerTy()) return false;
return getParent()->getParamAttributes(getArgNo()+1).
- hasAttribute(Attributes::ByVal);
+ hasAttribute(Attribute::ByVal);
}
unsigned Argument::getParamAlignment() const {
@@ -94,7 +94,7 @@ unsigned Argument::getParamAlignment() const {
bool Argument::hasNestAttr() const {
if (!getType()->isPointerTy()) return false;
return getParent()->getParamAttributes(getArgNo()+1).
- hasAttribute(Attributes::Nest);
+ hasAttribute(Attribute::Nest);
}
/// hasNoAliasAttr - Return true if this argument has the noalias attribute on
@@ -102,7 +102,7 @@ bool Argument::hasNestAttr() const {
bool Argument::hasNoAliasAttr() const {
if (!getType()->isPointerTy()) return false;
return getParent()->getParamAttributes(getArgNo()+1).
- hasAttribute(Attributes::NoAlias);
+ hasAttribute(Attribute::NoAlias);
}
/// hasNoCaptureAttr - Return true if this argument has the nocapture attribute
@@ -110,7 +110,7 @@ bool Argument::hasNoAliasAttr() const {
bool Argument::hasNoCaptureAttr() const {
if (!getType()->isPointerTy()) return false;
return getParent()->getParamAttributes(getArgNo()+1).
- hasAttribute(Attributes::NoCapture);
+ hasAttribute(Attribute::NoCapture);
}
/// hasSRetAttr - Return true if this argument has the sret attribute on
@@ -120,16 +120,16 @@ bool Argument::hasStructRetAttr() const {
if (this != getParent()->arg_begin())
return false; // StructRet param must be first param
return getParent()->getParamAttributes(1).
- hasAttribute(Attributes::StructRet);
+ hasAttribute(Attribute::StructRet);
}
/// addAttr - Add a Attribute to an argument
-void Argument::addAttr(Attributes attr) {
+void Argument::addAttr(Attribute attr) {
getParent()->addAttribute(getArgNo() + 1, attr);
}
/// removeAttr - Remove a Attribute from an argument
-void Argument::removeAttr(Attributes attr) {
+void Argument::removeAttr(Attribute attr) {
getParent()->removeAttribute(getArgNo() + 1, attr);
}
@@ -248,13 +248,13 @@ void Function::dropAllReferences() {
BasicBlocks.begin()->eraseFromParent();
}
-void Function::addAttribute(unsigned i, Attributes attr) {
+void Function::addAttribute(unsigned i, Attribute attr) {
AttributeSet PAL = getAttributes();
PAL = PAL.addAttr(getContext(), i, attr);
setAttributes(PAL);
}
-void Function::removeAttribute(unsigned i, Attributes attr) {
+void Function::removeAttribute(unsigned i, Attribute attr) {
AttributeSet PAL = getAttributes();
PAL = PAL.removeAttr(getContext(), i, attr);
setAttributes(PAL);
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index 17ab34f..1870426 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -331,19 +331,19 @@ CallInst::CallInst(const CallInst &CI)
SubclassOptionalData = CI.SubclassOptionalData;
}
-void CallInst::addAttribute(unsigned i, Attributes attr) {
+void CallInst::addAttribute(unsigned i, Attribute attr) {
AttributeSet PAL = getAttributes();
PAL = PAL.addAttr(getContext(), i, attr);
setAttributes(PAL);
}
-void CallInst::removeAttribute(unsigned i, Attributes attr) {
+void CallInst::removeAttribute(unsigned i, Attribute attr) {
AttributeSet PAL = getAttributes();
PAL = PAL.removeAttr(getContext(), i, attr);
setAttributes(PAL);
}
-bool CallInst::hasFnAttr(Attributes::AttrVal A) const {
+bool CallInst::hasFnAttr(Attribute::AttrVal A) const {
if (AttributeList.getParamAttributes(AttributeSet::FunctionIndex)
.hasAttribute(A))
return true;
@@ -352,7 +352,7 @@ bool CallInst::hasFnAttr(Attributes::AttrVal A) const {
return false;
}
-bool CallInst::paramHasAttr(unsigned i, Attributes::AttrVal A) const {
+bool CallInst::paramHasAttr(unsigned i, Attribute::AttrVal A) const {
if (AttributeList.getParamAttributes(i).hasAttribute(A))
return true;
if (const Function *F = getCalledFunction())
@@ -572,7 +572,7 @@ void InvokeInst::setSuccessorV(unsigned idx, BasicBlock *B) {
return setSuccessor(idx, B);
}
-bool InvokeInst::hasFnAttr(Attributes::AttrVal A) const {
+bool InvokeInst::hasFnAttr(Attribute::AttrVal A) const {
if (AttributeList.getParamAttributes(AttributeSet::FunctionIndex).
hasAttribute(A))
return true;
@@ -581,7 +581,7 @@ bool InvokeInst::hasFnAttr(Attributes::AttrVal A) const {
return false;
}
-bool InvokeInst::paramHasAttr(unsigned i, Attributes::AttrVal A) const {
+bool InvokeInst::paramHasAttr(unsigned i, Attribute::AttrVal A) const {
if (AttributeList.getParamAttributes(i).hasAttribute(A))
return true;
if (const Function *F = getCalledFunction())
@@ -589,13 +589,13 @@ bool InvokeInst::paramHasAttr(unsigned i, Attributes::AttrVal A) const {
return false;
}
-void InvokeInst::addAttribute(unsigned i, Attributes attr) {
+void InvokeInst::addAttribute(unsigned i, Attribute attr) {
AttributeSet PAL = getAttributes();
PAL = PAL.addAttr(getContext(), i, attr);
setAttributes(PAL);
}
-void InvokeInst::removeAttribute(unsigned i, Attributes attr) {
+void InvokeInst::removeAttribute(unsigned i, Attribute attr) {
AttributeSet PAL = getAttributes();
PAL = PAL.removeAttr(getContext(), i, attr);
setAttributes(PAL);
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp
index 0c9493e..03bb2dd 100644
--- a/lib/VMCore/Verifier.cpp
+++ b/lib/VMCore/Verifier.cpp
@@ -297,7 +297,7 @@ namespace {
bool VerifyIntrinsicType(Type *Ty,
ArrayRef<Intrinsic::IITDescriptor> &Infos,
SmallVectorImpl<Type*> &ArgTys);
- void VerifyParameterAttrs(Attributes Attrs, Type *Ty,
+ void VerifyParameterAttrs(Attribute Attrs, Type *Ty,
bool isReturnValue, const Value *V);
void VerifyFunctionAttrs(FunctionType *FT, const AttributeSet &Attrs,
const Value *V);
@@ -524,7 +524,7 @@ void Verifier::visitMDNode(MDNode &MD, Function *F) {
// VerifyParameterAttrs - Check the given attributes for an argument or return
// value of the specified type. The value V is printed in error messages.
-void Verifier::VerifyParameterAttrs(Attributes Attrs, Type *Ty,
+void Verifier::VerifyParameterAttrs(Attribute Attrs, Type *Ty,
bool isReturnValue, const Value *V) {
if (!Attrs.hasAttributes())
return;
@@ -535,49 +535,49 @@ void Verifier::VerifyParameterAttrs(Attributes Attrs, Type *Ty,
if (isReturnValue)
Assert1(!Attrs.hasParameterOnlyAttrs(),
- "Attributes 'byval', 'nest', 'sret', and 'nocapture' "
+ "Attribute 'byval', 'nest', 'sret', and 'nocapture' "
"do not apply to return values!", V);
// Check for mutually incompatible attributes.
- Assert1(!((Attrs.hasAttribute(Attributes::ByVal) &&
- Attrs.hasAttribute(Attributes::Nest)) ||
- (Attrs.hasAttribute(Attributes::ByVal) &&
- Attrs.hasAttribute(Attributes::StructRet)) ||
- (Attrs.hasAttribute(Attributes::Nest) &&
- Attrs.hasAttribute(Attributes::StructRet))), "Attributes "
+ Assert1(!((Attrs.hasAttribute(Attribute::ByVal) &&
+ Attrs.hasAttribute(Attribute::Nest)) ||
+ (Attrs.hasAttribute(Attribute::ByVal) &&
+ Attrs.hasAttribute(Attribute::StructRet)) ||
+ (Attrs.hasAttribute(Attribute::Nest) &&
+ Attrs.hasAttribute(Attribute::StructRet))), "Attributes "
"'byval, nest, and sret' are incompatible!", V);
- Assert1(!((Attrs.hasAttribute(Attributes::ByVal) &&
- Attrs.hasAttribute(Attributes::Nest)) ||
- (Attrs.hasAttribute(Attributes::ByVal) &&
- Attrs.hasAttribute(Attributes::InReg)) ||
- (Attrs.hasAttribute(Attributes::Nest) &&
- Attrs.hasAttribute(Attributes::InReg))), "Attributes "
+ Assert1(!((Attrs.hasAttribute(Attribute::ByVal) &&
+ Attrs.hasAttribute(Attribute::Nest)) ||
+ (Attrs.hasAttribute(Attribute::ByVal) &&
+ Attrs.hasAttribute(Attribute::InReg)) ||
+ (Attrs.hasAttribute(Attribute::Nest) &&
+ Attrs.hasAttribute(Attribute::InReg))), "Attributes "
"'byval, nest, and inreg' are incompatible!", V);
- Assert1(!(Attrs.hasAttribute(Attributes::ZExt) &&
- Attrs.hasAttribute(Attributes::SExt)), "Attributes "
+ Assert1(!(Attrs.hasAttribute(Attribute::ZExt) &&
+ Attrs.hasAttribute(Attribute::SExt)), "Attributes "
"'zeroext and signext' are incompatible!", V);
- Assert1(!(Attrs.hasAttribute(Attributes::ReadNone) &&
- Attrs.hasAttribute(Attributes::ReadOnly)), "Attributes "
+ Assert1(!(Attrs.hasAttribute(Attribute::ReadNone) &&
+ Attrs.hasAttribute(Attribute::ReadOnly)), "Attributes "
"'readnone and readonly' are incompatible!", V);
- Assert1(!(Attrs.hasAttribute(Attributes::NoInline) &&
- Attrs.hasAttribute(Attributes::AlwaysInline)), "Attributes "
+ Assert1(!(Attrs.hasAttribute(Attribute::NoInline) &&
+ Attrs.hasAttribute(Attribute::AlwaysInline)), "Attributes "
"'noinline and alwaysinline' are incompatible!", V);
Assert1(!AttrBuilder(Attrs).
- hasAttributes(Attributes::typeIncompatible(Ty)),
+ hasAttributes(Attribute::typeIncompatible(Ty)),
"Wrong types for attribute: " +
- Attributes::typeIncompatible(Ty).getAsString(), V);
+ Attribute::typeIncompatible(Ty).getAsString(), V);
if (PointerType *PTy = dyn_cast<PointerType>(Ty))
- Assert1(!Attrs.hasAttribute(Attributes::ByVal) ||
+ Assert1(!Attrs.hasAttribute(Attribute::ByVal) ||
PTy->getElementType()->isSized(),
"Attribute 'byval' does not support unsized types!", V);
else
- Assert1(!Attrs.hasAttribute(Attributes::ByVal),
+ Assert1(!Attrs.hasAttribute(Attribute::ByVal),
"Attribute 'byval' only applies to parameters with pointer type!",
V);
}
@@ -605,49 +605,49 @@ void Verifier::VerifyFunctionAttrs(FunctionType *FT,
VerifyParameterAttrs(Attr.Attrs, Ty, Attr.Index == 0, V);
- if (Attr.Attrs.hasAttribute(Attributes::Nest)) {
+ if (Attr.Attrs.hasAttribute(Attribute::Nest)) {
Assert1(!SawNest, "More than one parameter has attribute nest!", V);
SawNest = true;
}
- if (Attr.Attrs.hasAttribute(Attributes::StructRet))
- Assert1(Attr.Index == 1, "Attribute sret not on first parameter!", V);
+ if (Attr.Attrs.hasAttribute(Attribute::StructRet))
+ Assert1(Attr.Index == 1, "Attribute sret is not on first parameter!", V);
}
- Attributes FAttrs = Attrs.getFnAttributes();
+ Attribute FAttrs = Attrs.getFnAttributes();
AttrBuilder NotFn(FAttrs);
NotFn.removeFunctionOnlyAttrs();
- Assert1(!NotFn.hasAttributes(), "Attributes '" +
- Attributes::get(V->getContext(), NotFn).getAsString() +
+ Assert1(!NotFn.hasAttributes(), "Attribute '" +
+ Attribute::get(V->getContext(), NotFn).getAsString() +
"' do not apply to the function!", V);
// Check for mutually incompatible attributes.
- Assert1(!((FAttrs.hasAttribute(Attributes::ByVal) &&
- FAttrs.hasAttribute(Attributes::Nest)) ||
- (FAttrs.hasAttribute(Attributes::ByVal) &&
- FAttrs.hasAttribute(Attributes::StructRet)) ||
- (FAttrs.hasAttribute(Attributes::Nest) &&
- FAttrs.hasAttribute(Attributes::StructRet))), "Attributes "
+ Assert1(!((FAttrs.hasAttribute(Attribute::ByVal) &&
+ FAttrs.hasAttribute(Attribute::Nest)) ||
+ (FAttrs.hasAttribute(Attribute::ByVal) &&
+ FAttrs.hasAttribute(Attribute::StructRet)) ||
+ (FAttrs.hasAttribute(Attribute::Nest) &&
+ FAttrs.hasAttribute(Attribute::StructRet))), "Attributes "
"'byval, nest, and sret' are incompatible!", V);
- Assert1(!((FAttrs.hasAttribute(Attributes::ByVal) &&
- FAttrs.hasAttribute(Attributes::Nest)) ||
- (FAttrs.hasAttribute(Attributes::ByVal) &&
- FAttrs.hasAttribute(Attributes::InReg)) ||
- (FAttrs.hasAttribute(Attributes::Nest) &&
- FAttrs.hasAttribute(Attributes::InReg))), "Attributes "
+ Assert1(!((FAttrs.hasAttribute(Attribute::ByVal) &&
+ FAttrs.hasAttribute(Attribute::Nest)) ||
+ (FAttrs.hasAttribute(Attribute::ByVal) &&
+ FAttrs.hasAttribute(Attribute::InReg)) ||
+ (FAttrs.hasAttribute(Attribute::Nest) &&
+ FAttrs.hasAttribute(Attribute::InReg))), "Attributes "
"'byval, nest, and inreg' are incompatible!", V);
- Assert1(!(FAttrs.hasAttribute(Attributes::ZExt) &&
- FAttrs.hasAttribute(Attributes::SExt)), "Attributes "
+ Assert1(!(FAttrs.hasAttribute(Attribute::ZExt) &&
+ FAttrs.hasAttribute(Attribute::SExt)), "Attributes "
"'zeroext and signext' are incompatible!", V);
- Assert1(!(FAttrs.hasAttribute(Attributes::ReadNone) &&
- FAttrs.hasAttribute(Attributes::ReadOnly)), "Attributes "
+ Assert1(!(FAttrs.hasAttribute(Attribute::ReadNone) &&
+ FAttrs.hasAttribute(Attribute::ReadOnly)), "Attributes "
"'readnone and readonly' are incompatible!", V);
- Assert1(!(FAttrs.hasAttribute(Attributes::NoInline) &&
- FAttrs.hasAttribute(Attributes::AlwaysInline)), "Attributes "
+ Assert1(!(FAttrs.hasAttribute(Attribute::NoInline) &&
+ FAttrs.hasAttribute(Attribute::AlwaysInline)), "Attributes "
"'noinline and alwaysinline' are incompatible!", V);
}
@@ -690,7 +690,7 @@ void Verifier::visitFunction(Function &F) {
const AttributeSet &Attrs = F.getAttributes();
Assert1(VerifyAttributeCount(Attrs, FT->getNumParams()),
- "Attributes after last parameter!", &F);
+ "Attribute after last parameter!", &F);
// Check function attributes.
VerifyFunctionAttrs(FT, Attrs, &F);
@@ -1203,7 +1203,7 @@ void Verifier::VerifyCallSite(CallSite CS) {
const AttributeSet &Attrs = CS.getAttributes();
Assert1(VerifyAttributeCount(Attrs, CS.arg_size()),
- "Attributes after last parameter!", I);
+ "Attribute after last parameter!", I);
// Verify call attributes.
VerifyFunctionAttrs(FTy, Attrs, I);
@@ -1211,7 +1211,7 @@ void Verifier::VerifyCallSite(CallSite CS) {
if (FTy->isVarArg())
// Check attributes on the varargs part.
for (unsigned Idx = 1 + FTy->getNumParams(); Idx <= CS.arg_size(); ++Idx) {
- Attributes Attr = Attrs.getParamAttributes(Idx);
+ Attribute Attr = Attrs.getParamAttributes(Idx);
VerifyParameterAttrs(Attr, CS.getArgument(Idx-1)->getType(), false, I);