diff options
author | Dale Johannesen <dalej@apple.com> | 2008-02-19 21:38:47 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2008-02-19 21:38:47 +0000 |
commit | 0d51e7ec0d2dcbea9e304fd58deb05f37eb75635 (patch) | |
tree | 9fbe3f267ddd1719fd5b3e0f95733e786c07fa5c /lib | |
parent | a795aca96aca81ddeb4cd9628138926dd9fa612c (diff) | |
download | llvm-0d51e7ec0d2dcbea9e304fd58deb05f37eb75635.tar.gz llvm-0d51e7ec0d2dcbea9e304fd58deb05f37eb75635.tar.bz2 llvm-0d51e7ec0d2dcbea9e304fd58deb05f37eb75635.tar.xz |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AsmParser/llvmAsmParser.y | 2 | ||||
-rw-r--r-- | lib/Bitcode/Writer/BitcodeWriter.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/IPO/ArgumentPromotion.cpp | 14 | ||||
-rw-r--r-- | lib/Transforms/IPO/DeadArgumentElimination.cpp | 13 | ||||
-rw-r--r-- | lib/Transforms/IPO/PruneEH.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 21 | ||||
-rw-r--r-- | lib/VMCore/AsmWriter.cpp | 23 | ||||
-rw-r--r-- | lib/VMCore/Function.cpp | 6 | ||||
-rw-r--r-- | lib/VMCore/Instructions.cpp | 18 | ||||
-rw-r--r-- | lib/VMCore/ParameterAttributes.cpp | 22 | ||||
-rw-r--r-- | lib/VMCore/Verifier.cpp | 22 |
11 files changed, 82 insertions, 63 deletions
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index ccfe44ab82..2848945648 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/lib/AsmParser/llvmAsmParser.y @@ -974,7 +974,7 @@ Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) { llvm::GlobalValue::LinkageTypes Linkage; llvm::GlobalValue::VisibilityTypes Visibility; - uint16_t ParamAttrs; + llvm::ParameterAttributes ParamAttrs; llvm::APInt *APIntVal; int64_t SInt64Val; uint64_t UInt64Val; diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index fe013e8156..3f7cfcc209 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -119,7 +119,7 @@ static void WriteParamAttrTable(const ValueEnumerator &VE, const ParamAttrsList *A = Attrs[i]; for (unsigned op = 0, e = A->size(); op != e; ++op) { Record.push_back(A->getParamIndex(op)); - Record.push_back(A->getParamAttrsAtIndex(op)); + Record.push_back((uint16_t)A->getParamAttrsAtIndex(op)); } Stream.EmitRecord(bitc::PARAMATTR_CODE_ENTRY, Record); diff --git a/lib/Transforms/IPO/ArgumentPromotion.cpp b/lib/Transforms/IPO/ArgumentPromotion.cpp index 4486677e63..894e6ba564 100644 --- a/lib/Transforms/IPO/ArgumentPromotion.cpp +++ b/lib/Transforms/IPO/ArgumentPromotion.cpp @@ -405,7 +405,7 @@ Function *ArgPromotion::DoPromotion(Function *F, 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 @@ Function *ArgPromotion::DoPromotion(Function *F, ++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 @@ Function *ArgPromotion::DoPromotion(Function *F, 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 @@ Function *ArgPromotion::DoPromotion(Function *F, 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 @@ Function *ArgPromotion::DoPromotion(Function *F, // 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 3a4c36f87f..fe2db6d4e9 100644 --- a/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp @@ -512,7 +512,7 @@ void DAE::RemoveDeadArgumentsFromFunction(Function *F) { 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 @@ void DAE::RemoveDeadArgumentsFromFunction(Function *F) { ++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 @@ void DAE::RemoveDeadArgumentsFromFunction(Function *F) { 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 @@ void DAE::RemoveDeadArgumentsFromFunction(Function *F) { 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 @@ void DAE::RemoveDeadArgumentsFromFunction(Function *F) { // 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 4fe139a380..26ca2f6200 100644 --- a/lib/Transforms/IPO/PruneEH.cpp +++ b/lib/Transforms/IPO/PruneEH.cpp @@ -123,7 +123,7 @@ bool PruneEH::runOnSCC(const std::vector<CallGraphNode *> &SCC) { // 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 9957bc19c6..ba9ce568f3 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -8384,7 +8384,7 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) { 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 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) { 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 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) { 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 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) { 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 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) { } // 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 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) { } // 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 @@ Instruction *InstCombiner::transformCallThroughTrampoline(CallSite CS) { 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 @@ Instruction *InstCombiner::transformCallThroughTrampoline(CallSite CS) { // 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)); diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index 94477bab25..6e1652c4c7 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -742,7 +742,7 @@ public: inline void write(const Type *Ty) { printType(Ty); } void writeOperand(const Value *Op, bool PrintType); - void writeParamOperand(const Value *Operand, uint16_t Attrs); + void writeParamOperand(const Value *Operand, ParameterAttributes Attrs); const Module* getModule() { return TheModule; } @@ -752,7 +752,7 @@ private: void printGlobal(const GlobalVariable *GV); void printAlias(const GlobalAlias *GV); void printFunction(const Function *F); - void printArgument(const Argument *FA, uint16_t ParamAttrs); + void printArgument(const Argument *FA, ParameterAttributes Attrs); void printBasicBlock(const BasicBlock *BB); void printInstruction(const Instruction &I); @@ -839,7 +839,8 @@ void AssemblyWriter::writeOperand(const Value *Operand, bool PrintType) { } } -void AssemblyWriter::writeParamOperand(const Value *Operand, uint16_t Attrs) { +void AssemblyWriter::writeParamOperand(const Value *Operand, + ParameterAttributes Attrs) { if (Operand == 0) { Out << "<null operand!>"; } else { @@ -1092,7 +1093,7 @@ void AssemblyWriter::printFunction(const Function *F) { // Insert commas as we go... the first arg doesn't get a comma if (I != F->arg_begin()) Out << ", "; printArgument(I, (Attrs ? Attrs->getParamAttrs(Idx) - : uint16_t(ParamAttr::None))); + : ParamAttr::None)); Idx++; } } else { @@ -1104,7 +1105,7 @@ void AssemblyWriter::printFunction(const Function *F) { // Output type... printType(FT->getParamType(i)); - unsigned ArgAttrs = ParamAttr::None; + ParameterAttributes ArgAttrs = ParamAttr::None; if (Attrs) ArgAttrs = Attrs->getParamAttrs(i+1); if (ArgAttrs != ParamAttr::None) Out << ' ' << ParamAttrsList::getParamAttrsText(ArgAttrs); @@ -1144,7 +1145,8 @@ void AssemblyWriter::printFunction(const Function *F) { /// printArgument - This member is called for every argument that is passed into /// the function. Simply print it out /// -void AssemblyWriter::printArgument(const Argument *Arg, uint16_t Attrs) { +void AssemblyWriter::printArgument(const Argument *Arg, + ParameterAttributes Attrs) { // Output type... printType(Arg->getType()); @@ -1323,7 +1325,8 @@ void AssemblyWriter::printInstruction(const Instruction &I) { for (unsigned op = 1, Eop = I.getNumOperands(); op < Eop; ++op) { if (op > 1) Out << ','; - writeParamOperand(I.getOperand(op), PAL ? PAL->getParamAttrs(op) : 0); + writeParamOperand(I.getOperand(op), PAL ? PAL->getParamAttrs(op) : + ParamAttr::None); } Out << " )"; if (PAL && PAL->getParamAttrs(0) != ParamAttr::None) @@ -1361,7 +1364,8 @@ void AssemblyWriter::printInstruction(const Instruction &I) { for (unsigned op = 3, Eop = I.getNumOperands(); op < Eop; ++op) { if (op > 3) Out << ','; - writeParamOperand(I.getOperand(op), PAL ? PAL->getParamAttrs(op-2) : 0); + writeParamOperand(I.getOperand(op), PAL ? PAL->getParamAttrs(op-2) : + ParamAttr::None); } Out << " )"; @@ -1515,9 +1519,10 @@ ParamAttrsList::dump() const { cerr << "PAL[ "; for (unsigned i = 0; i < attrs.size(); ++i) { uint16_t index = getParamIndex(i); - uint16_t attrs = getParamAttrs(index); + ParameterAttributes attrs = getParamAttrs(index); cerr << "{" << index << "," << attrs << "} "; } + cerr << "]\n"; } diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index ec34abc106..cbe11f0b6c 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -139,8 +139,8 @@ void Function::eraseFromParent() { } /// @brief Determine whether the function has the given attribute. -bool Function::paramHasAttr(uint16_t i, unsigned attr) const { - return ParamAttrs && ParamAttrs->paramHasAttr(i, (ParameterAttributes)attr); +bool Function::paramHasAttr(uint16_t i, ParameterAttributes attr) const { + return ParamAttrs && ParamAttrs->paramHasAttr(i, attr); } /// @brief Determine if the function cannot return. @@ -365,7 +365,7 @@ const FunctionType *Intrinsic::getType(ID id, const Type **Tys, const ParamAttrsList *Intrinsic::getParamAttrs(ID id) { ParamAttrsVector Attrs; - uint16_t Attr = ParamAttr::None; + ParameterAttributes Attr = ParamAttr::None; #define GET_INTRINSIC_ATTRIBUTES #include "llvm/Intrinsics.gen" diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp index 1a4a5ce725..863f011cd0 100644 --- a/lib/VMCore/Instructions.cpp +++ b/lib/VMCore/Instructions.cpp @@ -55,11 +55,11 @@ void CallSite::setParamAttrs(const ParamAttrsList *PAL) { else cast<InvokeInst>(I)->setParamAttrs(PAL); } -bool CallSite::paramHasAttr(uint16_t i, unsigned attr) const { +bool CallSite::paramHasAttr(uint16_t i, ParameterAttributes attr) const { if (CallInst *CI = dyn_cast<CallInst>(I)) - return CI->paramHasAttr(i, (ParameterAttributes)attr); + return CI->paramHasAttr(i, attr); else - return cast<InvokeInst>(I)->paramHasAttr(i, (ParameterAttributes)attr); + return cast<InvokeInst>(I)->paramHasAttr(i, attr); } bool CallSite::doesNotAccessMemory() const { if (CallInst *CI = dyn_cast<CallInst>(I)) @@ -374,11 +374,11 @@ void CallInst::setParamAttrs(const ParamAttrsList *newAttrs) { ParamAttrs = newAttrs; } -bool CallInst::paramHasAttr(uint16_t i, unsigned attr) const { - if (ParamAttrs && ParamAttrs->paramHasAttr(i, (ParameterAttributes)attr)) +bool CallInst::paramHasAttr(uint16_t i, ParameterAttributes attr) const { + if (ParamAttrs && ParamAttrs->paramHasAttr(i, attr)) return true; if (const Function *F = getCalledFunction()) - return F->paramHasAttr(i, (ParameterAttributes)attr); + return F->paramHasAttr(i, attr); return false; } @@ -498,11 +498,11 @@ void InvokeInst::setParamAttrs(const ParamAttrsList *newAttrs) { ParamAttrs = newAttrs; } -bool InvokeInst::paramHasAttr(uint16_t i, unsigned attr) const { - if (ParamAttrs && ParamAttrs->paramHasAttr(i, (ParameterAttributes)attr)) +bool InvokeInst::paramHasAttr(uint16_t i, ParameterAttributes attr) const { + if (ParamAttrs && ParamAttrs->paramHasAttr(i, attr)) return true; if (const Function *F = getCalledFunction()) - return F->paramHasAttr(i, (ParameterAttributes)attr); + return F->paramHasAttr(i, attr); return false; } diff --git a/lib/VMCore/ParameterAttributes.cpp b/lib/VMCore/ParameterAttributes.cpp index 344e52c59a..d78068df11 100644 --- a/lib/VMCore/ParameterAttributes.cpp +++ b/lib/VMCore/ParameterAttributes.cpp @@ -27,7 +27,7 @@ ParamAttrsList::~ParamAttrsList() { ParamAttrsLists->RemoveNode(this); } -uint16_t +ParameterAttributes ParamAttrsList::getParamAttrs(uint16_t Index) const { unsigned limit = attrs.size(); for (unsigned i = 0; i < limit && attrs[i].index <= Index; ++i) @@ -44,7 +44,7 @@ bool ParamAttrsList::hasAttrSomewhere(ParameterAttributes attr) const { } std::string -ParamAttrsList::getParamAttrsText(uint16_t Attrs) { +ParamAttrsList::getParamAttrsText(ParameterAttributes Attrs) { std::string Result; if (Attrs & ParamAttr::ZExt) Result += "zeroext "; @@ -170,9 +170,10 @@ ParamAttrsList::getModified(const ParamAttrsList *PAL, const ParamAttrsList * ParamAttrsList::includeAttrs(const ParamAttrsList *PAL, - uint16_t idx, uint16_t attrs) { - uint16_t OldAttrs = PAL ? PAL->getParamAttrs(idx) : 0; - uint16_t NewAttrs = OldAttrs | attrs; + uint16_t idx, ParameterAttributes attrs) { + ParameterAttributes OldAttrs = PAL ? PAL->getParamAttrs(idx) : + ParamAttr::None; + ParameterAttributes NewAttrs = OldAttrs | attrs; if (NewAttrs == OldAttrs) return PAL; @@ -183,9 +184,10 @@ ParamAttrsList::includeAttrs(const ParamAttrsList *PAL, const ParamAttrsList * ParamAttrsList::excludeAttrs(const ParamAttrsList *PAL, - uint16_t idx, uint16_t attrs) { - uint16_t OldAttrs = PAL ? PAL->getParamAttrs(idx) : 0; - uint16_t NewAttrs = OldAttrs & ~attrs; + uint16_t idx, ParameterAttributes attrs) { + ParameterAttributes OldAttrs = PAL ? PAL->getParamAttrs(idx) : + ParamAttr::None; + ParameterAttributes NewAttrs = OldAttrs & ~attrs; if (NewAttrs == OldAttrs) return PAL; @@ -194,8 +196,8 @@ ParamAttrsList::excludeAttrs(const ParamAttrsList *PAL, return getModified(PAL, modVec); } -uint16_t ParamAttr::typeIncompatible (const Type *Ty) { - uint16_t Incompatible = None; +ParameterAttributes ParamAttr::typeIncompatible (const Type *Ty) { + ParameterAttributes Incompatible = None; if (!Ty->isInteger()) // Attributes that only apply to integers. diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 3c7ce7a5a2..98f421e95e 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -261,8 +261,8 @@ namespace { // Anonymous namespace for class void VerifyCallSite(CallSite CS); void VerifyIntrinsicPrototype(Intrinsic::ID ID, Function *F, unsigned Count, ...); - void VerifyAttrs(uint16_t Attrs, const Type *Ty, bool isReturnValue, - const Value *V); + void VerifyAttrs(ParameterAttributes Attrs, const Type *Ty, + bool isReturnValue, const Value *V); void VerifyFunctionAttrs(const FunctionType *FT, const ParamAttrsList *Attrs, const Value *V); @@ -386,29 +386,29 @@ void Verifier::verifyTypeSymbolTable(TypeSymbolTable &ST) { // VerifyAttrs - Check the given parameter attributes for an argument or return // value of the specified type. The value V is printed in error messages. -void Verifier::VerifyAttrs(uint16_t Attrs, const Type *Ty, bool isReturnValue, - const Value *V) { +void Verifier::VerifyAttrs(ParameterAttributes Attrs, const Type *Ty, + bool isReturnValue, const Value *V) { if (Attrs == ParamAttr::None) return; if (isReturnValue) { - uint16_t RetI = Attrs & ParamAttr::ParameterOnly; + ParameterAttributes RetI = Attrs & ParamAttr::ParameterOnly; Assert1(!RetI, "Attribute " + ParamAttrsList::getParamAttrsText(RetI) + "does not apply to return values!", V); } else { - uint16_t ParmI = Attrs & ParamAttr::ReturnOnly; + ParameterAttributes ParmI = Attrs & ParamAttr::ReturnOnly; Assert1(!ParmI, "Attribute " + ParamAttrsList::getParamAttrsText(ParmI) + "only applies to return values!", V); } for (unsigned i = 0; i < array_lengthof(ParamAttr::MutuallyIncompatible); ++i) { - uint16_t MutI = Attrs & ParamAttr::MutuallyIncompatible[i]; + ParameterAttributes MutI = Attrs & ParamAttr::MutuallyIncompatible[i]; Assert1(!(MutI & (MutI - 1)), "Attributes " + ParamAttrsList::getParamAttrsText(MutI) + "are incompatible!", V); } - uint16_t TypeI = Attrs & ParamAttr::typeIncompatible(Ty); + ParameterAttributes TypeI = Attrs & ParamAttr::typeIncompatible(Ty); Assert1(!TypeI, "Wrong type for attribute " + ParamAttrsList::getParamAttrsText(TypeI), V); } @@ -424,7 +424,7 @@ void Verifier::VerifyFunctionAttrs(const FunctionType *FT, bool SawNest = false; for (unsigned Idx = 0; Idx <= FT->getNumParams(); ++Idx) { - uint16_t Attr = Attrs->getParamAttrs(Idx); + ParameterAttributes Attr = Attrs->getParamAttrs(Idx); VerifyAttrs(Attr, FT->getParamType(Idx-1), !Idx, V); @@ -873,11 +873,11 @@ void Verifier::VerifyCallSite(CallSite CS) { if (Attrs && FTy->isVarArg()) // Check attributes on the varargs part. for (unsigned Idx = 1 + FTy->getNumParams(); Idx <= CS.arg_size(); ++Idx) { - uint16_t Attr = Attrs->getParamAttrs(Idx); + ParameterAttributes Attr = Attrs->getParamAttrs(Idx); VerifyAttrs(Attr, CS.getArgument(Idx-1)->getType(), false, I); - uint16_t VArgI = Attr & ParamAttr::VarArgsIncompatible; + ParameterAttributes VArgI = Attr & ParamAttr::VarArgsIncompatible; Assert1(!VArgI, "Attribute " + ParamAttrsList::getParamAttrsText(VArgI) + "cannot be used for vararg call arguments!", I); } |