added emulation of "soa" data types via shared-memory

This commit is contained in:
Evghenii
2014-01-23 16:17:06 +01:00
parent 0091973bca
commit da7a2c0c7f
5 changed files with 42 additions and 1 deletions

View File

@@ -264,6 +264,7 @@ DeclStmt::EmitCode(FunctionEmitContext *ctx) const {
return;
}
if (sym->storageClass == SC_STATIC) {
if (g->target->getISA() == Target::NVPTX && !sym->type->IsConstType())
@@ -328,7 +329,7 @@ DeclStmt::EmitCode(FunctionEmitContext *ctx) const {
// Tell the FunctionEmitContext about the variable
ctx->EmitVariableDebugInfo(sym);
}
else if (sym->type->IsUniformType() &&
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
@@ -357,6 +358,8 @@ DeclStmt::EmitCode(FunctionEmitContext *ctx) const {
* instead of compile-time constants
*/
nel *= at->GetElementCount();
if (sym->type->IsSOAType())
nel *= sym->type->GetSOAWidth();
nat = new ArrayType(at->GetElementType(), nel);
variable = false;
}