mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-17 18:31:04 +00:00
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
This commit is contained in:
parent
b2484b4332
commit
ac90696722
@ -1116,7 +1116,7 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
|
|||||||
// inserting cast instructions as necessary.
|
// inserting cast instructions as necessary.
|
||||||
std::vector<Value*> Args;
|
std::vector<Value*> Args;
|
||||||
Args.reserve(NumActualArgs);
|
Args.reserve(NumActualArgs);
|
||||||
SmallVector<AttributeWithIndex, 8> attrVec;
|
SmallVector<AttributeSet, 8> attrVec;
|
||||||
attrVec.reserve(NumCommonArgs);
|
attrVec.reserve(NumCommonArgs);
|
||||||
|
|
||||||
// Get any return attributes.
|
// Get any return attributes.
|
||||||
@ -1128,9 +1128,8 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
|
|||||||
|
|
||||||
// Add the new return attributes.
|
// Add the new return attributes.
|
||||||
if (RAttrs.hasAttributes())
|
if (RAttrs.hasAttributes())
|
||||||
attrVec.push_back(
|
attrVec.push_back(AttributeSet::get(Caller->getContext(),
|
||||||
AttributeWithIndex::get(AttributeSet::ReturnIndex,
|
AttributeSet::ReturnIndex, RAttrs));
|
||||||
Attribute::get(FT->getContext(), RAttrs)));
|
|
||||||
|
|
||||||
AI = CS.arg_begin();
|
AI = CS.arg_begin();
|
||||||
for (unsigned i = 0; i != NumCommonArgs; ++i, ++AI) {
|
for (unsigned i = 0; i != NumCommonArgs; ++i, ++AI) {
|
||||||
@ -1146,9 +1145,8 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
|
|||||||
// Add any parameter attributes.
|
// Add any parameter attributes.
|
||||||
AttrBuilder PAttrs(CallerPAL.getParamAttributes(i + 1), i + 1);
|
AttrBuilder PAttrs(CallerPAL.getParamAttributes(i + 1), i + 1);
|
||||||
if (PAttrs.hasAttributes())
|
if (PAttrs.hasAttributes())
|
||||||
attrVec.push_back(
|
attrVec.push_back(AttributeSet::get(Caller->getContext(), i + 1,
|
||||||
AttributeWithIndex::get(i + 1,
|
PAttrs));
|
||||||
Attribute::get(FT->getContext(), PAttrs)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the function takes more arguments than the call was taking, add them
|
// 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.
|
// Add any parameter attributes.
|
||||||
AttrBuilder PAttrs(CallerPAL.getParamAttributes(i + 1), i + 1);
|
AttrBuilder PAttrs(CallerPAL.getParamAttributes(i + 1), i + 1);
|
||||||
if (PAttrs.hasAttributes())
|
if (PAttrs.hasAttributes())
|
||||||
attrVec.push_back(
|
attrVec.push_back(AttributeSet::get(FT->getContext(), i + 1,
|
||||||
AttributeWithIndex::get(i + 1,
|
PAttrs));
|
||||||
Attribute::get(FT->getContext(), PAttrs)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AttributeSet FnAttrs = CallerPAL.getFnAttributes();
|
AttributeSet FnAttrs = CallerPAL.getFnAttributes();
|
||||||
if (CallerPAL.hasAttributes(AttributeSet::FunctionIndex))
|
if (CallerPAL.hasAttributes(AttributeSet::FunctionIndex))
|
||||||
attrVec.push_back(AttributeWithIndex::get(Callee->getContext(),
|
attrVec.push_back(AttributeSet::get(Callee->getContext(), FnAttrs));
|
||||||
AttributeSet::FunctionIndex,
|
|
||||||
FnAttrs));
|
|
||||||
|
|
||||||
if (NewRetTy->isVoidTy())
|
if (NewRetTy->isVoidTy())
|
||||||
Caller->setName(""); // Void type should not have a name.
|
Caller->setName(""); // Void type should not have a name.
|
||||||
@ -1287,7 +1282,7 @@ InstCombiner::transformCallThroughTrampoline(CallSite CS,
|
|||||||
std::vector<Value*> NewArgs;
|
std::vector<Value*> NewArgs;
|
||||||
NewArgs.reserve(unsigned(CS.arg_end()-CS.arg_begin())+1);
|
NewArgs.reserve(unsigned(CS.arg_end()-CS.arg_begin())+1);
|
||||||
|
|
||||||
SmallVector<AttributeWithIndex, 8> NewAttrs;
|
SmallVector<AttributeSet, 8> NewAttrs;
|
||||||
NewAttrs.reserve(Attrs.getNumSlots() + 1);
|
NewAttrs.reserve(Attrs.getNumSlots() + 1);
|
||||||
|
|
||||||
// Insert the nest argument into the call argument list, which may
|
// Insert the nest argument into the call argument list, which may
|
||||||
@ -1295,9 +1290,8 @@ InstCombiner::transformCallThroughTrampoline(CallSite CS,
|
|||||||
|
|
||||||
// Add any result attributes.
|
// Add any result attributes.
|
||||||
if (Attrs.hasAttributes(AttributeSet::ReturnIndex))
|
if (Attrs.hasAttributes(AttributeSet::ReturnIndex))
|
||||||
NewAttrs.push_back(AttributeWithIndex::get(Caller->getContext(),
|
NewAttrs.push_back(AttributeSet::get(Caller->getContext(),
|
||||||
AttributeSet::ReturnIndex,
|
Attrs.getRetAttributes()));
|
||||||
Attrs.getRetAttributes()));
|
|
||||||
|
|
||||||
{
|
{
|
||||||
unsigned Idx = 1;
|
unsigned Idx = 1;
|
||||||
@ -1309,8 +1303,8 @@ InstCombiner::transformCallThroughTrampoline(CallSite CS,
|
|||||||
if (NestVal->getType() != NestTy)
|
if (NestVal->getType() != NestTy)
|
||||||
NestVal = Builder->CreateBitCast(NestVal, NestTy, "nest");
|
NestVal = Builder->CreateBitCast(NestVal, NestTy, "nest");
|
||||||
NewArgs.push_back(NestVal);
|
NewArgs.push_back(NestVal);
|
||||||
NewAttrs.push_back(AttributeWithIndex::get(Caller->getContext(),
|
NewAttrs.push_back(AttributeSet::get(Caller->getContext(),
|
||||||
NestIdx, NestAttr));
|
NestAttr));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (I == E)
|
if (I == E)
|
||||||
@ -1320,9 +1314,9 @@ InstCombiner::transformCallThroughTrampoline(CallSite CS,
|
|||||||
NewArgs.push_back(*I);
|
NewArgs.push_back(*I);
|
||||||
AttributeSet Attr = Attrs.getParamAttributes(Idx);
|
AttributeSet Attr = Attrs.getParamAttributes(Idx);
|
||||||
if (Attr.hasAttributes(Idx)) {
|
if (Attr.hasAttributes(Idx)) {
|
||||||
NewAttrs.push_back
|
AttrBuilder B(Attr, Idx);
|
||||||
(AttributeWithIndex::get(Caller->getContext(), Idx, Attr));
|
NewAttrs.push_back(AttributeSet::get(Caller->getContext(),
|
||||||
NewAttrs.back().Index = Idx + (Idx >= NestIdx);
|
Idx + (Idx >= NestIdx), B));
|
||||||
}
|
}
|
||||||
|
|
||||||
++Idx, ++I;
|
++Idx, ++I;
|
||||||
@ -1331,9 +1325,8 @@ InstCombiner::transformCallThroughTrampoline(CallSite CS,
|
|||||||
|
|
||||||
// Add any function attributes.
|
// Add any function attributes.
|
||||||
if (Attrs.hasAttributes(AttributeSet::FunctionIndex))
|
if (Attrs.hasAttributes(AttributeSet::FunctionIndex))
|
||||||
NewAttrs.push_back(AttributeWithIndex::get(FTy->getContext(),
|
NewAttrs.push_back(AttributeSet::get(FTy->getContext(),
|
||||||
AttributeSet::FunctionIndex,
|
Attrs.getFnAttributes()));
|
||||||
Attrs.getFnAttributes()));
|
|
||||||
|
|
||||||
// The trampoline may have been bitcast to a bogus type (FTy).
|
// The trampoline may have been bitcast to a bogus type (FTy).
|
||||||
// Handle this by synthesizing a new function type, equal to FTy
|
// Handle this by synthesizing a new function type, equal to FTy
|
||||||
|
Loading…
Reference in New Issue
Block a user