Skip to content

Commit 1d77071

Browse files
committed
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. llvm-svn: 225041
1 parent 6797855 commit 1d77071

File tree

2 files changed

+9
-54
lines changed

2 files changed

+9
-54
lines changed

libclc/configure.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ def c_compiler_rule(b, name, description, compiler, flags):
55
b.rule(name, command, description + " $out", depfile="$out.d")
66

77
version_major = 0;
8-
version_minor = 0;
9-
version_patch = 1;
8+
version_minor = 1;
9+
version_patch = 0;
1010

1111
from optparse import OptionParser
1212
import os
@@ -64,9 +64,11 @@ def llvm_config(args):
6464
sys.exit(1)
6565

6666
llvm_version = string.split(string.replace(llvm_config(['--version']), 'svn', ''), '.')
67-
llvm_system_libs = ''
68-
if (int(llvm_version[0]) == 3 and int(llvm_version[1]) >= 5) or int(llvm_version[0]) > 3:
69-
llvm_system_libs = llvm_config(['--system-libs'])
67+
if (int(llvm_version[0]) != 3 and int(llvm_version[1]) != 6):
68+
print "libclc requires LLVM 3.6"
69+
sys.exit(1)
70+
71+
llvm_system_libs = llvm_config(['--system-libs'])
7072
llvm_bindir = llvm_config(['--bindir'])
7173
llvm_core_libs = llvm_config(['--libs', 'core', 'bitreader', 'bitwriter']) + ' ' + \
7274
llvm_system_libs + ' ' + \

libclc/utils/prepare-builtins.cpp

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,8 @@
1212
#include "llvm/Support/ToolOutputFile.h"
1313
#include "llvm/Config/llvm-config.h"
1414

15-
#define LLVM_360_AND_NEWER \
16-
(LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 6))
17-
18-
#define LLVM_350_AND_NEWER \
19-
(LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 5))
20-
21-
#if LLVM_350_AND_NEWER
2215
#include <system_error>
2316

24-
#define ERROR_CODE std::error_code
25-
#define UNIQUE_PTR std::unique_ptr
26-
#else
27-
#include "llvm/ADT/OwningPtr.h"
28-
#include "llvm/Support/system_error.h"
29-
30-
#define ERROR_CODE error_code
31-
#define UNIQUE_PTR OwningPtr
32-
#endif
33-
3417
using namespace llvm;
3518

3619
static cl::opt<std::string>
@@ -50,30 +33,17 @@ int main(int argc, char **argv) {
5033
std::auto_ptr<Module> M;
5134

5235
{
53-
#if LLVM_350_AND_NEWER
5436
ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr =
5537
MemoryBuffer::getFile(InputFilename);
5638
std::unique_ptr<MemoryBuffer> &BufferPtr = BufferOrErr.get();
5739
if (std::error_code ec = BufferOrErr.getError())
58-
#else
59-
UNIQUE_PTR<MemoryBuffer> BufferPtr;
60-
if (ERROR_CODE ec = MemoryBuffer::getFileOrSTDIN(InputFilename, BufferPtr))
61-
#endif
6240
ErrorMessage = ec.message();
6341
else {
64-
#if LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR > 4)
65-
# if LLVM_360_AND_NEWER
6642
ErrorOr<Module *> ModuleOrErr =
6743
parseBitcodeFile(BufferPtr.get()->getMemBufferRef(), Context);
68-
# else
69-
ErrorOr<Module *> ModuleOrErr = parseBitcodeFile(BufferPtr.get(), Context);
70-
# endif
71-
if (ERROR_CODE ec = ModuleOrErr.getError())
44+
if (std::error_code ec = ModuleOrErr.getError())
7245
ErrorMessage = ec.message();
7346
M.reset(ModuleOrErr.get());
74-
#else
75-
M.reset(ParseBitcodeFile(BufferPtr.get(), Context, &ErrorMessage));
76-
#endif
7747
}
7848
}
7949

@@ -103,30 +73,13 @@ int main(int argc, char **argv) {
10373
return 1;
10474
}
10575

106-
#if LLVM_360_AND_NEWER
10776
std::error_code EC;
108-
UNIQUE_PTR<tool_output_file> Out
77+
std::unique_ptr<tool_output_file> Out
10978
(new tool_output_file(OutputFilename, EC, sys::fs::F_None));
11079
if (EC) {
11180
errs() << EC.message() << '\n';
11281
exit(1);
11382
}
114-
#else
115-
std::string ErrorInfo;
116-
UNIQUE_PTR<tool_output_file> Out
117-
(new tool_output_file(OutputFilename.c_str(), ErrorInfo,
118-
#if (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR == 4)
119-
sys::fs::F_Binary));
120-
#elif LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 5)
121-
sys::fs::F_None));
122-
#else
123-
raw_fd_ostream::F_Binary));
124-
#endif
125-
if (!ErrorInfo.empty()) {
126-
errs() << ErrorInfo << '\n';
127-
exit(1);
128-
}
129-
#endif // LLVM_360_AND_NEWER
13083

13184
WriteBitcodeToFile(M.get(), Out->os());
13285

0 commit comments

Comments
 (0)