about summary refs log tree commit diff homepage
path: root/lib/Core
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2017-02-22 15:57:55 +0100
committerMartinNowack <martin.nowack@gmail.com>2018-09-14 09:59:29 +0100
commitc27f225e79b82d3de4f70578cb80d0603fbff6f1 (patch)
tree2876832b7148c93bb6b835f8265382a9f56061ae /lib/Core
parentc97526d0fff13e098b284369e2fc40c256b268d5 (diff)
downloadklee-c27f225e79b82d3de4f70578cb80d0603fbff6f1.tar.gz
llvm: make KLEE compile against LLVM 3.9
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Diffstat (limited to 'lib/Core')
-rw-r--r--lib/Core/Executor.cpp16
-rw-r--r--lib/Core/MemoryManager.cpp5
2 files changed, 20 insertions, 1 deletions
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
index b053d488..7f69a618 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -1338,10 +1338,18 @@ void Executor::executeCall(ExecutionState &state,
           //
           // Alignment requirements for scalar types is the same as their size
           if (argWidth > Expr::Int64) {
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9)
+             size = llvm::alignTo(size, 16);
+#else
              size = llvm::RoundUpToAlignment(size, 16);
+#endif
              requires16ByteAlignment = true;
           }
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9)
+          size += llvm::alignTo(argWidth, WordSize) / 8;
+#else
           size += llvm::RoundUpToAlignment(argWidth, WordSize) / 8;
+#endif
         }
       }
 
@@ -1374,10 +1382,18 @@ void Executor::executeCall(ExecutionState &state,
 
             Expr::Width argWidth = arguments[i]->getWidth();
             if (argWidth > Expr::Int64) {
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9)
+              offset = llvm::alignTo(offset, 16);
+#else
               offset = llvm::RoundUpToAlignment(offset, 16);
+#endif
             }
             os->write(offset, arguments[i]);
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9)
+            offset += llvm::alignTo(argWidth, WordSize) / 8;
+#else
             offset += llvm::RoundUpToAlignment(argWidth, WordSize) / 8;
+#endif
           }
         }
       }
diff --git a/lib/Core/MemoryManager.cpp b/lib/Core/MemoryManager.cpp
index 24e2ed97..f40e8bc9 100644
--- a/lib/Core/MemoryManager.cpp
+++ b/lib/Core/MemoryManager.cpp
@@ -111,9 +111,12 @@ MemoryObject *MemoryManager::allocate(uint64_t size, bool isLocal,
 
   uint64_t address = 0;
   if (DeterministicAllocation) {
-
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9)
+    address = llvm::alignTo((uint64_t)nextFreeSlot + alignment - 1, alignment);
+#else
     address = llvm::RoundUpToAlignment((uint64_t)nextFreeSlot + alignment - 1,
                                        alignment);
+#endif
 
     // Handle the case of 0-sized allocations as 1-byte allocations.
     // This way, we make sure we have this allocation between its own red zones