diff options
author | Dan Gohman <gohman@apple.com> | 2009-08-11 17:05:24 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-08-11 17:05:24 +0000 |
commit | 59c4f5c2fc82af14b0f4f332709aac62921c6177 (patch) | |
tree | 5292327d7cd9f9a067e7687645fbcf3df77d9b82 /include/llvm/InstrTypes.h | |
parent | d30658c3ffd1e33e98b82750202a9375bf5963ed (diff) | |
download | llvm-59c4f5c2fc82af14b0f4f332709aac62921c6177.tar.gz llvm-59c4f5c2fc82af14b0f4f332709aac62921c6177.tar.bz2 llvm-59c4f5c2fc82af14b0f4f332709aac62921c6177.tar.xz |
Add convenience functions for creating exact sdiv operators, and
use them in CreatePtrDiff.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78682 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/InstrTypes.h')
-rw-r--r-- | include/llvm/InstrTypes.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/llvm/InstrTypes.h b/include/llvm/InstrTypes.h index 550849bc8a..771e9f799b 100644 --- a/include/llvm/InstrTypes.h +++ b/include/llvm/InstrTypes.h @@ -18,6 +18,7 @@ #include "llvm/Instruction.h" #include "llvm/OperandTraits.h" +#include "llvm/Operator.h" #include "llvm/DerivedTypes.h" namespace llvm { @@ -195,6 +196,27 @@ public: #include "llvm/Instruction.def" + /// CreateExactSDiv - Create an SDiv operator with the exact flag set. + /// + static BinaryOperator *CreateExactSDiv(Value *V1, Value *V2, + const Twine &Name = "") { + BinaryOperator *BO = CreateSDiv(V1, V2, Name); + 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); + 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); + cast<SDivOperator>(BO)->setIsExact(true); + return BO; + } + /// Helper functions to construct and inspect unary operations (NEG and NOT) /// via binary operators SUB and XOR: /// |