diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2004-07-18 00:41:27 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2004-07-18 00:41:27 +0000 |
commit | 40cf2f954e7d554872f6eca42c844bc065b02c11 (patch) | |
tree | 785004b4a78d976050b03b8e6c757fd86d147b19 /lib/ExecutionEngine/ExecutionEngine.cpp | |
parent | 8863f1814ba2c26910edb30857d10a8587f2f7de (diff) |
bug 122:
- Replace ConstantPointerRef usage with GlobalValue usage
- Correct isa<Constant> for GlobalValue subclass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14951 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/ExecutionEngine.cpp')
-rw-r--r-- | lib/ExecutionEngine/ExecutionEngine.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp index e53c468a2f..e6f096f8aa 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<ConstantPointerNull>(C)) { + if (isa<ConstantPointerNull>(C)) Result.PointerVal = 0; - } else if (const ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(C)){ - if (Function *F = - const_cast<Function*>(dyn_cast<Function>(CPR->getValue()))) - Result = PTOGV(getPointerToFunctionOrStub(F)); - else - Result = PTOGV(getOrEmitGlobalVariable( - cast<GlobalVariable>(CPR->getValue()))); - - } else { + else if (const Function *F = dyn_cast<Function>(C)) + Result = PTOGV(getPointerToFunctionOrStub(const_cast<Function*>(F))); + else if (const GlobalVariable* GV = dyn_cast<GlobalVariable>(C)) + Result = PTOGV(getOrEmitGlobalVariable(const_cast<GlobalVariable*>(GV))); + else assert(0 && "Unknown constant pointer type!"); - } break; default: std::cout << "ERROR: Constant unimp for type: " << *C->getType() << "\n"; |