1 #ifndef LDSINSTRUCTION_H 2 #define LDSINSTRUCTION_H 3 4 #include "sfn_instruction_base.h" 5 6 namespace r600 { 7 8 class LDSReadInstruction : public Instruction { 9 public: 10 LDSReadInstruction(std::vector<PValue>& value, std::vector<PValue>& address); 11 void replace_values(const ValueSet& candidates, PValue new_value) override; 12 num_values()13 unsigned num_values() const { return m_dest_value.size();} address(unsigned i)14 const Value& address(unsigned i) const { return *m_address[i];} dest(unsigned i)15 const Value& dest(unsigned i) const { return *m_dest_value[i];} 16 accept(InstructionVisitor & visitor)17 bool accept(InstructionVisitor& visitor) override {return visitor.visit(*this);} accept(ConstInstructionVisitor & visitor)18 bool accept(ConstInstructionVisitor& visitor) const override {return visitor.visit(*this);} 19 20 private: 21 void do_print(std::ostream& os) const override; 22 bool is_equal_to(const Instruction& lhs) const override; 23 24 std::vector<PValue> m_address; 25 std::vector<PValue> m_dest_value; 26 }; 27 28 class LDSAtomicInstruction : public Instruction { 29 public: 30 LDSAtomicInstruction(PValue& dest, PValue& src0, PValue src1, PValue& address, unsigned op); 31 LDSAtomicInstruction(PValue& dest, PValue& src0, PValue& address, unsigned op); 32 address()33 const Value& address() const { return *m_address;} dest()34 const Value& dest() const { return *m_dest_value;} src0()35 const Value& src0() const { return *m_src0_value;} src1()36 const PValue& src1() const { return m_src1_value;} op()37 unsigned op() const {return m_opcode;} 38 accept(InstructionVisitor & visitor)39 bool accept(InstructionVisitor& visitor) override {return visitor.visit(*this);} accept(ConstInstructionVisitor & visitor)40 bool accept(ConstInstructionVisitor& visitor) const override {return visitor.visit(*this);} 41 42 private: 43 void do_print(std::ostream& os) const override; 44 bool is_equal_to(const Instruction& lhs) const override; 45 46 PValue m_address; 47 PValue m_dest_value; 48 PValue m_src0_value; 49 PValue m_src1_value; 50 unsigned m_opcode; 51 }; 52 53 class LDSWriteInstruction : public Instruction { 54 public: 55 LDSWriteInstruction(PValue address, unsigned idx_offset, PValue value0); 56 LDSWriteInstruction(PValue address, unsigned idx_offset, PValue value0, PValue value1); 57 address()58 const Value& address() const {return *m_address;}; value0()59 const Value& value0() const { return *m_value0;} value1()60 const Value& value1() const { return *m_value1;} num_components()61 unsigned num_components() const { return m_value1 ? 2 : 1;} idx_offset()62 unsigned idx_offset() const {return m_idx_offset;}; 63 64 void replace_values(const ValueSet& candidates, PValue new_value) override; 65 accept(InstructionVisitor & visitor)66 bool accept(InstructionVisitor& visitor) override {return visitor.visit(*this);} accept(ConstInstructionVisitor & visitor)67 bool accept(ConstInstructionVisitor& visitor) const override {return visitor.visit(*this);} 68 69 private: 70 void do_print(std::ostream& os) const override; 71 bool is_equal_to(const Instruction& lhs) const override; 72 73 PValue m_address; 74 PValue m_value0; 75 PValue m_value1; 76 unsigned m_idx_offset; 77 78 }; 79 80 } 81 82 #endif // LDSINSTRUCTION_H 83