summaryrefslogtreecommitdiff
path: root/include/llvm
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-09-06 00:11:24 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-09-06 00:11:24 +0000
commit92a97a9166e359e195d949e63d7e24a4a33284cf (patch)
tree47fc373baf592033d473b376cc7a246697d5279b /include/llvm
parent0985b3c81c4b56c4fb7104778df8e9ab21438d4b (diff)
downloadllvm-92a97a9166e359e195d949e63d7e24a4a33284cf.tar.gz
llvm-92a97a9166e359e195d949e63d7e24a4a33284cf.tar.bz2
llvm-92a97a9166e359e195d949e63d7e24a4a33284cf.tar.xz
Revert "Include optional subclass flags, such as inbounds, nsw, etc., ...", this
breaks MiniSAT on x86_64. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81098 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/Constants.h9
-rw-r--r--include/llvm/InstrTypes.h27
-rw-r--r--include/llvm/Instructions.h12
-rw-r--r--include/llvm/Operator.h66
-rw-r--r--include/llvm/Value.h13
5 files changed, 34 insertions, 93 deletions
diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h
index e79ca543ab..da6fe96a77 100644
--- a/include/llvm/Constants.h
+++ b/include/llvm/Constants.h
@@ -571,17 +571,13 @@ protected:
// These private methods are used by the type resolution code to create
// ConstantExprs in intermediate forms.
static Constant *getTy(const Type *Ty, unsigned Opcode,
- Constant *C1, Constant *C2,
- unsigned Flags = 0);
+ Constant *C1, Constant *C2);
static Constant *getCompareTy(unsigned short pred, Constant *C1,
Constant *C2);
static Constant *getSelectTy(const Type *Ty,
Constant *C1, Constant *C2, Constant *C3);
static Constant *getGetElementPtrTy(const Type *Ty, Constant *C,
Value* const *Idxs, unsigned NumIdxs);
- static Constant *getInBoundsGetElementPtrTy(const Type *Ty, Constant *C,
- Value* const *Idxs,
- unsigned NumIdxs);
static Constant *getExtractElementTy(const Type *Ty, Constant *Val,
Constant *Idx);
static Constant *getInsertElementTy(const Type *Ty, Constant *Val,
@@ -722,8 +718,7 @@ public:
/// get - Return a binary or shift operator constant expression,
/// folding if possible.
///
- static Constant *get(unsigned Opcode, Constant *C1, Constant *C2,
- unsigned Flags = 0);
+ static Constant *get(unsigned Opcode, Constant *C1, Constant *C2);
/// @brief Return an ICmp or FCmp comparison operator constant expression.
static Constant *getCompare(unsigned short pred, Constant *C1, Constant *C2);
diff --git a/include/llvm/InstrTypes.h b/include/llvm/InstrTypes.h
index 032a1e7f7a..35d7534e5a 100644
--- a/include/llvm/InstrTypes.h
+++ b/include/llvm/InstrTypes.h
@@ -200,19 +200,19 @@ public:
static BinaryOperator *CreateNSWAdd(Value *V1, Value *V2,
const Twine &Name = "") {
BinaryOperator *BO = CreateAdd(V1, V2, Name);
- BO->setHasNoSignedWrap(true);
+ cast<AddOperator>(BO)->setHasNoSignedWrap(true);
return BO;
}
static BinaryOperator *CreateNSWAdd(Value *V1, Value *V2,
const Twine &Name, BasicBlock *BB) {
BinaryOperator *BO = CreateAdd(V1, V2, Name, BB);
- BO->setHasNoSignedWrap(true);
+ cast<AddOperator>(BO)->setHasNoSignedWrap(true);
return BO;
}
static BinaryOperator *CreateNSWAdd(Value *V1, Value *V2,
const Twine &Name, Instruction *I) {
BinaryOperator *BO = CreateAdd(V1, V2, Name, I);
- BO->setHasNoSignedWrap(true);
+ cast<AddOperator>(BO)->setHasNoSignedWrap(true);
return BO;
}
@@ -221,19 +221,19 @@ public:
static BinaryOperator *CreateExactSDiv(Value *V1, Value *V2,
const Twine &Name = "") {
BinaryOperator *BO = CreateSDiv(V1, V2, Name);
- BO->setIsExact(true);
+ cast<SDivOperator>(BO)->setIsExact(true);
return BO;
}
static BinaryOperator *CreateExactSDiv(Value *V1, Value *V2,
const Twine &Name, BasicBlock *BB) {
BinaryOperator *BO = CreateSDiv(V1, V2, Name, BB);
- BO->setIsExact(true);
+ cast<SDivOperator>(BO)->setIsExact(true);
return BO;
}
static BinaryOperator *CreateExactSDiv(Value *V1, Value *V2,
const Twine &Name, Instruction *I) {
BinaryOperator *BO = CreateSDiv(V1, V2, Name, I);
- BO->setIsExact(true);
+ cast<SDivOperator>(BO)->setIsExact(true);
return BO;
}
@@ -287,21 +287,6 @@ public:
///
bool swapOperands();
- /// setHasNoUnsignedWrap - Set or clear the nsw flag on this instruction,
- /// which must be an operator which supports this flag. See LangRef.html
- /// for the meaning of this flag.
- void setHasNoUnsignedWrap(bool);
-
- /// setHasNoSignedWrap - Set or clear the nsw flag on this instruction,
- /// which must be an operator which supports this flag. See LangRef.html
- /// for the meaning of this flag.
- void setHasNoSignedWrap(bool);
-
- /// setIsExact - Set or clear the exact flag on this instruction,
- /// which must be an operator which supports this flag. See LangRef.html
- /// for the meaning of this flag.
- void setIsExact(bool);
-
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const BinaryOperator *) { return true; }
static inline bool classof(const Instruction *I) {
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index 57cff17221..71f4738528 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -496,7 +496,7 @@ public:
Instruction *InsertBefore = 0) {
GetElementPtrInst *GEP = Create(Ptr, IdxBegin, IdxEnd,
NameStr, InsertBefore);
- GEP->setIsInBounds(true);
+ cast<GEPOperator>(GEP)->setIsInBounds(true);
return GEP;
}
template<typename InputIterator>
@@ -507,21 +507,21 @@ public:
BasicBlock *InsertAtEnd) {
GetElementPtrInst *GEP = Create(Ptr, IdxBegin, IdxEnd,
NameStr, InsertAtEnd);
- GEP->setIsInBounds(true);
+ cast<GEPOperator>(GEP)->setIsInBounds(true);
return GEP;
}
static GetElementPtrInst *CreateInBounds(Value *Ptr, Value *Idx,
const Twine &NameStr = "",
Instruction *InsertBefore = 0) {
GetElementPtrInst *GEP = Create(Ptr, Idx, NameStr, InsertBefore);
- GEP->setIsInBounds(true);
+ cast<GEPOperator>(GEP)->setIsInBounds(true);
return GEP;
}
static GetElementPtrInst *CreateInBounds(Value *Ptr, Value *Idx,
const Twine &NameStr,
BasicBlock *InsertAtEnd) {
GetElementPtrInst *GEP = Create(Ptr, Idx, NameStr, InsertAtEnd);
- GEP->setIsInBounds(true);
+ cast<GEPOperator>(GEP)->setIsInBounds(true);
return GEP;
}
@@ -602,10 +602,6 @@ public:
/// a constant offset between them.
bool hasAllConstantIndices() const;
- /// setIsInBounds - Set or clear the inbounds flag on this GEP instruction.
- /// See LangRef.html for the meaning of inbounds on a getelementptr.
- void setIsInBounds(bool);
-
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const GetElementPtrInst *) { return true; }
static inline bool classof(const Instruction *I) {
diff --git a/include/llvm/Operator.h b/include/llvm/Operator.h
index 06eb243418..48ac09d54f 100644
--- a/include/llvm/Operator.h
+++ b/include/llvm/Operator.h
@@ -21,8 +21,6 @@
namespace llvm {
class GetElementPtrInst;
-class BinaryOperator;
-class ConstantExpr;
/// Operator - This is a utility class that provides an abstraction for the
/// common functionality between Instructions and ConstantExprs.
@@ -69,37 +67,24 @@ public:
/// despite that operator having the potential for overflow.
///
class OverflowingBinaryOperator : public Operator {
-public:
- enum {
- NoUnsignedWrap = (1 << 0),
- NoSignedWrap = (1 << 1)
- };
-
-private:
~OverflowingBinaryOperator(); // do not implement
-
- friend class BinaryOperator;
- friend class ConstantExpr;
- void setHasNoUnsignedWrap(bool B) {
- SubclassOptionalData =
- (SubclassOptionalData & ~NoUnsignedWrap) | (B * NoUnsignedWrap);
- }
- void setHasNoSignedWrap(bool B) {
- SubclassOptionalData =
- (SubclassOptionalData & ~NoSignedWrap) | (B * NoSignedWrap);
- }
-
public:
/// hasNoUnsignedWrap - Test whether this operation is known to never
/// undergo unsigned overflow, aka the nuw property.
bool hasNoUnsignedWrap() const {
- return SubclassOptionalData & NoUnsignedWrap;
+ return SubclassOptionalData & (1 << 0);
+ }
+ void setHasNoUnsignedWrap(bool B) {
+ SubclassOptionalData = (SubclassOptionalData & ~(1 << 0)) | (B << 0);
}
/// hasNoSignedWrap - Test whether this operation is known to never
/// undergo signed overflow, aka the nsw property.
bool hasNoSignedWrap() const {
- return SubclassOptionalData & NoSignedWrap;
+ return SubclassOptionalData & (1 << 1);
+ }
+ void setHasNoSignedWrap(bool B) {
+ SubclassOptionalData = (SubclassOptionalData & ~(1 << 1)) | (B << 1);
}
static inline bool classof(const OverflowingBinaryOperator *) { return true; }
@@ -176,25 +161,15 @@ public:
/// SDivOperator - An Operator with opcode Instruction::SDiv.
///
class SDivOperator : public Operator {
-public:
- enum {
- IsExact = (1 << 0)
- };
-
-private:
~SDivOperator(); // do not implement
-
- friend class BinaryOperator;
- friend class ConstantExpr;
- void setIsExact(bool B) {
- SubclassOptionalData = (SubclassOptionalData & ~IsExact) | (B * IsExact);
- }
-
public:
/// isExact - Test whether this division is known to be exact, with
/// zero remainder.
bool isExact() const {
- return SubclassOptionalData & IsExact;
+ return SubclassOptionalData & (1 << 0);
+ }
+ void setIsExact(bool B) {
+ SubclassOptionalData = (SubclassOptionalData & ~(1 << 0)) | (B << 0);
}
// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -212,24 +187,15 @@ public:
};
class GEPOperator : public Operator {
- enum {
- IsInBounds = (1 << 0)
- };
-
~GEPOperator(); // do not implement
-
- friend class GetElementPtrInst;
- friend class ConstantExpr;
- void setIsInBounds(bool B) {
- SubclassOptionalData =
- (SubclassOptionalData & ~IsInBounds) | (B * IsInBounds);
- }
-
public:
/// isInBounds - Test whether this is an inbounds GEP, as defined
/// by LangRef.html.
bool isInBounds() const {
- return SubclassOptionalData & IsInBounds;
+ return SubclassOptionalData & (1 << 0);
+ }
+ void setIsInBounds(bool B) {
+ SubclassOptionalData = (SubclassOptionalData & ~(1 << 0)) | (B << 0);
}
inline op_iterator idx_begin() { return op_begin()+1; }
diff --git a/include/llvm/Value.h b/include/llvm/Value.h
index 415b8fbb2b..fdc3aeb956 100644
--- a/include/llvm/Value.h
+++ b/include/llvm/Value.h
@@ -146,6 +146,12 @@ public:
// Only use when in type resolution situations!
void uncheckedReplaceAllUsesWith(Value *V);
+ /// clearOptionalData - Clear any optional optimization data from this Value.
+ /// Transformation passes must call this method whenever changing the IR
+ /// in a way that would affect the values produced by this Value, unless
+ /// it takes special care to ensure correctness in some other way.
+ void clearOptionalData() { SubclassOptionalData = 0; }
+
//----------------------------------------------------------------------
// Methods for handling the chain of uses of this Value.
//
@@ -234,13 +240,6 @@ public:
return SubclassID;
}
- /// getRawSubclassOptionalData - Return the raw optional flags value
- /// contained in this value. This should only be used when testing two
- /// Values for equivalence.
- unsigned getRawSubclassOptionalData() const {
- return SubclassOptionalData;
- }
-
/// hasSameSubclassOptionalData - Test whether the optional flags contained
/// in this value are equal to the optional flags in the given value.
bool hasSameSubclassOptionalData(const Value *V) const {