mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-13 01:15:32 +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@173603 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ac90696722
commit
a1683d6c48
@ -2813,25 +2813,25 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) {
|
|||||||
// Okay, if we got here, the function is syntactically valid. Convert types
|
// Okay, if we got here, the function is syntactically valid. Convert types
|
||||||
// and do semantic checks.
|
// and do semantic checks.
|
||||||
std::vector<Type*> ParamTypeList;
|
std::vector<Type*> ParamTypeList;
|
||||||
SmallVector<AttributeWithIndex, 8> Attrs;
|
SmallVector<AttributeSet, 8> Attrs;
|
||||||
|
|
||||||
if (RetAttrs.hasAttributes())
|
if (RetAttrs.hasAttributes())
|
||||||
Attrs.push_back(
|
Attrs.push_back(AttributeSet::get(RetType->getContext(),
|
||||||
AttributeWithIndex::get(AttributeSet::ReturnIndex,
|
AttributeSet::ReturnIndex,
|
||||||
Attribute::get(RetType->getContext(),
|
RetAttrs));
|
||||||
RetAttrs)));
|
|
||||||
|
|
||||||
for (unsigned i = 0, e = ArgList.size(); i != e; ++i) {
|
for (unsigned i = 0, e = ArgList.size(); i != e; ++i) {
|
||||||
ParamTypeList.push_back(ArgList[i].Ty);
|
ParamTypeList.push_back(ArgList[i].Ty);
|
||||||
if (ArgList[i].Attrs.hasAttributes())
|
if (ArgList[i].Attrs.hasAttributes()) {
|
||||||
Attrs.push_back(AttributeWithIndex::get(i+1, ArgList[i].Attrs));
|
AttrBuilder B(ArgList[i].Attrs);
|
||||||
|
Attrs.push_back(AttributeSet::get(RetType->getContext(), i + 1, B));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FuncAttrs.hasAttributes())
|
if (FuncAttrs.hasAttributes())
|
||||||
Attrs.push_back(
|
Attrs.push_back(AttributeSet::get(RetType->getContext(),
|
||||||
AttributeWithIndex::get(AttributeSet::FunctionIndex,
|
AttributeSet::FunctionIndex,
|
||||||
Attribute::get(RetType->getContext(),
|
FuncAttrs));
|
||||||
FuncAttrs)));
|
|
||||||
|
|
||||||
AttributeSet PAL = AttributeSet::get(Context, Attrs);
|
AttributeSet PAL = AttributeSet::get(Context, Attrs);
|
||||||
|
|
||||||
@ -3358,12 +3358,11 @@ bool LLParser::ParseInvoke(Instruction *&Inst, PerFunctionState &PFS) {
|
|||||||
if (ConvertValIDToValue(PFTy, CalleeID, Callee, &PFS)) return true;
|
if (ConvertValIDToValue(PFTy, CalleeID, Callee, &PFS)) return true;
|
||||||
|
|
||||||
// Set up the Attribute for the function.
|
// Set up the Attribute for the function.
|
||||||
SmallVector<AttributeWithIndex, 8> Attrs;
|
SmallVector<AttributeSet, 8> Attrs;
|
||||||
if (RetAttrs.hasAttributes())
|
if (RetAttrs.hasAttributes())
|
||||||
Attrs.push_back(
|
Attrs.push_back(AttributeSet::get(RetType->getContext(),
|
||||||
AttributeWithIndex::get(AttributeSet::ReturnIndex,
|
AttributeSet::ReturnIndex,
|
||||||
Attribute::get(Callee->getContext(),
|
RetAttrs));
|
||||||
RetAttrs)));
|
|
||||||
|
|
||||||
SmallVector<Value*, 8> Args;
|
SmallVector<Value*, 8> Args;
|
||||||
|
|
||||||
@ -3383,18 +3382,19 @@ bool LLParser::ParseInvoke(Instruction *&Inst, PerFunctionState &PFS) {
|
|||||||
return Error(ArgList[i].Loc, "argument is not of expected type '" +
|
return Error(ArgList[i].Loc, "argument is not of expected type '" +
|
||||||
getTypeString(ExpectedTy) + "'");
|
getTypeString(ExpectedTy) + "'");
|
||||||
Args.push_back(ArgList[i].V);
|
Args.push_back(ArgList[i].V);
|
||||||
if (ArgList[i].Attrs.hasAttributes())
|
if (ArgList[i].Attrs.hasAttributes()) {
|
||||||
Attrs.push_back(AttributeWithIndex::get(i+1, ArgList[i].Attrs));
|
AttrBuilder B(ArgList[i].Attrs);
|
||||||
|
Attrs.push_back(AttributeSet::get(RetType->getContext(), i + 1, B));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (I != E)
|
if (I != E)
|
||||||
return Error(CallLoc, "not enough parameters specified for call");
|
return Error(CallLoc, "not enough parameters specified for call");
|
||||||
|
|
||||||
if (FnAttrs.hasAttributes())
|
if (FnAttrs.hasAttributes())
|
||||||
Attrs.push_back(
|
Attrs.push_back(AttributeSet::get(RetType->getContext(),
|
||||||
AttributeWithIndex::get(AttributeSet::FunctionIndex,
|
AttributeSet::FunctionIndex,
|
||||||
Attribute::get(Callee->getContext(),
|
FnAttrs));
|
||||||
FnAttrs)));
|
|
||||||
|
|
||||||
// Finish off the Attribute and check them
|
// Finish off the Attribute and check them
|
||||||
AttributeSet PAL = AttributeSet::get(Context, Attrs);
|
AttributeSet PAL = AttributeSet::get(Context, Attrs);
|
||||||
@ -3760,12 +3760,11 @@ bool LLParser::ParseCall(Instruction *&Inst, PerFunctionState &PFS,
|
|||||||
if (ConvertValIDToValue(PFTy, CalleeID, Callee, &PFS)) return true;
|
if (ConvertValIDToValue(PFTy, CalleeID, Callee, &PFS)) return true;
|
||||||
|
|
||||||
// Set up the Attribute for the function.
|
// Set up the Attribute for the function.
|
||||||
SmallVector<AttributeWithIndex, 8> Attrs;
|
SmallVector<AttributeSet, 8> Attrs;
|
||||||
if (RetAttrs.hasAttributes())
|
if (RetAttrs.hasAttributes())
|
||||||
Attrs.push_back(
|
Attrs.push_back(AttributeSet::get(RetType->getContext(),
|
||||||
AttributeWithIndex::get(AttributeSet::ReturnIndex,
|
AttributeSet::ReturnIndex,
|
||||||
Attribute::get(Callee->getContext(),
|
RetAttrs));
|
||||||
RetAttrs)));
|
|
||||||
|
|
||||||
SmallVector<Value*, 8> Args;
|
SmallVector<Value*, 8> Args;
|
||||||
|
|
||||||
@ -3785,18 +3784,19 @@ bool LLParser::ParseCall(Instruction *&Inst, PerFunctionState &PFS,
|
|||||||
return Error(ArgList[i].Loc, "argument is not of expected type '" +
|
return Error(ArgList[i].Loc, "argument is not of expected type '" +
|
||||||
getTypeString(ExpectedTy) + "'");
|
getTypeString(ExpectedTy) + "'");
|
||||||
Args.push_back(ArgList[i].V);
|
Args.push_back(ArgList[i].V);
|
||||||
if (ArgList[i].Attrs.hasAttributes())
|
if (ArgList[i].Attrs.hasAttributes()) {
|
||||||
Attrs.push_back(AttributeWithIndex::get(i+1, ArgList[i].Attrs));
|
AttrBuilder B(ArgList[i].Attrs);
|
||||||
|
Attrs.push_back(AttributeSet::get(RetType->getContext(), i + 1, B));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (I != E)
|
if (I != E)
|
||||||
return Error(CallLoc, "not enough parameters specified for call");
|
return Error(CallLoc, "not enough parameters specified for call");
|
||||||
|
|
||||||
if (FnAttrs.hasAttributes())
|
if (FnAttrs.hasAttributes())
|
||||||
Attrs.push_back(
|
Attrs.push_back(AttributeSet::get(RetType->getContext(),
|
||||||
AttributeWithIndex::get(AttributeSet::FunctionIndex,
|
AttributeSet::FunctionIndex,
|
||||||
Attribute::get(Callee->getContext(),
|
FnAttrs));
|
||||||
FnAttrs)));
|
|
||||||
|
|
||||||
// Finish off the Attribute and check them
|
// Finish off the Attribute and check them
|
||||||
AttributeSet PAL = AttributeSet::get(Context, Attrs);
|
AttributeSet PAL = AttributeSet::get(Context, Attrs);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user