Use the new method, though noone currently implements it any better than before
authorChris Lattner <sabre@nondot.org>
Mon, 8 Dec 2003 08:22:48 +0000 (08:22 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 8 Dec 2003 08:22:48 +0000 (08:22 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10320 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ExecutionEngine/ExecutionEngine.cpp

index 2681790e56aadef00be51e1d64d7342e8a7c5139..0252595926ecd59ba395b0d8f9c72bc313d737fd 100644 (file)
@@ -150,7 +150,11 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
     if (isa<ConstantPointerNull>(C)) {
       Result.PointerVal = 0;
     } else if (const ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(C)){
-      Result = PTOGV(getPointerToGlobal(CPR->getValue()));
+      if (Function *F =
+          const_cast<Function*>(dyn_cast<Function>(CPR->getValue())))
+        Result = PTOGV(getPointerToFunctionOrStub(F));
+      else 
+        Result = PTOGV(getPointerToGlobal(CPR->getValue()));
 
     } else {
       assert(0 && "Unknown constant pointer type!");