diff options
author | Chris Lattner <sabre@nondot.org> | 2003-04-17 19:22:47 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-04-17 19:22:47 +0000 |
commit | fd73cf895c8e83c8f016f8e67f8d96544e316343 (patch) | |
tree | b8ef49ab83b9c3b7b4ddd86938a6ab17614ab4cf /lib/VMCore/ConstantFolding.h | |
parent | 4d21cb41513b7f7870b5308de3cdeb25ba523104 (diff) | |
download | external_llvm-fd73cf895c8e83c8f016f8e67f8d96544e316343.zip external_llvm-fd73cf895c8e83c8f016f8e67f8d96544e316343.tar.gz external_llvm-fd73cf895c8e83c8f016f8e67f8d96544e316343.tar.bz2 |
Don't force a ConstantPointer to be returned
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5799 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/ConstantFolding.h')
-rw-r--r-- | lib/VMCore/ConstantFolding.h | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/VMCore/ConstantFolding.h b/lib/VMCore/ConstantFolding.h index 546b37e..8175b6c 100644 --- a/lib/VMCore/ConstantFolding.h +++ b/lib/VMCore/ConstantFolding.h @@ -41,14 +41,12 @@ class PointerType; // Implement == and != directly... //===----------------------------------------------------------------------===// -inline ConstantBool *operator==(const Constant &V1, - const Constant &V2) { +inline ConstantBool *operator==(const Constant &V1, const Constant &V2) { assert(V1.getType() == V2.getType() && "Constant types must be identical!"); return ConstantBool::get(&V1 == &V2); } -inline ConstantBool *operator!=(const Constant &V1, - const Constant &V2) { +inline ConstantBool *operator!=(const Constant &V1, const Constant &V2) { return ConstantBool::get(&V1 != &V2); } @@ -89,8 +87,8 @@ public: virtual ConstantUInt *castToULong (const Constant *V) const = 0; virtual ConstantFP *castToFloat (const Constant *V) const = 0; virtual ConstantFP *castToDouble(const Constant *V) const = 0; - virtual ConstantPointer *castToPointer(const Constant *V, - const PointerType *Ty) const = 0; + virtual Constant *castToPointer(const Constant *V, + const PointerType *Ty) const = 0; inline Constant *castTo(const Constant *V, const Type *Ty) const { switch (Ty->getPrimitiveID()) { @@ -117,7 +115,7 @@ public: static inline ConstRules *get(const Constant &V) { return (ConstRules*)V.getType()->getOrCreateAnnotation(AID); } -private : +private: static Annotation *find(AnnotationID AID, const Annotable *Ty, void *); ConstRules(const ConstRules &); // Do not implement @@ -220,5 +218,6 @@ Constant *ConstantFoldBinaryInstruction(unsigned Opcode, const Constant *V1, const Constant *V2); Constant *ConstantFoldShiftInstruction(unsigned Opcode, const Constant *V1, const Constant *V2); - +Constant *ConstantFoldGetElementPtr(const Constant *C, + const std::vector<Constant*> &IdxList); #endif |