diff --git a/builtins.cpp b/builtins.cpp index d9432ae9..14444f40 100644 --- a/builtins.cpp +++ b/builtins.cpp @@ -157,7 +157,7 @@ lLLVMTypeToISPCType(const llvm::Type *t, bool intAsUnsigned) { static void lCreateSymbol(const std::string &name, const Type *returnType, - const std::vector &argTypes, + llvm::SmallVector &argTypes, const llvm::FunctionType *ftype, llvm::Function *func, SymbolTable *symbolTable) { SourcePos noPos; @@ -199,7 +199,7 @@ lCreateISPCSymbol(llvm::Function *func, SymbolTable *symbolTable) { // bool, so just have a one-off override for that one... if (g->target.maskBitCount != 1 && name == "__sext_varying_bool") { const Type *returnType = AtomicType::VaryingInt32; - std::vector argTypes; + llvm::SmallVector argTypes; argTypes.push_back(AtomicType::VaryingBool); FunctionType *funcType = new FunctionType(returnType, argTypes, noPos); @@ -229,7 +229,7 @@ lCreateISPCSymbol(llvm::Function *func, SymbolTable *symbolTable) { // Iterate over the arguments and try to find their equivalent ispc // types. Track if any of the arguments has an integer type. bool anyIntArgs = false; - std::vector argTypes; + llvm::SmallVector argTypes; for (unsigned int j = 0; j < ftype->getNumParams(); ++j) { const llvm::Type *llvmArgType = ftype->getParamType(j); const Type *type = lLLVMTypeToISPCType(llvmArgType, intAsUnsigned); @@ -674,7 +674,7 @@ lDefineConstantInt(const char *name, int val, llvm::Module *module, static void lDefineConstantIntFunc(const char *name, int val, llvm::Module *module, SymbolTable *symbolTable) { - std::vector args; + llvm::SmallVector args; FunctionType *ft = new FunctionType(AtomicType::UniformInt32, args, SourcePos()); Symbol *sym = new Symbol(name, SourcePos(), ft, SC_STATIC); diff --git a/decl.cpp b/decl.cpp index 00caa856..728206fd 100644 --- a/decl.cpp +++ b/decl.cpp @@ -386,11 +386,11 @@ Declarator::InitFromType(const Type *baseType, DeclSpecs *ds) { type = arrayType; } else if (kind == DK_FUNCTION) { - std::vector args; - std::vector argNames; - std::vector argDefaults; - std::vector argPos; - + llvm::SmallVector args; + llvm::SmallVector argNames; + llvm::SmallVector argDefaults; + llvm::SmallVector argPos; + // Loop over the function arguments and store the names, types, // default values (if any), and source file positions each one in // the corresponding vector. @@ -646,9 +646,9 @@ Declaration::Print(int indent) const { void GetStructTypesNamesPositions(const std::vector &sd, - std::vector *elementTypes, - std::vector *elementNames, - std::vector *elementPositions) { + llvm::SmallVector *elementTypes, + llvm::SmallVector *elementNames, + llvm::SmallVector *elementPositions) { std::set seenNames; for (unsigned int i = 0; i < sd.size(); ++i) { const Type *type = sd[i]->type; diff --git a/decl.h b/decl.h index ea2cb0fd..f8b5f3d4 100644 --- a/decl.h +++ b/decl.h @@ -55,6 +55,7 @@ #define ISPC_DECL_H #include "ispc.h" +#include struct VariableDeclaration; @@ -219,8 +220,8 @@ struct StructDeclaration { /** Given a set of StructDeclaration instances, this returns the types of the elements of the corresponding struct and their names. */ extern void GetStructTypesNamesPositions(const std::vector &sd, - std::vector *elementTypes, - std::vector *elementNames, - std::vector *elementPositions); + llvm::SmallVector *elementTypes, + llvm::SmallVector *elementNames, + llvm::SmallVector *elementPositions); #endif // ISPC_DECL_H diff --git a/parse.yy b/parse.yy index e983afdf..605d5d7d 100644 --- a/parse.yy +++ b/parse.yy @@ -853,9 +853,9 @@ struct_or_union_specifier : struct_or_union struct_or_union_name '{' struct_declaration_list '}' { if ($4 != NULL) { - std::vector elementTypes; - std::vector elementNames; - std::vector elementPositions; + llvm::SmallVector elementTypes; + llvm::SmallVector elementNames; + llvm::SmallVector elementPositions; GetStructTypesNamesPositions(*$4, &elementTypes, &elementNames, &elementPositions); StructType *st = new StructType($2, elementTypes, elementNames, @@ -869,9 +869,9 @@ struct_or_union_specifier | struct_or_union '{' struct_declaration_list '}' { if ($3 != NULL) { - std::vector elementTypes; - std::vector elementNames; - std::vector elementPositions; + llvm::SmallVector elementTypes; + llvm::SmallVector elementNames; + llvm::SmallVector elementPositions; GetStructTypesNamesPositions(*$3, &elementTypes, &elementNames, &elementPositions); $$ = new StructType("", elementTypes, elementNames, elementPositions, diff --git a/type.cpp b/type.cpp index a492af1d..f7edc485 100644 --- a/type.cpp +++ b/type.cpp @@ -1772,9 +1772,9 @@ lMangleStructName(const std::string &name, Variability variability) { } -StructType::StructType(const std::string &n, const std::vector &elts, - const std::vector &en, - const std::vector &ep, +StructType::StructType(const std::string &n, const llvm::SmallVector &elts, + const llvm::SmallVector &en, + const llvm::SmallVector &ep, bool ic, Variability v, SourcePos p) : CollectionType(STRUCT_TYPE), name(n), elementTypes(elts), elementNames(en), elementPositions(ep), variability(v), isConst(ic), pos(p) { @@ -2590,22 +2590,22 @@ ReferenceType::GetDIType(llvm::DIDescriptor scope) const { /////////////////////////////////////////////////////////////////////////// // FunctionType -FunctionType::FunctionType(const Type *r, const std::vector &a, +FunctionType::FunctionType(const Type *r, const llvm::SmallVector &a, SourcePos p) : Type(FUNCTION_TYPE), isTask(false), isExported(false), isExternC(false), - returnType(r), paramTypes(a), paramNames(std::vector(a.size(), "")), - paramDefaults(std::vector(a.size(), NULL)), - paramPositions(std::vector(a.size(), p)) { + returnType(r), paramTypes(a), paramNames(llvm::SmallVector(a.size(), "")), + paramDefaults(llvm::SmallVector(a.size(), NULL)), + paramPositions(llvm::SmallVector(a.size(), p)) { Assert(returnType != NULL); isSafe = false; costOverride = -1; } -FunctionType::FunctionType(const Type *r, const std::vector &a, - const std::vector &an, - const std::vector &ad, - const std::vector &ap, +FunctionType::FunctionType(const Type *r, const llvm::SmallVector &a, + const llvm::SmallVector &an, + const llvm::SmallVector &ad, + const llvm::SmallVector &ap, bool it, bool is, bool ec) : Type(FUNCTION_TYPE), isTask(it), isExported(is), isExternC(ec), returnType(r), paramTypes(a), paramNames(an), paramDefaults(ad), paramPositions(ap) { @@ -2697,7 +2697,7 @@ FunctionType::ResolveUnboundVariability(Variability v) const { } const Type *rt = returnType->ResolveUnboundVariability(v); - std::vector pt; + llvm::SmallVector pt; for (unsigned int i = 0; i < paramTypes.size(); ++i) { if (paramTypes[i] == NULL) { Assert(m->errorCount > 0); diff --git a/type.h b/type.h index 0d155ef2..ebd69af9 100644 --- a/type.h +++ b/type.h @@ -42,6 +42,7 @@ #include "util.h" #include #include +#include class ConstExpr; class StructType; @@ -642,9 +643,9 @@ private: */ class StructType : public CollectionType { public: - StructType(const std::string &name, const std::vector &elts, - const std::vector &eltNames, - const std::vector &eltPositions, bool isConst, + StructType(const std::string &name, const llvm::SmallVector &elts, + const llvm::SmallVector &eltNames, + const llvm::SmallVector &eltPositions, bool isConst, Variability variability, SourcePos pos); Variability GetVariability() const; @@ -709,16 +710,16 @@ private: make a uniform version of the struct, we've maintained the original information about the member types. */ - const std::vector elementTypes; - const std::vector elementNames; + const llvm::SmallVector elementTypes; + const llvm::SmallVector elementNames; /** Source file position at which each structure element declaration appeared. */ - const std::vector elementPositions; + const llvm::SmallVector elementPositions; const Variability variability; const bool isConst; const SourcePos pos; - mutable std::vector finalElementTypes; + mutable llvm::SmallVector finalElementTypes; mutable const StructType *oppositeConstStructType; }; @@ -822,12 +823,12 @@ private: class FunctionType : public Type { public: FunctionType(const Type *returnType, - const std::vector &argTypes, SourcePos pos); + const llvm::SmallVector &argTypes, SourcePos pos); FunctionType(const Type *returnType, - const std::vector &argTypes, - const std::vector &argNames, - const std::vector &argDefaults, - const std::vector &argPos, + const llvm::SmallVector &argTypes, + const llvm::SmallVector &argNames, + const llvm::SmallVector &argDefaults, + const llvm::SmallVector &argPos, bool isTask, bool isExported, bool isExternC); Variability GetVariability() const; @@ -897,16 +898,16 @@ private: // The following four vectors should all have the same length (which is // in turn the length returned by GetNumParameters()). - const std::vector paramTypes; - const std::vector paramNames; + const llvm::SmallVector paramTypes; + const llvm::SmallVector paramNames; /** Default values of the function's arguments. For arguments without default values provided, NULL is stored. */ - mutable std::vector paramDefaults; + mutable llvm::SmallVector paramDefaults; /** The names provided (if any) with the function arguments in the function's signature. These should only be used for error messages and the like and so not affect testing function types for equality, etc. */ - const std::vector paramPositions; + const llvm::SmallVector paramPositions; };