summaryrefslogtreecommitdiff
path: root/backend/src/ir
diff options
context:
space:
mode:
Diffstat (limited to 'backend/src/ir')
-rw-r--r--backend/src/ir/instruction.cpp56
-rw-r--r--backend/src/ir/instruction.hpp14
-rw-r--r--backend/src/ir/instruction.hxx1
-rw-r--r--backend/src/ir/liveness.cpp1
4 files changed, 71 insertions, 1 deletions
diff --git a/backend/src/ir/instruction.cpp b/backend/src/ir/instruction.cpp
index 48590fd1..75e1eec4 100644
--- a/backend/src/ir/instruction.cpp
+++ b/backend/src/ir/instruction.cpp
@@ -682,6 +682,50 @@ namespace ir {
uint32_t dstNum;
};
+ class ALIGNED_INSTRUCTION ImeInstruction :
+ public BasePolicy,
+ public TupleSrcPolicy<ImeInstruction>,
+ public TupleDstPolicy<ImeInstruction>
+ {
+ public:
+ ImeInstruction(uint8_t imageIdx, Tuple dstTuple, Tuple srcTuple,
+ uint32_t dstNum, uint32_t srcNum, int msg_type) {
+ this->opcode = OP_IME;
+ this->dst = dstTuple;
+ this->src = srcTuple;
+ this->dstNum = dstNum;
+ this->srcNum = srcNum;
+ this->imageIdx = imageIdx;
+ this->msg_type = msg_type;
+ }
+ INLINE bool wellFormed(const Function &fn, std::string &why) const;
+ INLINE void out(std::ostream &out, const Function &fn) const {
+ this->outOpcode(out);
+ out << " src_surface id " << (int)this->getImageIndex()
+ << " ref_surface id " << (int)this->getImageIndex() + 1;
+ for(uint32_t i = 0; i < dstNum; i++){
+ out<< " %" << this->getDst(fn, i);
+ }
+ for(uint32_t i = 0; i < srcNum; i++){
+ out<< " %" << this->getSrc(fn, i);
+ }
+ out
+ << " msg_type " << (int)this->getMsgType();
+ }
+ Tuple src;
+ Tuple dst;
+
+ INLINE uint8_t getImageIndex(void) const { return this->imageIdx; }
+ INLINE uint8_t getMsgType(void) const { return this->msg_type; }
+
+ INLINE Type getSrcType(void) const { return TYPE_U32; }
+ INLINE Type getDstType(void) const { return TYPE_U32; }
+ uint8_t imageIdx;
+ uint8_t msg_type;
+ uint32_t srcNum;
+ uint32_t dstNum;
+ };
+
class ALIGNED_INSTRUCTION TypedWriteInstruction : // TODO
public BasePolicy,
@@ -1454,6 +1498,8 @@ namespace ir {
{ return true; }
INLINE bool VmeInstruction::wellFormed(const Function &fn, std::string &why) const
{ return true; }
+ INLINE bool ImeInstruction::wellFormed(const Function &fn, std::string &why) const
+ { return true; }
INLINE bool TypedWriteInstruction::wellFormed(const Function &fn, std::string &why) const
{ return true; }
INLINE bool GetImageInfoInstruction::wellFormed(const Function &fn, std::string &why) const
@@ -2182,6 +2228,9 @@ END_INTROSPECTION(WaitInstruction)
START_INTROSPECTION(VmeInstruction)
#include "ir/instruction.hxx"
END_INTROSPECTION(VmeInstruction)
+START_INTROSPECTION(ImeInstruction)
+#include "ir/instruction.hxx"
+END_INTROSPECTION(ImeInstruction)
START_INTROSPECTION(WorkGroupInstruction)
#include "ir/instruction.hxx"
@@ -2404,6 +2453,10 @@ DECL_MEM_FN(VmeInstruction, Type, getSrcType(void), getSrcType())
DECL_MEM_FN(VmeInstruction, Type, getDstType(void), getDstType())
DECL_MEM_FN(VmeInstruction, uint8_t, getImageIndex(void), getImageIndex())
DECL_MEM_FN(VmeInstruction, uint8_t, getMsgType(void), getMsgType())
+DECL_MEM_FN(ImeInstruction, Type, getSrcType(void), getSrcType())
+DECL_MEM_FN(ImeInstruction, Type, getDstType(void), getDstType())
+DECL_MEM_FN(ImeInstruction, uint8_t, getImageIndex(void), getImageIndex())
+DECL_MEM_FN(ImeInstruction, uint8_t, getMsgType(void), getMsgType())
DECL_MEM_FN(TypedWriteInstruction, Type, getSrcType(void), getSrcType())
DECL_MEM_FN(TypedWriteInstruction, Type, getCoordType(void), getCoordType())
DECL_MEM_FN(TypedWriteInstruction, uint8_t, getImageIndex(void), getImageIndex())
@@ -2709,6 +2762,9 @@ DECL_MEM_FN(MemInstruction, void, setBtiReg(Register reg), setBtiReg(reg))
Instruction VME(uint8_t imageIndex, Tuple dst, Tuple src, uint32_t dstNum, uint32_t srcNum, int msg_type, int vme_search_path_lut, int lut_sub) {
return internal::VmeInstruction(imageIndex, dst, src, dstNum, srcNum, msg_type, vme_search_path_lut, lut_sub).convert();
}
+ Instruction IME(uint8_t imageIndex, Tuple dst, Tuple src, uint32_t dstNum, uint32_t srcNum, int msg_type) {
+ return internal::ImeInstruction(imageIndex, dst, src, dstNum, srcNum, msg_type).convert();
+ }
Instruction TYPED_WRITE(uint8_t imageIndex, Tuple src, uint8_t srcNum, Type srcType, Type coordType) {
return internal::TypedWriteInstruction(imageIndex, src, srcNum, srcType, coordType).convert();
diff --git a/backend/src/ir/instruction.hpp b/backend/src/ir/instruction.hpp
index 05c3e649..ab8bc1f9 100644
--- a/backend/src/ir/instruction.hpp
+++ b/backend/src/ir/instruction.hpp
@@ -217,7 +217,8 @@ namespace ir {
return T::isClassOf(*this);
}
/*! max_src used by vme for payload passing and setting */
- static const uint32_t MAX_SRC_NUM = 40;
+ //static const uint32_t MAX_SRC_NUM = 48;
+ static const uint32_t MAX_SRC_NUM = 64;
static const uint32_t MAX_DST_NUM = 32;
DebugInfo DBGInfo;
protected:
@@ -429,6 +430,16 @@ namespace ir {
static bool isClassOf(const Instruction &insn);
};
+ class ImeInstruction : public Instruction {
+ public:
+ uint8_t getImageIndex() const;
+ uint8_t getMsgType() const;
+ Type getSrcType(void) const;
+ Type getDstType(void) const;
+ /*! Return true if the given instruction is an instance of this class */
+ static bool isClassOf(const Instruction &insn);
+ };
+
typedef union _ImageInfoKey{
_ImageInfoKey(uint8_t i, uint8_t t) : index(i), type(t) {};
_ImageInfoKey(int key) : data(key) {};
@@ -880,6 +891,7 @@ namespace ir {
Instruction SAMPLE(uint8_t imageIndex, Tuple dst, Tuple src, uint8_t srcNum, bool dstIsFloat, bool srcIsFloat, uint8_t sampler, uint8_t samplerOffset);
/*! video motion estimation */
Instruction VME(uint8_t imageIndex, Tuple dst, Tuple src, uint32_t dstNum, uint32_t srcNum, int msg_type, int vme_search_path_lut, int lut_sub);
+ Instruction IME(uint8_t imageIndex, Tuple dst, Tuple src, uint32_t dstNum, uint32_t srcNum, int msg_type);
/*! get image information , such as width/height/depth/... */
Instruction GET_IMAGE_INFO(int infoType, Register dst, uint8_t imageIndex, Register infoReg);
/*! label labelIndex */
diff --git a/backend/src/ir/instruction.hxx b/backend/src/ir/instruction.hxx
index 81618eb9..2054b9c2 100644
--- a/backend/src/ir/instruction.hxx
+++ b/backend/src/ir/instruction.hxx
@@ -86,6 +86,7 @@ DECL_INSN(LABEL, LabelInstruction)
DECL_INSN(READ_ARF, ReadARFInstruction)
DECL_INSN(REGION, RegionInstruction)
DECL_INSN(VME, VmeInstruction)
+DECL_INSN(IME, ImeInstruction)
DECL_INSN(INDIRECT_MOV, IndirectMovInstruction)
DECL_INSN(GET_IMAGE_INFO, GetImageInfoInstruction)
DECL_INSN(MUL_HI, BinaryInstruction)
diff --git a/backend/src/ir/liveness.cpp b/backend/src/ir/liveness.cpp
index dbb5c33f..1d385ee3 100644
--- a/backend/src/ir/liveness.cpp
+++ b/backend/src/ir/liveness.cpp
@@ -142,6 +142,7 @@ namespace ir {
opCode != ir::OP_RHADD &&
opCode != ir::OP_READ_ARF &&
opCode != ir::OP_ADDSAT &&
+ opCode != ir::OP_IME &&
(dstNum == 1 || insn.getOpcode() != ir::OP_LOAD) &&
!extentRegs->contains(reg)
)