[llvm-commits] [llvm] r47342 - in /llvm/trunk: include/llvm/ include/llvm/Support/ lib/AsmParser/ lib/Bitcode/Writer/ lib/Transforms/IPO/ lib/Transforms/Scalar/ lib/VMCore/ tools/llvm2cpp/
Dale Johannesen
dalej at apple.com
Tue Feb 19 13:38:47 PST 2008
Author: johannes
Date: Tue Feb 19 15:38:47 2008
New Revision: 47342
URL: http://llvm.org/viewvc/llvm-project?rev=47342&view=rev
Log:
Expand ParameterAttributes to 32 bits (in preparation
for adding alignment info, not there yet). Clean up
interfaces to reference ParameterAttributes consistently.
Modified:
llvm/trunk/include/llvm/Function.h
llvm/trunk/include/llvm/Instructions.h
llvm/trunk/include/llvm/ParameterAttributes.h
llvm/trunk/include/llvm/Support/CallSite.h
llvm/trunk/lib/AsmParser/llvmAsmParser.y
llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp
llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp
llvm/trunk/lib/Transforms/IPO/PruneEH.cpp
llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
llvm/trunk/lib/VMCore/AsmWriter.cpp
llvm/trunk/lib/VMCore/Function.cpp
llvm/trunk/lib/VMCore/Instructions.cpp
llvm/trunk/lib/VMCore/ParameterAttributes.cpp
llvm/trunk/lib/VMCore/Verifier.cpp
llvm/trunk/tools/llvm2cpp/CppWriter.cpp
Modified: llvm/trunk/include/llvm/Function.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Function.h?rev=47342&r1=47341&r2=47342&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Function.h (original)
+++ llvm/trunk/include/llvm/Function.h Tue Feb 19 15:38:47 2008
@@ -22,6 +22,7 @@
#include "llvm/BasicBlock.h"
#include "llvm/Argument.h"
#include "llvm/Support/Annotation.h"
+#include "llvm/ParameterAttributes.h"
namespace llvm {
@@ -163,7 +164,7 @@
void clearCollector();
/// @brief Determine whether the function has the given attribute.
- bool paramHasAttr(uint16_t i, unsigned attr) const;
+ bool paramHasAttr(uint16_t i, ParameterAttributes attr) const;
/// @brief Determine if the function cannot return.
bool doesNotReturn() const;
Modified: llvm/trunk/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=47342&r1=47341&r2=47342&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Instructions.h (original)
+++ llvm/trunk/include/llvm/Instructions.h Tue Feb 19 15:38:47 2008
@@ -20,6 +20,7 @@
#include "llvm/InstrTypes.h"
#include "llvm/DerivedTypes.h"
+#include "llvm/ParameterAttributes.h"
namespace llvm {
@@ -1735,7 +1736,7 @@
void setParamAttrs(const ParamAttrsList *attrs);
/// @brief Determine whether the call or the callee has the given attribute.
- bool paramHasAttr(uint16_t i, unsigned attr) const;
+ bool paramHasAttr(uint16_t i, ParameterAttributes attr) const;
/// @brief Determine if the call does not access memory.
bool doesNotAccessMemory() const;
Modified: llvm/trunk/include/llvm/ParameterAttributes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ParameterAttributes.h?rev=47342&r1=47341&r2=47342&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ParameterAttributes.h (original)
+++ llvm/trunk/include/llvm/ParameterAttributes.h Tue Feb 19 15:38:47 2008
@@ -31,50 +31,55 @@
/// lists the attributes that can be associated with parameters or function
/// results.
/// @brief Function parameter attributes.
-enum Attributes {
- None = 0, ///< No attributes have been set
- ZExt = 1 << 0, ///< Zero extended before/after call
- SExt = 1 << 1, ///< Sign extended before/after call
- NoReturn = 1 << 2, ///< Mark the function as not returning
- InReg = 1 << 3, ///< Force argument to be passed in register
- StructRet = 1 << 4, ///< Hidden pointer to structure to return
- NoUnwind = 1 << 5, ///< Function doesn't unwind stack
- NoAlias = 1 << 6, ///< Considered to not alias after call
- ByVal = 1 << 7, ///< Pass structure by value
- Nest = 1 << 8, ///< Nested function static chain
- ReadNone = 1 << 9, ///< Function does not access memory
- ReadOnly = 1 << 10 ///< Function only reads from memory
-};
+
+/// @brief A more friendly way to reference the attributes.
+typedef uint32_t Attributes;
+
+const Attributes None = 0; ///< No attributes have been set
+const Attributes ZExt = 1<<0; ///< Zero extended before/after call
+const Attributes SExt = 1<<1; ///< Sign extended before/after call
+const Attributes NoReturn = 1<<2; ///< Mark the function as not returning
+const Attributes InReg = 1<<3; ///< Force argument to be passed in register
+const Attributes StructRet = 1<<4; ///< Hidden pointer to structure to return
+const Attributes NoUnwind = 1<<5; ///< Function doesn't unwind stack
+const Attributes NoAlias = 1<<6; ///< Considered to not alias after call
+const Attributes ByVal = 1<<7; ///< Pass structure by value
+const Attributes Nest = 1<<8; ///< Nested function static chain
+const Attributes ReadNone = 1<<9; ///< Function does not access memory
+const Attributes ReadOnly = 1<<10; ///< Function only reads from memory
/// @brief Attributes that only apply to function parameters.
-const uint16_t ParameterOnly = ByVal | InReg | Nest | StructRet;
+const Attributes ParameterOnly = ByVal | InReg | Nest | StructRet;
/// @brief Attributes that only apply to function return values.
-const uint16_t ReturnOnly = NoReturn | NoUnwind | ReadNone | ReadOnly;
+const Attributes ReturnOnly = NoReturn | NoUnwind | ReadNone | ReadOnly;
/// @brief Parameter attributes that do not apply to vararg call arguments.
-const uint16_t VarArgsIncompatible = StructRet;
+const Attributes VarArgsIncompatible = StructRet;
/// @brief Attributes that are mutually incompatible.
-const uint16_t MutuallyIncompatible[3] = {
+const Attributes MutuallyIncompatible[3] = {
ByVal | InReg | Nest | StructRet,
ZExt | SExt,
ReadNone | ReadOnly
};
/// @brief Which attributes cannot be applied to a type.
-uint16_t typeIncompatible (const Type *Ty);
+Attributes typeIncompatible (const Type *Ty);
} // end namespace ParamAttr
+/// @brief A more friendly way to reference the attributes.
+typedef ParamAttr::Attributes ParameterAttributes;
+
/// This is just a pair of values to associate a set of parameter attributes
/// with a parameter index.
/// @brief ParameterAttributes with a parameter index.
struct ParamAttrsWithIndex {
- uint16_t attrs; ///< The attributes that are set, or'd together
+ ParameterAttributes attrs; ///< The attributes that are set, or'd together
uint16_t index; ///< Index of the parameter for which the attributes apply
- static ParamAttrsWithIndex get(uint16_t idx, uint16_t attrs) {
+ static ParamAttrsWithIndex get(uint16_t idx, ParameterAttributes attrs) {
ParamAttrsWithIndex P;
P.index = idx;
P.attrs = attrs;
@@ -85,9 +90,6 @@
/// @brief A vector of attribute/index pairs.
typedef SmallVector<ParamAttrsWithIndex,4> ParamAttrsVector;
-/// @brief A more friendly way to reference the attributes.
-typedef ParamAttr::Attributes ParameterAttributes;
-
/// This class represents a list of attribute/index pairs for parameter
/// attributes. Each entry in the list contains the index of a function
/// parameter and the associated ParameterAttributes. If a parameter's index is
@@ -143,11 +145,13 @@
/// @brief Add the specified attributes to those in PAL at index idx.
static const ParamAttrsList *includeAttrs(const ParamAttrsList *PAL,
- uint16_t idx, uint16_t attrs);
+ uint16_t idx,
+ ParameterAttributes attrs);
/// @brief Remove the specified attributes from those in PAL at index idx.
static const ParamAttrsList *excludeAttrs(const ParamAttrsList *PAL,
- uint16_t idx, uint16_t attrs);
+ uint16_t idx,
+ ParameterAttributes attrs);
/// @}
/// @name Accessors
@@ -161,7 +165,7 @@
/// @returns The all the ParameterAttributes for the \p indexth parameter
/// as a uint16_t of enumeration values OR'd together.
/// @brief Get the attributes for a parameter
- uint16_t getParamAttrs(uint16_t param_index) const;
+ ParameterAttributes getParamAttrs(uint16_t param_index) const;
/// This checks to see if the \p ith function parameter has the parameter
/// attribute given by \p attr set.
@@ -181,7 +185,7 @@
/// string of equivalent mnemonics. This is, presumably, for writing out
/// the mnemonics for the assembly writer.
/// @brief Convert parameter attribute bits to text
- static std::string getParamAttrsText(uint16_t Attributes);
+ static std::string getParamAttrsText(ParameterAttributes Attributes);
/// The \p Indexth parameter attribute is converted to string.
/// @brief Get the text for the parmeter attributes for one parameter.
@@ -218,7 +222,7 @@
return attrs[attr_index].index;
}
- uint16_t getParamAttrsAtIndex(unsigned attr_index) const {
+ ParameterAttributes getParamAttrsAtIndex(unsigned attr_index) const {
return attrs[attr_index].attrs;
}
Modified: llvm/trunk/include/llvm/Support/CallSite.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CallSite.h?rev=47342&r1=47341&r2=47342&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/CallSite.h (original)
+++ llvm/trunk/include/llvm/Support/CallSite.h Tue Feb 19 15:38:47 2008
@@ -22,6 +22,7 @@
#include "llvm/Instruction.h"
#include "llvm/BasicBlock.h"
+#include "llvm/ParameterAttributes.h"
namespace llvm {
@@ -65,7 +66,7 @@
void setParamAttrs(const ParamAttrsList *PAL);
/// paramHasAttr - whether the call or the callee has the given attribute.
- bool paramHasAttr(uint16_t i, unsigned attr) const;
+ bool paramHasAttr(uint16_t i, ParameterAttributes attr) const;
/// @brief Determine if the call does not access memory.
bool doesNotAccessMemory() const;
Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y?rev=47342&r1=47341&r2=47342&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/llvmAsmParser.y (original)
+++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Tue Feb 19 15:38:47 2008
@@ -974,7 +974,7 @@
llvm::GlobalValue::LinkageTypes Linkage;
llvm::GlobalValue::VisibilityTypes Visibility;
- uint16_t ParamAttrs;
+ llvm::ParameterAttributes ParamAttrs;
llvm::APInt *APIntVal;
int64_t SInt64Val;
uint64_t UInt64Val;
Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=47342&r1=47341&r2=47342&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Tue Feb 19 15:38:47 2008
@@ -119,7 +119,7 @@
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);
Modified: llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp?rev=47342&r1=47341&r2=47342&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp Tue Feb 19 15:38:47 2008
@@ -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));
}
Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp?rev=47342&r1=47341&r2=47342&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Tue Feb 19 15:38:47 2008
@@ -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));
}
Modified: llvm/trunk/lib/Transforms/IPO/PruneEH.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PruneEH.cpp?rev=47342&r1=47341&r2=47342&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/PruneEH.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/PruneEH.cpp Tue Feb 19 15:38:47 2008
@@ -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;
Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=47342&r1=47341&r2=47342&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Tue Feb 19 15:38:47 2008
@@ -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));
Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=47342&r1=47341&r2=47342&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
+++ llvm/trunk/lib/VMCore/AsmWriter.cpp Tue Feb 19 15:38:47 2008
@@ -742,7 +742,7 @@
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 @@
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::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 @@
// 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 @@
// 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 @@
/// 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 @@
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 @@
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 @@
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";
}
Modified: llvm/trunk/lib/VMCore/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Function.cpp?rev=47342&r1=47341&r2=47342&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Function.cpp (original)
+++ llvm/trunk/lib/VMCore/Function.cpp Tue Feb 19 15:38:47 2008
@@ -139,8 +139,8 @@
}
/// @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 ParamAttrsList *Intrinsic::getParamAttrs(ID id) {
ParamAttrsVector Attrs;
- uint16_t Attr = ParamAttr::None;
+ ParameterAttributes Attr = ParamAttr::None;
#define GET_INTRINSIC_ATTRIBUTES
#include "llvm/Intrinsics.gen"
Modified: llvm/trunk/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=47342&r1=47341&r2=47342&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Tue Feb 19 15:38:47 2008
@@ -55,11 +55,11 @@
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 @@
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 @@
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;
}
Modified: llvm/trunk/lib/VMCore/ParameterAttributes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ParameterAttributes.cpp?rev=47342&r1=47341&r2=47342&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/ParameterAttributes.cpp (original)
+++ llvm/trunk/lib/VMCore/ParameterAttributes.cpp Tue Feb 19 15:38:47 2008
@@ -27,7 +27,7 @@
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 @@
}
std::string
-ParamAttrsList::getParamAttrsText(uint16_t Attrs) {
+ParamAttrsList::getParamAttrsText(ParameterAttributes Attrs) {
std::string Result;
if (Attrs & ParamAttr::ZExt)
Result += "zeroext ";
@@ -170,9 +170,10 @@
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 @@
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 @@
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.
Modified: llvm/trunk/lib/VMCore/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=47342&r1=47341&r2=47342&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Verifier.cpp (original)
+++ llvm/trunk/lib/VMCore/Verifier.cpp Tue Feb 19 15:38:47 2008
@@ -261,8 +261,8 @@
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 @@
// 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 @@
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 @@
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);
}
Modified: llvm/trunk/tools/llvm2cpp/CppWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm2cpp/CppWriter.cpp?rev=47342&r1=47341&r2=47342&view=diff
==============================================================================
--- llvm/trunk/tools/llvm2cpp/CppWriter.cpp (original)
+++ llvm/trunk/tools/llvm2cpp/CppWriter.cpp Tue Feb 19 15:38:47 2008
@@ -447,7 +447,7 @@
Out << "ParamAttrsWithIndex PAWI;"; nl(Out);
for (unsigned i = 0; i < PAL->size(); ++i) {
uint16_t index = PAL->getParamIndex(i);
- uint16_t attrs = PAL->getParamAttrs(index);
+ ParameterAttributes attrs = PAL->getParamAttrs(index);
Out << "PAWI.index = " << index << "; PAWI.attrs = 0 ";
if (attrs & ParamAttr::SExt)
Out << " | ParamAttr::SExt";
More information about the llvm-commits
mailing list