From fc629e359485bdac175d2c63fd4154b490094d39 Mon Sep 17 00:00:00 2001 From: Aaron Watry Date: Sat, 5 Aug 2017 20:18:48 -0500 Subject: clover: Pass device to llvm::create_compiler_instance We'll be using dev.device_clc_version to select the default language version soon along with the existing ir_target field. Signed-off-by: Aaron Watry Reviewed-by: Pierre Moreau Reviewed-by: Jan Vesely Reviewed-by: Francisco Jerez v4: Pass the device down instead of device_clc_version as a separate field v3: Revise to acknowledge that we now have the device in compile/link_program instead of the string values. v2: (Pierre) Move changes to create_compiler_instance invocation to correct patch to prevent temporary build breakage. (Jan) Use device_clc_version instead of device_version for compile/link --- src/gallium/state_trackers/clover/llvm/invocation.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp b/src/gallium/state_trackers/clover/llvm/invocation.cpp index c8c0311a3a0..2635064bec7 100644 --- a/src/gallium/state_trackers/clover/llvm/invocation.cpp +++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp @@ -94,7 +94,7 @@ namespace { } std::unique_ptr - create_compiler_instance(const target &target, + create_compiler_instance(const device &dev, const std::vector &opts, std::string &r_log) { std::unique_ptr c { new clang::CompilerInstance }; @@ -108,6 +108,8 @@ namespace { const std::vector copts = map(std::mem_fn(&std::string::c_str), opts); + const target &target = dev.ir_target(); + if (!clang::CompilerInvocation::CreateFromArgs( c->getInvocation(), copts.data(), copts.data() + copts.size(), diag)) throw invalid_build_options_error(); @@ -208,8 +210,7 @@ clover::llvm::compile_program(const std::string &source, debug::log(".cl", "// Options: " + opts + '\n' + source); auto ctx = create_context(r_log); - auto c = create_compiler_instance(dev.ir_target(), - tokenize(opts + " input.cl"), r_log); + auto c = create_compiler_instance(dev, tokenize(opts + " input.cl"), r_log); auto mod = compile(*ctx, *c, "input.cl", source, headers, dev.ir_target(), opts, r_log); @@ -276,7 +277,7 @@ clover::llvm::link_program(const std::vector &modules, erase_if(equals("-create-library"), options); auto ctx = create_context(r_log); - auto c = create_compiler_instance(dev.ir_target(), options, r_log); + auto c = create_compiler_instance(dev, options, r_log); auto mod = link(*ctx, *c, modules, r_log); optimize(*mod, c->getCodeGenOpts().OptimizationLevel, !create_library); -- cgit v1.2.3