mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-16 11:30:51 +00:00
Add IRBuilder methods for creating an exact udiv, like for exact sdiv.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125002 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cf9efa5966
commit
1dbf0df996
@ -321,6 +321,27 @@ public:
|
||||
return BO;
|
||||
}
|
||||
|
||||
/// CreateExactUDiv - Create a UDiv operator with the exact flag set.
|
||||
///
|
||||
static BinaryOperator *CreateExactUDiv(Value *V1, Value *V2,
|
||||
const Twine &Name = "") {
|
||||
BinaryOperator *BO = CreateUDiv(V1, V2, Name);
|
||||
BO->setIsExact(true);
|
||||
return BO;
|
||||
}
|
||||
static BinaryOperator *CreateExactUDiv(Value *V1, Value *V2,
|
||||
const Twine &Name, BasicBlock *BB) {
|
||||
BinaryOperator *BO = CreateUDiv(V1, V2, Name, BB);
|
||||
BO->setIsExact(true);
|
||||
return BO;
|
||||
}
|
||||
static BinaryOperator *CreateExactUDiv(Value *V1, Value *V2,
|
||||
const Twine &Name, Instruction *I) {
|
||||
BinaryOperator *BO = CreateUDiv(V1, V2, Name, I);
|
||||
BO->setIsExact(true);
|
||||
return BO;
|
||||
}
|
||||
|
||||
/// CreateExactSDiv - Create an SDiv operator with the exact flag set.
|
||||
///
|
||||
static BinaryOperator *CreateExactSDiv(Value *V1, Value *V2,
|
||||
|
@ -228,7 +228,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/// UDivOperator - An Operator with opcode Instruction::SDiv.
|
||||
/// UDivOperator - An Operator with opcode Instruction::UDiv.
|
||||
///
|
||||
class UDivOperator : public PossiblyExactOperator {
|
||||
public:
|
||||
|
@ -72,6 +72,9 @@ public:
|
||||
Constant *CreateUDiv(Constant *LHS, Constant *RHS) const {
|
||||
return ConstantExpr::getUDiv(LHS, RHS);
|
||||
}
|
||||
Constant *CreateExactUDiv(Constant *LHS, Constant *RHS) const {
|
||||
return ConstantExpr::getExactUDiv(LHS, RHS);
|
||||
}
|
||||
Constant *CreateSDiv(Constant *LHS, Constant *RHS) const {
|
||||
return ConstantExpr::getSDiv(LHS, RHS);
|
||||
}
|
||||
|
@ -527,6 +527,12 @@ public:
|
||||
return Insert(Folder.CreateUDiv(LC, RC), Name);
|
||||
return Insert(BinaryOperator::CreateUDiv(LHS, RHS), Name);
|
||||
}
|
||||
Value *CreateExactUDiv(Value *LHS, Value *RHS, const Twine &Name = "") {
|
||||
if (Constant *LC = dyn_cast<Constant>(LHS))
|
||||
if (Constant *RC = dyn_cast<Constant>(RHS))
|
||||
return Insert(Folder.CreateExactUDiv(LC, RC), Name);
|
||||
return Insert(BinaryOperator::CreateExactUDiv(LHS, RHS), Name);
|
||||
}
|
||||
Value *CreateSDiv(Value *LHS, Value *RHS, const Twine &Name = "") {
|
||||
if (Constant *LC = dyn_cast<Constant>(LHS))
|
||||
if (Constant *RC = dyn_cast<Constant>(RHS))
|
||||
|
@ -77,6 +77,9 @@ public:
|
||||
Instruction *CreateUDiv(Constant *LHS, Constant *RHS) const {
|
||||
return BinaryOperator::CreateUDiv(LHS, RHS);
|
||||
}
|
||||
Instruction *CreateExactUDiv(Constant *LHS, Constant *RHS) const {
|
||||
return BinaryOperator::CreateExactUDiv(LHS, RHS);
|
||||
}
|
||||
Instruction *CreateSDiv(Constant *LHS, Constant *RHS) const {
|
||||
return BinaryOperator::CreateSDiv(LHS, RHS);
|
||||
}
|
||||
|
@ -85,6 +85,9 @@ public:
|
||||
Constant *CreateUDiv(Constant *LHS, Constant *RHS) const {
|
||||
return Fold(ConstantExpr::getUDiv(LHS, RHS));
|
||||
}
|
||||
Constant *CreateExactUDiv(Constant *LHS, Constant *RHS) const {
|
||||
return Fold(ConstantExpr::getExactUDiv(LHS, RHS));
|
||||
}
|
||||
Constant *CreateSDiv(Constant *LHS, Constant *RHS) const {
|
||||
return Fold(ConstantExpr::getSDiv(LHS, RHS));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user