#include "tgsi/tgsi_scan.h"
}
+#include <set>
+
#include "nv50_ir.h"
#include "nv50_ir_util.h"
#include "nv50_ir_build_util.h"
int tempArrayCount;
int immdArrayCount;
+ typedef nv50_ir::BuildUtil::Location Location;
+ // these registers are per-subroutine, cannot be used for parameter passing
+ std::set<Location> locals;
+
bool mainTempsInLMem;
int clipVertexOutput;
bool Source::scanDeclaration(const struct tgsi_full_declaration *decl)
{
- unsigned i;
+ unsigned i, c;
unsigned sn = TGSI_SEMANTIC_GENERIC;
unsigned si = 0;
const unsigned first = decl->Range.First, last = decl->Range.Last;
si = decl->Semantic.Index;
}
+ if (decl->Declaration.Local) {
+ for (i = first; i <= last; ++i) {
+ for (c = 0; c < 4; ++c) {
+ locals.insert(
+ Location(decl->Declaration.File, decl->Dim.Index2D, i, c));
+ }
+ }
+ }
+
switch (decl->Declaration.File) {
case TGSI_FILE_INPUT:
if (info->type == PIPE_SHADER_VERTEX) {
if (decl->Dim.Index2D >= immdArrayCount)
immdArrayCount = decl->Dim.Index2D + 1;
immdArrays[decl->Dim.Index2D].u32 = (last + 1) << 2;
- int c;
uint32_t base, count;
switch (decl->Declaration.UsageMask) {
case 0x1: c = 1; break;
if (decl->Dim.Index2D >= tempArrayCount)
tempArrayCount = decl->Dim.Index2D + 1;
tempArrays[decl->Dim.Index2D].u32 = (last + 1) << 2;
- int c;
uint32_t count;
switch (decl->Declaration.UsageMask) {
case 0x1: c = 1; break;
Converter &conv;
Subroutine *sub;
+ inline const Location *getValueLocation(Subroutine *, Value *);
+
template<typename T> inline void
updateCallArgs(Instruction *i, void (Instruction::*setArg)(int, Value *),
T (Function::*proto));
{
}
+inline const Converter::Location *
+Converter::BindArgumentsPass::getValueLocation(Subroutine *s, Value *v)
+{
+ ValueMap::l_iterator it = s->values.l.find(v);
+ return it == s->values.l.end() ? NULL : &it->second;
+}
+
template<typename T> inline void
Converter::BindArgumentsPass::updateCallArgs(
Instruction *i, void (Instruction::*setArg)(int, Value *),
for (unsigned a = 0; a < (g->*proto).size(); ++a) {
Value *v = (g->*proto)[a].get();
- const Converter::Location &l = subg->values.l.find(v)->second;
+ const Converter::Location &l = *getValueLocation(subg, v);
Converter::DataArray *array = conv.getArrayForFile(l.array, l.arrayIdx);
(i->*setArg)(a, array->acquire(sub->values, l.i, l.c));
for (unsigned i = 0; i < set->getSize(); ++i) {
Value *v = func->getLValue(i);
+ const Converter::Location *l = getValueLocation(sub, v);
// only include values with a matching TGSI register
- if (set->test(i) && sub->values.l.find(v) != sub->values.l.end())
+ if (set->test(i) && l && !conv.code->locals.count(*l))
(func->*proto).push_back(v);
}
}