From 1dc1e3dcd8524088cbb506bbc75916e706df8c1c Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 21 Jul 2018 14:01:19 -0400 Subject: [PATCH] fp: Use forward declarations where applicable Minimizes the amount of files that need to be rebuilt if the headers ever change. --- src/backend_x64/emit_x64_floating_point.cpp | 3 +++ src/common/fp/op/FPRoundInt.h | 7 ++++--- src/common/fp/op/FPToFixed.h | 7 ++++--- src/common/fp/process_exception.h | 6 +++--- src/common/fp/process_nan.cpp | 1 + src/common/fp/process_nan.h | 8 ++++---- src/common/fp/unpacked.cpp | 2 ++ src/common/fp/unpacked.h | 4 +++- src/common/fp/util.h | 1 + tests/fp/FPToFixed.cpp | 3 +++ tests/fp/mantissa_util_tests.cpp | 1 + tests/fp/unpacked_tests.cpp | 6 ++++++ 12 files changed, 35 insertions(+), 14 deletions(-) diff --git a/src/backend_x64/emit_x64_floating_point.cpp b/src/backend_x64/emit_x64_floating_point.cpp index 47a5b826..7c033f45 100644 --- a/src/backend_x64/emit_x64_floating_point.cpp +++ b/src/backend_x64/emit_x64_floating_point.cpp @@ -12,7 +12,10 @@ #include "backend_x64/emit_x64.h" #include "common/assert.h" #include "common/common_types.h" +#include "common/fp/fpcr.h" +#include "common/fp/fpsr.h" #include "common/fp/op.h" +#include "common/fp/rounding_mode.h" #include "common/fp/util.h" #include "common/mp/cartesian_product.h" #include "common/mp/integer.h" diff --git a/src/common/fp/op/FPRoundInt.h b/src/common/fp/op/FPRoundInt.h index cb03936d..e0a60b29 100644 --- a/src/common/fp/op/FPRoundInt.h +++ b/src/common/fp/op/FPRoundInt.h @@ -7,12 +7,13 @@ #pragma once #include "common/common_types.h" -#include "common/fp/fpcr.h" -#include "common/fp/fpsr.h" -#include "common/fp/rounding_mode.h" namespace Dynarmic::FP { +class FPCR; +class FPSR; +enum class RoundingMode; + template u64 FPRoundInt(FPT op, FPCR fpcr, RoundingMode rounding, bool exact, FPSR& fpsr); diff --git a/src/common/fp/op/FPToFixed.h b/src/common/fp/op/FPToFixed.h index 79154760..d4febe0b 100644 --- a/src/common/fp/op/FPToFixed.h +++ b/src/common/fp/op/FPToFixed.h @@ -7,12 +7,13 @@ #pragma once #include "common/common_types.h" -#include "common/fp/fpcr.h" -#include "common/fp/fpsr.h" -#include "common/fp/rounding_mode.h" namespace Dynarmic::FP { +class FPCR; +class FPSR; +enum class RoundingMode; + template u64 FPToFixed(size_t ibits, FPT op, size_t fbits, bool unsigned_, FPCR fpcr, RoundingMode rounding, FPSR& fpsr); diff --git a/src/common/fp/process_exception.h b/src/common/fp/process_exception.h index 050c006d..6115a97f 100644 --- a/src/common/fp/process_exception.h +++ b/src/common/fp/process_exception.h @@ -6,11 +6,11 @@ #pragma once -#include "common/fp/fpcr.h" -#include "common/fp/fpsr.h" - namespace Dynarmic::FP { +class FPCR; +class FPSR; + enum class FPExc { InvalidOp, DivideByZero, diff --git a/src/common/fp/process_nan.cpp b/src/common/fp/process_nan.cpp index cbd7f2d3..13d09a0f 100644 --- a/src/common/fp/process_nan.cpp +++ b/src/common/fp/process_nan.cpp @@ -11,6 +11,7 @@ #include "common/fp/info.h" #include "common/fp/process_exception.h" #include "common/fp/process_nan.h" +#include "common/fp/unpacked.h" namespace Dynarmic::FP { diff --git a/src/common/fp/process_nan.h b/src/common/fp/process_nan.h index 021f70fe..848b49dd 100644 --- a/src/common/fp/process_nan.h +++ b/src/common/fp/process_nan.h @@ -6,12 +6,12 @@ #pragma once -#include "common/fp/fpcr.h" -#include "common/fp/fpsr.h" -#include "common/fp/unpacked.h" - namespace Dynarmic::FP { +class FPCR; +class FPSR; +enum class FPType; + template FPT FPProcessNaN(FPType type, FPT op, FPCR fpcr, FPSR& fpsr); diff --git a/src/common/fp/unpacked.cpp b/src/common/fp/unpacked.cpp index 6f145723..55fe21f0 100644 --- a/src/common/fp/unpacked.cpp +++ b/src/common/fp/unpacked.cpp @@ -4,8 +4,10 @@ * General Public License version 2 or any later version. */ +#include "common/fp/fpsr.h" #include "common/fp/info.h" #include "common/fp/process_exception.h" +#include "common/fp/rounding_mode.h" #include "common/fp/unpacked.h" #include "common/safe_ops.h" diff --git a/src/common/fp/unpacked.h b/src/common/fp/unpacked.h index 9fda7df6..067058c8 100644 --- a/src/common/fp/unpacked.h +++ b/src/common/fp/unpacked.h @@ -10,10 +10,12 @@ #include "common/common_types.h" #include "common/fp/fpcr.h" -#include "common/fp/fpsr.h" namespace Dynarmic::FP { +class FPSR; +enum class RoundingMode; + enum class FPType { Nonzero, Zero, diff --git a/src/common/fp/util.h b/src/common/fp/util.h index 8241dbf3..66db5c67 100644 --- a/src/common/fp/util.h +++ b/src/common/fp/util.h @@ -7,6 +7,7 @@ #pragma once #include +#include "common/common_types.h" namespace Dynarmic::FP { diff --git a/tests/fp/FPToFixed.cpp b/tests/fp/FPToFixed.cpp index 1a507dfb..66f178a5 100644 --- a/tests/fp/FPToFixed.cpp +++ b/tests/fp/FPToFixed.cpp @@ -9,8 +9,11 @@ #include +#include "common/common_types.h" +#include "common/fp/fpcr.h" #include "common/fp/fpsr.h" #include "common/fp/op.h" +#include "common/fp/rounding_mode.h" #include "rand_int.h" using namespace Dynarmic; diff --git a/tests/fp/mantissa_util_tests.cpp b/tests/fp/mantissa_util_tests.cpp index 04703e1d..732d35f7 100644 --- a/tests/fp/mantissa_util_tests.cpp +++ b/tests/fp/mantissa_util_tests.cpp @@ -9,6 +9,7 @@ #include +#include "common/common_types.h" #include "common/fp/mantissa_util.h" #include "common/safe_ops.h" #include "rand_int.h" diff --git a/tests/fp/unpacked_tests.cpp b/tests/fp/unpacked_tests.cpp index f17fc99c..bdc54172 100644 --- a/tests/fp/unpacked_tests.cpp +++ b/tests/fp/unpacked_tests.cpp @@ -4,8 +4,14 @@ * General Public License version 2 or any later version. */ +#include +#include + #include +#include "common/common_types.h" +#include "common/fp/fpcr.h" +#include "common/fp/fpsr.h" #include "common/fp/unpacked.h" #include "rand_int.h"