aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/AsmWriter.cpp46
-rw-r--r--lib/VMCore/Attributes.cpp158
-rw-r--r--lib/VMCore/AutoUpgrade.cpp6
-rw-r--r--lib/VMCore/Core.cpp28
-rw-r--r--lib/VMCore/Function.cpp40
-rw-r--r--lib/VMCore/Instructions.cpp44
-rw-r--r--lib/VMCore/Verifier.cpp50
7 files changed, 186 insertions, 186 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index 1fb229b..365369b 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -1134,8 +1134,8 @@ void AssemblyWriter::writeParamOperand(const Value *Operand,
// Print the type
printType(Operand->getType());
// Print parameter attributes list
- if (Attrs != ParamAttr::None)
- Out << ' ' << ParamAttr::getAsString(Attrs);
+ if (Attrs != Attribute::None)
+ Out << ' ' << Attribute::getAsString(Attrs);
Out << ' ';
// Print the operand
WriteAsOperandInternal(Out, Operand, TypeNames, &Machine);
@@ -1356,7 +1356,7 @@ void AssemblyWriter::printFunction(const Function *F) {
}
const FunctionType *FT = F->getFunctionType();
- const PAListPtr &Attrs = F->getParamAttrs();
+ const AttrListPtr &Attrs = F->getAttributes();
printType(F->getReturnType());
Out << ' ';
if (F->hasName())
@@ -1375,7 +1375,7 @@ void AssemblyWriter::printFunction(const Function *F) {
I != E; ++I) {
// Insert commas as we go... the first arg doesn't get a comma
if (I != F->arg_begin()) Out << ", ";
- printArgument(I, Attrs.getParamAttrs(Idx));
+ printArgument(I, Attrs.getAttributes(Idx));
Idx++;
}
} else {
@@ -1387,9 +1387,9 @@ void AssemblyWriter::printFunction(const Function *F) {
// Output type...
printType(FT->getParamType(i));
- Attributes ArgAttrs = Attrs.getParamAttrs(i+1);
- if (ArgAttrs != ParamAttr::None)
- Out << ' ' << ParamAttr::getAsString(ArgAttrs);
+ Attributes ArgAttrs = Attrs.getAttributes(i+1);
+ if (ArgAttrs != Attribute::None)
+ Out << ' ' << Attribute::getAsString(ArgAttrs);
}
}
@@ -1399,9 +1399,9 @@ void AssemblyWriter::printFunction(const Function *F) {
Out << "..."; // Output varargs portion of signature!
}
Out << ')';
- Attributes RetAttrs = Attrs.getParamAttrs(0);
- if (RetAttrs != ParamAttr::None)
- Out << ' ' << ParamAttr::getAsString(Attrs.getParamAttrs(0));
+ Attributes RetAttrs = Attrs.getAttributes(0);
+ if (RetAttrs != Attribute::None)
+ Out << ' ' << Attribute::getAsString(Attrs.getAttributes(0));
if (F->hasSection())
Out << " section \"" << F->getSection() << '"';
if (F->getAlignment())
@@ -1413,12 +1413,12 @@ void AssemblyWriter::printFunction(const Function *F) {
} else {
bool insideNotes = false;
- if (F->hasNote(FnAttr::AlwaysInline)) {
+ if (F->hasNote(Attribute::AlwaysInline)) {
Out << "notes(";
insideNotes = true;
Out << "inline=always";
}
- if (F->hasNote(FnAttr::NoInline)) {
+ if (F->hasNote(Attribute::NoInline)) {
if (insideNotes)
Out << ",";
else {
@@ -1427,7 +1427,7 @@ void AssemblyWriter::printFunction(const Function *F) {
}
Out << "inline=never";
}
- if (F->hasNote(FnAttr::OptimizeForSize)) {
+ if (F->hasNote(Attribute::OptimizeForSize)) {
if (insideNotes)
Out << ",";
else {
@@ -1460,8 +1460,8 @@ void AssemblyWriter::printArgument(const Argument *Arg,
printType(Arg->getType());
// Output parameter attributes list
- if (Attrs != ParamAttr::None)
- Out << ' ' << ParamAttr::getAsString(Attrs);
+ if (Attrs != Attribute::None)
+ Out << ' ' << Attribute::getAsString(Attrs);
// Output name, if available...
if (Arg->hasName()) {
@@ -1642,7 +1642,7 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
const PointerType *PTy = cast<PointerType>(Operand->getType());
const FunctionType *FTy = cast<FunctionType>(PTy->getElementType());
const Type *RetTy = FTy->getReturnType();
- const PAListPtr &PAL = CI->getParamAttrs();
+ const AttrListPtr &PAL = CI->getAttributes();
// If possible, print out the short form of the call instruction. We can
// only do this if the first argument is a pointer to a nonvararg function,
@@ -1662,16 +1662,16 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
for (unsigned op = 1, Eop = I.getNumOperands(); op < Eop; ++op) {
if (op > 1)
Out << ", ";
- writeParamOperand(I.getOperand(op), PAL.getParamAttrs(op));
+ writeParamOperand(I.getOperand(op), PAL.getAttributes(op));
}
Out << ')';
- if (PAL.getParamAttrs(0) != ParamAttr::None)
- Out << ' ' << ParamAttr::getAsString(PAL.getParamAttrs(0));
+ if (PAL.getAttributes(0) != Attribute::None)
+ Out << ' ' << Attribute::getAsString(PAL.getAttributes(0));
} else if (const InvokeInst *II = dyn_cast<InvokeInst>(&I)) {
const PointerType *PTy = cast<PointerType>(Operand->getType());
const FunctionType *FTy = cast<FunctionType>(PTy->getElementType());
const Type *RetTy = FTy->getReturnType();
- const PAListPtr &PAL = II->getParamAttrs();
+ const AttrListPtr &PAL = II->getAttributes();
// Print the calling convention being used.
switch (II->getCallingConv()) {
@@ -1702,12 +1702,12 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
for (unsigned op = 3, Eop = I.getNumOperands(); op < Eop; ++op) {
if (op > 3)
Out << ", ";
- writeParamOperand(I.getOperand(op), PAL.getParamAttrs(op-2));
+ writeParamOperand(I.getOperand(op), PAL.getAttributes(op-2));
}
Out << ')';
- if (PAL.getParamAttrs(0) != ParamAttr::None)
- Out << ' ' << ParamAttr::getAsString(PAL.getParamAttrs(0));
+ if (PAL.getAttributes(0) != Attribute::None)
+ Out << ' ' << Attribute::getAsString(PAL.getAttributes(0));
Out << "\n\t\t\tto ";
writeOperand(II->getNormalDest(), true);
Out << " unwind ";
diff --git a/lib/VMCore/Attributes.cpp b/lib/VMCore/Attributes.cpp
index cce4843..b2f2150 100644
--- a/lib/VMCore/Attributes.cpp
+++ b/lib/VMCore/Attributes.cpp
@@ -1,4 +1,4 @@
-//===-- Attributes.cpp - Implement ParamAttrsList -------------------------===//
+//===-- Attributes.cpp - Implement AttributesList -------------------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// This file implements the ParamAttrsList class and ParamAttr utilities.
+// This file implements the AttributesList class and Attribute utilities.
//
//===----------------------------------------------------------------------===//
@@ -20,36 +20,36 @@
using namespace llvm;
//===----------------------------------------------------------------------===//
-// ParamAttr Function Definitions
+// Attribute Function Definitions
//===----------------------------------------------------------------------===//
-std::string ParamAttr::getAsString(Attributes Attrs) {
+std::string Attribute::getAsString(Attributes Attrs) {
std::string Result;
- if (Attrs & ParamAttr::ZExt)
+ if (Attrs & Attribute::ZExt)
Result += "zeroext ";
- if (Attrs & ParamAttr::SExt)
+ if (Attrs & Attribute::SExt)
Result += "signext ";
- if (Attrs & ParamAttr::NoReturn)
+ if (Attrs & Attribute::NoReturn)
Result += "noreturn ";
- if (Attrs & ParamAttr::NoUnwind)
+ if (Attrs & Attribute::NoUnwind)
Result += "nounwind ";
- if (Attrs & ParamAttr::InReg)
+ if (Attrs & Attribute::InReg)
Result += "inreg ";
- if (Attrs & ParamAttr::NoAlias)
+ if (Attrs & Attribute::NoAlias)
Result += "noalias ";
- if (Attrs & ParamAttr::StructRet)
+ if (Attrs & Attribute::StructRet)
Result += "sret ";
- if (Attrs & ParamAttr::ByVal)
+ if (Attrs & Attribute::ByVal)
Result += "byval ";
- if (Attrs & ParamAttr::Nest)
+ if (Attrs & Attribute::Nest)
Result += "nest ";
- if (Attrs & ParamAttr::ReadNone)
+ if (Attrs & Attribute::ReadNone)
Result += "readnone ";
- if (Attrs & ParamAttr::ReadOnly)
+ if (Attrs & Attribute::ReadOnly)
Result += "readonly ";
- if (Attrs & ParamAttr::Alignment) {
+ if (Attrs & Attribute::Alignment) {
Result += "align ";
- Result += utostr((Attrs & ParamAttr::Alignment) >> 16);
+ Result += utostr((Attrs & Attribute::Alignment) >> 16);
Result += " ";
}
// Trim the trailing space.
@@ -57,7 +57,7 @@ std::string ParamAttr::getAsString(Attributes Attrs) {
return Result;
}
-Attributes ParamAttr::typeIncompatible(const Type *Ty) {
+Attributes Attribute::typeIncompatible(const Type *Ty) {
Attributes Incompatible = None;
if (!Ty->isInteger())
@@ -79,14 +79,14 @@ namespace llvm {
class AttributeListImpl : public FoldingSetNode {
unsigned RefCount;
- // ParamAttrsList is uniqued, these should not be publicly available.
+ // AttributesList is uniqued, these should not be publicly available.
void operator=(const AttributeListImpl &); // Do not implement
AttributeListImpl(const AttributeListImpl &); // Do not implement
~AttributeListImpl(); // Private implementation
public:
- SmallVector<FnAttributeWithIndex, 4> Attrs;
+ SmallVector<AttributeWithIndex, 4> Attrs;
- AttributeListImpl(const FnAttributeWithIndex *Attr, unsigned NumAttrs)
+ AttributeListImpl(const AttributeWithIndex *Attr, unsigned NumAttrs)
: Attrs(Attr, Attr+NumAttrs) {
RefCount = 0;
}
@@ -97,7 +97,7 @@ public:
void Profile(FoldingSetNodeID &ID) const {
Profile(ID, &Attrs[0], Attrs.size());
}
- static void Profile(FoldingSetNodeID &ID, const FnAttributeWithIndex *Attr,
+ static void Profile(FoldingSetNodeID &ID, const AttributeWithIndex *Attr,
unsigned NumAttrs) {
for (unsigned i = 0; i != NumAttrs; ++i)
ID.AddInteger(uint64_t(Attr[i].Attrs) << 32 | unsigned(Attr[i].Index));
@@ -105,24 +105,24 @@ public:
};
}
-static ManagedStatic<FoldingSet<AttributeListImpl> > ParamAttrsLists;
+static ManagedStatic<FoldingSet<AttributeListImpl> > AttributesLists;
AttributeListImpl::~AttributeListImpl() {
- ParamAttrsLists->RemoveNode(this);
+ AttributesLists->RemoveNode(this);
}
-PAListPtr PAListPtr::get(const FnAttributeWithIndex *Attrs, unsigned NumAttrs) {
- // If there are no attributes then return a null ParamAttrsList pointer.
+AttrListPtr AttrListPtr::get(const AttributeWithIndex *Attrs, unsigned NumAttrs) {
+ // If there are no attributes then return a null AttributesList pointer.
if (NumAttrs == 0)
- return PAListPtr();
+ return AttrListPtr();
#ifndef NDEBUG
for (unsigned i = 0; i != NumAttrs; ++i) {
- assert(Attrs[i].Attrs != ParamAttr::None &&
- "Pointless parameter attribute!");
+ assert(Attrs[i].Attrs != Attribute::None &&
+ "Pointless attribute!");
assert((!i || Attrs[i-1].Index < Attrs[i].Index) &&
- "Misordered ParamAttrsList!");
+ "Misordered AttributesList!");
}
#endif
@@ -131,78 +131,78 @@ PAListPtr PAListPtr::get(const FnAttributeWithIndex *Attrs, unsigned NumAttrs) {
AttributeListImpl::Profile(ID, Attrs, NumAttrs);
void *InsertPos;
AttributeListImpl *PAL =
- ParamAttrsLists->FindNodeOrInsertPos(ID, InsertPos);
+ AttributesLists->FindNodeOrInsertPos(ID, InsertPos);
// If we didn't find any existing attributes of the same shape then
// create a new one and insert it.
if (!PAL) {
PAL = new AttributeListImpl(Attrs, NumAttrs);
- ParamAttrsLists->InsertNode(PAL, InsertPos);
+ AttributesLists->InsertNode(PAL, InsertPos);
}
- // Return the ParamAttrsList that we found or created.
- return PAListPtr(PAL);
+ // Return the AttributesList that we found or created.
+ return AttrListPtr(PAL);
}
//===----------------------------------------------------------------------===//
-// PAListPtr Method Implementations
+// AttrListPtr Method Implementations
//===----------------------------------------------------------------------===//
-PAListPtr::PAListPtr(AttributeListImpl *LI) : PAList(LI) {
+AttrListPtr::AttrListPtr(AttributeListImpl *LI) : AttrList(LI) {
if (LI) LI->AddRef();
}
-PAListPtr::PAListPtr(const PAListPtr &P) : PAList(P.PAList) {
- if (PAList) PAList->AddRef();
+AttrListPtr::AttrListPtr(const AttrListPtr &P) : AttrList(P.AttrList) {
+ if (AttrList) AttrList->AddRef();
}
-const PAListPtr &PAListPtr::operator=(const PAListPtr &RHS) {
- if (PAList == RHS.PAList) return *this;
- if (PAList) PAList->DropRef();
- PAList = RHS.PAList;
- if (PAList) PAList->AddRef();
+const AttrListPtr &AttrListPtr::operator=(const AttrListPtr &RHS) {
+ if (AttrList == RHS.AttrList) return *this;
+ if (AttrList) AttrList->DropRef();
+ AttrList = RHS.AttrList;
+ if (AttrList) AttrList->AddRef();
return *this;
}
-PAListPtr::~PAListPtr() {
- if (PAList) PAList->DropRef();
+AttrListPtr::~AttrListPtr() {
+ if (AttrList) AttrList->DropRef();
}
/// getNumSlots - Return the number of slots used in this attribute list.
/// This is the number of arguments that have an attribute set on them
/// (including the function itself).
-unsigned PAListPtr::getNumSlots() const {
- return PAList ? PAList->Attrs.size() : 0;
+unsigned AttrListPtr::getNumSlots() const {
+ return AttrList ? AttrList->Attrs.size() : 0;
}
-/// getSlot - Return the FnAttributeWithIndex at the specified slot. This
-/// holds a parameter number plus a set of attributes.
-const FnAttributeWithIndex &PAListPtr::getSlot(unsigned Slot) const {
- assert(PAList && Slot < PAList->Attrs.size() && "Slot # out of range!");
- return PAList->Attrs[Slot];
+/// 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];
}
-/// getParamAttrs - The parameter attributes for the specified parameter are
-/// returned. Parameters for the result are denoted with Idx = 0.
+/// 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.
-Attributes PAListPtr::getParamAttrs(unsigned Idx) const {
- if (PAList == 0) return ParamAttr::None;
+Attributes AttrListPtr::getAttributes(unsigned Idx) const {
+ if (AttrList == 0) return Attribute::None;
- const SmallVector<FnAttributeWithIndex, 4> &Attrs = PAList->Attrs;
+ 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 ParamAttr::None;
+ return Attribute::None;
}
/// hasAttrSomewhere - Return true if the specified attribute is set for at
/// least one parameter or for the return value.
-bool PAListPtr::hasAttrSomewhere(Attributes Attr) const {
- if (PAList == 0) return false;
+bool AttrListPtr::hasAttrSomewhere(Attributes Attr) const {
+ if (AttrList == 0) return false;
- const SmallVector<FnAttributeWithIndex, 4> &Attrs = PAList->Attrs;
+ const SmallVector<AttributeWithIndex, 4> &Attrs = AttrList->Attrs;
for (unsigned i = 0, e = Attrs.size(); i != e; ++i)
if (Attrs[i].Attrs & Attr)
return true;
@@ -210,13 +210,13 @@ bool PAListPtr::hasAttrSomewhere(Attributes Attr) const {
}
-PAListPtr PAListPtr::addAttr(unsigned Idx, Attributes Attrs) const {
- Attributes OldAttrs = getParamAttrs(Idx);
+AttrListPtr AttrListPtr::addAttr(unsigned Idx, Attributes Attrs) const {
+ Attributes 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.
- Attributes OldAlign = OldAttrs & ParamAttr::Alignment;
- Attributes NewAlign = Attrs & ParamAttr::Alignment;
+ Attributes OldAlign = OldAttrs & Attribute::Alignment;
+ Attributes NewAlign = Attrs & Attribute::Alignment;
assert((!OldAlign || !NewAlign || OldAlign == NewAlign) &&
"Attempt to change alignment!");
#endif
@@ -225,11 +225,11 @@ PAListPtr PAListPtr::addAttr(unsigned Idx, Attributes Attrs) const {
if (NewAttrs == OldAttrs)
return *this;
- SmallVector<FnAttributeWithIndex, 8> NewAttrList;
- if (PAList == 0)
- NewAttrList.push_back(FnAttributeWithIndex::get(Idx, Attrs));
+ SmallVector<AttributeWithIndex, 8> NewAttrList;
+ if (AttrList == 0)
+ NewAttrList.push_back(AttributeWithIndex::get(Idx, Attrs));
else {
- const SmallVector<FnAttributeWithIndex, 4> &OldAttrList = PAList->Attrs;
+ const SmallVector<AttributeWithIndex, 4> &OldAttrList = AttrList->Attrs;
unsigned i = 0, e = OldAttrList.size();
// Copy attributes for arguments before this one.
for (; i != e && OldAttrList[i].Index < Idx; ++i)
@@ -241,7 +241,7 @@ PAListPtr PAListPtr::addAttr(unsigned Idx, Attributes Attrs) const {
++i;
}
- NewAttrList.push_back(FnAttributeWithIndex::get(Idx, Attrs));
+ NewAttrList.push_back(AttributeWithIndex::get(Idx, Attrs));
// Copy attributes for arguments after this one.
NewAttrList.insert(NewAttrList.end(),
@@ -251,21 +251,21 @@ PAListPtr PAListPtr::addAttr(unsigned Idx, Attributes Attrs) const {
return get(&NewAttrList[0], NewAttrList.size());
}
-PAListPtr PAListPtr::removeAttr(unsigned Idx, Attributes Attrs) const {
+AttrListPtr AttrListPtr::removeAttr(unsigned Idx, Attributes 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 & ParamAttr::Alignment) && "Attempt to exclude alignment!");
+ assert(!(Attrs & Attribute::Alignment) && "Attempt to exclude alignment!");
#endif
- if (PAList == 0) return PAListPtr();
+ if (AttrList == 0) return AttrListPtr();
- Attributes OldAttrs = getParamAttrs(Idx);
+ Attributes OldAttrs = getAttributes(Idx);
Attributes NewAttrs = OldAttrs & ~Attrs;
if (NewAttrs == OldAttrs)
return *this;
- SmallVector<FnAttributeWithIndex, 8> NewAttrList;
- const SmallVector<FnAttributeWithIndex, 4> &OldAttrList = PAList->Attrs;
+ SmallVector<AttributeWithIndex, 8> NewAttrList;
+ const SmallVector<AttributeWithIndex, 4> &OldAttrList = AttrList->Attrs;
unsigned i = 0, e = OldAttrList.size();
// Copy attributes for arguments before this one.
@@ -277,7 +277,7 @@ PAListPtr PAListPtr::removeAttr(unsigned Idx, Attributes Attrs) const {
Attrs = OldAttrList[i].Attrs & ~Attrs;
++i;
if (Attrs) // If any attributes left for this parameter, add them.
- NewAttrList.push_back(FnAttributeWithIndex::get(Idx, Attrs));
+ NewAttrList.push_back(AttributeWithIndex::get(Idx, Attrs));
// Copy attributes for arguments after this one.
NewAttrList.insert(NewAttrList.end(),
@@ -286,10 +286,10 @@ PAListPtr PAListPtr::removeAttr(unsigned Idx, Attributes Attrs) const {
return get(&NewAttrList[0], NewAttrList.size());
}
-void PAListPtr::dump() const {
+void AttrListPtr::dump() const {
cerr << "PAL[ ";
for (unsigned i = 0; i < getNumSlots(); ++i) {
- const FnAttributeWithIndex &PAWI = getSlot(i);
+ const AttributeWithIndex &PAWI = getSlot(i);
cerr << "{" << PAWI.Index << "," << PAWI.Attrs << "} ";
}
diff --git a/lib/VMCore/AutoUpgrade.cpp b/lib/VMCore/AutoUpgrade.cpp
index 221dc06..abad7af 100644
--- a/lib/VMCore/AutoUpgrade.cpp
+++ b/lib/VMCore/AutoUpgrade.cpp
@@ -218,7 +218,7 @@ bool llvm::UpgradeIntrinsicFunction(Function *F, Function *&NewFn) {
if (NewFn)
F = NewFn;
if (unsigned id = F->getIntrinsicID(true))
- F->setParamAttrs(Intrinsic::getParamAttrs((Intrinsic::ID)id));
+ F->setAttributes(Intrinsic::getAttributes((Intrinsic::ID)id));
return Upgraded;
}
@@ -383,8 +383,8 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
// Handle any uses of the old CallInst.
if (!CI->use_empty()) {
// Check for sign extend parameter attributes on the return values.
- bool SrcSExt = NewFn->getParamAttrs().paramHasAttr(0, ParamAttr::SExt);
- bool DestSExt = F->getParamAttrs().paramHasAttr(0, ParamAttr::SExt);
+ bool SrcSExt = NewFn->getAttributes().paramHasAttr(0, Attribute::SExt);
+ bool DestSExt = F->getAttributes().paramHasAttr(0, Attribute::SExt);
// Construct an appropriate cast from the new return type to the old.
CastInst *RetCast = CastInst::Create(
diff --git a/lib/VMCore/Core.cpp b/lib/VMCore/Core.cpp
index 2fedc1e..a802373 100644
--- a/lib/VMCore/Core.cpp
+++ b/lib/VMCore/Core.cpp
@@ -790,17 +790,17 @@ LLVMValueRef LLVMGetPreviousParam(LLVMValueRef Arg) {
return wrap(--I);
}
-void LLVMAddParamAttr(LLVMValueRef Arg, LLVMParamAttr PA) {
+void LLVMAddAttribute(LLVMValueRef Arg, LLVMAttribute PA) {
unwrap<Argument>(Arg)->addAttr(PA);
}
-void LLVMRemoveParamAttr(LLVMValueRef Arg, LLVMParamAttr PA) {
+void LLVMRemoveAttribute(LLVMValueRef Arg, LLVMAttribute PA) {
unwrap<Argument>(Arg)->removeAttr(PA);
}
void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align) {
unwrap<Argument>(Arg)->addAttr(
- ParamAttr::constructAlignmentFromInt(align));
+ Attribute::constructAlignmentFromInt(align));
}
/*--.. Operations on basic blocks ..........................................--*/
@@ -941,26 +941,26 @@ void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC) {
assert(0 && "LLVMSetInstructionCallConv applies only to call and invoke!");
}
-void LLVMAddInstrParamAttr(LLVMValueRef Instr, unsigned index,
- LLVMParamAttr PA) {
+void LLVMAddInstrAttribute(LLVMValueRef Instr, unsigned index,
+ LLVMAttribute PA) {
CallSite Call = CallSite(unwrap<Instruction>(Instr));
- Call.setParamAttrs(
- Call.getParamAttrs().addAttr(index, PA));
+ Call.setAttributes(
+ Call.getAttributes().addAttr(index, PA));
}
-void LLVMRemoveInstrParamAttr(LLVMValueRef Instr, unsigned index,
- LLVMParamAttr PA) {
+void LLVMRemoveInstrAttribute(LLVMValueRef Instr, unsigned index,
+ LLVMAttribute PA) {
CallSite Call = CallSite(unwrap<Instruction>(Instr));
- Call.setParamAttrs(
- Call.getParamAttrs().removeAttr(index, PA));
+ Call.setAttributes(
+ Call.getAttributes().removeAttr(index, PA));
}
void LLVMSetInstrParamAlignment(LLVMValueRef Instr, unsigned index,
unsigned align) {
CallSite Call = CallSite(unwrap<Instruction>(Instr));
- Call.setParamAttrs(
- Call.getParamAttrs().addAttr(index,
- ParamAttr::constructAlignmentFromInt(align)));
+ Call.setAttributes(
+ Call.getAttributes().addAttr(index,
+ Attribute::constructAlignmentFromInt(align)));
}
/*--.. Operations on call instructions (only) ..............................--*/
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp
index 2602443..f16042b 100644
--- a/lib/VMCore/Function.cpp
+++ b/lib/VMCore/Function.cpp
@@ -92,14 +92,14 @@ unsigned Argument::getArgNo() const {
/// in its containing function.
bool Argument::hasByValAttr() const {
if (!isa<PointerType>(getType())) return false;
- return getParent()->paramHasAttr(getArgNo()+1, ParamAttr::ByVal);
+ return getParent()->paramHasAttr(getArgNo()+1, Attribute::ByVal);
}
/// hasNoAliasAttr - Return true if this argument has the noalias attribute on
/// it in its containing function.
bool Argument::hasNoAliasAttr() const {
if (!isa<PointerType>(getType())) return false;
- return getParent()->paramHasAttr(getArgNo()+1, ParamAttr::NoAlias);
+ return getParent()->paramHasAttr(getArgNo()+1, Attribute::NoAlias);
}
/// hasSRetAttr - Return true if this argument has the sret attribute on
@@ -108,17 +108,17 @@ bool Argument::hasStructRetAttr() const {
if (!isa<PointerType>(getType())) return false;
if (this != getParent()->arg_begin())
return false; // StructRet param must be first param
- return getParent()->paramHasAttr(1, ParamAttr::StructRet);
+ return getParent()->paramHasAttr(1, Attribute::StructRet);
}
-/// addAttr - Add a ParamAttr to an argument
+/// addAttr - Add a Attribute to an argument
void Argument::addAttr(Attributes attr) {
- getParent()->addParamAttr(getArgNo() + 1, attr);
+ getParent()->addAttribute(getArgNo() + 1, attr);
}
-/// removeAttr - Remove a ParamAttr from an argument
+/// removeAttr - Remove a Attribute from an argument
void Argument::removeAttr(Attributes attr) {
- getParent()->removeParamAttr(getArgNo() + 1, attr);
+ getParent()->removeAttribute(getArgNo() + 1, attr);
}
@@ -172,7 +172,7 @@ Function::Function(const FunctionType *Ty, LinkageTypes Linkage,
// Ensure intrinsics have the right parameter attributes.
if (unsigned IID = getIntrinsicID(true))
- setParamAttrs(Intrinsic::getParamAttrs(Intrinsic::ID(IID)));
+ setAttributes(Intrinsic::getAttributes(Intrinsic::ID(IID)));
}
@@ -229,16 +229,16 @@ void Function::dropAllReferences() {
BasicBlocks.clear(); // Delete all basic blocks...
}
-void Function::addParamAttr(unsigned i, Attributes attr) {
- PAListPtr PAL = getParamAttrs();
+void Function::addAttribute(unsigned i, Attributes attr) {
+ AttrListPtr PAL = getAttributes();
PAL = PAL.addAttr(i, attr);
- setParamAttrs(PAL);
+ setAttributes(PAL);
}
-void Function::removeParamAttr(unsigned i, Attributes attr) {
- PAListPtr PAL = getParamAttrs();
+void Function::removeAttribute(unsigned i, Attributes attr) {
+ AttrListPtr PAL = getAttributes();
PAL = PAL.removeAttr(i, attr);
- setParamAttrs(PAL);
+ setAttributes(PAL);
}
// Maintain the GC name for each function in an on-the-side table. This saves
@@ -286,7 +286,7 @@ void Function::copyAttributesFrom(const GlobalValue *Src) {
GlobalValue::copyAttributesFrom(Src);
const Function *SrcF = cast<Function>(Src);
setCallingConv(SrcF->getCallingConv());
- setParamAttrs(SrcF->getParamAttrs());
+ setAttributes(SrcF->getAttributes());
if (SrcF->hasGC())
setGC(SrcF->getGC());
else
@@ -355,18 +355,18 @@ const FunctionType *Intrinsic::getType(ID id, const Type **Tys,
return FunctionType::get(ResultTy, ArgTys, IsVarArg);
}
-PAListPtr Intrinsic::getParamAttrs(ID id) {
- Attributes Attr = ParamAttr::None;
+AttrListPtr Intrinsic::getAttributes(ID id) {
+ Attributes Attr = Attribute::None;
#define GET_INTRINSIC_ATTRIBUTES
#include "llvm/Intrinsics.gen"
#undef GET_INTRINSIC_ATTRIBUTES
// Intrinsics cannot throw exceptions.
- Attr |= ParamAttr::NoUnwind;
+ Attr |= Attribute::NoUnwind;
- FnAttributeWithIndex PAWI = FnAttributeWithIndex::get(0, Attr);
- return PAListPtr::get(&PAWI, 1);
+ AttributeWithIndex PAWI = AttributeWithIndex::get(0, Attr);
+ return AttrListPtr::get(&PAWI, 1);
}
Function *Intrinsic::getDeclaration(Module *M, ID id, const Type **Tys,
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index 1366d30..1fd51f7 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -41,17 +41,17 @@ void CallSite::setCallingConv(unsigned CC) {
else
cast<InvokeInst>(I)->setCallingConv(CC);
}
-const PAListPtr &CallSite::getParamAttrs() const {
+const AttrListPtr &CallSite::getAttributes() const {
if (CallInst *CI = dyn_cast<CallInst>(I))
- return CI->getParamAttrs();
+ return CI->getAttributes();
else
- return cast<InvokeInst>(I)->getParamAttrs();
+ return cast<InvokeInst>(I)->getAttributes();
}
-void CallSite::setParamAttrs(const PAListPtr &PAL) {
+void CallSite::setAttributes(const AttrListPtr &PAL) {
if (CallInst *CI = dyn_cast<CallInst>(I))
- CI->setParamAttrs(PAL);
+ CI->setAttributes(PAL);
else
- cast<InvokeInst>(I)->setParamAttrs(PAL);
+ cast<InvokeInst>(I)->setAttributes(PAL);
}
bool CallSite::paramHasAttr(uint16_t i, Attributes attr) const {
if (CallInst *CI = dyn_cast<CallInst>(I))
@@ -394,7 +394,7 @@ CallInst::CallInst(const CallInst &CI)
: Instruction(CI.getType(), Instruction::Call,
OperandTraits<CallInst>::op_end(this) - CI.getNumOperands(),
CI.getNumOperands()) {
- setParamAttrs(CI.getParamAttrs());
+ setAttributes(CI.getAttributes());
SubclassData = CI.SubclassData;
Use *OL = OperandList;
Use *InOL = CI.OperandList;
@@ -402,20 +402,20 @@ CallInst::CallInst(const CallInst &CI)
OL[i] = InOL[i];
}
-void CallInst::addParamAttr(unsigned i, Attributes attr) {
- PAListPtr PAL = getParamAttrs();
+void CallInst::addAttribute(unsigned i, Attributes attr) {
+ AttrListPtr PAL = getAttributes();
PAL = PAL.addAttr(i, attr);
- setParamAttrs(PAL);
+ setAttributes(PAL);
}
-void CallInst::removeParamAttr(unsigned i, Attributes attr) {
- PAListPtr PAL = getParamAttrs();
+void CallInst::removeAttribute(unsigned i, Attributes attr) {
+ AttrListPtr PAL = getAttributes();
PAL = PAL.removeAttr(i, attr);
- setParamAttrs(PAL);
+ setAttributes(PAL);
}
bool CallInst::paramHasAttr(unsigned i, Attributes attr) const {
- if (ParamAttrs.paramHasAttr(i, attr))
+ if (AttributeList.paramHasAttr(i, attr))
return true;
if (const Function *F = getCalledFunction())
return F->paramHasAttr(i, attr);
@@ -456,7 +456,7 @@ InvokeInst::InvokeInst(const InvokeInst &II)
OperandTraits<InvokeInst>::op_end(this)
- II.getNumOperands(),
II.getNumOperands()) {
- setParamAttrs(II.getParamAttrs());
+ setAttributes(II.getAttributes());
SubclassData = II.SubclassData;
Use *OL = OperandList, *InOL = II.OperandList;
for (unsigned i = 0, e = II.getNumOperands(); i != e; ++i)
@@ -474,23 +474,23 @@ void InvokeInst::setSuccessorV(unsigned idx, BasicBlock *B) {
}
bool InvokeInst::paramHasAttr(unsigned i, Attributes attr) const {
- if (ParamAttrs.paramHasAttr(i, attr))
+ if (AttributeList.paramHasAttr(i, attr))
return true;
if (const Function *F = getCalledFunction())
return F->paramHasAttr(i, attr);
return false;
}
-void InvokeInst::addParamAttr(unsigned i, Attributes attr) {
- PAListPtr PAL = getParamAttrs();
+void InvokeInst::addAttribute(unsigned i, Attributes attr) {
+ AttrListPtr PAL = getAttributes();
PAL = PAL.addAttr(i, attr);
- setParamAttrs(PAL);
+ setAttributes(PAL);
}
-void InvokeInst::removeParamAttr(unsigned i, Attributes attr) {
- PAListPtr PAL = getParamAttrs();
+void InvokeInst::removeAttribute(unsigned i, Attributes attr) {
+ AttrListPtr PAL = getAttributes();
PAL = PAL.removeAttr(i, attr);
- setParamAttrs(PAL);
+ setAttributes(PAL);
}
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp
index c5ddad2..c780868 100644
--- a/lib/VMCore/Verifier.cpp
+++ b/lib/VMCore/Verifier.cpp
@@ -270,7 +270,7 @@ namespace {
unsigned Count, ...);
void VerifyAttrs(Attributes Attrs, const Type *Ty,
bool isReturnValue, const Value *V);
- void VerifyFunctionAttrs(const FunctionType *FT, const PAListPtr &Attrs,
+ void VerifyFunctionAttrs(const FunctionType *FT, const AttrListPtr &Attrs,
const Value *V);
void WriteValue(const Value *V) {
@@ -408,38 +408,38 @@ void Verifier::verifyTypeSymbolTable(TypeSymbolTable &ST) {
// value of the specified type. The value V is printed in error messages.
void Verifier::VerifyAttrs(Attributes Attrs, const Type *Ty,
bool isReturnValue, const Value *V) {
- if (Attrs == ParamAttr::None)
+ if (Attrs == Attribute::None)
return;
if (isReturnValue) {
- Attributes RetI = Attrs & ParamAttr::ParameterOnly;
- Assert1(!RetI, "Attribute " + ParamAttr::getAsString(RetI) +
+ Attributes RetI = Attrs & Attribute::ParameterOnly;
+ Assert1(!RetI, "Attribute " + Attribute::getAsString(RetI) +
" does not apply to return values!", V);
} else {
- Attributes ParmI = Attrs & ParamAttr::ReturnOnly;
- Assert1(!ParmI, "Attribute " + ParamAttr::getAsString(ParmI) +
+ Attributes ParmI = Attrs & Attribute::ReturnOnly;
+ Assert1(!ParmI, "Attribute " + Attribute::getAsString(ParmI) +
" only applies to return values!", V);
}
for (unsigned i = 0;
- i < array_lengthof(ParamAttr::MutuallyIncompatible); ++i) {
- Attributes MutI = Attrs & ParamAttr::MutuallyIncompatible[i];
+ i < array_lengthof(Attribute::MutuallyIncompatible); ++i) {
+ Attributes MutI = Attrs & Attribute::MutuallyIncompatible[i];
Assert1(!(MutI & (MutI - 1)), "Attributes " +
- ParamAttr::getAsString(MutI) + " are incompatible!", V);
+ Attribute::getAsString(MutI) + " are incompatible!", V);
}
- Attributes TypeI = Attrs & ParamAttr::typeIncompatible(Ty);
+ Attributes TypeI = Attrs & Attribute::typeIncompatible(Ty);
Assert1(!TypeI, "Wrong type for attribute " +
- ParamAttr::getAsString(TypeI), V);
+ Attribute::getAsString(TypeI), V);
- Attributes ByValI = Attrs & ParamAttr::ByVal;
+ Attributes ByValI = Attrs & Attribute::ByVal;
if (const PointerType *PTy = dyn_cast<PointerType>(Ty)) {
Assert1(!ByValI || PTy->getElementType()->isSized(),
- "Attribute " + ParamAttr::getAsString(ByValI) +
+ "Attribute " + Attribute::getAsString(ByValI) +
" does not support unsized types!", V);
} else {
Assert1(!ByValI,
- "Attribute " + ParamAttr::getAsString(ByValI) +
+ "Attribute " + Attribute::getAsString(ByValI) +
" only applies to parameters with pointer type!", V);
}
}
@@ -447,7 +447,7 @@ void Verifier::VerifyAttrs(Attributes Attrs, const Type *Ty,
// VerifyFunctionAttrs - Check parameter attributes against a function type.
// The value V is printed in error messages.
void Verifier::VerifyFunctionAttrs(const FunctionType *FT,
- const PAListPtr &Attrs,
+ const AttrListPtr &Attrs,
const Value *V) {
if (Attrs.isEmpty())
return;
@@ -455,7 +455,7 @@ void Verifier::VerifyFunctionAttrs(const FunctionType *FT,
bool SawNest = false;
for (unsigned i = 0, e = Attrs.getNumSlots(); i != e; ++i) {
- const FnAttributeWithIndex &Attr = Attrs.getSlot(i);
+ const AttributeWithIndex &Attr = Attrs.getSlot(i);
const Type *Ty;
if (Attr.Index == 0)
@@ -467,17 +467,17 @@ void Verifier::VerifyFunctionAttrs(const FunctionType *FT,
VerifyAttrs(Attr.Attrs, Ty, Attr.Index == 0, V);
- if (Attr.Attrs & ParamAttr::Nest) {
+ if (Attr.Attrs & Attribute::Nest) {
Assert1(!SawNest, "More than one parameter has attribute nest!", V);
SawNest = true;
}
- if (Attr.Attrs & ParamAttr::StructRet)
+ if (Attr.Attrs & Attribute::StructRet)
Assert1(Attr.Index == 1, "Attribute sret not on first parameter!", V);
}
}
-static bool VerifyAttributeCount(const PAListPtr &Attrs, unsigned Params) {
+static bool VerifyAttributeCount(const AttrListPtr &Attrs, unsigned Params) {
if (Attrs.isEmpty())
return true;
@@ -508,7 +508,7 @@ void Verifier::visitFunction(Function &F) {
Assert1(!F.hasStructRetAttr() || F.getReturnType() == Type::VoidTy,
"Invalid struct return type!", &F);
- const PAListPtr &Attrs = F.getParamAttrs();
+ const AttrListPtr &Attrs = F.getAttributes();
Assert1(VerifyAttributeCount(Attrs, FT->getNumParams()),
"Attributes after last parameter!", &F);
@@ -965,7 +965,7 @@ void Verifier::VerifyCallSite(CallSite CS) {
"Call parameter type does not match function signature!",
CS.getArgument(i), FTy->getParamType(i), I);
- const PAListPtr &Attrs = CS.getParamAttrs();
+ const AttrListPtr &Attrs = CS.getAttributes();
Assert1(VerifyAttributeCount(Attrs, CS.arg_size()),
"Attributes after last parameter!", I);
@@ -976,12 +976,12 @@ 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.getParamAttrs(Idx);
+ Attributes Attr = Attrs.getAttributes(Idx);
VerifyAttrs(Attr, CS.getArgument(Idx-1)->getType(), false, I);
- Attributes VArgI = Attr & ParamAttr::VarArgsIncompatible;
- Assert1(!VArgI, "Attribute " + ParamAttr::getAsString(VArgI) +
+ Attributes VArgI = Attr & Attribute::VarArgsIncompatible;
+ Assert1(!VArgI, "Attribute " + Attribute::getAsString(VArgI) +
" cannot be used for vararg call arguments!", I);
}
@@ -1523,7 +1523,7 @@ void Verifier::VerifyIntrinsicPrototype(Intrinsic::ID ID,
}
// Check parameter attributes.
- Assert1(F->getParamAttrs() == Intrinsic::getParamAttrs(ID),
+ Assert1(F->getAttributes() == Intrinsic::getAttributes(ID),
"Intrinsic has wrong parameter attributes!", F);
}