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;
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 *);
}
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;
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;