From 73239d40290df0ec140a4d026aaddabd9f3651cc Mon Sep 17 00:00:00 2001 From: M Henning Date: Sun, 16 Jul 2023 21:56:13 -0400 Subject: [PATCH] nouveau: Drop BuildUtil::DataArray Reviewed-by: Karol Herbst Part-of: --- src/nouveau/codegen/nv50_ir_build_util.cpp | 89 ------------------------------ src/nouveau/codegen/nv50_ir_build_util.h | 61 -------------------- src/nouveau/codegen/nv50_ir_util.h | 23 -------- 3 files changed, 173 deletions(-) diff --git a/src/nouveau/codegen/nv50_ir_build_util.cpp b/src/nouveau/codegen/nv50_ir_build_util.cpp index 3da4bd1..afbd8a2 100644 --- a/src/nouveau/codegen/nv50_ir_build_util.cpp +++ b/src/nouveau/codegen/nv50_ir_build_util.cpp @@ -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(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(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, diff --git a/src/nouveau/codegen/nv50_ir_build_util.h b/src/nouveau/codegen/nv50_ir_build_util.h index 5c3a01d..8f66b02 100644 --- a/src/nouveau/codegen/nv50_ir_build_util.h +++ b/src/nouveau/codegen/nv50_ir_build_util.h @@ -135,46 +135,6 @@ public: unsigned array, arrayIdx, i, c; }; - typedef bimap 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__ diff --git a/src/nouveau/codegen/nv50_ir_util.h b/src/nouveau/codegen/nv50_ir_util.h index aa88e35..8edd06e 100644 --- a/src/nouveau/codegen/nv50_ir_util.h +++ b/src/nouveau/codegen/nv50_ir_util.h @@ -764,29 +764,6 @@ protected: } }; -template -struct bimap -{ - std::map forth; - std::map back; - -public: - bimap() : l(back), r(forth) { } - bimap(const bimap &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::const_iterator l_iterator; - const std::map &l; - typedef typename std::map::const_iterator r_iterator; - const std::map &r; -}; - } // namespace nv50_ir #endif // __NV50_IR_UTIL_H__ -- 2.7.4