<p dir="ltr">Looks good to me. </p>
<p dir="ltr">If we're going to start requiring the newest llvm explicitly (used to be an implicit requirement), do we want to eventually consider cutting a branch before bumping the llvm version (or tied to the llvm release schedule)?</p>
<p dir="ltr">Maybe it's more appropriate to start cutting releases when we have full support for CL 1.0/1.1.</p>
<p dir="ltr">--Aaron</p>
<div class="gmail_quote">On Dec 23, 2014 12:54 PM, "Tom Stellard" <<a href="mailto:thomas.stellard@amd.com">thomas.stellard@amd.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Some functions are implemented using hand-written LLVM IR and<br>
LLVM assembly format is allowed to change between versions, so we<br>
need to start tieing libclc to a specific version of LLVM.<br>
---<br>
configure.py | 12 ++++++-----<br>
utils/prepare-builtins.cpp | 51 ++--------------------------------------------<br>
2 files changed, 9 insertions(+), 54 deletions(-)<br>
<br>
diff --git a/configure.py b/configure.py<br>
index 7170f46..d962244 100755<br>
--- a/configure.py<br>
+++ b/configure.py<br>
@@ -5,8 +5,8 @@ def c_compiler_rule(b, name, description, compiler, flags):<br>
b.rule(name, command, description + " $out", depfile="$out.d")<br>
<br>
version_major = 0;<br>
-version_minor = 0;<br>
-version_patch = 1;<br>
+version_minor = 1;<br>
+version_patch = 0;<br>
<br>
from optparse import OptionParser<br>
import os<br>
@@ -64,9 +64,11 @@ def llvm_config(args):<br>
sys.exit(1)<br>
<br>
llvm_version = string.split(string.replace(llvm_config(['--version']), 'svn', ''), '.')<br>
-llvm_system_libs = ''<br>
-if (int(llvm_version[0]) == 3 and int(llvm_version[1]) >= 5) or int(llvm_version[0]) > 3:<br>
- llvm_system_libs = llvm_config(['--system-libs'])<br>
+if (int(llvm_version[0]) != 3 and int(llvm_version[1]) != 6):<br>
+ print "libclc requires LLVM 3.6"<br>
+ sys.exit(1)<br>
+<br>
+llvm_system_libs = llvm_config(['--system-libs'])<br>
llvm_bindir = llvm_config(['--bindir'])<br>
llvm_core_libs = llvm_config(['--libs', 'core', 'bitreader', 'bitwriter']) + ' ' + \<br>
llvm_system_libs + ' ' + \<br>
diff --git a/utils/prepare-builtins.cpp b/utils/prepare-builtins.cpp<br>
index ee51edf..a3c3383 100644<br>
--- a/utils/prepare-builtins.cpp<br>
+++ b/utils/prepare-builtins.cpp<br>
@@ -12,25 +12,8 @@<br>
#include "llvm/Support/ToolOutputFile.h"<br>
#include "llvm/Config/llvm-config.h"<br>
<br>
-#define LLVM_360_AND_NEWER \<br>
- (LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 6))<br>
-<br>
-#define LLVM_350_AND_NEWER \<br>
- (LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 5))<br>
-<br>
-#if LLVM_350_AND_NEWER<br>
#include <system_error><br>
<br>
-#define ERROR_CODE std::error_code<br>
-#define UNIQUE_PTR std::unique_ptr<br>
-#else<br>
-#include "llvm/ADT/OwningPtr.h"<br>
-#include "llvm/Support/system_error.h"<br>
-<br>
-#define ERROR_CODE error_code<br>
-#define UNIQUE_PTR OwningPtr<br>
-#endif<br>
-<br>
using namespace llvm;<br>
<br>
static cl::opt<std::string><br>
@@ -50,30 +33,17 @@ int main(int argc, char **argv) {<br>
std::auto_ptr<Module> M;<br>
<br>
{<br>
-#if LLVM_350_AND_NEWER<br>
ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr =<br>
MemoryBuffer::getFile(InputFilename);<br>
std::unique_ptr<MemoryBuffer> &BufferPtr = BufferOrErr.get();<br>
if (std::error_code ec = BufferOrErr.getError())<br>
-#else<br>
- UNIQUE_PTR<MemoryBuffer> BufferPtr;<br>
- if (ERROR_CODE ec = MemoryBuffer::getFileOrSTDIN(InputFilename, BufferPtr))<br>
-#endif<br>
ErrorMessage = ec.message();<br>
else {<br>
-#if LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR > 4)<br>
-# if LLVM_360_AND_NEWER<br>
ErrorOr<Module *> ModuleOrErr =<br>
parseBitcodeFile(BufferPtr.get()->getMemBufferRef(), Context);<br>
-# else<br>
- ErrorOr<Module *> ModuleOrErr = parseBitcodeFile(BufferPtr.get(), Context);<br>
-# endif<br>
- if (ERROR_CODE ec = ModuleOrErr.getError())<br>
+ if (std::error_code ec = ModuleOrErr.getError())<br>
ErrorMessage = ec.message();<br>
M.reset(ModuleOrErr.get());<br>
-#else<br>
- M.reset(ParseBitcodeFile(BufferPtr.get(), Context, &ErrorMessage));<br>
-#endif<br>
}<br>
}<br>
<br>
@@ -103,30 +73,13 @@ int main(int argc, char **argv) {<br>
return 1;<br>
}<br>
<br>
-#if LLVM_360_AND_NEWER<br>
std::error_code EC;<br>
- UNIQUE_PTR<tool_output_file> Out<br>
+ std::unique_ptr<tool_output_file> Out<br>
(new tool_output_file(OutputFilename, EC, sys::fs::F_None));<br>
if (EC) {<br>
errs() << EC.message() << '\n';<br>
exit(1);<br>
}<br>
-#else<br>
- std::string ErrorInfo;<br>
- UNIQUE_PTR<tool_output_file> Out<br>
- (new tool_output_file(OutputFilename.c_str(), ErrorInfo,<br>
-#if (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR == 4)<br>
- sys::fs::F_Binary));<br>
-#elif LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 5)<br>
- sys::fs::F_None));<br>
-#else<br>
- raw_fd_ostream::F_Binary));<br>
-#endif<br>
- if (!ErrorInfo.empty()) {<br>
- errs() << ErrorInfo << '\n';<br>
- exit(1);<br>
- }<br>
-#endif // LLVM_360_AND_NEWER<br>
<br>
WriteBitcodeToFile(M.get(), Out->os());<br>
<br>
--<br>
1.8.5.5<br>
<br>
<br>
_______________________________________________<br>
Libclc-dev mailing list<br>
<a href="mailto:Libclc-dev@pcc.me.uk">Libclc-dev@pcc.me.uk</a><br>
<a href="http://www.pcc.me.uk/cgi-bin/mailman/listinfo/libclc-dev" target="_blank">http://www.pcc.me.uk/cgi-bin/mailman/listinfo/libclc-dev</a><br>
</blockquote></div>