From 134bb02e1951eb6865155efa3c3994e9078f1e86 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 8 Sep 2018 20:03:45 -0400 Subject: [PATCH] ir/value: Replace includes with forward declarations enum classes are still considered complete types when forward declared (as the compiler knows the exact size of the type from the declaration alone). The only difference in this case being that the members of the enum class aren't visible. Given we don't use the members within this header in any way, we can simply forward declare them here and remove the inclusions. --- src/frontend/ir/value.h | 14 +++++++++++--- src/ir_opt/a32_get_set_elimination_pass.cpp | 1 + src/ir_opt/a64_get_set_elimination_pass.cpp | 1 + tests/A32/fuzz_arm.cpp | 1 + tests/A64/fuzz_with_unicorn.cpp | 1 + 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/frontend/ir/value.h b/src/frontend/ir/value.h index 2c946291..22b8b977 100644 --- a/src/frontend/ir/value.h +++ b/src/frontend/ir/value.h @@ -10,14 +10,22 @@ #include "common/assert.h" #include "common/common_types.h" -#include "frontend/A32/types.h" -#include "frontend/A64/types.h" -#include "frontend/ir/cond.h" #include "frontend/ir/type.h" +namespace Dynarmic::A32 { +enum class ExtReg; +enum class Reg; +} + +namespace Dynarmic::A64 { +enum class Reg; +enum class Vec; +} + namespace Dynarmic::IR { class Inst; +enum class Cond; /** * A representation of a value in the IR. diff --git a/src/ir_opt/a32_get_set_elimination_pass.cpp b/src/ir_opt/a32_get_set_elimination_pass.cpp index 522f9a2b..2ef8dc6c 100644 --- a/src/ir_opt/a32_get_set_elimination_pass.cpp +++ b/src/ir_opt/a32_get_set_elimination_pass.cpp @@ -8,6 +8,7 @@ #include "common/assert.h" #include "common/common_types.h" +#include "frontend/A32/types.h" #include "frontend/ir/basic_block.h" #include "frontend/ir/opcodes.h" #include "frontend/ir/value.h" diff --git a/src/ir_opt/a64_get_set_elimination_pass.cpp b/src/ir_opt/a64_get_set_elimination_pass.cpp index 791c981a..748ed7c4 100644 --- a/src/ir_opt/a64_get_set_elimination_pass.cpp +++ b/src/ir_opt/a64_get_set_elimination_pass.cpp @@ -8,6 +8,7 @@ #include "common/assert.h" #include "common/common_types.h" +#include "frontend/A64/types.h" #include "frontend/ir/basic_block.h" #include "frontend/ir/ir_emitter.h" #include "frontend/ir/opcodes.h" diff --git a/tests/A32/fuzz_arm.cpp b/tests/A32/fuzz_arm.cpp index ec1b4f6f..3efccf2e 100644 --- a/tests/A32/fuzz_arm.cpp +++ b/tests/A32/fuzz_arm.cpp @@ -25,6 +25,7 @@ #include "frontend/A32/location_descriptor.h" #include "frontend/A32/PSR.h" #include "frontend/A32/translate/translate.h" +#include "frontend/A32/types.h" #include "frontend/ir/basic_block.h" #include "frontend/ir/location_descriptor.h" #include "ir_opt/passes.h" diff --git a/tests/A64/fuzz_with_unicorn.cpp b/tests/A64/fuzz_with_unicorn.cpp index 4851b20f..5d78ec56 100644 --- a/tests/A64/fuzz_with_unicorn.cpp +++ b/tests/A64/fuzz_with_unicorn.cpp @@ -19,6 +19,7 @@ #include "frontend/A64/decoder/a64.h" #include "frontend/A64/location_descriptor.h" #include "frontend/A64/translate/translate.h" +#include "frontend/A64/types.h" #include "frontend/ir/basic_block.h" #include "frontend/ir/opcodes.h" #include "fuzz_util.h"