aco: Const correctness for get_barrier_interaction.
authorTimur Kristóf <timur.kristof@gmail.com>
Wed, 18 Mar 2020 09:40:06 +0000 (10:40 +0100)
committerMarge Bot <eric+marge@anholt.net>
Fri, 24 Apr 2020 17:58:57 +0000 (17:58 +0000)
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4536>

src/amd/compiler/aco_ir.h
src/amd/compiler/aco_scheduler.cpp

index e8dbbf0534a1a4ba929299fde08b9aa3f1bce65a..7769355eab9a7d86165b22b5c070b72c33a03ce9 100644 (file)
@@ -1210,7 +1210,7 @@ static inline bool is_phi(aco_ptr<Instruction>& instr)
    return is_phi(instr.get());
 }
 
-barrier_interaction get_barrier_interaction(Instruction* instr);
+barrier_interaction get_barrier_interaction(const Instruction* instr);
 
 bool is_dead(const std::vector<uint16_t>& uses, Instruction *instr);
 
index d07b4e381ab78446b0802120cc2fbff87e205f8c..c1d4e9b3ce8a351d5442c82b85f10a71b7b52f8a 100644 (file)
@@ -338,40 +338,40 @@ bool can_reorder(Instruction* candidate)
    }
 }
 
-bool is_gs_or_done_sendmsg(Instruction *instr)
+bool is_gs_or_done_sendmsg(const Instruction *instr)
 {
    if (instr->opcode == aco_opcode::s_sendmsg) {
-      uint16_t imm = static_cast<SOPP_instruction*>(instr)->imm;
+      uint16_t imm = static_cast<const SOPP_instruction*>(instr)->imm;
       return (imm & sendmsg_id_mask) == _sendmsg_gs ||
              (imm & sendmsg_id_mask) == _sendmsg_gs_done;
    }
    return false;
 }
 
-bool is_done_sendmsg(Instruction *instr)
+bool is_done_sendmsg(const Instruction *instr)
 {
    if (instr->opcode == aco_opcode::s_sendmsg) {
-      uint16_t imm = static_cast<SOPP_instruction*>(instr)->imm;
+      uint16_t imm = static_cast<const SOPP_instruction*>(instr)->imm;
       return (imm & sendmsg_id_mask) == _sendmsg_gs_done;
    }
    return false;
 }
 
-barrier_interaction get_barrier_interaction(Instruction* instr)
+barrier_interaction get_barrier_interaction(const Instruction* instr)
 {
    switch (instr->format) {
    case Format::SMEM:
-      return static_cast<SMEM_instruction*>(instr)->barrier;
+      return static_cast<const SMEM_instruction*>(instr)->barrier;
    case Format::MUBUF:
-      return static_cast<MUBUF_instruction*>(instr)->barrier;
+      return static_cast<const MUBUF_instruction*>(instr)->barrier;
    case Format::MIMG:
-      return static_cast<MIMG_instruction*>(instr)->barrier;
+      return static_cast<const MIMG_instruction*>(instr)->barrier;
    case Format::MTBUF:
-      return static_cast<MTBUF_instruction*>(instr)->barrier;
+      return static_cast<const MTBUF_instruction*>(instr)->barrier;
    case Format::FLAT:
    case Format::GLOBAL:
    case Format::SCRATCH:
-      return static_cast<FLAT_instruction*>(instr)->barrier;
+      return static_cast<const FLAT_instruction*>(instr)->barrier;
    case Format::DS:
       return barrier_shared;
    case Format::SOPP: