From c82714c593ac38ea87e061b92d10b34853784723 Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Fri, 18 May 2012 16:17:44 +0200 Subject: [PATCH] nv50/ir: Rename "mkLoad" to "mkLoadv" for consistency. --- .../drivers/nv50/codegen/nv50_ir_build_util.cpp | 11 +++++------ .../drivers/nv50/codegen/nv50_ir_build_util.h | 12 +++++++++++- .../drivers/nv50/codegen/nv50_ir_from_tgsi.cpp | 6 +++--- .../drivers/nvc0/codegen/nv50_ir_lowering_nvc0.cpp | 4 ++-- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_build_util.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_build_util.cpp index 322d6b9d34b..4448e8299d2 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir_build_util.cpp +++ b/src/gallium/drivers/nv50/codegen/nv50_ir_build_util.cpp @@ -103,19 +103,18 @@ BuildUtil::mkOp3(operation op, DataType ty, Value *dst, return insn; } -LValue * -BuildUtil::mkLoad(DataType ty, Symbol *mem, Value *ptr) +Instruction * +BuildUtil::mkLoad(DataType ty, Value *dst, Symbol *mem, Value *ptr) { Instruction *insn = new_Instruction(func, OP_LOAD, ty); - LValue *def = getScratch(); - insn->setDef(0, def); + insn->setDef(0, dst); insn->setSrc(0, mem); if (ptr) insn->setIndirect(0, 0, ptr); insert(insn); - return def; + return insn; } Instruction * @@ -502,7 +501,7 @@ BuildUtil::DataArray::load(ValueMap &m, int i, int c, Value *ptr) if (!sym) sym = insert(m, i, c, mkSymbol(i, c)); - return up->mkLoad(typeOfSize(eltSize), static_cast(sym), ptr); + return up->mkLoadv(typeOfSize(eltSize), static_cast(sym), ptr); } } diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_build_util.h b/src/gallium/drivers/nv50/codegen/nv50_ir_build_util.h index dd7e491cb5c..963c3505083 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir_build_util.h +++ b/src/gallium/drivers/nv50/codegen/nv50_ir_build_util.h @@ -58,9 +58,11 @@ public: LValue *mkOp2v(operation, DataType, Value *, Value *, Value *); LValue *mkOp3v(operation, DataType, Value *, Value *, Value *, Value *); - LValue *mkLoad(DataType, Symbol *, Value *ptr); + Instruction *mkLoad(DataType, Value *dst, Symbol *, Value *ptr); Instruction *mkStore(operation, DataType, Symbol *, Value *ptr, Value *val); + LValue *mkLoadv(DataType, Symbol *, Value *ptr); + Instruction *mkMov(Value *, Value *, DataType = TYPE_U32); Instruction *mkMovToReg(int id, Value *); Instruction *mkMovFromReg(Value *, int id); @@ -282,6 +284,14 @@ BuildUtil::mkOp3v(operation op, DataType ty, Value *dst, return dst->asLValue(); } +inline LValue * +BuildUtil::mkLoadv(DataType ty, Symbol *mem, Value *ptr) +{ + LValue *dst = getScratch(); + mkLoad(ty, dst, mem, ptr); + return dst; +} + bool BuildUtil::DataArray::exists(ValueMap &m, unsigned int i, unsigned int c) { diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp index 954dfd47adb..32915174e01 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp +++ b/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp @@ -1346,7 +1346,7 @@ Converter::fetchSrc(tgsi::Instruction::SrcRegister src, int c, Value *ptr) assert(!ptr); return loadImm(NULL, info->immd.data[idx * 4 + swz]); case TGSI_FILE_CONSTANT: - return mkLoad(TYPE_U32, srcToSym(src, c), ptr); + return mkLoadv(TYPE_U32, srcToSym(src, c), ptr); case TGSI_FILE_INPUT: if (prog->getType() == Program::TYPE_FRAGMENT) { // don't load masked inputs, won't be assigned a slot @@ -1356,7 +1356,7 @@ Converter::fetchSrc(tgsi::Instruction::SrcRegister src, int c, Value *ptr) return mkOp1v(OP_RDSV, TYPE_F32, getSSA(), mkSysVal(SV_FACE, 0)); return interpolate(src, c, ptr); } - return mkLoad(TYPE_U32, srcToSym(src, c), ptr); + return mkLoadv(TYPE_U32, srcToSym(src, c), ptr); case TGSI_FILE_OUTPUT: assert(!"load from output file"); return NULL; @@ -2287,7 +2287,7 @@ Converter::handleUserClipPlanes() for (i = 0; i < info->io.genUserClip; ++i) { Symbol *sym = mkSymbol(FILE_MEMORY_CONST, info->io.ucpBinding, TYPE_F32, info->io.ucpBase + i * 16 + c * 4); - Value *ucp = mkLoad(TYPE_F32, sym, NULL); + Value *ucp = mkLoadv(TYPE_F32, sym, NULL); if (c == 0) res[i] = mkOp2v(OP_MUL, TYPE_F32, getScratch(), clipVtx[c], ucp); else diff --git a/src/gallium/drivers/nvc0/codegen/nv50_ir_lowering_nvc0.cpp b/src/gallium/drivers/nvc0/codegen/nv50_ir_lowering_nvc0.cpp index c5a7772ed9f..9cea061d06b 100644 --- a/src/gallium/drivers/nvc0/codegen/nv50_ir_lowering_nvc0.cpp +++ b/src/gallium/drivers/nvc0/codegen/nv50_ir_lowering_nvc0.cpp @@ -673,7 +673,7 @@ NVC0LoweringPass::handleTEX(TexInstruction *i) tmp[0] = bld.getScratch(); bind = bld.mkSymbol(FILE_MEMORY_CONST, 15, TYPE_U32, i->tex.r * 4); bld.mkOp2(OP_SHL, TYPE_U32, tmp[0], rRel, shCnt); - tmp[1] = bld.mkLoad(TYPE_U32, bind, tmp[0]); + tmp[1] = bld.mkLoadv(TYPE_U32, bind, tmp[0]); bld.mkOp2(OP_AND, TYPE_U32, tmp[0], tmp[1], bld.loadImm(tmp[0], 0x00ffffffu)); rRel = tmp[0]; @@ -683,7 +683,7 @@ NVC0LoweringPass::handleTEX(TexInstruction *i) tmp[0] = bld.getScratch(); bind = bld.mkSymbol(FILE_MEMORY_CONST, 15, TYPE_U32, i->tex.s * 4); bld.mkOp2(OP_SHL, TYPE_U32, tmp[0], sRel, shCnt); - tmp[1] = bld.mkLoad(TYPE_U32, bind, tmp[0]); + tmp[1] = bld.mkLoadv(TYPE_U32, bind, tmp[0]); bld.mkOp2(OP_AND, TYPE_U32, tmp[0], tmp[1], bld.loadImm(tmp[0], 0xff000000u)); sRel = tmp[0]; -- 2.30.2