forked from OSchip/llvm-project
parent
4ab4420d7a
commit
4e3b29e309
|
@ -695,6 +695,7 @@ public:
|
|||
static Constant *getNSWNeg(Constant *C);
|
||||
static Constant *getNSWAdd(Constant *C1, Constant *C2);
|
||||
static Constant *getNSWSub(Constant *C1, Constant *C2);
|
||||
static Constant *getNSWMul(Constant *C1, Constant *C2);
|
||||
static Constant *getExactSDiv(Constant *C1, Constant *C2);
|
||||
|
||||
/// Transparently provide more efficient getOperand methods.
|
||||
|
|
|
@ -277,6 +277,27 @@ public:
|
|||
return BO;
|
||||
}
|
||||
|
||||
/// CreateNSWMul - Create a Mul operator with the NSW flag set.
|
||||
///
|
||||
static BinaryOperator *CreateNSWMul(Value *V1, Value *V2,
|
||||
const Twine &Name = "") {
|
||||
BinaryOperator *BO = CreateMul(V1, V2, Name);
|
||||
BO->setHasNoSignedWrap(true);
|
||||
return BO;
|
||||
}
|
||||
static BinaryOperator *CreateNSWMul(Value *V1, Value *V2,
|
||||
const Twine &Name, BasicBlock *BB) {
|
||||
BinaryOperator *BO = CreateMul(V1, V2, Name, BB);
|
||||
BO->setHasNoSignedWrap(true);
|
||||
return BO;
|
||||
}
|
||||
static BinaryOperator *CreateNSWMul(Value *V1, Value *V2,
|
||||
const Twine &Name, Instruction *I) {
|
||||
BinaryOperator *BO = CreateMul(V1, V2, Name, I);
|
||||
BO->setHasNoSignedWrap(true);
|
||||
return BO;
|
||||
}
|
||||
|
||||
/// CreateExactSDiv - Create an SDiv operator with the exact flag set.
|
||||
///
|
||||
static BinaryOperator *CreateExactSDiv(Value *V1, Value *V2,
|
||||
|
|
|
@ -54,6 +54,9 @@ public:
|
|||
Constant *CreateMul(Constant *LHS, Constant *RHS) const {
|
||||
return ConstantExpr::getMul(LHS, RHS);
|
||||
}
|
||||
Constant *CreateNSWMul(Constant *LHS, Constant *RHS) const {
|
||||
return ConstantExpr::getNSWMul(LHS, RHS);
|
||||
}
|
||||
Constant *CreateFMul(Constant *LHS, Constant *RHS) const {
|
||||
return ConstantExpr::getFMul(LHS, RHS);
|
||||
}
|
||||
|
|
|
@ -353,6 +353,12 @@ public:
|
|||
return Folder.CreateMul(LC, RC);
|
||||
return Insert(BinaryOperator::CreateMul(LHS, RHS), Name);
|
||||
}
|
||||
Value *CreateNSWMul(Value *LHS, Value *RHS, const Twine &Name = "") {
|
||||
if (Constant *LC = dyn_cast<Constant>(LHS))
|
||||
if (Constant *RC = dyn_cast<Constant>(RHS))
|
||||
return Folder.CreateNSWMul(LC, RC);
|
||||
return Insert(BinaryOperator::CreateNSWMul(LHS, RHS), Name);
|
||||
}
|
||||
Value *CreateFMul(Value *LHS, Value *RHS, const Twine &Name = "") {
|
||||
if (Constant *LC = dyn_cast<Constant>(LHS))
|
||||
if (Constant *RC = dyn_cast<Constant>(RHS))
|
||||
|
|
|
@ -60,6 +60,9 @@ public:
|
|||
Value *CreateMul(Constant *LHS, Constant *RHS) const {
|
||||
return BinaryOperator::CreateMul(LHS, RHS);
|
||||
}
|
||||
Value *CreateNSWMul(Constant *LHS, Constant *RHS) const {
|
||||
return BinaryOperator::CreateNSWMul(LHS, RHS);
|
||||
}
|
||||
Value *CreateFMul(Constant *LHS, Constant *RHS) const {
|
||||
return BinaryOperator::CreateFMul(LHS, RHS);
|
||||
}
|
||||
|
|
|
@ -67,6 +67,9 @@ public:
|
|||
Constant *CreateMul(Constant *LHS, Constant *RHS) const {
|
||||
return Fold(ConstantExpr::getMul(LHS, RHS));
|
||||
}
|
||||
Constant *CreateNSWMul(Constant *LHS, Constant *RHS) const {
|
||||
return Fold(ConstantExpr::getNSWMul(LHS, RHS));
|
||||
}
|
||||
Constant *CreateFMul(Constant *LHS, Constant *RHS) const {
|
||||
return Fold(ConstantExpr::getFMul(LHS, RHS));
|
||||
}
|
||||
|
|
|
@ -643,6 +643,11 @@ Constant* ConstantExpr::getNSWSub(Constant* C1, Constant* C2) {
|
|||
OverflowingBinaryOperator::NoSignedWrap);
|
||||
}
|
||||
|
||||
Constant* ConstantExpr::getNSWMul(Constant* C1, Constant* C2) {
|
||||
return getTy(C1->getType(), Instruction::Mul, C1, C2,
|
||||
OverflowingBinaryOperator::NoSignedWrap);
|
||||
}
|
||||
|
||||
Constant* ConstantExpr::getExactSDiv(Constant* C1, Constant* C2) {
|
||||
return getTy(C1->getType(), Instruction::SDiv, C1, C2,
|
||||
SDivOperator::IsExact);
|
||||
|
|
Loading…
Reference in New Issue