Expand ParameterAttributes to 32 bits (in preparation
for adding alignment info, not there yet). Clean up
interfaces to reference ParameterAttributes consistently.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47342 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/IPO/ArgumentPromotion.cpp b/lib/Transforms/IPO/ArgumentPromotion.cpp
index 4486677..894e6ba 100644
--- a/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -405,7 +405,7 @@
const ParamAttrsList *PAL = F->getParamAttrs();
// Add any return attributes.
- if (unsigned attrs = PAL ? PAL->getParamAttrs(0) : 0)
+ if (ParameterAttributes attrs = PAL ? PAL->getParamAttrs(0) : ParamAttr::None)
ParamAttrsVec.push_back(ParamAttrsWithIndex::get(0, attrs));
unsigned ArgIndex = 1;
@@ -420,7 +420,8 @@
++NumByValArgsPromoted;
} else if (!ArgsToPromote.count(I)) {
Params.push_back(I->getType());
- if (unsigned attrs = PAL ? PAL->getParamAttrs(ArgIndex) : 0)
+ if (ParameterAttributes attrs = PAL ? PAL->getParamAttrs(ArgIndex) :
+ ParamAttr::None)
ParamAttrsVec.push_back(ParamAttrsWithIndex::get(Params.size(), attrs));
} else if (I->use_empty()) {
++NumArgumentsDead;
@@ -496,7 +497,8 @@
PAL = CS.getParamAttrs();
// Add any return attributes.
- if (unsigned attrs = PAL ? PAL->getParamAttrs(0) : 0)
+ if (ParameterAttributes attrs = PAL ? PAL->getParamAttrs(0) :
+ ParamAttr::None)
ParamAttrsVec.push_back(ParamAttrsWithIndex::get(0, attrs));
// Loop over the operands, inserting GEP and loads in the caller as
@@ -508,7 +510,8 @@
if (!ArgsToPromote.count(I) && !ByValArgsToTransform.count(I)) {
Args.push_back(*AI); // Unmodified argument
- if (unsigned Attrs = PAL ? PAL->getParamAttrs(ArgIndex) : 0)
+ if (ParameterAttributes Attrs = PAL ? PAL->getParamAttrs(ArgIndex) :
+ ParamAttr::None)
ParamAttrsVec.push_back(ParamAttrsWithIndex::get(Args.size(), Attrs));
} else if (ByValArgsToTransform.count(I)) {
@@ -547,7 +550,8 @@
// Push any varargs arguments on the list
for (; AI != CS.arg_end(); ++AI, ++ArgIndex) {
Args.push_back(*AI);
- if (unsigned Attrs = PAL ? PAL->getParamAttrs(ArgIndex) : 0)
+ if (ParameterAttributes Attrs = PAL ? PAL->getParamAttrs(ArgIndex) :
+ ParamAttr::None)
ParamAttrsVec.push_back(ParamAttrsWithIndex::get(Args.size(), Attrs));
}
diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp
index 3a4c36f..fe2db6d 100644
--- a/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -512,7 +512,7 @@
const ParamAttrsList *PAL = F->getParamAttrs();
// The existing function return attributes.
- uint16_t RAttrs = PAL ? PAL->getParamAttrs(0) : 0;
+ ParameterAttributes RAttrs = PAL ? PAL->getParamAttrs(0) : ParamAttr::None;
// Make the function return void if the return value is dead.
const Type *RetTy = FTy->getReturnType();
@@ -532,7 +532,8 @@
++I, ++index)
if (!DeadArguments.count(I)) {
Params.push_back(I->getType());
- uint16_t Attrs = PAL ? PAL->getParamAttrs(index) : 0;
+ ParameterAttributes Attrs = PAL ? PAL->getParamAttrs(index) :
+ ParamAttr::None;
if (Attrs)
ParamAttrsVec.push_back(ParamAttrsWithIndex::get(Params.size(), Attrs));
}
@@ -572,7 +573,7 @@
PAL = CS.getParamAttrs();
// The call return attributes.
- uint16_t RAttrs = PAL ? PAL->getParamAttrs(0) : 0;
+ ParameterAttributes RAttrs = PAL ? PAL->getParamAttrs(0) : ParamAttr::None;
// Adjust in case the function was changed to return void.
RAttrs &= ~ParamAttr::typeIncompatible(NF->getReturnType());
if (RAttrs)
@@ -585,7 +586,8 @@
I != E; ++I, ++AI, ++index)
if (!DeadArguments.count(I)) { // Remove operands for dead arguments
Args.push_back(*AI);
- uint16_t Attrs = PAL ? PAL->getParamAttrs(index) : 0;
+ ParameterAttributes Attrs = PAL ? PAL->getParamAttrs(index) :
+ ParamAttr::None;
if (Attrs)
ParamAttrsVec.push_back(ParamAttrsWithIndex::get(Args.size(), Attrs));
}
@@ -596,7 +598,8 @@
// Push any varargs arguments on the list. Don't forget their attributes.
for (; AI != CS.arg_end(); ++AI) {
Args.push_back(*AI);
- uint16_t Attrs = PAL ? PAL->getParamAttrs(index++) : 0;
+ ParameterAttributes Attrs = PAL ? PAL->getParamAttrs(index++) :
+ ParamAttr::None;
if (Attrs)
ParamAttrsVec.push_back(ParamAttrsWithIndex::get(Args.size(), Attrs));
}
diff --git a/lib/Transforms/IPO/PruneEH.cpp b/lib/Transforms/IPO/PruneEH.cpp
index 4fe139a..26ca2f6 100644
--- a/lib/Transforms/IPO/PruneEH.cpp
+++ b/lib/Transforms/IPO/PruneEH.cpp
@@ -123,7 +123,7 @@
// If the SCC doesn't unwind or doesn't throw, note this fact.
if (!SCCMightUnwind || !SCCMightReturn)
for (unsigned i = 0, e = SCC.size(); i != e; ++i) {
- uint16_t NewAttributes = ParamAttr::None;
+ ParameterAttributes NewAttributes = ParamAttr::None;
if (!SCCMightUnwind)
NewAttributes |= ParamAttr::NoUnwind;
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 9957bc1..ba9ce56 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -8384,7 +8384,7 @@
return false; // Cannot transform this return value.
if (CallerPAL && !Caller->use_empty()) {
- uint16_t RAttrs = CallerPAL->getParamAttrs(0);
+ ParameterAttributes RAttrs = CallerPAL->getParamAttrs(0);
if (RAttrs & ParamAttr::typeIncompatible(FT->getReturnType()))
return false; // Attribute not compatible with transformed value.
}
@@ -8415,7 +8415,7 @@
return false; // Cannot transform this parameter value.
if (CallerPAL) {
- uint16_t PAttrs = CallerPAL->getParamAttrs(i + 1);
+ ParameterAttributes PAttrs = CallerPAL->getParamAttrs(i + 1);
if (PAttrs & ParamAttr::typeIncompatible(ParamTy))
return false; // Attribute not compatible with transformed value.
}
@@ -8443,7 +8443,7 @@
for (unsigned i = CallerPAL->size(); i; --i) {
if (CallerPAL->getParamIndex(i - 1) <= FT->getNumParams())
break;
- uint16_t PAttrs = CallerPAL->getParamAttrsAtIndex(i - 1);
+ ParameterAttributes PAttrs = CallerPAL->getParamAttrsAtIndex(i - 1);
if (PAttrs & ParamAttr::VarArgsIncompatible)
return false;
}
@@ -8456,7 +8456,8 @@
attrVec.reserve(NumCommonArgs);
// Get any return attributes.
- uint16_t RAttrs = CallerPAL ? CallerPAL->getParamAttrs(0) : 0;
+ ParameterAttributes RAttrs = CallerPAL ? CallerPAL->getParamAttrs(0) :
+ ParamAttr::None;
// If the return value is not being used, the type may not be compatible
// with the existing attributes. Wipe out any problematic attributes.
@@ -8479,7 +8480,8 @@
}
// Add any parameter attributes.
- uint16_t PAttrs = CallerPAL ? CallerPAL->getParamAttrs(i + 1) : 0;
+ ParameterAttributes PAttrs = CallerPAL ? CallerPAL->getParamAttrs(i + 1) :
+ ParamAttr::None;
if (PAttrs)
attrVec.push_back(ParamAttrsWithIndex::get(i + 1, PAttrs));
}
@@ -8510,7 +8512,9 @@
}
// Add any parameter attributes.
- uint16_t PAttrs = CallerPAL ? CallerPAL->getParamAttrs(i + 1) : 0;
+ ParameterAttributes PAttrs = CallerPAL ?
+ CallerPAL->getParamAttrs(i + 1) :
+ ParamAttr::None;
if (PAttrs)
attrVec.push_back(ParamAttrsWithIndex::get(i + 1, PAttrs));
}
@@ -8593,7 +8597,7 @@
if (const ParamAttrsList *NestAttrs = NestF->getParamAttrs()) {
unsigned NestIdx = 1;
const Type *NestTy = 0;
- uint16_t NestAttr = 0;
+ ParameterAttributes NestAttr = ParamAttr::None;
// Look for a parameter marked with the 'nest' attribute.
for (FunctionType::param_iterator I = NestFTy->param_begin(),
@@ -8617,7 +8621,8 @@
// mean appending it. Likewise for attributes.
// Add any function result attributes.
- uint16_t Attr = Attrs ? Attrs->getParamAttrs(0) : 0;
+ ParameterAttributes Attr = Attrs ? Attrs->getParamAttrs(0) :
+ ParamAttr::None;
if (Attr)
NewAttrs.push_back (ParamAttrsWithIndex::get(0, Attr));