[llvm-commits] [llvm] r173602 - Use the AttributeSet instead of AttributeWithIndex.
Bill Wendling
isanbard at gmail.com
Sat Jan 26 18:08:22 PST 2013
Author: void
Date: Sat Jan 26 20:08:22 2013
New Revision: 173602
URL: http://llvm.org/viewvc/llvm-project?rev=173602&view=rev
Log:
Use the AttributeSet instead of AttributeWithIndex.
In the future, AttributeWithIndex won't be used anymore. Besides, it exposes the
internals of the AttributeSet to outside users, which isn't goodness.
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=173602&r1=173601&r2=173602&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp Sat Jan 26 20:08:22 2013
@@ -1116,7 +1116,7 @@ bool InstCombiner::transformConstExprCas
// inserting cast instructions as necessary.
std::vector<Value*> Args;
Args.reserve(NumActualArgs);
- SmallVector<AttributeWithIndex, 8> attrVec;
+ SmallVector<AttributeSet, 8> attrVec;
attrVec.reserve(NumCommonArgs);
// Get any return attributes.
@@ -1128,9 +1128,8 @@ bool InstCombiner::transformConstExprCas
// Add the new return attributes.
if (RAttrs.hasAttributes())
- attrVec.push_back(
- AttributeWithIndex::get(AttributeSet::ReturnIndex,
- Attribute::get(FT->getContext(), RAttrs)));
+ attrVec.push_back(AttributeSet::get(Caller->getContext(),
+ AttributeSet::ReturnIndex, RAttrs));
AI = CS.arg_begin();
for (unsigned i = 0; i != NumCommonArgs; ++i, ++AI) {
@@ -1146,9 +1145,8 @@ bool InstCombiner::transformConstExprCas
// Add any parameter attributes.
AttrBuilder PAttrs(CallerPAL.getParamAttributes(i + 1), i + 1);
if (PAttrs.hasAttributes())
- attrVec.push_back(
- AttributeWithIndex::get(i + 1,
- Attribute::get(FT->getContext(), PAttrs)));
+ attrVec.push_back(AttributeSet::get(Caller->getContext(), i + 1,
+ PAttrs));
}
// If the function takes more arguments than the call was taking, add them
@@ -1175,18 +1173,15 @@ bool InstCombiner::transformConstExprCas
// Add any parameter attributes.
AttrBuilder PAttrs(CallerPAL.getParamAttributes(i + 1), i + 1);
if (PAttrs.hasAttributes())
- attrVec.push_back(
- AttributeWithIndex::get(i + 1,
- Attribute::get(FT->getContext(), PAttrs)));
+ attrVec.push_back(AttributeSet::get(FT->getContext(), i + 1,
+ PAttrs));
}
}
}
AttributeSet FnAttrs = CallerPAL.getFnAttributes();
if (CallerPAL.hasAttributes(AttributeSet::FunctionIndex))
- attrVec.push_back(AttributeWithIndex::get(Callee->getContext(),
- AttributeSet::FunctionIndex,
- FnAttrs));
+ attrVec.push_back(AttributeSet::get(Callee->getContext(), FnAttrs));
if (NewRetTy->isVoidTy())
Caller->setName(""); // Void type should not have a name.
@@ -1287,7 +1282,7 @@ InstCombiner::transformCallThroughTrampo
std::vector<Value*> NewArgs;
NewArgs.reserve(unsigned(CS.arg_end()-CS.arg_begin())+1);
- SmallVector<AttributeWithIndex, 8> NewAttrs;
+ SmallVector<AttributeSet, 8> NewAttrs;
NewAttrs.reserve(Attrs.getNumSlots() + 1);
// Insert the nest argument into the call argument list, which may
@@ -1295,9 +1290,8 @@ InstCombiner::transformCallThroughTrampo
// Add any result attributes.
if (Attrs.hasAttributes(AttributeSet::ReturnIndex))
- NewAttrs.push_back(AttributeWithIndex::get(Caller->getContext(),
- AttributeSet::ReturnIndex,
- Attrs.getRetAttributes()));
+ NewAttrs.push_back(AttributeSet::get(Caller->getContext(),
+ Attrs.getRetAttributes()));
{
unsigned Idx = 1;
@@ -1309,8 +1303,8 @@ InstCombiner::transformCallThroughTrampo
if (NestVal->getType() != NestTy)
NestVal = Builder->CreateBitCast(NestVal, NestTy, "nest");
NewArgs.push_back(NestVal);
- NewAttrs.push_back(AttributeWithIndex::get(Caller->getContext(),
- NestIdx, NestAttr));
+ NewAttrs.push_back(AttributeSet::get(Caller->getContext(),
+ NestAttr));
}
if (I == E)
@@ -1320,9 +1314,9 @@ InstCombiner::transformCallThroughTrampo
NewArgs.push_back(*I);
AttributeSet Attr = Attrs.getParamAttributes(Idx);
if (Attr.hasAttributes(Idx)) {
- NewAttrs.push_back
- (AttributeWithIndex::get(Caller->getContext(), Idx, Attr));
- NewAttrs.back().Index = Idx + (Idx >= NestIdx);
+ AttrBuilder B(Attr, Idx);
+ NewAttrs.push_back(AttributeSet::get(Caller->getContext(),
+ Idx + (Idx >= NestIdx), B));
}
++Idx, ++I;
@@ -1331,9 +1325,8 @@ InstCombiner::transformCallThroughTrampo
// Add any function attributes.
if (Attrs.hasAttributes(AttributeSet::FunctionIndex))
- NewAttrs.push_back(AttributeWithIndex::get(FTy->getContext(),
- AttributeSet::FunctionIndex,
- Attrs.getFnAttributes()));
+ NewAttrs.push_back(AttributeSet::get(FTy->getContext(),
+ Attrs.getFnAttributes()));
// The trampoline may have been bitcast to a bogus type (FTy).
// Handle this by synthesizing a new function type, equal to FTy
More information about the llvm-commits
mailing list