Implement constant propogation of null pointer values.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1078 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2001-11-01 05:55:13 +00:00
parent d558426b0e
commit 76ac1a45b4
4 changed files with 88 additions and 1 deletions

View File

@@ -36,6 +36,7 @@
#include "llvm/ConstPoolVals.h"
#include "llvm/Instruction.h"
#include "llvm/Type.h"
class PointerType;
namespace opt {
@@ -90,6 +91,8 @@ public:
virtual ConstPoolUInt *castToULong (const ConstPoolVal *V) const = 0;
virtual ConstPoolFP *castToFloat (const ConstPoolVal *V) const = 0;
virtual ConstPoolFP *castToDouble(const ConstPoolVal *V) const = 0;
virtual ConstPoolPointer *castToPointer(const ConstPoolVal *V,
const PointerType *Ty) const = 0;
inline ConstPoolVal *castTo(const ConstPoolVal *V, const Type *Ty) const {
switch (Ty->getPrimitiveID()) {
@@ -104,6 +107,7 @@ public:
case Type::LongTyID: return castToLong(V);
case Type::FloatTyID: return castToFloat(V);
case Type::DoubleTyID: return castToDouble(V);
case Type::PointerTyID:return castToPointer(V, (PointerType*)Ty);
default: return 0;
}
}