1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
/* -*- mesa-c++ -*-
*
* Copyright (c) 2019 Collabora LTD
*
* Author: Gert Wollny <gert.wollny@collabora.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* on the rights to use, copy, modify, merge, publish, distribute, sub
* license, and/or sell copies of the Software, and to permit persons to whom
* the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef SFN_EXPORTINSTRUCTION_H
#define SFN_EXPORTINSTRUCTION_H
#include "sfn_instruction_base.h"
namespace r600 {
class WriteoutInstruction: public Instruction {
public:
void replace_values(const ValueSet& candiates, PValue new_value) override;
const GPRVector& gpr() const {return m_value;}
const GPRVector *gpr_ptr() const {return &m_value;}
protected:
WriteoutInstruction(instr_type t, const GPRVector& value);
private:
virtual void replace_values_child(const ValueSet& candiates, PValue new_value);
virtual void remap_registers_child(std::vector<rename_reg_pair>& map,
ValueMap& values);
GPRVector m_value;
};
class ExportInstruction : public WriteoutInstruction {
public:
enum ExportType {
et_pixel,
et_pos,
et_param
};
ExportInstruction(unsigned loc, const GPRVector& value, ExportType type);
void set_last();
ExportType export_type() const {return m_type;}
unsigned location() const {return m_loc;}
bool is_last_export() const {return m_is_last;}
void update_output_map(OutputRegisterMap& map) const;
private:
bool is_equal_to(const Instruction& lhs) const override;
void do_print(std::ostream& os) const override;
ExportType m_type;
unsigned m_loc;
bool m_is_last;
};
class WriteScratchInstruction : public WriteoutInstruction {
public:
WriteScratchInstruction(unsigned loc, const GPRVector& value, int align,
int align_offset, int writemask);
WriteScratchInstruction(const PValue& address, const GPRVector& value,
int align, int align_offset, int writemask, int array_size);
unsigned location() const {return m_loc;}
int write_mask() const { return m_writemask;}
int address() const { assert(m_address); return m_address->sel();}
bool indirect() const { return !!m_address;}
int array_size() const { return m_array_size;}
private:
bool is_equal_to(const Instruction& lhs) const override;
void do_print(std::ostream& os) const override;
void replace_values_child(const ValueSet& candiates, PValue new_value) override;
void remap_registers_child(std::vector<rename_reg_pair>& map,
ValueMap& values)override;
unsigned m_loc;
PValue m_address;
unsigned m_align;
unsigned m_align_offset;
unsigned m_writemask;
int m_array_size;
};
class StreamOutIntruction: public WriteoutInstruction {
public:
StreamOutIntruction(const GPRVector& value, int num_components,
int array_base, int comp_mask, int out_buffer,
int stream);
int element_size() const { return m_element_size;}
int burst_count() const { return m_burst_count;}
int array_base() const { return m_array_base;}
int array_size() const { return m_array_size;}
int comp_mask() const { return m_writemask;}
unsigned op() const;
private:
bool is_equal_to(const Instruction& lhs) const override;
void do_print(std::ostream& os) const override;
int m_element_size;
int m_burst_count;
int m_array_base;
int m_array_size;
int m_writemask;
int m_output_buffer;
int m_stream;
};
enum EMemWriteType {
mem_write = 0,
mem_write_ind = 1,
mem_write_ack = 2,
mem_write_ind_ack = 3,
};
class MemRingOutIntruction: public WriteoutInstruction {
public:
MemRingOutIntruction(ECFOpCode ring, EMemWriteType type,
const GPRVector& value, unsigned base_addr,
unsigned ncomp, PValue m_index);
unsigned op() const{return m_ring_op;}
unsigned ncomp() const;
unsigned addr() const {return m_base_address;}
EMemWriteType type() const {return m_type;}
unsigned index_reg() const {return m_index->sel();}
unsigned array_base() const {return m_base_address; }
void replace_values_child(const ValueSet& candiates, PValue new_value) override;
void remap_registers_child(std::vector<rename_reg_pair>& map,
ValueMap& values) override;
private:
bool is_equal_to(const Instruction& lhs) const override;
void do_print(std::ostream& os) const override;
ECFOpCode m_ring_op;
EMemWriteType m_type;
unsigned m_base_address;
unsigned m_num_comp;
PValue m_index;
};
}
#endif // SFN_EXPORTINSTRUCTION_H
|