VapourSynth-llvmexpr
Loading...
Searching...
No Matches
VectorizationDiagnosticHandler Class Reference

#include <llvmexpr/codegen/llvm/Diagnostics.hpp>

Public Member Functions

 VectorizationDiagnosticHandler ()
void setOriginalHandler (llvm::DiagnosticHandler::DiagnosticHandlerTy handler, void *context)
void handleDiagnostic (const llvm::DiagnosticInfo &di)
bool hasVectorizationFailed () const
void reset ()

Static Public Member Functions

static void diagnosticHandlerCallback (const llvm::DiagnosticInfo *di, void *context)

Detailed Description

Copyright (C) 2025 yuygfgg

This file is part of Vapoursynth-llvmexpr.

Vapoursynth-llvmexpr is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Vapoursynth-llvmexpr is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Vapoursynth-llvmexpr. If not, see https://www.gnu.org/licenses/.

Definition at line 28 of file Diagnostics.hpp.

Constructor & Destructor Documentation

◆ VectorizationDiagnosticHandler()

VectorizationDiagnosticHandler::VectorizationDiagnosticHandler ( )

Copyright (C) 2025 yuygfgg

This file is part of Vapoursynth-llvmexpr.

Vapoursynth-llvmexpr is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Vapoursynth-llvmexpr is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Vapoursynth-llvmexpr. If not, see https://www.gnu.org/licenses/.

Definition at line 27 of file Diagnostics.cpp.

28 : vectorization_failed(false), original_handler(nullptr),
29 original_context(nullptr) {}

Referenced by diagnosticHandlerCallback().

Member Function Documentation

◆ diagnosticHandlerCallback()

void VectorizationDiagnosticHandler::diagnosticHandlerCallback ( const llvm::DiagnosticInfo * di,
void * context )
static

Definition at line 68 of file Diagnostics.cpp.

69 {
71 *di);
72}
void handleDiagnostic(const llvm::DiagnosticInfo &di)

References handleDiagnostic(), and VectorizationDiagnosticHandler().

◆ handleDiagnostic()

void VectorizationDiagnosticHandler::handleDiagnostic ( const llvm::DiagnosticInfo & di)

Definition at line 37 of file Diagnostics.cpp.

38 {
39 bool should_suppress = false;
40
41 if (di.getSeverity() == llvm::DS_Remark ||
42 di.getSeverity() == llvm::DS_Warning) {
43 std::string msg;
44 llvm::raw_string_ostream stream(msg);
45 llvm::DiagnosticPrinterRawOStream printer(stream);
46 di.print(printer);
47
48 if (msg.find("loop not vectorized") != std::string::npos) {
49 vectorization_failed.store(true);
50 should_suppress = true;
51 }
52 }
53
54 // Call original handler for all diagnostics except "loop not vectorized"
55 if (!should_suppress && (original_handler != nullptr)) {
56 original_handler(&di, original_context);
57 }
58}

Referenced by diagnosticHandlerCallback().

◆ hasVectorizationFailed()

bool VectorizationDiagnosticHandler::hasVectorizationFailed ( ) const
nodiscard

Definition at line 60 of file Diagnostics.cpp.

60 {
61 return vectorization_failed.load();
62}

◆ reset()

void VectorizationDiagnosticHandler::reset ( )

Definition at line 64 of file Diagnostics.cpp.

64 {
65 vectorization_failed.store(false);
66}

◆ setOriginalHandler()

void VectorizationDiagnosticHandler::setOriginalHandler ( llvm::DiagnosticHandler::DiagnosticHandlerTy handler,
void * context )

Definition at line 31 of file Diagnostics.cpp.

32 {
33 original_handler = handler;
34 original_context = context;
35}

The documentation for this class was generated from the following files: