Module: Mesa Branch: main Commit: 2172ddf2bff59f9ea9f3dfa4bcd4125905210768 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2172ddf2bff59f9ea9f3dfa4bcd4125905210768
Author: Pierre-Eric Pelloux-Prayer <[email protected]> Date: Wed May 18 17:48:32 2022 +0200 ac: export LLVM c++ ResetCommandLineParser method This method isn't part of the C API but we can still use it and avoid getting error messages from the command line parser: mesa: for the [...]: may only occur zero or one times We could call it at the beginning of ac_init_llvm_target but this may hide some real bugs so let drivers call it. Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16587> --- src/amd/llvm/ac_llvm_helper.cpp | 6 ++++++ src/amd/llvm/ac_llvm_util.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/amd/llvm/ac_llvm_helper.cpp b/src/amd/llvm/ac_llvm_helper.cpp index 1fee75f30c5..77034a06d53 100644 --- a/src/amd/llvm/ac_llvm_helper.cpp +++ b/src/amd/llvm/ac_llvm_helper.cpp @@ -29,6 +29,7 @@ #include <llvm/IR/LegacyPassManager.h> #include <llvm/Target/TargetMachine.h> #include <llvm/MC/MCSubtargetInfo.h> +#include <llvm/Support/CommandLine.h> #include <llvm/Transforms/IPO.h> #include <cstring> @@ -50,6 +51,11 @@ bool ac_is_llvm_processor_supported(LLVMTargetMachineRef tm, const char *process return TM->getMCSubtargetInfo()->isCPUStringValid(processor); } +void ac_reset_llvm_command_line_parser() +{ + llvm::cl::ResetCommandLineParser(); +} + void ac_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes) { llvm::Argument *A = llvm::unwrap<llvm::Argument>(val); diff --git a/src/amd/llvm/ac_llvm_util.h b/src/amd/llvm/ac_llvm_util.h index 546f9e2f2d4..b3ef2f617c8 100644 --- a/src/amd/llvm/ac_llvm_util.h +++ b/src/amd/llvm/ac_llvm_util.h @@ -92,6 +92,7 @@ struct ac_llvm_compiler { LLVMTargetRef ac_get_llvm_target(const char *triple); const char *ac_get_llvm_processor_name(enum radeon_family family); bool ac_is_llvm_processor_supported(LLVMTargetMachineRef tm, const char *processor); +void ac_reset_llvm_command_line_parser(); void ac_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes); void ac_add_attr_alignment(LLVMValueRef val, uint64_t bytes); bool ac_is_sgpr_param(LLVMValueRef param);
