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 | 0627a96e7eddce6eb62437c4bd12191bfdc108ee (patch) | |
tree | d2d190ad33ce26141075ed91f01d13536e64a3da /llvm/lib/ExecutionEngine | |
parent | ab69ecc6d5b26dd063a67bdae2e7e89bfe7be5bb (diff) | |
download | bcm5719-llvm-0627a96e7eddce6eb62437c4bd12191bfdc108ee.tar.gz bcm5719-llvm-0627a96e7eddce6eb62437c4bd12191bfdc108ee.zip |
Add support for casting any pointer to any integer type
llvm-svn: 7953
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r-- | llvm/lib/ExecutionEngine/ExecutionEngine.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp index 9b119c73e35..e37d56f2cca 100644 --- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/llvm/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; } |