aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-01-27 02:08:22 +0000
committerBill Wendling <isanbard@gmail.com>2013-01-27 02:08:22 +0000
commitac90696722bef3993e5fb9f72a6fa4209bbc8763 (patch)
treed34198a8746c2c1abaefc1861441ee84e87c09ca /lib/Transforms
parentb2484b4332ffe385421e338de21372ea8a9dc5cf (diff)
downloadexternal_llvm-ac90696722bef3993e5fb9f72a6fa4209bbc8763.zip
external_llvm-ac90696722bef3993e5fb9f72a6fa4209bbc8763.tar.gz
external_llvm-ac90696722bef3993e5fb9f72a6fa4209bbc8763.tar.bz2
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173602 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/InstCombine/InstCombineCalls.cpp43
1 files changed, 18 insertions, 25 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineCalls.cpp b/lib/Transforms/InstCombine/InstCombineCalls.cpp
index 19eb965..f56dc95 100644
--- a/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -1116,7 +1116,7 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
// 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::transformConstExprCastCall(CallSite CS) {
// 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::transformConstExprCastCall(CallSite CS) {
// 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::transformConstExprCastCall(CallSite CS) {
// 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::transformCallThroughTrampoline(CallSite CS,
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::transformCallThroughTrampoline(CallSite CS,
// 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::transformCallThroughTrampoline(CallSite CS,
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::transformCallThroughTrampoline(CallSite CS,
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::transformCallThroughTrampoline(CallSite CS,
// 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