mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 00:24:26 +00:00
Now Attributes are divided in three groups
- return attributes - inreg, zext and sext - parameter attributes - function attributes - nounwind, readonly, readnone, noreturn Return attributes use 0 as the index. Function attributes use ~0U as the index. This patch requires corresponding changes in llvm-gcc and clang. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56704 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -210,7 +210,7 @@ Function *SRETPromotion::cloneFunctionBody(Function *F,
|
||||
const AttrListPtr &PAL = F->getAttributes();
|
||||
|
||||
// Add any return attributes.
|
||||
if (Attributes attrs = PAL.getAttributes(0))
|
||||
if (Attributes attrs = PAL.getRetAttributes())
|
||||
AttributesVec.push_back(AttributeWithIndex::get(0, attrs));
|
||||
|
||||
// Skip first argument.
|
||||
@ -221,12 +221,17 @@ Function *SRETPromotion::cloneFunctionBody(Function *F,
|
||||
unsigned ParamIndex = 2;
|
||||
while (I != E) {
|
||||
Params.push_back(I->getType());
|
||||
if (Attributes Attrs = PAL.getAttributes(ParamIndex))
|
||||
if (Attributes Attrs = PAL.getParamAttributes(ParamIndex))
|
||||
AttributesVec.push_back(AttributeWithIndex::get(ParamIndex - 1, Attrs));
|
||||
++I;
|
||||
++ParamIndex;
|
||||
}
|
||||
|
||||
// Add any fn attributes.
|
||||
if (Attributes attrs = PAL.getFnAttributes())
|
||||
AttributesVec.push_back(AttributeWithIndex::get(~0, attrs));
|
||||
|
||||
|
||||
FunctionType *NFTy = FunctionType::get(STy, Params, FTy->isVarArg());
|
||||
Function *NF = Function::Create(NFTy, F->getLinkage());
|
||||
NF->takeName(F);
|
||||
@ -264,7 +269,7 @@ void SRETPromotion::updateCallSites(Function *F, Function *NF) {
|
||||
|
||||
const AttrListPtr &PAL = F->getAttributes();
|
||||
// Add any return attributes.
|
||||
if (Attributes attrs = PAL.getAttributes(0))
|
||||
if (Attributes attrs = PAL.getRetAttributes())
|
||||
ArgAttrsVec.push_back(AttributeWithIndex::get(0, attrs));
|
||||
|
||||
// Copy arguments, however skip first one.
|
||||
@ -276,12 +281,15 @@ void SRETPromotion::updateCallSites(Function *F, Function *NF) {
|
||||
unsigned ParamIndex = 2;
|
||||
while (AI != AE) {
|
||||
Args.push_back(*AI);
|
||||
if (Attributes Attrs = PAL.getAttributes(ParamIndex))
|
||||
if (Attributes Attrs = PAL.getParamAttributes(ParamIndex))
|
||||
ArgAttrsVec.push_back(AttributeWithIndex::get(ParamIndex - 1, Attrs));
|
||||
++ParamIndex;
|
||||
++AI;
|
||||
}
|
||||
|
||||
// Add any function attributes.
|
||||
if (Attributes attrs = PAL.getFnAttributes())
|
||||
ArgAttrsVec.push_back(AttributeWithIndex::get(~0, attrs));
|
||||
|
||||
AttrListPtr NewPAL = AttrListPtr::get(ArgAttrsVec.begin(), ArgAttrsVec.end());
|
||||
|
||||
|
Reference in New Issue
Block a user