From 0f17514eb0e47a9d6ca74edb91add4525b2caf77 Mon Sep 17 00:00:00 2001 From: Aaron Gutierrez Date: Sun, 7 May 2017 15:08:47 -0400 Subject: [PATCH] remove trailing whitespace --- ast.cpp | 2 +- expr.cpp | 12 ++++++------ expr.h | 40 ++++++++++++++++++++-------------------- func.cpp | 14 +++++++------- stmt.cpp | 32 ++++++++++++++++---------------- sym.h | 2 +- 6 files changed, 51 insertions(+), 51 deletions(-) diff --git a/ast.cpp b/ast.cpp index 5acfb651..506aa1e2 100644 --- a/ast.cpp +++ b/ast.cpp @@ -497,7 +497,7 @@ lCheckAllOffSafety(ASTNode *node, void *data) { } /* - Don't allow turning if/else to straight-line-code if we + Don't allow turning if/else to straight-line-code if we assign to a uniform. */ AssignExpr *ae; diff --git a/expr.cpp b/expr.cpp index 423c5e60..3b1276f5 100644 --- a/expr.cpp +++ b/expr.cpp @@ -3204,7 +3204,7 @@ static llvm::Value * lEmitVaryingSelect(FunctionEmitContext *ctx, llvm::Value *test, llvm::Value *expr1, llvm::Value *expr2, const Type *type) { - + llvm::Value *resultPtr = ctx->AllocaInst(expr1->getType(), "selectexpr_tmp"); // Don't need to worry about masking here ctx->StoreInst(expr2, resultPtr); @@ -3704,7 +3704,7 @@ FunctionCallExpr::GetValue(FunctionEmitContext *ctx) const { ctx->SetDebugPos(pos); if (ft->isTask) { AssertPos(pos, launchCountExpr[0] != NULL); - llvm::Value *launchCount[3] = + llvm::Value *launchCount[3] = { launchCountExpr[0]->GetValue(ctx), launchCountExpr[1]->GetValue(ctx), launchCountExpr[2]->GetValue(ctx) }; @@ -3773,7 +3773,7 @@ FunctionCallExpr::GetType() const { const Type * FunctionCallExpr::GetLValueType() const { const FunctionType *ftype = lGetFunctionType(func); - if (ftype && (ftype->GetReturnType()->IsPointerType() + if (ftype && (ftype->GetReturnType()->IsPointerType() || ftype->GetReturnType()->IsReferenceType())) { return ftype->GetReturnType(); } @@ -4314,7 +4314,7 @@ IndexExpr::GetValue(FunctionEmitContext *ctx) const { } else { Symbol *baseSym = GetBaseSymbol(); - if (llvm::dyn_cast(baseExpr) == NULL && + if (llvm::dyn_cast(baseExpr) == NULL && llvm::dyn_cast(baseExpr) == NULL) { // Don't check if we're doing a function call or pointer arith AssertPos(pos, baseSym != NULL); @@ -5168,7 +5168,7 @@ MemberExpr::create(Expr *e, const char *id, SourcePos p, SourcePos idpos, } if (CastType(exprType) != NULL) { const StructType *st = CastType(exprType); - if (st->IsDefined()) { + if (st->IsDefined()) { return new StructMemberExpr(e, id, p, idpos, derefLValue); } else { @@ -7224,7 +7224,7 @@ TypeCastExpr::TypeCheck() { // Issues #721 return this; } - + const AtomicType *fromAtomic = CastType(fromType); const AtomicType *toAtomic = CastType(toType); const EnumType *fromEnum = CastType(fromType); diff --git a/expr.h b/expr.h index 446b7bd1..8b3e8db0 100644 --- a/expr.h +++ b/expr.h @@ -166,12 +166,12 @@ public: }; BinaryExpr(Op o, Expr *a, Expr *b, SourcePos p); - + static inline bool classof(BinaryExpr const*) { return true; } static inline bool classof(ASTNode const* N) { return N->getValueID() == BinaryExprID; } - + llvm::Value *GetValue(FunctionEmitContext *ctx) const; const Type *GetType() const; const Type *GetLValueType() const; @@ -209,7 +209,7 @@ public: static inline bool classof(ASTNode const* N) { return N->getValueID() == AssignExprID; } - + llvm::Value *GetValue(FunctionEmitContext *ctx) const; const Type *GetType() const; void Print() const; @@ -235,7 +235,7 @@ public: static inline bool classof(ASTNode const* N) { return N->getValueID() == SelectExprID; } - + llvm::Value *GetValue(FunctionEmitContext *ctx) const; const Type *GetType() const; void Print() const; @@ -262,7 +262,7 @@ public: static inline bool classof(ASTNode const* N) { return N->getValueID() == ExprListID; } - + llvm::Value *GetValue(FunctionEmitContext *ctx) const; const Type *GetType() const; void Print() const; @@ -280,14 +280,14 @@ public: class FunctionCallExpr : public Expr { public: FunctionCallExpr(Expr *func, ExprList *args, SourcePos p, - bool isLaunch = false, + bool isLaunch = false, Expr *launchCountExpr[3] = NULL); static inline bool classof(FunctionCallExpr const*) { return true; } static inline bool classof(ASTNode const* N) { return N->getValueID() == FunctionCallExprID; } - + llvm::Value *GetValue(FunctionEmitContext *ctx) const; llvm::Value *GetLValue(FunctionEmitContext *ctx) const; const Type *GetType() const; @@ -318,7 +318,7 @@ public: static inline bool classof(ASTNode const* N) { return N->getValueID() == IndexExprID; } - + llvm::Value *GetValue(FunctionEmitContext *ctx) const; llvm::Value *GetLValue(FunctionEmitContext *ctx) const; const Type *GetType() const; @@ -353,7 +353,7 @@ public: return ((N->getValueID() == StructMemberExprID) || (N->getValueID() == VectorMemberExprID)); } - + llvm::Value *GetValue(FunctionEmitContext *ctx) const; llvm::Value *GetLValue(FunctionEmitContext *ctx) const; const Type *GetType() const; @@ -456,7 +456,7 @@ public: static inline bool classof(ASTNode const* N) { return N->getValueID() == ConstExprID; } - + llvm::Value *GetValue(FunctionEmitContext *ctx) const; const Type *GetType() const; void Print() const; @@ -518,7 +518,7 @@ public: static inline bool classof(ASTNode const* N) { return N->getValueID() == TypeCastExprID; } - + llvm::Value *GetValue(FunctionEmitContext *ctx) const; llvm::Value *GetLValue(FunctionEmitContext *ctx) const; const Type *GetType() const; @@ -545,7 +545,7 @@ public: static inline bool classof(ASTNode const* N) { return N->getValueID() == ReferenceExprID; } - + llvm::Value *GetValue(FunctionEmitContext *ctx) const; const Type *GetType() const; const Type *GetLValueType() const; @@ -571,7 +571,7 @@ public: (N->getValueID() == PtrDerefExprID) || (N->getValueID() == RefDerefExprID)); } - + llvm::Value *GetValue(FunctionEmitContext *ctx) const; llvm::Value *GetLValue(FunctionEmitContext *ctx) const; const Type *GetLValueType() const; @@ -592,7 +592,7 @@ public: static inline bool classof(ASTNode const* N) { return N->getValueID() == PtrDerefExprID; } - + const Type *GetType() const; void Print() const; Expr *TypeCheck(); @@ -610,7 +610,7 @@ public: static inline bool classof(ASTNode const* N) { return N->getValueID() == RefDerefExprID; } - + const Type *GetType() const; void Print() const; Expr *TypeCheck(); @@ -653,7 +653,7 @@ public: static inline bool classof(ASTNode const* N) { return N->getValueID() == SizeOfExprID; } - + llvm::Value *GetValue(FunctionEmitContext *ctx) const; const Type *GetType() const; void Print() const; @@ -677,7 +677,7 @@ public: static inline bool classof(ASTNode const* N) { return N->getValueID() == SymbolExprID; } - + llvm::Value *GetValue(FunctionEmitContext *ctx) const; llvm::Value *GetLValue(FunctionEmitContext *ctx) const; const Type *GetType() const; @@ -705,7 +705,7 @@ public: static inline bool classof(ASTNode const* N) { return N->getValueID() == FunctionSymbolExprID; } - + llvm::Value *GetValue(FunctionEmitContext *ctx) const; const Type *GetType() const; Symbol *GetBaseSymbol() const; @@ -766,7 +766,7 @@ public: static inline bool classof(ASTNode const* N) { return N->getValueID() == SyncExprID; } - + llvm::Value *GetValue(FunctionEmitContext *ctx) const; const Type *GetType() const; Expr *TypeCheck(); @@ -785,7 +785,7 @@ public: static inline bool classof(ASTNode const* N) { return N->getValueID() == NullPointerExprID; } - + llvm::Value *GetValue(FunctionEmitContext *ctx) const; const Type *GetType() const; Expr *TypeCheck(); diff --git a/func.cpp b/func.cpp index 8a4d9779..d97c4dd0 100644 --- a/func.cpp +++ b/func.cpp @@ -140,7 +140,7 @@ Function::Function(Symbol *s, Stmt *c) { if (type->isTask #ifdef ISPC_NVPTX_ENABLED - && (g->target->getISA() != Target::NVPTX) + && (g->target->getISA() != Target::NVPTX) #endif ){ threadIndexSym = m->symbolTable->LookupVariable("threadIndex"); @@ -260,8 +260,8 @@ Function::emitCode(FunctionEmitContext *ctx, llvm::Function *function, Assert(type != NULL); if (type->isTask == true #ifdef ISPC_NVPTX_ENABLED - && (g->target->getISA() != Target::NVPTX) -#endif + && (g->target->getISA() != Target::NVPTX) +#endif ){ // For tasks, there should always be three parameters: the // pointer to the structure that holds all of the arguments, the @@ -322,14 +322,14 @@ Function::emitCode(FunctionEmitContext *ctx, llvm::Function *function, taskCountSym->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskCount"); ctx->StoreInst(taskCount, taskCountSym->storagePtr); - + taskIndexSym0->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskIndex0"); ctx->StoreInst(taskIndex0, taskIndexSym0->storagePtr); taskIndexSym1->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskIndex1"); ctx->StoreInst(taskIndex1, taskIndexSym1->storagePtr); taskIndexSym2->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskIndex2"); ctx->StoreInst(taskIndex2, taskIndexSym2->storagePtr); - + taskCountSym0->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskCount0"); ctx->StoreInst(taskCount0, taskCountSym0->storagePtr); taskCountSym1->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskCount1"); @@ -570,7 +570,7 @@ Function::GenerateIR() { av.push_back(function); av.push_back(llvm::MDString::get(*g->ctx, "kernel")); av.push_back(llvm::ConstantInt::get(llvm::IntegerType::get(*g->ctx,32), 1)); - annotations->addOperand(llvm::MDNode::get(*g->ctx, av)); + annotations->addOperand(llvm::MDNode::get(*g->ctx, av)); #endif } #endif /* ISPC_NVPTX_ENABLED */ @@ -611,7 +611,7 @@ Function::GenerateIR() { av.push_back(llvm::ValueAsMetadata::get(appFunction)); av.push_back(llvm::MDString::get(*g->ctx, "kernel")); av.push_back(llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(llvm::IntegerType::get(*g->ctx,32), 1))); - annotations->addOperand(llvm::MDNode::get(*g->ctx, llvm::ArrayRef(av))); + annotations->addOperand(llvm::MDNode::get(*g->ctx, llvm::ArrayRef(av))); #else llvm::SmallVector av; av.push_back(appFunction); diff --git a/stmt.cpp b/stmt.cpp index 03d89e38..e5e5f97e 100644 --- a/stmt.cpp +++ b/stmt.cpp @@ -150,11 +150,11 @@ lHasUnsizedArrays(const Type *type) { #ifdef ISPC_NVPTX_ENABLED static llvm::Value* lConvertToGenericPtr(FunctionEmitContext *ctx, llvm::Value *value, const SourcePos ¤tPos, const bool variable = false) { - if (!value->getType()->isPointerTy() || g->target->getISA() != Target::NVPTX) + if (!value->getType()->isPointerTy() || g->target->getISA() != Target::NVPTX) return value; llvm::PointerType *pt = llvm::dyn_cast(value->getType()); const int addressSpace = pt->getAddressSpace(); - if (addressSpace != 3 && addressSpace != 4) + if (addressSpace != 3 && addressSpace != 4) return value; llvm::Type *elTy = pt->getElementType(); @@ -276,17 +276,17 @@ DeclStmt::EmitCode(FunctionEmitContext *ctx) const { #ifdef ISPC_NVPTX_ENABLED if (g->target->getISA() == Target::NVPTX && !sym->type->IsConstType()) { - Error(sym->pos, + Error(sym->pos, "Non-constant static variable ""\"%s\" is not supported with ""\"nvptx\" target.", sym->name.c_str()); return; } if (g->target->getISA() == Target::NVPTX && sym->type->IsVaryingType()) - PerformanceWarning(sym->pos, + PerformanceWarning(sym->pos, "\"const static varying\" variable ""\"%s\" is stored in __global address space with ""\"nvptx\" target.", sym->name.c_str()); if (g->target->getISA() == Target::NVPTX && sym->type->IsUniformType()) - PerformanceWarning(sym->pos, + PerformanceWarning(sym->pos, "\"const static uniform\" variable ""\"%s\" is stored in __constant address space with ""\"nvptx\" target.", sym->name.c_str()); #endif /* ISPC_NVPTX_ENABLED */ @@ -351,11 +351,11 @@ DeclStmt::EmitCode(FunctionEmitContext *ctx) const { #ifdef ISPC_NVPTX_ENABLED else if ((sym->type->IsUniformType() || sym->type->IsSOAType()) && /* NVPTX: - * only non-constant uniform data types are stored in shared memory - * constant uniform are automatically promoted to varying + * only non-constant uniform data types are stored in shared memory + * constant uniform are automatically promoted to varying */ !sym->type->IsConstType() && -#if 1 +#if 1 sym->type->IsArrayType() && #endif g->target->getISA() == Target::NVPTX) @@ -375,7 +375,7 @@ DeclStmt::EmitCode(FunctionEmitContext *ctx) const { * or 128 threads. * ***note-to-me***:please define these value (128threads/4warps) * in nvptx-target definition - * instead of compile-time constants + * instead of compile-time constants */ nel *= at->GetElementCount(); if (sym->type->IsSOAType()) @@ -392,9 +392,9 @@ DeclStmt::EmitCode(FunctionEmitContext *ctx) const { sym->storagePtr = new llvm::GlobalVariable(*m->module, llvmTypeUn, sym->type->IsConstType(), - llvm::GlobalValue::InternalLinkage, + llvm::GlobalValue::InternalLinkage, cinit, - llvm::Twine("local_") + + llvm::Twine("local_") + llvm::Twine(sym->pos.first_line) + llvm::Twine("_") + sym->name.c_str(), NULL, @@ -595,7 +595,7 @@ IfStmt::EmitCode(FunctionEmitContext *ctx) const { #if 0 if (!isUniform && g->target->getISA() == Target::NVPTX) { - /* With "nvptx" target, SIMT hardware takes care of non-uniform + /* With "nvptx" target, SIMT hardware takes care of non-uniform * control flow. We trick ISPC to generate uniform control flow. */ testValue = ctx->ExtractInst(testValue, 0); @@ -1500,9 +1500,9 @@ lUpdateVaryingCounter(int dim, int nDims, FunctionEmitContext *ctx, // (0,1,2,3,0,1,2,3), and for the outer dimension we want // (0,0,0,0,1,1,1,1). int32_t delta[ISPC_MAX_NVEC]; - const int vecWidth = 32; + const int vecWidth = 32; std::vector constDeltaList; - for (int i = 0; i < vecWidth; ++i) + for (int i = 0; i < vecWidth; ++i) { int d = i; // First, account for the effect of any dimensions at deeper @@ -1699,7 +1699,7 @@ ForeachStmt::EmitCode(FunctionEmitContext *ctx) const { std::vector span(nDims, 0); #ifdef ISPC_NVPTX_ENABLED - const int vectorWidth = + const int vectorWidth = g->target->getISA() == Target::NVPTX ? 32 : g->target->getVectorWidth(); lGetSpans(nDims-1, nDims, vectorWidth, isTiled, &span[0]); #else /* ISPC_NVPTX_ENABLED */ @@ -3343,7 +3343,7 @@ lProcessPrintArg(Expr *expr, FunctionEmitContext *ctx, std::string &argTypes) { } else { if (Type::Equal(baseType, AtomicType::UniformBool)) { - // Blast bools to ints, but do it here to preserve encoding for + // Blast bools to ints, but do it here to preserve encoding for // printing 'true' or 'false' expr = new TypeCastExpr(type->IsUniformType() ? AtomicType::UniformInt32 : AtomicType::VaryingInt32, diff --git a/sym.h b/sym.h index 5840fcdb..d2955f90 100644 --- a/sym.h +++ b/sym.h @@ -219,7 +219,7 @@ public: @return Pointer to the Type, if found; otherwise NULL is returned. */ const Type *LookupType(const char *name) const; - + /** Look for a type given a pointer. @return True if found, False otherwise.