summaryrefslogtreecommitdiff
path: root/lib/VMCore
diff options
context:
space:
mode:
authorTanya Lattner <tonic@nondot.org>2003-07-31 04:05:50 +0000
committerTanya Lattner <tonic@nondot.org>2003-07-31 04:05:50 +0000
commit741bb0019de9aa28a731b4eef2422a3397f99cd0 (patch)
treee34afdf407d76effeee66cf18ee23db83a5bfeec /lib/VMCore
parent0ad1361837d69b388e0e108862e5eadbde7ea682 (diff)
downloadllvm-741bb0019de9aa28a731b4eef2422a3397f99cd0.tar.gz
llvm-741bb0019de9aa28a731b4eef2422a3397f99cd0.tar.bz2
llvm-741bb0019de9aa28a731b4eef2422a3397f99cd0.tar.xz
Added function to determine if an Instruction may trap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7442 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/Instruction.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/VMCore/Instruction.cpp b/lib/VMCore/Instruction.cpp
index ce1423a863..a1ccddf416 100644
--- a/lib/VMCore/Instruction.cpp
+++ b/lib/VMCore/Instruction.cpp
@@ -137,3 +137,20 @@ bool Instruction::isCommutative(unsigned op) {
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;
+ }
+}