diff options
author | Christoph Bumiller <[email protected]> | 2012-03-28 23:50:32 +0200 |
---|---|---|
committer | Christoph Bumiller <[email protected]> | 2012-04-14 21:54:00 +0200 |
commit | 56cf2da02226aee6b7476675c0e05ac7c218756e (patch) | |
tree | f253cd112870b2c6219b7568f8a786402cd1c77a | |
parent | 286abcb51ec2c27970e901ed815a814b3f0bebf6 (diff) |
nv50/ir: add setFlagsDef/Src helper
Will be used by nv50 target.
4 files changed, 29 insertions, 3 deletions
diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir.h b/src/gallium/drivers/nv50/codegen/nv50_ir.h index 04ea5e6d5a9..eb9f0ff7e3b 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir.h +++ b/src/gallium/drivers/nv50/codegen/nv50_ir.h @@ -637,6 +637,9 @@ public: inline Value *getPredicate() const; bool writesPredicate() const; + inline void setFlagsSrc(int s, Value *); + inline void setFlagsDef(int d, Value *); + unsigned int defCount(unsigned int mask) const; unsigned int srcCount(unsigned int mask) const; 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 53a73b457f4..bdde9eaa904 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir_build_util.cpp +++ b/src/gallium/drivers/nv50/codegen/nv50_ir_build_util.cpp @@ -221,6 +221,9 @@ BuildUtil::mkCmp(operation op, CondCode cc, DataType ty, Value *dst, if (src2) insn->setSrc(2, src2); + if (dst->reg.file == FILE_FLAGS) + insn->flagsDef = 0; + insert(insn); return insn; } 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 0bb853a340b..f815cf06759 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir_build_util.h +++ b/src/gallium/drivers/nv50/codegen/nv50_ir_build_util.h @@ -44,7 +44,7 @@ public: inline void insert(Instruction *); inline void remove(Instruction *i) { assert(i->bb == bb); bb->remove(i); } - inline LValue *getScratch(int size = 4); + inline LValue *getScratch(int size = 4, DataFile = FILE_GPR); inline LValue *getSSA(int size = 4); // scratch value for a single assignment inline Instruction *mkOp(operation, DataType, Value *); @@ -186,9 +186,9 @@ BuildUtil::setPosition(Instruction *i, bool after) } LValue * -BuildUtil::getScratch(int size) +BuildUtil::getScratch(int size, DataFile f) { - LValue *lval = new_LValue(func, FILE_GPR); + LValue *lval = new_LValue(func, f); if (size != 4) lval->reg.size = size; return lval; diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_inlines.h b/src/gallium/drivers/nv50/codegen/nv50_ir_inlines.h index 0352cafb1ca..6d0848e6e07 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir_inlines.h +++ b/src/gallium/drivers/nv50/codegen/nv50_ir_inlines.h @@ -215,6 +215,26 @@ Value *Instruction::getPredicate() const return (predSrc >= 0) ? getSrc(predSrc) : NULL; } +void Instruction::setFlagsDef(int d, Value *val) +{ + if (val) { + if (flagsDef < 0) + flagsDef = d; + setDef(flagsDef, val); + } else { + if (flagsDef >= 0) { + setDef(flagsDef, NULL); + flagsDef = -1; + } + } +} + +void Instruction::setFlagsSrc(int s, Value *val) +{ + flagsSrc = s; + setSrc(flagsSrc, val); +} + Value *TexInstruction::getIndirectR() const { return tex.rIndirectSrc >= 0 ? getSrc(tex.rIndirectSrc) : NULL; |