nouveau: Drop BuildUtil::DataArray
Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24175>
This commit is contained in:
parent
51dfde7b96
commit
73239d4029
3 changed files with 0 additions and 173 deletions
|
|
@ -504,95 +504,6 @@ BuildUtil::mkTSVal(TSSemantic tsName)
|
|||
return sym;
|
||||
}
|
||||
|
||||
void
|
||||
BuildUtil::DataArray::setup(unsigned array, unsigned arrayIdx,
|
||||
uint32_t base, int len, int vecDim, int eltSize,
|
||||
DataFile file, int8_t fileIdx)
|
||||
{
|
||||
this->array = array;
|
||||
this->arrayIdx = arrayIdx;
|
||||
this->baseAddr = base;
|
||||
this->arrayLen = len;
|
||||
this->vecDim = vecDim;
|
||||
this->eltSize = eltSize;
|
||||
this->file = file;
|
||||
this->regOnly = !isMemoryFile(file);
|
||||
|
||||
if (!regOnly) {
|
||||
baseSym = new_Symbol(up->getProgram(), file, fileIdx);
|
||||
baseSym->setOffset(baseAddr);
|
||||
baseSym->reg.size = eltSize;
|
||||
} else {
|
||||
baseSym = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
Value *
|
||||
BuildUtil::DataArray::acquire(ValueMap &m, int i, int c)
|
||||
{
|
||||
if (regOnly) {
|
||||
Value *v = lookup(m, i, c);
|
||||
if (!v)
|
||||
v = insert(m, i, c, new_LValue(up->getFunction(), file));
|
||||
|
||||
return v;
|
||||
} else {
|
||||
return up->getScratch(eltSize);
|
||||
}
|
||||
}
|
||||
|
||||
Value *
|
||||
BuildUtil::DataArray::load(ValueMap &m, int i, int c, Value *ptr)
|
||||
{
|
||||
if (regOnly) {
|
||||
Value *v = lookup(m, i, c);
|
||||
if (!v)
|
||||
v = insert(m, i, c, new_LValue(up->getFunction(), file));
|
||||
|
||||
return v;
|
||||
} else {
|
||||
Value *sym = lookup(m, i, c);
|
||||
if (!sym)
|
||||
sym = insert(m, i, c, mkSymbol(i, c));
|
||||
|
||||
return up->mkLoadv(typeOfSize(eltSize), static_cast<Symbol *>(sym), ptr);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BuildUtil::DataArray::store(ValueMap &m, int i, int c, Value *ptr, Value *value)
|
||||
{
|
||||
if (regOnly) {
|
||||
assert(!ptr);
|
||||
if (!lookup(m, i, c))
|
||||
insert(m, i, c, value);
|
||||
|
||||
assert(lookup(m, i, c) == value);
|
||||
} else {
|
||||
Value *sym = lookup(m, i, c);
|
||||
if (!sym)
|
||||
sym = insert(m, i, c, mkSymbol(i, c));
|
||||
|
||||
const DataType stTy = typeOfSize(value->reg.size);
|
||||
|
||||
up->mkStore(OP_STORE, stTy, static_cast<Symbol *>(sym), ptr, value);
|
||||
}
|
||||
}
|
||||
|
||||
Symbol *
|
||||
BuildUtil::DataArray::mkSymbol(int i, int c)
|
||||
{
|
||||
const unsigned int idx = i * vecDim + c;
|
||||
Symbol *sym = new_Symbol(up->getProgram(), file, 0);
|
||||
|
||||
assert(baseSym || (idx < arrayLen && c < vecDim));
|
||||
|
||||
sym->reg.size = eltSize;
|
||||
sym->reg.type = typeOfSize(eltSize);
|
||||
sym->setAddress(baseSym, baseAddr + idx * eltSize);
|
||||
return sym;
|
||||
}
|
||||
|
||||
|
||||
Instruction *
|
||||
BuildUtil::split64BitOpPostRA(Function *fn, Instruction *i,
|
||||
|
|
|
|||
|
|
@ -135,46 +135,6 @@ public:
|
|||
unsigned array, arrayIdx, i, c;
|
||||
};
|
||||
|
||||
typedef bimap<Location, Value *> ValueMap;
|
||||
|
||||
class DataArray
|
||||
{
|
||||
public:
|
||||
DataArray(BuildUtil *bld) : up(bld), array(0), arrayIdx(0), baseAddr(0),
|
||||
arrayLen(0), baseSym(NULL), vecDim(0), eltSize(0), file(FILE_NULL),
|
||||
regOnly(false) { }
|
||||
|
||||
void setup(unsigned array, unsigned arrayIdx,
|
||||
uint32_t base, int len, int vecDim, int eltSize,
|
||||
DataFile file, int8_t fileIdx);
|
||||
|
||||
inline bool exists(ValueMap&, unsigned int i, unsigned int c);
|
||||
|
||||
Value *load(ValueMap&, int i, int c, Value *ptr);
|
||||
void store(ValueMap&, int i, int c, Value *ptr, Value *value);
|
||||
Value *acquire(ValueMap&, int i, int c);
|
||||
|
||||
private:
|
||||
inline Value *lookup(ValueMap&, unsigned i, unsigned c);
|
||||
inline Value *insert(ValueMap&, unsigned i, unsigned c, Value *v);
|
||||
|
||||
Symbol *mkSymbol(int i, int c);
|
||||
|
||||
private:
|
||||
BuildUtil *up;
|
||||
unsigned array, arrayIdx;
|
||||
|
||||
uint32_t baseAddr;
|
||||
uint32_t arrayLen;
|
||||
Symbol *baseSym;
|
||||
|
||||
uint8_t vecDim;
|
||||
uint8_t eltSize; // in bytes
|
||||
|
||||
DataFile file;
|
||||
bool regOnly;
|
||||
};
|
||||
|
||||
Symbol *mkSymbol(DataFile file, int8_t fileIndex,
|
||||
DataType ty, uint32_t baseAddress);
|
||||
|
||||
|
|
@ -312,27 +272,6 @@ BuildUtil::mkBMov(Value *dst, Value *src)
|
|||
return mkCvt(OP_CVT, TYPE_U32, dst, TYPE_U32, src);
|
||||
}
|
||||
|
||||
bool
|
||||
BuildUtil::DataArray::exists(ValueMap &m, unsigned int i, unsigned int c)
|
||||
{
|
||||
assert(i < arrayLen && c < vecDim);
|
||||
return !regOnly || m.r.count(Location(array, arrayIdx, i, c));
|
||||
}
|
||||
|
||||
Value *
|
||||
BuildUtil::DataArray::lookup(ValueMap &m, unsigned i, unsigned c)
|
||||
{
|
||||
ValueMap::r_iterator it = m.r.find(Location(array, arrayIdx, i, c));
|
||||
return it != m.r.end() ? it->second : NULL;
|
||||
}
|
||||
|
||||
Value *
|
||||
BuildUtil::DataArray::insert(ValueMap &m, unsigned i, unsigned c, Value *v)
|
||||
{
|
||||
m.insert(Location(array, arrayIdx, i, c), v);
|
||||
return v;
|
||||
}
|
||||
|
||||
} // namespace nv50_ir
|
||||
|
||||
#endif // __NV50_IR_BUILD_UTIL_H__
|
||||
|
|
|
|||
|
|
@ -764,29 +764,6 @@ protected:
|
|||
}
|
||||
};
|
||||
|
||||
template<typename S, typename T>
|
||||
struct bimap
|
||||
{
|
||||
std::map<S, T> forth;
|
||||
std::map<T, S> back;
|
||||
|
||||
public:
|
||||
bimap() : l(back), r(forth) { }
|
||||
bimap(const bimap<S, T> &m)
|
||||
: forth(m.forth), back(m.back), l(back), r(forth) { }
|
||||
|
||||
void insert(const S &s, const T &t)
|
||||
{
|
||||
forth.insert(std::make_pair(s, t));
|
||||
back.insert(std::make_pair(t, s));
|
||||
}
|
||||
|
||||
typedef typename std::map<T, S>::const_iterator l_iterator;
|
||||
const std::map<T, S> &l;
|
||||
typedef typename std::map<S, T>::const_iterator r_iterator;
|
||||
const std::map<S, T> &r;
|
||||
};
|
||||
|
||||
} // namespace nv50_ir
|
||||
|
||||
#endif // __NV50_IR_UTIL_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue