aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2007-12-17 21:53:30 +0000
committerBill Wendling <isanbard@gmail.com>2007-12-17 21:53:30 +0000
commitc42fce0c17cb7425b08d6026a60307f7fee0bb66 (patch)
tree79e6c1d0405487531209398113f7bf748c943265
parent9febdd29c644bfda4e2c18d906618634dc03ad8d (diff)
downloadexternal_llvm-c42fce0c17cb7425b08d6026a60307f7fee0bb66.zip
external_llvm-c42fce0c17cb7425b08d6026a60307f7fee0bb66.tar.gz
external_llvm-c42fce0c17cb7425b08d6026a60307f7fee0bb66.tar.bz2
Add "hasSideEffects" method to MachineInstrInfo class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45126 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Target/TargetInstrInfo.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/llvm/Target/TargetInstrInfo.h b/include/llvm/Target/TargetInstrInfo.h
index 28a08b2..9b77649 100644
--- a/include/llvm/Target/TargetInstrInfo.h
+++ b/include/llvm/Target/TargetInstrInfo.h
@@ -314,6 +314,15 @@ public:
isReallyTriviallyReMaterializable(MI);
}
+ /// hasSideEffects - Returns true if the instruction has side effects that are
+ /// not captured by any operands of the instruction or other flags.
+ bool hasSideEffects(MachineInstr *MI) const {
+ const TargetInstrDescriptor *TID = MI->getInstrDescriptor();
+ if (!(TID->Flags & M_NEVER_HAS_SIDE_EFFECTS ||
+ TID->Flags & M_MAY_HAVE_SIDE_EFFECTS)) return true;
+ if (TID->Flags & M_NEVER_HAS_SIDE_EFFECTS) return false;
+ return !isReallySideEffectFree(MI); // May have side effects
+ }
protected:
/// isReallyTriviallyReMaterializable - For instructions with opcodes for
/// which the M_REMATERIALIZABLE flag is set, this function tests whether the
@@ -329,7 +338,7 @@ protected:
/// isReallySideEffectFree - If the M_MAY_HAVE_SIDE_EFFECTS flag is set, this
/// method is called to determine if the specific instance of this
- /// instructions has side effects. This is useful in cases of instructions,
+ /// instruction has side effects. This is useful in cases of instructions,
/// like loads, which generally always have side effects. A load from a
/// constant pool doesn't have side effects, though. So we need to
/// differentiate it from the general case.