remove trailing whitespace

This commit is contained in:
2017-05-07 15:08:47 -04:00
parent 46ed9bdb3c
commit c86c5097d7
3 changed files with 24 additions and 24 deletions

View File

@@ -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. assign to a uniform.
*/ */
AssignExpr *ae; AssignExpr *ae;

View File

@@ -140,7 +140,7 @@ Function::Function(Symbol *s, Stmt *c) {
if (type->isTask if (type->isTask
#ifdef ISPC_NVPTX_ENABLED #ifdef ISPC_NVPTX_ENABLED
&& (g->target->getISA() != Target::NVPTX) && (g->target->getISA() != Target::NVPTX)
#endif #endif
){ ){
threadIndexSym = m->symbolTable->LookupVariable("threadIndex"); threadIndexSym = m->symbolTable->LookupVariable("threadIndex");
@@ -260,8 +260,8 @@ Function::emitCode(FunctionEmitContext *ctx, llvm::Function *function,
Assert(type != NULL); Assert(type != NULL);
if (type->isTask == true if (type->isTask == true
#ifdef ISPC_NVPTX_ENABLED #ifdef ISPC_NVPTX_ENABLED
&& (g->target->getISA() != Target::NVPTX) && (g->target->getISA() != Target::NVPTX)
#endif #endif
){ ){
// For tasks, there should always be three parameters: the // For tasks, there should always be three parameters: the
// pointer to the structure that holds all of the arguments, 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"); taskCountSym->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskCount");
ctx->StoreInst(taskCount, taskCountSym->storagePtr); ctx->StoreInst(taskCount, taskCountSym->storagePtr);
taskIndexSym0->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskIndex0"); taskIndexSym0->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskIndex0");
ctx->StoreInst(taskIndex0, taskIndexSym0->storagePtr); ctx->StoreInst(taskIndex0, taskIndexSym0->storagePtr);
taskIndexSym1->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskIndex1"); taskIndexSym1->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskIndex1");
ctx->StoreInst(taskIndex1, taskIndexSym1->storagePtr); ctx->StoreInst(taskIndex1, taskIndexSym1->storagePtr);
taskIndexSym2->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskIndex2"); taskIndexSym2->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskIndex2");
ctx->StoreInst(taskIndex2, taskIndexSym2->storagePtr); ctx->StoreInst(taskIndex2, taskIndexSym2->storagePtr);
taskCountSym0->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskCount0"); taskCountSym0->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskCount0");
ctx->StoreInst(taskCount0, taskCountSym0->storagePtr); ctx->StoreInst(taskCount0, taskCountSym0->storagePtr);
taskCountSym1->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskCount1"); taskCountSym1->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskCount1");
@@ -570,7 +570,7 @@ Function::GenerateIR() {
av.push_back(function); av.push_back(function);
av.push_back(llvm::MDString::get(*g->ctx, "kernel")); av.push_back(llvm::MDString::get(*g->ctx, "kernel"));
av.push_back(llvm::ConstantInt::get(llvm::IntegerType::get(*g->ctx,32), 1)); 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
} }
#endif /* ISPC_NVPTX_ENABLED */ #endif /* ISPC_NVPTX_ENABLED */
@@ -611,7 +611,7 @@ Function::GenerateIR() {
av.push_back(llvm::ValueAsMetadata::get(appFunction)); av.push_back(llvm::ValueAsMetadata::get(appFunction));
av.push_back(llvm::MDString::get(*g->ctx, "kernel")); 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))); 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<llvm::Metadata*>(av))); annotations->addOperand(llvm::MDNode::get(*g->ctx, llvm::ArrayRef<llvm::Metadata*>(av)));
#else #else
llvm::SmallVector<llvm::Value*, 3> av; llvm::SmallVector<llvm::Value*, 3> av;
av.push_back(appFunction); av.push_back(appFunction);

View File

