From 66b3df3c152ef4625977f6b7bb286686a45d32ec Mon Sep 17 00:00:00 2001 From: Italo Nicola Date: Thu, 6 Oct 2022 12:18:45 +0000 Subject: [PATCH] clc: add 32-bit target Signed-off-by: Italo Nicola Reviewed-by: Karol Herbst Reviewed-by: Jesse Natalie Part-of: --- src/compiler/clc/clc.h | 2 ++ src/compiler/clc/clc_helpers.cpp | 4 +++- src/gallium/frontends/rusticl/mesa/compiler/clc/spirv.rs | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/compiler/clc/clc.h b/src/compiler/clc/clc.h index d544730..71a763b 100644 --- a/src/compiler/clc/clc.h +++ b/src/compiler/clc/clc.h @@ -76,6 +76,8 @@ struct clc_compile_args { * extension if NULL. */ const char * const *allowed_spirv_extensions; + + unsigned address_bits; }; struct clc_binary { diff --git a/src/compiler/clc/clc_helpers.cpp b/src/compiler/clc/clc_helpers.cpp index b89601e..5827d06 100644 --- a/src/compiler/clc/clc_helpers.cpp +++ b/src/compiler/clc/clc_helpers.cpp @@ -764,9 +764,11 @@ clc_compile_to_llvm_module(LLVMContext &llvm_ctx, &c->getDiagnosticOpts()) }; + const char *triple = args->address_bits == 32 ? "spir-unknown-unknown" : "spir64-unknown-unknown"; + std::vector clang_opts = { args->source.name, - "-triple", "spir64-unknown-unknown", + "-triple", triple, // By default, clang prefers to use modules to pull in the default headers, // which doesn't work with our technique of embedding the headers in our binary #if LLVM_VERSION_MAJOR >= 15 diff --git a/src/gallium/frontends/rusticl/mesa/compiler/clc/spirv.rs b/src/gallium/frontends/rusticl/mesa/compiler/clc/spirv.rs index 721de8e..63963ca 100644 --- a/src/gallium/frontends/rusticl/mesa/compiler/clc/spirv.rs +++ b/src/gallium/frontends/rusticl/mesa/compiler/clc/spirv.rs @@ -96,6 +96,7 @@ impl SPIRVBin { spirv_version: clc_spirv_version::CLC_SPIRV_VERSION_MAX, features: features, allowed_spirv_extensions: ptr::null(), + address_bits: 64, }; let mut msgs: Vec = Vec::new(); let logger = clc_logger { -- 2.7.4