diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2009-07-17 04:28:42 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2009-07-17 04:28:42 +0000 |
commit | 0b79a7727d68a507837e827803859424cf3d997b (patch) | |
tree | 660f0ded255f727b4f60161a752eec3bad39b6e4 /include/llvm/Instruction.h | |
parent | 6055a6adb792f857fe04d8880a6cfb8914828046 (diff) | |
download | external_llvm-0b79a7727d68a507837e827803859424cf3d997b.zip external_llvm-0b79a7727d68a507837e827803859424cf3d997b.tar.gz external_llvm-0b79a7727d68a507837e827803859424cf3d997b.tar.bz2 |
Replace isTrapping with a new, similar method called
isSafeToSpeculativelyExecute. The new method is a bit closer to what
the callers actually care about in that it rejects more things callers
don't want. It also adds more precise handling for integer
division, and unifies code for analyzing the legality of a speculative
load.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76150 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Instruction.h')
-rw-r--r-- | include/llvm/Instruction.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/include/llvm/Instruction.h b/include/llvm/Instruction.h index e06ae2d..1d1f0f4 100644 --- a/include/llvm/Instruction.h +++ b/include/llvm/Instruction.h @@ -168,13 +168,6 @@ public: bool isCommutative() const { return isCommutative(getOpcode()); } static bool isCommutative(unsigned op); - /// isTrapping - Return true if the instruction may trap. - /// - bool isTrapping() const { - return isTrapping(getOpcode()); - } - static bool isTrapping(unsigned op); - /// mayWriteToMemory - Return true if this instruction may modify memory. /// bool mayWriteToMemory() const; @@ -193,6 +186,17 @@ public: return mayWriteToMemory() || mayThrow(); } + /// isSafeToSpeculativelyExecute - Return true if the instruction does not + /// have any effects besides calculating the result and does not have + /// undefined behavior. Unlike in mayHaveSideEffects(), allocating memory + /// is considered an effect. + /// + /// This method only looks at the instruction itself and its operands, so if + /// this method returns true, it is safe to move the instruction as long as + /// the operands still dominate it. However, care must be taken with + /// instructions which read memory. + bool isSafeToSpeculativelyExecute() const; + /// Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const Instruction *) { return true; } static inline bool classof(const Value *V) { |