[llvm-commits] CVS: llvm/lib/VMCore/Instruction.cpp
Chris Lattner
sabre at nondot.org
Thu Feb 15 15:15:21 PST 2007
Changes in directory llvm/lib/VMCore:
Instruction.cpp updated: 1.65 -> 1.66
---
Log message:
make mayWriteToMemory a non-virtual function
---
Diffs of the changes: (+19 -0)
Instruction.cpp | 19 +++++++++++++++++++
1 files changed, 19 insertions(+)
Index: llvm/lib/VMCore/Instruction.cpp
diff -u llvm/lib/VMCore/Instruction.cpp:1.65 llvm/lib/VMCore/Instruction.cpp:1.66
--- llvm/lib/VMCore/Instruction.cpp:1.65 Tue Feb 13 01:54:42 2007
+++ llvm/lib/VMCore/Instruction.cpp Thu Feb 15 17:15:00 2007
@@ -225,6 +225,25 @@
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:
///
More information about the llvm-commits
mailing list