From 74cf81919d3a44457bec1cbf01b655c80f4673b1 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 18 Aug 2003 17:23:40 +0000 Subject: Add support for casting any pointer to any integer type git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7953 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/ExecutionEngine/ExecutionEngine.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'lib/ExecutionEngine/ExecutionEngine.cpp') diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp index 9b119c73e3..e37d56f2cc 100644 --- a/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/lib/ExecutionEngine/ExecutionEngine.cpp @@ -54,13 +54,15 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) { if (Op->getType()->getPrimitiveID() == C->getType()->getPrimitiveID()) return getConstantValue(Op); - // Handle cast of long to pointer or pointer to long... - if ((isa(Op->getType()) && (C->getType() == Type::LongTy || - C->getType() == Type::ULongTy))|| - (isa(C->getType()) && (Op->getType() == Type::LongTy || - Op->getType() == Type::ULongTy))){ + // Handle a cast of pointer to any integral type... + if (isa(Op->getType()) && + (C->getType() == Type::LongTy || C->getType() == Type::ULongTy)) + return getConstantValue(Op); + + // Handle cast of long to pointer... + if (isa(C->getType()) && (Op->getType() == Type::LongTy || + Op->getType() == Type::ULongTy)) return getConstantValue(Op); - } break; } -- cgit v1.2.3-18-g5258