From: Evan Cheng Date: Wed, 20 Aug 2008 00:28:12 +0000 (+0000) Subject: Get rid of a couple of dynamic_cast. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=a044dfcb5ae3b789799cefaf5c4c2e1973fbf4c5;p=oota-llvm.git Get rid of a couple of dynamic_cast. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55022 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/ExecutionEngine/JIT/JITEmitter.cpp b/lib/ExecutionEngine/JIT/JITEmitter.cpp index 3100f0680b7..3b96a78bfc0 100644 --- a/lib/ExecutionEngine/JIT/JITEmitter.cpp +++ b/lib/ExecutionEngine/JIT/JITEmitter.cpp @@ -486,6 +486,12 @@ namespace { delete MemMgr; if (ExceptionHandling) delete DE; } + + /// classof - Methods for support type inquiry through isa, cast, and + /// dyn_cast: + /// + static inline bool classof(const JITEmitter*) { return true; } + static inline bool classof(const MachineCodeEmitter*) { return true; } JITResolver &getJITResolver() { return Resolver; } @@ -1129,8 +1135,8 @@ void *JIT::getPointerToFunctionOrStub(Function *F) { return Addr; // Get a stub if the target supports it. - assert(dynamic_cast(MCE) && "Unexpected MCE?"); - JITEmitter *JE = static_cast(getCodeEmitter()); + assert(isa(MCE) && "Unexpected MCE?"); + JITEmitter *JE = cast(getCodeEmitter()); return JE->getJITResolver().getFunctionStub(F); } @@ -1146,7 +1152,7 @@ void JIT::freeMachineCodeForFunction(Function *F) { RemoveFunctionFromSymbolTable(OldPtr); // Free the actual memory for the function body and related stuff. - assert(dynamic_cast(MCE) && "Unexpected MCE?"); - static_cast(MCE)->deallocateMemForFunction(F); + assert(isa(MCE) && "Unexpected MCE?"); + cast(MCE)->deallocateMemForFunction(F); }