mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-20 10:24:12 +00:00
Include optional subclass flags, such as inbounds, nsw, etc., in the
Constant uniquing tables. This allows distinct ConstantExpr objects with the same operation and different flags. Even though a ConstantExpr "a + b" is either always overflowing or never overflowing (due to being a ConstantExpr), it's still necessary to be able to represent it both with and without overflow flags at the same time within the IR, because the safety of the flag may depend on the context of the use. If the constant really does overflow, it wouldn't ever be safe to use with the flag set, however the use may be in code that is never actually executed. This also makes it possible to merge all the flags tests into a single test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80998 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -200,19 +200,19 @@ public:
|
||||
static BinaryOperator *CreateNSWAdd(Value *V1, Value *V2,
|
||||
const Twine &Name = "") {
|
||||
BinaryOperator *BO = CreateAdd(V1, V2, Name);
|
||||
cast<AddOperator>(BO)->setHasNoSignedWrap(true);
|
||||
BO->setHasNoSignedWrap(true);
|
||||
return BO;
|
||||
}
|
||||
static BinaryOperator *CreateNSWAdd(Value *V1, Value *V2,
|
||||
const Twine &Name, BasicBlock *BB) {
|
||||
BinaryOperator *BO = CreateAdd(V1, V2, Name, BB);
|
||||
cast<AddOperator>(BO)->setHasNoSignedWrap(true);
|
||||
BO->setHasNoSignedWrap(true);
|
||||
return BO;
|
||||
}
|
||||
static BinaryOperator *CreateNSWAdd(Value *V1, Value *V2,
|
||||
const Twine &Name, Instruction *I) {
|
||||
BinaryOperator *BO = CreateAdd(V1, V2, Name, I);
|
||||
cast<AddOperator>(BO)->setHasNoSignedWrap(true);
|
||||
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);
|
||||
cast<SDivOperator>(BO)->setIsExact(true);
|
||||
BO->setIsExact(true);
|
||||
return BO;
|
||||
}
|
||||
static BinaryOperator *CreateExactSDiv(Value *V1, Value *V2,
|
||||
const Twine &Name, BasicBlock *BB) {
|
||||
BinaryOperator *BO = CreateSDiv(V1, V2, Name, BB);
|
||||
cast<SDivOperator>(BO)->setIsExact(true);
|
||||
BO->setIsExact(true);
|
||||
return BO;
|
||||
}
|
||||
static BinaryOperator *CreateExactSDiv(Value *V1, Value *V2,
|
||||
const Twine &Name, Instruction *I) {
|
||||
BinaryOperator *BO = CreateSDiv(V1, V2, Name, I);
|
||||
cast<SDivOperator>(BO)->setIsExact(true);
|
||||
BO->setIsExact(true);
|
||||
return BO;
|
||||
}
|
||||
|
||||
@ -287,6 +287,21 @@ 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) {
|
||||
|
Reference in New Issue
Block a user