diff --git a/decompiler/IR/BasicOpBuilder.cpp b/decompiler/IR/BasicOpBuilder.cpp index 273c4facd6..6027a434c9 100644 --- a/decompiler/IR/BasicOpBuilder.cpp +++ b/decompiler/IR/BasicOpBuilder.cpp @@ -1009,7 +1009,7 @@ std::shared_ptr try_sw(Instruction& instr, int idx) { return op; } else if (instr.kind == InstructionKind::SW && instr.get_src(1).is_imm()) { if (instr.get_src(1).get_imm() == 0) { - auto op = std::make_shared(IR_Store_Atomic::INTEGER, + auto op = std::make_shared(IR_Store_Atomic::Kind::INTEGER, make_reg(instr.get_src(2).get_reg(), idx), make_reg(instr.get_src(0).get_reg(), idx), 4); op->update_reginfo_self(0, 2, 0); @@ -1027,7 +1027,7 @@ std::shared_ptr try_sw(Instruction& instr, int idx) { return op; } else { auto op = std::make_shared( - IR_Store_Atomic::INTEGER, + IR_Store_Atomic::Kind::INTEGER, std::make_shared( IR_IntMath2::ADD, make_reg(instr.get_src(2).get_reg(), idx), std::make_shared(instr.get_src(1).get_imm())), @@ -1044,13 +1044,13 @@ std::shared_ptr try_sb(Instruction& instr, int idx) { if (instr.kind == InstructionKind::SB && instr.get_src(1).is_imm()) { if (instr.get_src(1).get_imm() == 0) { if (instr.get_src(0).is_reg(make_gpr(Reg::R0))) { - auto op = std::make_shared(IR_Store_Atomic::INTEGER, + auto op = std::make_shared(IR_Store_Atomic::Kind::INTEGER, make_reg(instr.get_src(2).get_reg(), idx), std::make_shared(0), 1); op->update_reginfo_self(0, 1, 0); return op; } else { - auto op = std::make_shared(IR_Store_Atomic::INTEGER, + auto op = std::make_shared(IR_Store_Atomic::Kind::INTEGER, make_reg(instr.get_src(2).get_reg(), idx), make_reg(instr.get_src(0).get_reg(), idx), 1); op->update_reginfo_self(0, 2, 0); @@ -1060,7 +1060,7 @@ std::shared_ptr try_sb(Instruction& instr, int idx) { } else { if (instr.get_src(0).is_reg(make_gpr(Reg::R0))) { auto op = std::make_shared( - IR_Store_Atomic::INTEGER, + IR_Store_Atomic::Kind::INTEGER, std::make_shared( IR_IntMath2::ADD, make_reg(instr.get_src(2).get_reg(), idx), std::make_shared(instr.get_src(1).get_imm())), @@ -1069,7 +1069,7 @@ std::shared_ptr try_sb(Instruction& instr, int idx) { return op; } else { auto op = std::make_shared( - IR_Store_Atomic::INTEGER, + IR_Store_Atomic::Kind::INTEGER, std::make_shared( IR_IntMath2::ADD, make_reg(instr.get_src(2).get_reg(), idx), std::make_shared(instr.get_src(1).get_imm())), @@ -1085,7 +1085,7 @@ std::shared_ptr try_sb(Instruction& instr, int idx) { std::shared_ptr try_sh(Instruction& instr, int idx) { if (instr.kind == InstructionKind::SH && instr.get_src(1).is_imm()) { auto op = std::make_shared( - IR_Store_Atomic::INTEGER, + IR_Store_Atomic::Kind::INTEGER, std::make_shared( IR_IntMath2::ADD, make_reg(instr.get_src(2).get_reg(), idx), std::make_shared(instr.get_src(1).get_imm())), @@ -1099,7 +1099,7 @@ std::shared_ptr try_sh(Instruction& instr, int idx) { std::shared_ptr try_sd(Instruction& instr, int idx) { if (instr.kind == InstructionKind::SD && instr.get_src(1).is_imm()) { auto op = std::make_shared( - IR_Store_Atomic::INTEGER, + IR_Store_Atomic::Kind::INTEGER, std::make_shared( IR_IntMath2::ADD, make_reg(instr.get_src(2).get_reg(), idx), std::make_shared(instr.get_src(1).get_imm())), @@ -1113,7 +1113,7 @@ std::shared_ptr try_sd(Instruction& instr, int idx) { std::shared_ptr try_sq(Instruction& instr, int idx) { if (instr.kind == InstructionKind::SQ && instr.get_src(1).is_imm()) { auto op = std::make_shared( - IR_Store_Atomic::INTEGER, + IR_Store_Atomic::Kind::INTEGER, std::make_shared( IR_IntMath2::ADD, make_reg(instr.get_src(2).get_reg(), idx), std::make_shared(instr.get_src(1).get_imm())), @@ -1127,7 +1127,7 @@ std::shared_ptr try_sq(Instruction& instr, int idx) { std::shared_ptr try_swc1(Instruction& instr, int idx) { if (instr.kind == InstructionKind::SWC1 && instr.get_src(1).is_imm()) { auto op = std::make_shared( - IR_Store_Atomic::FLOAT, + IR_Store_Atomic::Kind::FLOAT, std::make_shared( IR_IntMath2::ADD, make_reg(instr.get_src(2).get_reg(), idx), std::make_shared(instr.get_src(1).get_imm())), diff --git a/decompiler/IR/IR.cpp b/decompiler/IR/IR.cpp index 8c4edd2688..5c6bb28ce7 100644 --- a/decompiler/IR/IR.cpp +++ b/decompiler/IR/IR.cpp @@ -275,10 +275,10 @@ void IR_Set_Atomic::update_reginfo_regreg() { goos::Object IR_Store::to_form(const LinkedObjectFile& file) const { std::string store_operator; switch (kind) { - case FLOAT: + case Kind::FLOAT: store_operator = "s.f"; break; - case INTEGER: + case Kind::INTEGER: switch (size) { case 1: store_operator = "s.b"; @@ -310,10 +310,10 @@ goos::Object IR_Store::to_form(const LinkedObjectFile& file) const { goos::Object IR_Store_Atomic::to_form(const LinkedObjectFile& file) const { std::string store_operator; switch (kind) { - case FLOAT: + case Kind::FLOAT: store_operator = "s.f"; break; - case INTEGER: + case Kind::INTEGER: switch (size) { case 1: store_operator = "s.b"; diff --git a/decompiler/IR/IR.h b/decompiler/IR/IR.h index 3c9198d1d5..5d71448d57 100644 --- a/decompiler/IR/IR.h +++ b/decompiler/IR/IR.h @@ -139,7 +139,7 @@ void IR_Set_Atomic::update_reginfo_self(int n_dest, int n_src, int class IR_Store : public virtual IR_Set { public: - enum Kind { INTEGER, FLOAT } kind; + enum class Kind { INTEGER, FLOAT } kind; IR_Store(Kind _kind, std::shared_ptr _dst, std::shared_ptr _src, int _size) : IR_Set(IR_Set::STORE, std::move(_dst), std::move(_src)), kind(_kind), size(_size) {} int size; @@ -152,7 +152,7 @@ class IR_Store : public virtual IR_Set { */ class IR_Store_Atomic : public IR_Set_Atomic { public: - enum Kind { INTEGER, FLOAT } kind; + enum class Kind { INTEGER, FLOAT } kind; IR_Store_Atomic(Kind _kind, std::shared_ptr _dst, std::shared_ptr _src, int _size) : IR_Set_Atomic(IR_Set::STORE, std::move(_dst), std::move(_src)), kind(_kind), size(_size) {} int size;