r600/sfn: Rework get_temp_register to return a smart pointer to GPRValue
authorGert Wollny <gert.wollny@collabora.com>
Tue, 6 Oct 2020 17:50:52 +0000 (19:50 +0200)
committerMarge Bot <eric+marge@anholt.net>
Fri, 16 Oct 2020 12:03:12 +0000 (12:03 +0000)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7142>

src/gallium/drivers/r600/sfn/sfn_emitinstruction.cpp
src/gallium/drivers/r600/sfn/sfn_emitinstruction.h
src/gallium/drivers/r600/sfn/sfn_emitssboinstruction.h
src/gallium/drivers/r600/sfn/sfn_value_gpr.h
src/gallium/drivers/r600/sfn/sfn_valuepool.cpp
src/gallium/drivers/r600/sfn/sfn_valuepool.h

index 37e31c2..42162ca 100644 (file)
@@ -124,7 +124,7 @@ int EmitInstruction::lookup_register_index(const nir_dest& dst)
    return m_proc.lookup_register_index(dst);
 }
 
-PValue EmitInstruction::get_temp_register(int channel)
+PGPRValue EmitInstruction::get_temp_register(int channel)
 {
    return m_proc.get_temp_register(channel);
 }
index 6662f43..bc6e3be 100644 (file)
@@ -65,7 +65,7 @@ protected:
 
    int allocate_temp_register();
 
-   PValue get_temp_register(int channel = -1);
+   PGPRValue get_temp_register(int channel = -1);
    GPRVector get_temp_vec4();
 
    // forwards from ShaderFromNirProcessor
index 4c742d0..f289c5d 100644 (file)
@@ -3,6 +3,7 @@
 
 #include "sfn_emitinstruction.h"
 #include "sfn_instruction_gds.h"
+#include "sfn_value_gpr.h"
 
 namespace r600 {
 
@@ -41,7 +42,7 @@ private:
 
    GPRVector make_dest(const nir_intrinsic_instr* instr);
 
-   PValue m_atomic_update;
+   PGPRValue m_atomic_update;
 
    bool m_require_rat_return_address;
    GPRVector m_rat_return_address;
index 1ab4940..671ca8d 100644 (file)
@@ -70,6 +70,8 @@ private:
    bool m_keep_alive;
 };
 
+using PGPRValue = std::shared_ptr<GPRValue>;
+
 class GPRVector : public Value {
 public:
    using Swizzle = std::array<uint32_t,4>;
index bda3c27..a790f18 100644 (file)
@@ -146,7 +146,7 @@ PValue ValuePool::from_nir(const nir_alu_src &v, unsigned component)
    return from_nir(v.src, component, v.swizzle[component]);
 }
 
-PValue ValuePool::get_temp_register(int channel)
+PGPRValue ValuePool::get_temp_register(int channel)
 {
    /* Skip to next register to get the channel we want */
    if (channel >= 0) {
@@ -160,7 +160,7 @@ PValue ValuePool::get_temp_register(int channel)
       current_temp_reg_index = allocate_temp_register();
       next_temp_reg_comp = 0;
    }
-   return PValue(new GPRValue(current_temp_reg_index, next_temp_reg_comp++));
+   return std::make_shared<GPRValue>(current_temp_reg_index, next_temp_reg_comp++);
 }
 
 GPRVector ValuePool::get_temp_vec4()
index 11fdf62..f61f697 100644 (file)
@@ -176,7 +176,7 @@ public:
 
    PValue literal(uint32_t value);
 
-   PValue get_temp_register(int channel = -1);
+   PGPRValue get_temp_register(int channel = -1);
 
    GPRVector get_temp_vec4();