From: Reid Spencer Date: Sun, 18 Jul 2004 00:41:27 +0000 (+0000) Subject: bug 122: X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=40cf2f954e7d554872f6eca42c844bc065b02c11;p=oota-llvm.git bug 122: - Replace ConstantPointerRef usage with GlobalValue usage - Correct isa for GlobalValue subclass git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14951 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp index e53c468a2f3..e6f096f8aad 100644 --- a/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/lib/ExecutionEngine/ExecutionEngine.cpp @@ -263,19 +263,14 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) { GET_CONST_VAL(Double , ConstantFP); #undef GET_CONST_VAL case Type::PointerTyID: - if (isa(C)) { + if (isa(C)) Result.PointerVal = 0; - } else if (const ConstantPointerRef *CPR = dyn_cast(C)){ - if (Function *F = - const_cast(dyn_cast(CPR->getValue()))) - Result = PTOGV(getPointerToFunctionOrStub(F)); - else - Result = PTOGV(getOrEmitGlobalVariable( - cast(CPR->getValue()))); - - } else { + else if (const Function *F = dyn_cast(C)) + Result = PTOGV(getPointerToFunctionOrStub(const_cast(F))); + else if (const GlobalVariable* GV = dyn_cast(C)) + Result = PTOGV(getOrEmitGlobalVariable(const_cast(GV))); + else assert(0 && "Unknown constant pointer type!"); - } break; default: std::cout << "ERROR: Constant unimp for type: " << *C->getType() << "\n";