diff options
author | Chris Lattner <sabre@nondot.org> | 2003-08-18 17:23:40 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-08-18 17:23:40 +0000 |
commit | 74cf81919d3a44457bec1cbf01b655c80f4673b1 (patch) | |
tree | d94949fa1e21e7589bb0f9462fbddd6c43f4e44f /lib | |
parent | 8164d6535a2c7f496c8512d515b4078fbabc5254 (diff) | |
download | external_llvm-74cf81919d3a44457bec1cbf01b655c80f4673b1.zip external_llvm-74cf81919d3a44457bec1cbf01b655c80f4673b1.tar.gz external_llvm-74cf81919d3a44457bec1cbf01b655c80f4673b1.tar.bz2 |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ExecutionEngine/ExecutionEngine.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp index 9b119c7..e37d56f 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<PointerType>(Op->getType()) && (C->getType() == Type::LongTy || - C->getType() == Type::ULongTy))|| - (isa<PointerType>(C->getType()) && (Op->getType() == Type::LongTy || - Op->getType() == Type::ULongTy))){ + // Handle a cast of pointer to any integral type... + if (isa<PointerType>(Op->getType()) && + (C->getType() == Type::LongTy || C->getType() == Type::ULongTy)) + return getConstantValue(Op); + + // Handle cast of long to pointer... + if (isa<PointerType>(C->getType()) && (Op->getType() == Type::LongTy || + Op->getType() == Type::ULongTy)) return getConstantValue(Op); - } break; } |