• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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& candiates, 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 private:
17    void do_print(std::ostream& os) const override;
18    bool is_equal_to(const Instruction& lhs) const override;
19 
20    std::vector<PValue> m_address;
21    std::vector<PValue> m_dest_value;
22 };
23 
24 class LDSAtomicInstruction : public Instruction {
25 public:
26    LDSAtomicInstruction(PValue& dest, PValue& src0, PValue src1, PValue& address, unsigned op);
27    LDSAtomicInstruction(PValue& dest, PValue& src0, PValue& address, unsigned op);
28 
address()29    const Value& address() const { return *m_address;}
dest()30    const Value& dest() const { return *m_dest_value;}
src0()31    const Value& src0() const { return *m_src0_value;}
src1()32    const PValue& src1() const { return m_src1_value;}
op()33    unsigned op() const {return m_opcode;}
34 
35 private:
36    void do_print(std::ostream& os) const override;
37    bool is_equal_to(const Instruction& lhs) const override;
38 
39    PValue m_address;
40    PValue m_dest_value;
41    PValue m_src0_value;
42    PValue m_src1_value;
43    unsigned m_opcode;
44 };
45 
46 class LDSWriteInstruction : public Instruction {
47 public:
48    LDSWriteInstruction(PValue address, unsigned idx_offset, PValue value0);
49    LDSWriteInstruction(PValue address, unsigned idx_offset, PValue value0, PValue value1);
50 
address()51    const Value& address() const {return *m_address;};
value0()52    const Value& value0() const { return *m_value0;}
value1()53    const Value& value1() const { return *m_value1;}
num_components()54    unsigned num_components() const { return m_value1 ? 2 : 1;}
idx_offset()55    unsigned idx_offset() const {return m_idx_offset;};
56 
57    void replace_values(const ValueSet& candiates, PValue new_value) override;
58 
59 private:
60    void do_print(std::ostream& os) const override;
61    bool is_equal_to(const Instruction& lhs) const override;
62 
63    PValue m_address;
64    PValue m_value0;
65    PValue m_value1;
66    unsigned m_idx_offset;
67 
68 };
69 
70 }
71 
72 #endif // LDSINSTRUCTION_H
73