From 31ff786aca19847cde402d55e9d7ef20b15c9d52 Mon Sep 17 00:00:00 2001 From: Junyan He Date: Thu, 15 May 2014 17:38:53 +0800 Subject: [PATCH] Modify the GenContext and GenEncoder's destructor to virtual Signed-off-by: Junyan He Reviewed-by: Zhigang Gong --- backend/src/backend/gen75_context.hpp | 4 ++-- backend/src/backend/gen75_encoder.hpp | 4 +++- backend/src/backend/gen_context.hpp | 2 +- backend/src/backend/gen_encoder.hpp | 2 ++ 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/backend/src/backend/gen75_context.hpp b/backend/src/backend/gen75_context.hpp index 2bb6e17..329b416 100644 --- a/backend/src/backend/gen75_context.hpp +++ b/backend/src/backend/gen75_context.hpp @@ -32,9 +32,9 @@ namespace gbe class Gen75Context : public GenContext { public: + virtual ~Gen75Context(void) { } Gen75Context(const ir::Unit &unit, const std::string &name, uint32_t deviceID, bool relaxMath = false) - : GenContext(unit, name, deviceID, relaxMath) { - }; + : GenContext(unit, name, deviceID, relaxMath) { } protected: virtual GenEncoder* generateEncoder(void) { diff --git a/backend/src/backend/gen75_encoder.hpp b/backend/src/backend/gen75_encoder.hpp index dc2dc76..a9042b3 100644 --- a/backend/src/backend/gen75_encoder.hpp +++ b/backend/src/backend/gen75_encoder.hpp @@ -31,8 +31,10 @@ namespace gbe class Gen75Encoder : public GenEncoder { public: + virtual ~Gen75Encoder(void) { } + Gen75Encoder(uint32_t simdWidth, uint32_t gen, uint32_t deviceID) - : GenEncoder(simdWidth, gen, deviceID, 8) { }; + : GenEncoder(simdWidth, gen, deviceID, 8) { } virtual void MOV_DF(GenRegister dest, GenRegister src0, GenRegister tmp = GenRegister::null()); virtual void LOAD_DF_IMM(GenRegister dest, GenRegister tmp, double value); diff --git a/backend/src/backend/gen_context.hpp b/backend/src/backend/gen_context.hpp index 21ee28d..750d72b 100644 --- a/backend/src/backend/gen_context.hpp +++ b/backend/src/backend/gen_context.hpp @@ -63,7 +63,7 @@ namespace gbe GenContext(const ir::Unit &unit, const std::string &name, uint32_t deviceID, bool relaxMath = false); /*! Release everything needed */ - ~GenContext(void); + virtual ~GenContext(void); /*! Start new code generation with specific parameters */ void startNewCG(uint32_t simdWidth, uint32_t reservedSpillRegs, bool limitRegisterPressure); /*! Target device ID*/ diff --git a/backend/src/backend/gen_encoder.hpp b/backend/src/backend/gen_encoder.hpp index 5129d99..9eaa1c2 100644 --- a/backend/src/backend/gen_encoder.hpp +++ b/backend/src/backend/gen_encoder.hpp @@ -66,6 +66,8 @@ namespace gbe public: /*! simdWidth is the default width for the instructions */ GenEncoder(uint32_t simdWidth, uint32_t gen, uint32_t deviceID, int jump_width = 1); + + virtual ~GenEncoder(void) { } /*! Size of the stack (should be large enough) */ enum { MAX_STATE_NUM = 16 }; /*! Push the current instruction state */ -- 2.7.4