xref: /aosp_15_r20/external/mesa3d/src/gallium/drivers/r600/sfn/sfn_instrfactory.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /* -*- mesa-c++  -*-
2  * Copyright 2022 Collabora LTD
3  * Author: Gert Wollny <[email protected]>
4  * SPDX-License-Identifier: MIT
5  */
6 
7 #ifndef INSTRFACTORY_H
8 #define INSTRFACTORY_H
9 
10 #include "sfn_instr.h"
11 #include "sfn_valuefactory.h"
12 
13 #include <iosfwd>
14 
15 namespace r600 {
16 
17 class Shader;
18 class InstrFactory : public Allocate {
19 public:
20    InstrFactory();
21 
22    PInst from_string(const std::string& s, int nesting_depth, bool is_cayman);
23    bool from_nir(nir_instr *instr, Shader& shader);
value_factory()24    auto& value_factory() { return m_value_factory; }
25 
26 private:
27    bool load_const(nir_load_const_instr *lc, Shader& shader);
28    bool process_jump(nir_jump_instr *instr, Shader& shader);
29    bool process_undef(nir_undef_instr *undef, Shader& shader);
30 
31    Instr::Pointer export_from_string(std::istream& is, bool is_last);
32 
33    ValueFactory m_value_factory;
34    AluGroup *group;
35 };
36 
37 } // namespace r600
38 
39 #endif // INSTRFACTORY_H
40