This commit is contained in:
Evghenii
2014-01-09 14:45:52 +01:00
parent 2c043f67d0
commit b6b8855728

View File

@@ -305,6 +305,12 @@ DeclStmt::EmitCode(FunctionEmitContext *ctx) const {
if (cinit == NULL) if (cinit == NULL)
cinit = llvm::Constant::getNullValue(llvmType); 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 // Allocate space for the static variable in global scope, so
// that it persists across function calls // that it persists across function calls
sym->storagePtr = sym->storagePtr =
@@ -316,7 +322,7 @@ DeclStmt::EmitCode(FunctionEmitContext *ctx) const {
llvm::Twine("_") + sym->name.c_str(), llvm::Twine("_") + sym->name.c_str(),
NULL, NULL,
llvm::GlobalVariable::NotThreadLocal, llvm::GlobalVariable::NotThreadLocal,
/*AddressSpace=*/ sym->type->IsUniformType() ? 4 : 0); addressSpace);
sym->storagePtr = lConvertToGenericPtr(ctx, sym->storagePtr, sym->pos); sym->storagePtr = lConvertToGenericPtr(ctx, sym->storagePtr, sym->pos);
// Tell the FunctionEmitContext about the variable // Tell the FunctionEmitContext about the variable
ctx->EmitVariableDebugInfo(sym); ctx->EmitVariableDebugInfo(sym);