summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Instruction.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-02-15 23:15:00 +0000
committerChris Lattner <sabre@nondot.org>2007-02-15 23:15:00 +0000
commitc992e18f8d315dd09a002d32bb614bf71888fdff (patch)
tree7bd96f65ecea9ad9a70c24793f1f1815c58b159e /llvm/lib/VMCore/Instruction.cpp
parent99c6cf60f136b3f24fc407866094001cd069fc77 (diff)
downloadbcm5719-llvm-c992e18f8d315dd09a002d32bb614bf71888fdff.tar.gz
bcm5719-llvm-c992e18f8d315dd09a002d32bb614bf71888fdff.zip
make mayWriteToMemory a non-virtual function
llvm-svn: 34334
Diffstat (limited to 'llvm/lib/VMCore/Instruction.cpp')
-rw-r--r--llvm/lib/VMCore/Instruction.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Instruction.cpp b/llvm/lib/VMCore/Instruction.cpp
index 39a895510ae..e02af07937a 100644
--- a/llvm/lib/VMCore/Instruction.cpp
+++ b/llvm/lib/VMCore/Instruction.cpp
@@ -225,6 +225,25 @@ bool Instruction::isSameOperationAs(Instruction *I) const {
return true;
}
+/// mayWriteToMemory - Return true if this instruction may modify memory.
+///
+bool Instruction::mayWriteToMemory() const {
+ switch (getOpcode()) {
+ default: return false;
+ case Instruction::Free:
+ case Instruction::Store:
+ case Instruction::Invoke:
+ case Instruction::VAArg:
+ return true;
+ case Instruction::Call:
+ if (const IntrinsicInst *II = dyn_cast<IntrinsicInst>(this)) {
+ // If the intrinsic doesn't write memory, it is safe.
+ }
+ return true;
+ case Instruction::Load:
+ return cast<LoadInst>(this)->isVolatile();
+ }
+}
/// isAssociative - Return true if the instruction is associative:
///
OpenPOWER on IntegriCloud