about summary refs log tree commit diff homepage
path: root/lib
diff options
context:
space:
mode:
authorRafael Zaehl <rafael.zaehl@rwth-aachen.de>2018-09-29 17:24:06 +0200
committerMartinNowack <martin.nowack@gmail.com>2018-10-24 10:08:19 +0100
commit7120c775037c911848fa634ae6398baf577d5650 (patch)
tree5f646355aa5c9801235e62b4452138f9b91985f7 /lib
parent2b34877c5dbf24eabf331a124b1e68d901a72cba (diff)
downloadklee-7120c775037c911848fa634ae6398baf577d5650.tar.gz
Added lowering pass
Diffstat (limited to 'lib')
-rw-r--r--lib/Core/Executor.cpp9
-rw-r--r--lib/Module/KModule.cpp3
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
index 0506b685..7c4ee23a 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -2566,6 +2566,15 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
     // instructions.
     terminateStateOnExecError(state, "Unexpected ShuffleVector instruction");
     break;
+  case Instruction::AtomicRMW:
+    terminateStateOnExecError(state, "Unexpected Atomic instruction, should be "
+                                     "lowered by LowerAtomicInstructionPass");
+    break;
+  case Instruction::AtomicCmpXchg:
+    terminateStateOnExecError(state,
+                              "Unexpected AtomicCmpXchg instruction, should be "
+                              "lowered by LowerAtomicInstructionPass");
+    break;
   // Other instructions...
   // Unhandled
   default:
diff --git a/lib/Module/KModule.cpp b/lib/Module/KModule.cpp
index 7b02c856..b025c888 100644
--- a/lib/Module/KModule.cpp
+++ b/lib/Module/KModule.cpp
@@ -224,6 +224,9 @@ void KModule::instrument(const Interpreter::ModuleOptions &opts) {
   // NOTE: Must come before division/overshift checks because those passes
   // don't know how to handle vector instructions.
   pm.add(createScalarizerPass());
+
+  // This pass will replace atomic instructions with non-atomic operations
+  pm.add(createLowerAtomicPass());
   if (opts.CheckDivZero) pm.add(new DivCheckPass());
   if (opts.CheckOvershift) pm.add(new OvershiftCheckPass());