LCOV - code coverage report
Current view: top level - asmjit - x86compiler.cpp (source / functions) Hit Total Coverage
Test: plumed test coverage (other modules) Lines: 17 21 81.0 %
Date: 2026-11-05 10:19:06 Functions: 4 6 66.7 %

          Line data    Source code
       1             : #ifdef __PLUMED_HAS_ASMJIT
       2             : // This file is part of AsmJit project <https://asmjit.com>
       3             : //
       4             : // See asmjit.h or LICENSE.md for license and copyright information
       5             : // SPDX-License-Identifier: Zlib
       6             : 
       7             : #include "api-build_p.h"
       8             : #if !defined(ASMJIT_NO_X86) && !defined(ASMJIT_NO_COMPILER)
       9             : 
      10             : #include "x86assembler.h"
      11             : #include "x86compiler.h"
      12             : #include "x86instapi_p.h"
      13             : #include "x86rapass_p.h"
      14             : 
      15             : ASMJIT_BEGIN_SUB_NAMESPACE(x86)
      16             : 
      17             : // x86::Compiler - Construction & Destruction
      18             : // ==========================================
      19             : 
      20       27492 : Compiler::Compiler(CodeHolder* code) noexcept : BaseCompiler() {
      21       27492 :   _archMask = (uint64_t(1) << uint32_t(Arch::kX86)) |
      22             :               (uint64_t(1) << uint32_t(Arch::kX64)) ;
      23       27492 :   assignEmitterFuncs(this);
      24             : 
      25       27492 :   if (code)
      26       27492 :     code->attach(this);
      27       27492 : }
      28       27492 : Compiler::~Compiler() noexcept {}
      29             : 
      30             : // x86::Compiler - Events
      31             : // ======================
      32             : 
      33       27492 : Error Compiler::onAttach(CodeHolder* code) noexcept {
      34       27492 :   ASMJIT_PROPAGATE(Base::onAttach(code));
      35       27492 :   Error err = addPassT<X86RAPass>();
      36             : 
      37       27492 :   if (ASMJIT_UNLIKELY(err)) {
      38           0 :     onDetach(code);
      39           0 :     return err;
      40             :   }
      41             : 
      42             :   return kErrorOk;
      43             : }
      44             : 
      45           0 : Error Compiler::onDetach(CodeHolder* code) noexcept {
      46           0 :   return Base::onDetach(code);
      47             : }
      48             : 
      49             : // x86::Compiler - Finalize
      50             : // ========================
      51             : 
      52       27492 : Error Compiler::finalize() {
      53       27492 :   ASMJIT_PROPAGATE(runPasses());
      54       27492 :   Assembler a(_code);
      55             :   a.addEncodingOptions(encodingOptions());
      56       27492 :   a.addDiagnosticOptions(diagnosticOptions());
      57       27492 :   return serializeTo(&a);
      58       27492 : }
      59             : 
      60             : ASMJIT_END_SUB_NAMESPACE
      61             : 
      62             : #endif // !ASMJIT_NO_X86 && !ASMJIT_NO_COMPILER
      63             : 
      64             : #endif // __PLUMED_HAS_ASMJIT

Generated by: LCOV version 1.16