mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 17:32:19 +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@173601 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d04b2d45d9
commit
b2484b4332
@ -514,14 +514,13 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F,
|
||||
// Attribute - Keep track of the parameter attributes for the arguments
|
||||
// that we are *not* promoting. For the ones that we do promote, the parameter
|
||||
// attributes are lost
|
||||
SmallVector<AttributeWithIndex, 8> AttributesVec;
|
||||
SmallVector<AttributeSet, 8> AttributesVec;
|
||||
const AttributeSet &PAL = F->getAttributes();
|
||||
|
||||
// Add any return attributes.
|
||||
if (PAL.hasAttributes(AttributeSet::ReturnIndex))
|
||||
AttributesVec.push_back(AttributeWithIndex::get(F->getContext(),
|
||||
AttributeSet::ReturnIndex,
|
||||
PAL.getRetAttributes()));
|
||||
AttributesVec.push_back(AttributeSet::get(F->getContext(),
|
||||
PAL.getRetAttributes()));
|
||||
|
||||
// First, determine the new argument list
|
||||
unsigned ArgIndex = 1;
|
||||
@ -539,10 +538,9 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F,
|
||||
Params.push_back(I->getType());
|
||||
AttributeSet attrs = PAL.getParamAttributes(ArgIndex);
|
||||
if (attrs.hasAttributes(ArgIndex)) {
|
||||
AttrBuilder B(attrs, ArgIndex);
|
||||
AttributesVec.
|
||||
push_back(AttributeWithIndex::get(F->getContext(),
|
||||
ArgIndex, attrs));
|
||||
AttributesVec.back().Index = Params.size();
|
||||
push_back(AttributeSet::get(F->getContext(), Params.size(), B));
|
||||
}
|
||||
} else if (I->use_empty()) {
|
||||
// Dead argument (which are always marked as promotable)
|
||||
@ -596,9 +594,8 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F,
|
||||
|
||||
// Add any function attributes.
|
||||
if (PAL.hasAttributes(AttributeSet::FunctionIndex))
|
||||
AttributesVec.push_back(AttributeWithIndex::get(FTy->getContext(),
|
||||
AttributeSet::FunctionIndex,
|
||||
PAL.getFnAttributes()));
|
||||
AttributesVec.push_back(AttributeSet::get(FTy->getContext(),
|
||||
PAL.getFnAttributes()));
|
||||
|
||||
Type *RetTy = FTy->getReturnType();
|
||||
|
||||
@ -644,9 +641,8 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F,
|
||||
|
||||
// Add any return attributes.
|
||||
if (CallPAL.hasAttributes(AttributeSet::ReturnIndex))
|
||||
AttributesVec.push_back(AttributeWithIndex::get(F->getContext(),
|
||||
AttributeSet::ReturnIndex,
|
||||
CallPAL.getRetAttributes()));
|
||||
AttributesVec.push_back(AttributeSet::get(F->getContext(),
|
||||
CallPAL.getRetAttributes()));
|
||||
|
||||
// Loop over the operands, inserting GEP and loads in the caller as
|
||||
// appropriate.
|
||||
@ -658,10 +654,9 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F,
|
||||
Args.push_back(*AI); // Unmodified argument
|
||||
|
||||
if (CallPAL.hasAttributes(ArgIndex)) {
|
||||
AttrBuilder B(CallPAL, ArgIndex);
|
||||
AttributesVec.
|
||||
push_back(AttributeWithIndex::get(F->getContext(), ArgIndex,
|
||||
CallPAL.getParamAttributes(ArgIndex)));
|
||||
AttributesVec.back().Index = Args.size();
|
||||
push_back(AttributeSet::get(F->getContext(), Args.size(), B));
|
||||
}
|
||||
} else if (ByValArgsToTransform.count(I)) {
|
||||
// Emit a GEP and load for each element of the struct.
|
||||
@ -722,18 +717,16 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F,
|
||||
for (; AI != CS.arg_end(); ++AI, ++ArgIndex) {
|
||||
Args.push_back(*AI);
|
||||
if (CallPAL.hasAttributes(ArgIndex)) {
|
||||
AttrBuilder B(CallPAL, ArgIndex);
|
||||
AttributesVec.
|
||||
push_back(AttributeWithIndex::get(F->getContext(), ArgIndex,
|
||||
CallPAL.getParamAttributes(ArgIndex)));
|
||||
AttributesVec.back().Index = Args.size();
|
||||
push_back(AttributeSet::get(F->getContext(), Args.size(), B));
|
||||
}
|
||||
}
|
||||
|
||||
// Add any function attributes.
|
||||
if (CallPAL.hasAttributes(AttributeSet::FunctionIndex))
|
||||
AttributesVec.push_back(AttributeWithIndex::get(Call->getContext(),
|
||||
AttributeSet::FunctionIndex,
|
||||
CallPAL.getFnAttributes()));
|
||||
AttributesVec.push_back(AttributeSet::get(Call->getContext(),
|
||||
CallPAL.getFnAttributes()));
|
||||
|
||||
Instruction *New;
|
||||
if (InvokeInst *II = dyn_cast<InvokeInst>(Call)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user