[libclc] r225041 - Require LLVM 3.6 and bump version to 0.1.0

Tom Stellard thomas.stellard at amd.com
Wed Dec 31 07:27:53 PST 2014


Author: tstellar
Date: Wed Dec 31 09:27:53 2014
New Revision: 225041

URL: http://llvm.org/viewvc/llvm-project?rev=225041&view=rev
Log:
Require LLVM 3.6 and bump version to 0.1.0

Some functions are implemented using hand-written LLVM IR, and
LLVM assembly format is allowed to change between versions, so we
should require a specific version of LLVM.

Modified:
    libclc/trunk/configure.py
    libclc/trunk/utils/prepare-builtins.cpp

Modified: libclc/trunk/configure.py
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/configure.py?rev=225041&r1=225040&r2=225041&view=diff
==============================================================================
--- libclc/trunk/configure.py (original)
+++ libclc/trunk/configure.py Wed Dec 31 09:27:53 2014
@@ -5,8 +5,8 @@ def c_compiler_rule(b, name, description
   b.rule(name, command, description + " $out", depfile="$out.d")
 
 version_major = 0;
-version_minor = 0;
-version_patch = 1;
+version_minor = 1;
+version_patch = 0;
 
 from optparse import OptionParser
 import os
@@ -64,9 +64,11 @@ def llvm_config(args):
     sys.exit(1)
 
 llvm_version = string.split(string.replace(llvm_config(['--version']), 'svn', ''), '.')
-llvm_system_libs = ''
-if (int(llvm_version[0]) == 3 and int(llvm_version[1]) >= 5) or int(llvm_version[0]) > 3:
-    llvm_system_libs = llvm_config(['--system-libs'])
+if (int(llvm_version[0]) != 3 and int(llvm_version[1]) != 6):
+    print "libclc requires LLVM 3.6"
+    sys.exit(1)
+
+llvm_system_libs = llvm_config(['--system-libs'])
 llvm_bindir = llvm_config(['--bindir'])
 llvm_core_libs = llvm_config(['--libs', 'core', 'bitreader', 'bitwriter']) + ' ' + \
                  llvm_system_libs + ' ' + \

Modified: libclc/trunk/utils/prepare-builtins.cpp
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/utils/prepare-builtins.cpp?rev=225041&r1=225040&r2=225041&view=diff
==============================================================================
--- libclc/trunk/utils/prepare-builtins.cpp (original)
+++ libclc/trunk/utils/prepare-builtins.cpp Wed Dec 31 09:27:53 2014
@@ -12,25 +12,8 @@
 #include "llvm/Support/ToolOutputFile.h"
 #include "llvm/Config/llvm-config.h"
 
-#define LLVM_360_AND_NEWER \
-  (LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 6))
-
-#define LLVM_350_AND_NEWER \
-  (LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 5))
-
-#if LLVM_350_AND_NEWER
 #include <system_error>
 
-#define ERROR_CODE std::error_code
-#define UNIQUE_PTR std::unique_ptr
-#else
-#include "llvm/ADT/OwningPtr.h"
-#include "llvm/Support/system_error.h"
-
-#define ERROR_CODE error_code
-#define UNIQUE_PTR OwningPtr
-#endif
-
 using namespace llvm;
 
 static cl::opt<std::string>
@@ -50,30 +33,17 @@ int main(int argc, char **argv) {
   std::auto_ptr<Module> M;
 
   {
-#if LLVM_350_AND_NEWER
     ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr =
       MemoryBuffer::getFile(InputFilename);
     std::unique_ptr<MemoryBuffer> &BufferPtr = BufferOrErr.get();
     if (std::error_code  ec = BufferOrErr.getError())
-#else
-    UNIQUE_PTR<MemoryBuffer> BufferPtr;
-    if (ERROR_CODE ec = MemoryBuffer::getFileOrSTDIN(InputFilename, BufferPtr))
-#endif
       ErrorMessage = ec.message();
     else {
-#if LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR > 4)
-# if LLVM_360_AND_NEWER
       ErrorOr<Module *> ModuleOrErr =
 	parseBitcodeFile(BufferPtr.get()->getMemBufferRef(), Context);
-# else
-      ErrorOr<Module *> ModuleOrErr = parseBitcodeFile(BufferPtr.get(), Context);
-# endif
-      if (ERROR_CODE ec = ModuleOrErr.getError())
+      if (std::error_code ec = ModuleOrErr.getError())
         ErrorMessage = ec.message();
       M.reset(ModuleOrErr.get());
-#else
-      M.reset(ParseBitcodeFile(BufferPtr.get(), Context, &ErrorMessage));
-#endif
     }
   }
 
@@ -103,30 +73,13 @@ int main(int argc, char **argv) {
     return 1;
   }
 
-#if LLVM_360_AND_NEWER
   std::error_code EC;
-  UNIQUE_PTR<tool_output_file> Out
+  std::unique_ptr<tool_output_file> Out
   (new tool_output_file(OutputFilename, EC, sys::fs::F_None));
   if (EC) {
     errs() << EC.message() << '\n';
     exit(1);
   }
-#else
-  std::string ErrorInfo;
-  UNIQUE_PTR<tool_output_file> Out
-  (new tool_output_file(OutputFilename.c_str(), ErrorInfo,
-#if (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR == 4)
-                        sys::fs::F_Binary));
-#elif LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 5)
-                        sys::fs::F_None));
-#else
-                        raw_fd_ostream::F_Binary));
-#endif
-  if (!ErrorInfo.empty()) {
-    errs() << ErrorInfo << '\n';
-    exit(1);
-  }
-#endif // LLVM_360_AND_NEWER
 
   WriteBitcodeToFile(M.get(), Out->os());
 





More information about the cfe-commits mailing list