about summary refs log tree commit diff homepage
path: root/lib/Module/Optimize.cpp
diff options
context:
space:
mode:
authorRichard Trembecký <richardt@centrum.sk>2016-05-01 16:38:21 +0200
committerDan Liew <delcypher@gmail.com>2017-05-24 14:24:47 +0100
commitd3a467d8999e6e52892b13c2bc93ac829ee1b7c9 (patch)
tree99493da4b33f50eb0c27a237213c615520efbd95 /lib/Module/Optimize.cpp
parent92367dec2ee00cb708454e4c33ff34d80eddb878 (diff)
downloadklee-d3a467d8999e6e52892b13c2bc93ac829ee1b7c9.tar.gz
llvm: make KLEE compile against LLVM 3.5 and 3.6
Based on work by @ccadeptic23 and @delcypher.
Formatting fixed by @snf.
Fix compiler warning by @martijnthe.
Further fixes by @mchalupa.

Refactored, so that changes can be reviewed -- no massive changes in
whitespace and in the surrounding code.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Diffstat (limited to 'lib/Module/Optimize.cpp')
-rw-r--r--lib/Module/Optimize.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/Module/Optimize.cpp b/lib/Module/Optimize.cpp
index 3d9c8cc1..c0f3f34c 100644
--- a/lib/Module/Optimize.cpp
+++ b/lib/Module/Optimize.cpp
@@ -172,15 +172,17 @@ void Optimize(Module *M, const std::string &EntryPoint) {
   if (VerifyEach)
     Passes.add(createVerifierPass());
 
-#if LLVM_VERSION_CODE <= LLVM_VERSION(3, 1)
-  // Add an appropriate TargetData instance for this module...
-  addPass(Passes, new TargetData(M));
-#elif LLVM_VERSION_CODE < LLVM_VERSION(3, 5)
   // Add an appropriate DataLayout instance for this module...
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
+  DataLayoutPass *dlpass = new DataLayoutPass();
+  dlpass->doInitialization(*M);
+  addPass(Passes, dlpass);
+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5)
+  addPass(Passes, new DataLayoutPass(M));
+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 2)
   addPass(Passes, new DataLayout(M));
 #else
-  // Add an appropriate DataLayout instance for this module...
-  addPass(Passes, new DataLayoutPass(M));
+  addPass(Passes, new TargetData(M));
 #endif
 
   // DWD - Run the opt standard pass list as well.