From b6b885572896f9b2155c05e49befbfbe6225fec2 Mon Sep 17 00:00:00 2001 From: Evghenii Date: Thu, 9 Jan 2014 14:45:52 +0100 Subject: [PATCH] +1 --- stmt.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/stmt.cpp b/stmt.cpp index 1caca0e1..c9a36c07 100644 --- a/stmt.cpp +++ b/stmt.cpp @@ -305,6 +305,12 @@ DeclStmt::EmitCode(FunctionEmitContext *ctx) const { if (cinit == NULL) cinit = llvm::Constant::getNullValue(llvmType); + int addressSpace = 0; + if (g->target->getISA() == Target::NVPTX && + sym->type->IsConstType() && + sym->type->IsUniformType()) + addressSpace = 4; + // Allocate space for the static variable in global scope, so // that it persists across function calls sym->storagePtr = @@ -316,7 +322,7 @@ DeclStmt::EmitCode(FunctionEmitContext *ctx) const { llvm::Twine("_") + sym->name.c_str(), NULL, llvm::GlobalVariable::NotThreadLocal, - /*AddressSpace=*/ sym->type->IsUniformType() ? 4 : 0); + addressSpace); sym->storagePtr = lConvertToGenericPtr(ctx, sym->storagePtr, sym->pos); // Tell the FunctionEmitContext about the variable ctx->EmitVariableDebugInfo(sym);