[Libclc-dev] [PATCH] Allow compilation depending to the LLVM version

Tom Stellard tom at stellard.net
Mon Apr 27 06:22:38 PDT 2015


On Sun, Apr 26, 2015 at 11:51:16PM +0200, EdB wrote:
> It allows to keep temporary compatibilty with older version.
> For exemple, this can be use when change are not to large.

Spelling -> compatibility
Spelling -> example

> ---
>  configure.py                                 | 16 +++++++++++++++-
>  generic/lib/LLVM3.6/subnormal_helper_func.ll |  8 ++++++++
>  generic/lib/SOURCES_LLVM3.6                  |  1 +
>  3 files changed, 24 insertions(+), 1 deletion(-)
>  create mode 100644 generic/lib/LLVM3.6/subnormal_helper_func.ll
>  create mode 100644 generic/lib/SOURCES_LLVM3.6
> 

I'm OK with this approach,  this patch LGTM.

-Tom

> diff --git a/configure.py b/configure.py
> index 7d4b537..1072ca8 100755
> --- a/configure.py
> +++ b/configure.py
> @@ -70,6 +70,8 @@ if (int(llvm_version[0]) != 3 and int(llvm_version[1]) != 6):
>      print "libclc requires LLVM 3.6"
>      sys.exit(1)
>  
> +llvm_string_version = 'LLVM' + llvm_version[0] + '.' + llvm_version[1]
> +
>  llvm_system_libs = llvm_config(['--system-libs'])
>  llvm_bindir = llvm_config(['--bindir'])
>  llvm_core_libs = llvm_config(['--libs', 'core', 'bitreader', 'bitwriter']) + ' ' + \
> @@ -189,6 +191,7 @@ for target in targets:
>  
>      objects = []
>      sources_seen = set()
> +    compats_seen = set()
>  
>      if device['gpu'] == '':
>        full_target_name = target
> @@ -201,6 +204,14 @@ for target in targets:
>        subdir_list_file = os.path.join(libdir, 'SOURCES')
>        manifest_deps.add(subdir_list_file)
>        override_list_file = os.path.join(libdir, 'OVERRIDES')
> +      compat_list_file = os.path.join(libdir,
> +        'SOURCES_' + llvm_string_version)
> +
> +      # Build compat list
> +      if os.path.exists(compat_list_file):
> +        for compat in open(compat_list_file).readlines():
> +          compat = compat.rstrip()
> +          compats_seen.add(compat)
>  
>        # Add target overrides
>        if os.path.exists(override_list_file):
> @@ -214,7 +225,10 @@ for target in targets:
>            sources_seen.add(src)
>            obj = os.path.join(target, 'lib', src + obj_suffix + '.bc')
>            objects.append(obj)
> -          src_file = os.path.join(libdir, src)
> +          src_path = libdir
> +          if src in compats_seen:
> +            src_path = os.path.join(libdir, llvm_string_version)
> +          src_file = os.path.join(src_path, src)
>            ext = os.path.splitext(src)[1]
>            if ext == '.ll':
>              b.build(obj, 'LLVM_AS', src_file)
> diff --git a/generic/lib/LLVM3.6/subnormal_helper_func.ll b/generic/lib/LLVM3.6/subnormal_helper_func.ll
> new file mode 100644
> index 0000000..0e9764b
> --- /dev/null
> +++ b/generic/lib/LLVM3.6/subnormal_helper_func.ll
> @@ -0,0 +1,8 @@
> + at __CLC_SUBNORMAL_DISABLE = external global i1
> +
> +define i1 @__clc_subnormals_disabled() #0 {
> +  %disable = load i1* @__CLC_SUBNORMAL_DISABLE
> +  ret i1 %disable
> +}
> +
> +attributes #0 = { alwaysinline }
> diff --git a/generic/lib/SOURCES_LLVM3.6 b/generic/lib/SOURCES_LLVM3.6
> new file mode 100644
> index 0000000..ee09f01
> --- /dev/null
> +++ b/generic/lib/SOURCES_LLVM3.6
> @@ -0,0 +1 @@
> +subnormal_helper_func.ll
> -- 
> 2.3.6
> 
> 
> _______________________________________________
> Libclc-dev mailing list
> Libclc-dev at pcc.me.uk
> http://www.pcc.me.uk/cgi-bin/mailman/listinfo/libclc-dev




More information about the Libclc-dev mailing list