summaryrefslogtreecommitdiffstats
path: root/lib/VMCore/ConstantFolding.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-10-31 05:07:57 +0000
committerChris Lattner <sabre@nondot.org>2001-10-31 05:07:57 +0000
commit37aabf28b3ae64356b58d7e0bed2c6764bc52334 (patch)
treec63fdee814535adbe92a5ed801f44527d744f94d /lib/VMCore/ConstantFolding.h
parent11c862cf4661708bf4a52fe8a6b630bb844d76bd (diff)
downloadexternal_llvm-37aabf28b3ae64356b58d7e0bed2c6764bc52334.zip
external_llvm-37aabf28b3ae64356b58d7e0bed2c6764bc52334.tar.gz
external_llvm-37aabf28b3ae64356b58d7e0bed2c6764bc52334.tar.bz2
Implemented constant propogation of cast instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1064 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/ConstantFolding.h')
-rw-r--r--lib/VMCore/ConstantFolding.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/VMCore/ConstantFolding.h b/lib/VMCore/ConstantFolding.h
index 9ce1b2c..d3af1bd 100644
--- a/lib/VMCore/ConstantFolding.h
+++ b/lib/VMCore/ConstantFolding.h
@@ -175,10 +175,16 @@ inline ConstPoolBool *operator<=(const ConstPoolVal &V1,
// Implement higher level instruction folding type instructions
//===----------------------------------------------------------------------===//
+inline ConstPoolVal *ConstantFoldCastInstruction(ConstPoolVal *V,
+ const Type *DestTy) {
+ return ConstRules::get(*V)->castTo(V, DestTy);
+}
+
inline ConstPoolVal *ConstantFoldUnaryInstruction(unsigned Opcode,
ConstPoolVal *V) {
switch (Opcode) {
case Instruction::Not: return !*V;
+ // TODO: Handle get element ptr instruction here in the future? GEP null?
}
return 0;
}