LCOV - code coverage report
Current view: top level - gcc/jit - jit-target.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 87.1 % 31 27
Test Date: 2026-02-28 14:20:25 Functions: 83.3 % 6 5
Legend: Lines:     hit not hit

            Line data    Source code
       1              : /* jit-target.cc -- Target interface for the jit front end.
       2              :    Copyright (C) 2023-2026 Free Software Foundation, Inc.
       3              : 
       4              : GCC is free software; you can redistribute it and/or modify
       5              : it under the terms of the GNU General Public License as published by
       6              : the Free Software Foundation; either version 3, or (at your option)
       7              : any later version.
       8              : 
       9              : GCC is distributed in the hope that it will be useful,
      10              : but WITHOUT ANY WARRANTY; without even the implied warranty of
      11              : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      12              : GNU General Public License for more details.
      13              : 
      14              : You should have received a copy of the GNU General Public License
      15              : along with GCC; see the file COPYING3.  If not see
      16              : <http://www.gnu.org/licenses/>.  */
      17              : 
      18              : #define INCLUDE_STRING
      19              : #define INCLUDE_ALGORITHM
      20              : #include "config.h"
      21              : #include "system.h"
      22              : #include "coretypes.h"
      23              : 
      24              : #include "tree.h"
      25              : #include "memmodel.h"
      26              : #include "fold-const.h"
      27              : #include "diagnostic.h"
      28              : #include "stor-layout.h"
      29              : #include "tm.h"
      30              : #include "tm_p.h"
      31              : #include "target.h"
      32              : #include "calls.h"
      33              : 
      34              : #include "jit-playback.h"
      35              : #include "jit-target.h"
      36              : 
      37              : /* Initialize all variables of the Target structure.  */
      38              : 
      39              : void
      40         1326 : jit_target_init ()
      41              : {
      42              :   /* Initialize target info tables, the keys required by the language are added
      43              :      last, so that the CPU handler can override.  */
      44         1326 :   targetjitm.jit_register_cpu_target_info ();
      45         1326 : }
      46              : 
      47              : /* Add a target info key:value to JIT_TARGET_INFO for use by
      48              :    target_info::has_target_value ().  */
      49              : 
      50              : void
      51         6630 : jit_add_target_info (const char *key, const char *value)
      52              : {
      53         6630 :   gcc_assert (gcc::jit::active_playback_ctxt != NULL);
      54         6630 :   target_info* jit_target_info
      55         6630 :     = gcc::jit::active_playback_ctxt->get_target_info ();
      56         6630 :   if (jit_target_info->m_info.find (key) == jit_target_info->m_info.end ())
      57         2652 :     jit_target_info->m_info.insert ({key, {value}});
      58              :   else
      59         3978 :     jit_target_info->m_info[key].insert (value);
      60         6630 : }
      61              : 
      62              : void
      63         1326 : jit_target_set_arch (std::string const& arch)
      64              : {
      65         1326 :   gcc_assert (gcc::jit::active_playback_ctxt != NULL);
      66         1326 :   target_info* jit_target_info
      67         1326 :     = gcc::jit::active_playback_ctxt->get_target_info ();
      68         1326 :   jit_target_info->m_arch = arch;
      69         1326 : }
      70              : 
      71              : void
      72         7956 : jit_target_add_supported_target_dependent_type (enum gcc_jit_types type_)
      73              : {
      74         7956 :   gcc_assert (gcc::jit::active_playback_ctxt != NULL);
      75         7956 :   target_info* jit_target_info
      76         7956 :     = gcc::jit::active_playback_ctxt->get_target_info ();
      77         7956 :   jit_target_info->m_supported_target_dependent_types.insert (type_);
      78         7956 : }
      79              : 
      80              : target_info *
      81            0 : jit_get_target_info ()
      82              : {
      83            0 :   gcc_assert (gcc::jit::active_playback_ctxt != NULL);
      84            0 :   target_info* info = gcc::jit::active_playback_ctxt->move_target_info ();
      85            0 :   return info;
      86              : }
      87              : 
      88              : bool
      89            1 : target_info::has_target_value (const char *key, const char *value)
      90              : {
      91            1 :   if (m_info.find (key) == m_info.end ())
      92              :     return false;
      93              : 
      94            1 :   auto& set = m_info[key];
      95            1 :   return set.find (value) != set.end ();
      96              : }
        

Generated by: LCOV version 2.4-beta

LCOV profile is generated on x86_64 machine using following configure options: configure --disable-bootstrap --enable-coverage=opt --enable-languages=c,c++,fortran,go,jit,lto,rust,m2 --enable-host-shared. GCC test suite is run with the built compiler.