From c86c5097d757882d743e90b332714a7fc59b641a Mon Sep 17 00:00:00 2001 From: Aaron Gutierrez Date: Sun, 7 May 2017 15:08:47 -0400 Subject: [PATCH 1/3] remove trailing whitespace --- ast.cpp | 2 +- func.cpp | 14 +++++++------- stmt.cpp | 32 ++++++++++++++++---------------- 3 files changed, 24 insertions(+), 24 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/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, From 05c9f63527389718a26db4694d02577eed3fffa3 Mon Sep 17 00:00:00 2001 From: Aaron Gutierrez Date: Mon, 8 May 2017 15:30:06 -0400 Subject: [PATCH 2/3] Remove trailing whitespace --- sym.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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. From 8a1aeed55c25b911fcd9215bcecaef17f594e618 Mon Sep 17 00:00:00 2001 From: Aaron Gutierrez Date: Mon, 8 May 2017 17:40:15 -0400 Subject: [PATCH 3/3] remove trailing whitespace --- expr.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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);