Added function to determine if an Instruction may trap.
llvm-svn: 7442
diff --git a/llvm/lib/VMCore/Instruction.cpp b/llvm/lib/VMCore/Instruction.cpp
index ce1423a..a1ccddf 100644
--- a/llvm/lib/VMCore/Instruction.cpp
+++ b/llvm/lib/VMCore/Instruction.cpp
@@ -137,3 +137,20 @@
return false;
}
}
+
+
+/// isTrappingInstruction - Return true if the instruction may trap.
+///
+bool Instruction::isTrappingInstruction(unsigned op) {
+ switch(op) {
+ case Div:
+ case Rem:
+ case Load:
+ case Store:
+ case Call:
+ case Invoke:
+ return true;
+ default:
+ return false;
+ }
+}