@@ -150,11 +150,11 @@ lHasUnsizedArrays(const Type *type) {
#ifdef ISPC_NVPTX_ENABLED #ifdef ISPC_NVPTX_ENABLED
static llvm::Value* lConvertToGenericPtr(FunctionEmitContext *ctx, llvm::Value *value, const SourcePos &currentPos, const bool variable = false) static llvm::Value* lConvertToGenericPtr(FunctionEmitContext *ctx, llvm::Value *value, const SourcePos &currentPos, const bool variable = false)
{ {
if (!value->getType()->isPointerTy() || g->target->getISA() != Target::NVPTX) if (!value->getType()->isPointerTy() || g->target->getISA() != Target::NVPTX)
return value; return value;
llvm::PointerType *pt = llvm::dyn_cast<llvm::PointerType>(value->getType()); llvm::PointerType *pt = llvm::dyn_cast<llvm::PointerType>(value->getType());
const int addressSpace = pt->getAddressSpace(); const int addressSpace = pt->getAddressSpace();
if (addressSpace != 3 && addressSpace != 4) if (addressSpace != 3 && addressSpace != 4)
return value; return value;
llvm::Type *elTy = pt->getElementType(); llvm::Type *elTy = pt->getElementType();
@@ -276,17 +276,17 @@ DeclStmt::EmitCode(FunctionEmitContext *ctx) const {
#ifdef ISPC_NVPTX_ENABLED #ifdef ISPC_NVPTX_ENABLED
if (g->target->getISA() == Target::NVPTX && !sym->type->IsConstType()) 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.", "Non-constant static variable ""\"%s\" is not supported with ""\"nvptx\" target.",
sym->name.c_str()); sym->name.c_str());
return; return;
} }
if (g->target->getISA() == Target::NVPTX && sym->type->IsVaryingType()) 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.", "\"const static varying\" variable ""\"%s\" is stored in __global address space with ""\"nvptx\" target.",
sym->name.c_str()); sym->name.c_str());
if (g->target->getISA() == Target::NVPTX && sym->type->IsUniformType()) 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.", "\"const static uniform\" variable ""\"%s\" is stored in __constant address space with ""\"nvptx\" target.",
sym->name.c_str()); sym->name.c_str());
#endif /* ISPC_NVPTX_ENABLED */ #endif /* ISPC_NVPTX_ENABLED */
@@ -351,11 +351,11 @@ DeclStmt::EmitCode(FunctionEmitContext *ctx) const {
#ifdef ISPC_NVPTX_ENABLED #ifdef ISPC_NVPTX_ENABLED
else if ((sym->type->IsUniformType() || sym->type->IsSOAType()) && else if ((sym->type->IsUniformType() || sym->type->IsSOAType()) &&
/* NVPTX: /* NVPTX:
* only non-constant uniform data types are stored in shared memory * only non-constant uniform data types are stored in shared memory
* constant uniform are automatically promoted to varying * constant uniform are automatically promoted to varying
*/ */
!sym->type->IsConstType() && !sym->type->IsConstType() &&
#if 1 #if 1
sym->type->IsArrayType() && sym->type->IsArrayType() &&
#endif #endif
g->target->getISA() == Target::NVPTX) g->target->getISA() == Target::NVPTX)
@@ -375,7 +375,7 @@ DeclStmt::EmitCode(FunctionEmitContext *ctx) const {
* or 128 threads. * or 128 threads.
* ***note-to-me***:please define these value (128threads/4warps) * ***note-to-me***:please define these value (128threads/4warps)
* in nvptx-target definition * in nvptx-target definition
* instead of compile-time constants * instead of compile-time constants
*/ */
nel *= at->GetElementCount(); nel *= at->GetElementCount();
if (sym->type->IsSOAType()) if (sym->type->IsSOAType())
@@ -392,9 +392,9 @@ DeclStmt::EmitCode(FunctionEmitContext *ctx) const {
sym->storagePtr = sym->storagePtr =
new llvm::GlobalVariable(*m->module, llvmTypeUn, new llvm::GlobalVariable(*m->module, llvmTypeUn,
sym->type->IsConstType(), sym->type->IsConstType(),
llvm::GlobalValue::InternalLinkage, llvm::GlobalValue::InternalLinkage,
cinit, cinit,
llvm::Twine("local_") + llvm::Twine("local_") +
llvm::Twine(sym->pos.first_line) + llvm::Twine(sym->pos.first_line) +
llvm::Twine("_") + sym->name.c_str(), llvm::Twine("_") + sym->name.c_str(),
NULL, NULL,
@@ -595,7 +595,7 @@ IfStmt::EmitCode(FunctionEmitContext *ctx) const {
#if 0 #if 0
if (!isUniform && g->target->getISA() == Target::NVPTX) 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. * control flow. We trick ISPC to generate uniform control flow.
*/ */
testValue = ctx->ExtractInst(testValue, 0); 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,1,2,3,0,1,2,3), and for the outer dimension we want
// (0,0,0,0,1,1,1,1). // (0,0,0,0,1,1,1,1).
int32_t delta[ISPC_MAX_NVEC]; int32_t delta[ISPC_MAX_NVEC];
const int vecWidth = 32; const int vecWidth = 32;
std::vector<llvm::Constant*> constDeltaList; std::vector<llvm::Constant*> constDeltaList;
for (int i = 0; i < vecWidth; ++i) for (int i = 0; i < vecWidth; ++i)
{ {
int d = i; int d = i;
// First, account for the effect of any dimensions at deeper // First, account for the effect of any dimensions at deeper
@@ -1699,7 +1699,7 @@ ForeachStmt::EmitCode(FunctionEmitContext *ctx) const {
std::vector<int> span(nDims, 0); std::vector<int> span(nDims, 0);
#ifdef ISPC_NVPTX_ENABLED #ifdef ISPC_NVPTX_ENABLED
const int vectorWidth = const int vectorWidth =
g->target->getISA() == Target::NVPTX ? 32 : g->target->getVectorWidth(); g->target->getISA() == Target::NVPTX ? 32 : g->target->getVectorWidth();
lGetSpans(nDims-1, nDims, vectorWidth, isTiled, &span[0]); lGetSpans(nDims-1, nDims, vectorWidth, isTiled, &span[0]);
#else /* ISPC_NVPTX_ENABLED */ #else /* ISPC_NVPTX_ENABLED */
@@ -3343,7 +3343,7 @@ lProcessPrintArg(Expr *expr, FunctionEmitContext *ctx, std::string &argTypes) {
} }
else { else {
if (Type::Equal(baseType, AtomicType::UniformBool)) { 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' // printing 'true' or 'false'
expr = new TypeCastExpr(type->IsUniformType() ? AtomicType::UniformInt32 : expr = new TypeCastExpr(type->IsUniformType() ? AtomicType::UniformInt32 :
AtomicType::VaryingInt32, AtomicType::VaryingInt32,