LCOV - code coverage report
Current view: top level - src/backend/jit/llvm - llvmjit_wrap.cpp (source / functions) Hit Total Coverage
Test: PostgreSQL 13devel Lines: 9 9 100.0 %
Date: 2019-11-15 23:07:02 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*-------------------------------------------------------------------------
       2             :  *
       3             :  * llvmjit_wrap.cpp
       4             :  *    Parts of the LLVM interface not (yet) exposed to C.
       5             :  *
       6             :  * Copyright (c) 2016-2019, PostgreSQL Global Development Group
       7             :  *
       8             :  * IDENTIFICATION
       9             :  *    src/backend/lib/llvm/llvmjit_wrap.cpp
      10             :  *
      11             :  *-------------------------------------------------------------------------
      12             :  */
      13             : 
      14             : extern "C"
      15             : {
      16             : #include "postgres.h"
      17             : }
      18             : 
      19             : #include <llvm/MC/SubtargetFeature.h>
      20             : #include <llvm/Support/Host.h>
      21             : 
      22             : #include "jit/llvmjit.h"
      23             : 
      24             : 
      25             : /*
      26             :  * C-API extensions.
      27             :  */
      28             : #if defined(HAVE_DECL_LLVMGETHOSTCPUNAME) && !HAVE_DECL_LLVMGETHOSTCPUNAME
      29         486 : char *LLVMGetHostCPUName(void) {
      30         972 :     return strdup(llvm::sys::getHostCPUName().data());
      31             : }
      32             : #endif
      33             : 
      34             : 
      35             : #if defined(HAVE_DECL_LLVMGETHOSTCPUFEATURES) && !HAVE_DECL_LLVMGETHOSTCPUFEATURES
      36         486 : char *LLVMGetHostCPUFeatures(void) {
      37         972 :     llvm::SubtargetFeatures Features;
      38         972 :     llvm::StringMap<bool> HostFeatures;
      39             : 
      40         486 :     if (llvm::sys::getHostCPUFeatures(HostFeatures))
      41       30132 :         for (auto &F : HostFeatures)
      42       29646 :             Features.AddFeature(F.first(), F.second);
      43             : 
      44         972 :     return strdup(Features.getString().c_str());
      45             : }
      46             : #endif

Generated by: LCOV version 1.13