LCOV - code coverage report
Current view: top level - gcc - hooks.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 44.8 % 174 78
Test Date: 2026-11-14 16:39:50 Functions: 44.8 % 87 39
Legend: Lines:     hit not hit

            Line data    Source code
       1              : /* General-purpose hooks.
       2              :    Copyright (C) 2002-2026 Free Software Foundation, Inc.
       3              : 
       4              :    This program is free software; you can redistribute it and/or modify it
       5              :    under the terms of the GNU General Public License as published by the
       6              :    Free Software Foundation; either version 3, or (at your option) any
       7              :    later version.
       8              : 
       9              :    This program 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 this program; see the file COPYING3.  If not see
      16              :    <http://www.gnu.org/licenses/>.
      17              : 
      18              :    In other words, you are welcome to use, share and improve this program.
      19              :    You are forbidden to forbid anyone else to use, share and improve
      20              :    what you give them.   Help stamp out software-hoarding!  */
      21              : 
      22              : /* This file contains generic hooks that can be used as defaults for
      23              :    target or language-dependent hook initializers.  */
      24              : 
      25              : #include "config.h"
      26              : #include "system.h"
      27              : #include "coretypes.h"
      28              : #include "tm.h"
      29              : #include "hooks.h"
      30              : 
      31              : /* Generic hook that does absolutely zappo.  */
      32              : void
      33      5359161 : hook_void_void (void)
      34              : {
      35      5359161 : }
      36              : 
      37              : /* Generic hook that takes no arguments and returns false.  */
      38              : bool
      39    614595325 : hook_bool_void_false (void)
      40              : {
      41    614595325 :   return false;
      42              : }
      43              : 
      44              : /* Generic hook that takes no arguments and returns true.  */
      45              : bool
      46    132718934 : hook_bool_void_true (void)
      47              : {
      48    132718934 :   return true;
      49              : }
      50              : 
      51              : /* Generic hook that takes (bool) and returns false.  */
      52              : bool
      53            0 : hook_bool_bool_false (bool)
      54              : {
      55            0 :   return false;
      56              : }
      57              : 
      58              : /* Generic hook that takes (bool, struct gcc_options *) and returns false.  */
      59              : bool
      60            0 : hook_bool_bool_gcc_optionsp_false (bool, struct gcc_options *)
      61              : {
      62            0 :   return false;
      63              : }
      64              : 
      65              : /* Generic hook that takes (dwarf_call_frame_info, dw_cfi_oprnd_type &) and
      66              :    return false.  */
      67            0 : bool hook_bool_dwcfi_dwcfioprndtyperef_false (dwarf_call_frame_info,
      68              :                                               dw_cfi_oprnd_type &)
      69              : {
      70            0 :   return false;
      71              : }
      72              : 
      73              : /* Generic hook that takes (FILE *, dw_cfi_ref) and return false.  */
      74            0 : bool hook_bool_FILEptr_dwcfiptr_false (FILE *, dw_cfi_ref)
      75              : {
      76            0 :   return false;
      77              : }
      78              : 
      79              : /* Generic hook that takes const int, const int) and returns true.  */
      80            0 : bool hook_bool_const_int_const_int_true (const int, const int)
      81              : {
      82            0 :   return true;
      83              : }
      84              : 
      85              : /* Generic hook that takes (machine_mode) and returns false.  */
      86              : bool
      87            0 : hook_bool_mode_false (machine_mode)
      88              : {
      89            0 :   return false;
      90              : }
      91              : 
      92              : /* Generic hook that takes (machine_mode) and returns true.  */
      93              : bool
      94    211529233 : hook_bool_mode_true (machine_mode)
      95              : {
      96    211529233 :   return true;
      97              : }
      98              : 
      99              : /* Generic hook that takes (machine_mode, machine_mode) and returns true.  */
     100              : bool
     101            0 : hook_bool_mode_mode_true (machine_mode, machine_mode)
     102              : {
     103            0 :   return true;
     104              : }
     105              : 
     106              : /* Generic hook that takes (machine_mode, const_rtx) and returns false.  */
     107              : bool
     108            0 : hook_bool_mode_const_rtx_false (machine_mode, const_rtx)
     109              : {
     110            0 :   return false;
     111              : }
     112              : 
     113              : /* Generic hook that takes (machine_mode, const_rtx) and returns true.  */
     114              : bool
     115      4310435 : hook_bool_mode_const_rtx_true (machine_mode, const_rtx)
     116              : {
     117      4310435 :   return true;
     118              : }
     119              : 
     120              : /* Generic hook that takes (machine_mode, int, unsigned) and returns false.  */
     121              : bool
     122            0 : hook_bool_mode_int_unsigned_false (machine_mode, int, unsigned)
     123              : {
     124            0 :   return false;
     125              : }
     126              : 
     127              : /* Generic hook that takes (machine_mode, rtx) and returns false.  */
     128              : bool
     129      4479948 : hook_bool_mode_rtx_false (machine_mode, rtx)
     130              : {
     131      4479948 :   return false;
     132              : }
     133              : 
     134              : /* Generic hook that takes (machine_mode, rtx) and returns true.  */
     135              : bool
     136            0 : hook_bool_mode_rtx_true (machine_mode, rtx)
     137              : {
     138            0 :   return true;
     139              : }
     140              : 
     141              : /* Generic hook that takes (const rtx_insn *, const rtx_insn *) and returns true.  */
     142              : bool
     143            0 : hook_bool_const_rtx_insn_const_rtx_insn_true (const rtx_insn *,
     144              :                                               const rtx_insn *)
     145              : {
     146            0 :   return true;
     147              : }
     148              : 
     149              : /* Generic hook that takes (machine_mode, unsigned HOST_WIDE_INT)
     150              :    and returns false.  */
     151              : bool
     152     67628019 : hook_bool_mode_uhwi_false (machine_mode, unsigned HOST_WIDE_INT)
     153              : {
     154     67628019 :   return false;
     155              : }
     156              : 
     157              : /* Generic hook that takes (poly_uint64, poly_uint64) and returns true.  */
     158              : bool
     159     11120917 : hook_bool_puint64_puint64_true (poly_uint64, poly_uint64)
     160              : {
     161     11120917 :   return true;
     162              : }
     163              : 
     164              : bool
     165            0 : hook_bool_uint_uint_mode_false (unsigned int, unsigned int, machine_mode)
     166              : {
     167            0 :   return false;
     168              : }
     169              : 
     170              : /* Generic hook that takes (unsigned int, machine_mode) and returns true.  */
     171              : bool
     172            0 : hook_bool_uint_mode_true (unsigned int, machine_mode)
     173              : {
     174            0 :   return true;
     175              : }
     176              : 
     177              : /* Generic hook that takes (FILE *, const char *) and does nothing.  */
     178              : void
     179            0 : hook_void_FILEptr_constcharptr (FILE *, const char *)
     180              : {
     181            0 : }
     182              : 
     183              : /* Generic hook that takes (FILE *, const char *, constr_tree *) and does
     184              :    nothing.  */
     185              : void
     186       295947 : hook_void_FILEptr_constcharptr_const_tree (FILE *, const char *, const_tree)
     187              : {
     188       295947 : }
     189              : 
     190              : /* Generic hook that takes (FILE *, rtx) and returns false.  */
     191              : bool
     192            0 : hook_bool_FILEptr_rtx_false (FILE *, rtx)
     193              : {
     194            0 :   return false;
     195              : }
     196              : 
     197              : /* Generic hook that takes (gimple_stmt_iterator *) and returns
     198              :    false.  */
     199              : bool
     200            0 : hook_bool_gsiptr_false (gimple_stmt_iterator *)
     201              : {
     202            0 :   return false;
     203              : }
     204              : 
     205              : /* Used for the TARGET_ASM_CAN_OUTPUT_MI_THUNK hook.  */
     206              : bool
     207            0 : hook_bool_const_tree_hwi_hwi_const_tree_false (const_tree, HOST_WIDE_INT,
     208              :                                                HOST_WIDE_INT, const_tree)
     209              : {
     210            0 :   return false;
     211              : }
     212              : 
     213              : bool
     214            0 : hook_bool_const_tree_hwi_hwi_const_tree_true (const_tree, HOST_WIDE_INT,
     215              :                                               HOST_WIDE_INT, const_tree)
     216              : {
     217            0 :   return true;
     218              : }
     219              : 
     220              : bool
     221            0 : default_can_output_mi_thunk_no_vcall (const_tree, HOST_WIDE_INT,
     222              :                                       HOST_WIDE_INT c, const_tree)
     223              : {
     224            0 :   return c == 0;
     225              : }
     226              : 
     227              : int
     228            0 : hook_int_uint_mode_1 (unsigned int, machine_mode)
     229              : {
     230            0 :   return 1;
     231              : }
     232              : 
     233              : int
     234     97206640 : hook_int_const_tree_0 (const_tree)
     235              : {
     236     97206640 :   return 0;
     237              : }
     238              : 
     239              : /* ??? Used for comp_type_attributes, which ought to return bool.  */
     240              : int
     241            0 : hook_int_const_tree_const_tree_1 (const_tree, const_tree)
     242              : {
     243            0 :   return 1;
     244              : }
     245              : 
     246              : int
     247            0 : hook_int_rtx_0 (rtx)
     248              : {
     249            0 :   return 0;
     250              : }
     251              : 
     252              : int
     253            0 : hook_int_rtx_1 (rtx)
     254              : {
     255            0 :   return 1;
     256              : }
     257              : 
     258              : int
     259      2988088 : hook_int_rtx_insn_0 (rtx_insn *)
     260              : {
     261      2988088 :   return 0;
     262              : }
     263              : 
     264              : int
     265            0 : hook_int_rtx_insn_unreachable (rtx_insn *)
     266              : {
     267            0 :   gcc_unreachable ();
     268              : }
     269              : 
     270              : int
     271            0 : hook_int_rtx_bool_0 (rtx, bool)
     272              : {
     273            0 :   return 0;
     274              : }
     275              : 
     276              : int
     277            0 : hook_int_rtx_mode_as_bool_0 (rtx, machine_mode, addr_space_t, bool)
     278              : {
     279            0 :   return 0;
     280              : }
     281              : 
     282              : unsigned int
     283        13648 : hook_uint_void_0 (void)
     284              : {
     285        13648 :   return 0;
     286              : }
     287              : 
     288              : HOST_WIDE_INT
     289     13643028 : hook_hwi_void_0 (void)
     290              : {
     291     13643028 :   return 0;
     292              : }
     293              : 
     294              : void
     295   2934736304 : hook_void_tree (tree)
     296              : {
     297   2934736304 : }
     298              : 
     299              : void
     300      1587980 : hook_void_FILEptr_tree (FILE *, tree)
     301              : {
     302      1587980 : }
     303              : 
     304              : void
     305         6098 : hook_void_constcharptr (const char *)
     306              : {
     307         6098 : }
     308              : 
     309              : void
     310   2188922718 : hook_void_tree_treeptr (tree, tree *)
     311              : {
     312   2188922718 : }
     313              : 
     314              : void
     315            0 : hook_void_int_int (int, int)
     316              : {
     317            0 : }
     318              : 
     319              : bool
     320        70468 : hook_bool_tree_false (tree)
     321              : {
     322        70468 :   return false;
     323              : }
     324              : 
     325              : bool
     326     38789431 : hook_bool_const_tree_false (const_tree)
     327              : {
     328     38789431 :   return false;
     329              : }
     330              : 
     331              : bool
     332      9398252 : hook_bool_const_tree_const_tree_true (const_tree, const_tree)
     333              : {
     334      9398252 :   return true;
     335              : }
     336              : 
     337              : bool
     338         9347 : hook_bool_tree_true (tree)
     339              : {
     340         9347 :   return true;
     341              : }
     342              : 
     343              : bool
     344      6094005 : hook_bool_const_tree_true (const_tree)
     345              : {
     346      6094005 :   return true;
     347              : }
     348              : 
     349              : bool
     350    241810312 : hook_bool_tree_tree_false (tree, tree)
     351              : {
     352    241810312 :   return false;
     353              : }
     354              : 
     355              : bool
     356            0 : hook_bool_tree_tree_true (tree, tree)
     357              : {
     358            0 :   return true;
     359              : }
     360              : 
     361              : bool
     362       541645 : hook_bool_tree_bool_false (tree, bool)
     363              : {
     364       541645 :   return false;
     365              : }
     366              : 
     367              : bool
     368         6945 : hook_bool_rtx_insn_true (rtx_insn *)
     369              : {
     370         6945 :   return true;
     371              : }
     372              : 
     373              : bool
     374            0 : hook_bool_rtx_insn_false (rtx_insn *)
     375              : {
     376            0 :   return false;
     377              : }
     378              : 
     379              : bool
     380      3256035 : hook_bool_rtx_false (rtx)
     381              : {
     382      3256035 :   return false;
     383              : }
     384              : 
     385              : bool
     386            0 : hook_bool_uintp_uintp_false (unsigned int *, unsigned int *)
     387              : {
     388            0 :   return false;
     389              : }
     390              : 
     391              : bool
     392            0 : hook_bool_rtx_mode_int_int_intp_bool_false (rtx, machine_mode, int, int,
     393              :                                             int *, bool)
     394              : {
     395            0 :   return false;
     396              : }
     397              : 
     398              : bool
     399            0 : hook_bool_wint_wint_uint_bool_true (const widest_int &, const widest_int &,
     400              :                                     unsigned int, bool)
     401              : {
     402            0 :   return true;
     403              : }
     404              : 
     405              : /* Generic hook that takes an rtx and returns it.  */
     406              : rtx
     407            0 : hook_rtx_rtx_identity (rtx x)
     408              : {
     409            0 :   return x;
     410              : }
     411              : 
     412              : /* Generic hook that takes an rtx and returns NULL_RTX.  */
     413              : rtx
     414     26067595 : hook_rtx_rtx_null (rtx)
     415              : {
     416     26067595 :   return NULL;
     417              : }
     418              : 
     419              : /* Generic hook that takes a tree and an int and returns NULL_RTX.  */
     420              : rtx
     421     22719864 : hook_rtx_tree_int_null (tree, int)
     422              : {
     423     22719864 :   return NULL;
     424              : }
     425              : 
     426              : /* Generic hook that takes a machine mode and returns an unsigned int 0.  */
     427              : unsigned int
     428      1484395 : hook_uint_mode_0 (machine_mode)
     429              : {
     430      1484395 :   return 0;
     431              : }
     432              : 
     433              : /* Generic hook that takes no arguments and returns a NULL const string.  */
     434              : const char *
     435            0 : hook_constcharptr_void_null (void)
     436              : {
     437            0 :   return NULL;
     438              : }
     439              : 
     440              : /* Generic hook that takes no arguments and returns a NULL string.  */
     441              : char *
     442            0 : hook_charptr_void_null (void)
     443              : {
     444            0 :   return NULL;
     445              : }
     446              : 
     447              : /* Generic hook that takes a tree and returns a NULL string.  */
     448              : const char *
     449            0 : hook_constcharptr_const_tree_null (const_tree)
     450              : {
     451            0 :   return NULL;
     452              : }
     453              : 
     454              : tree
     455            0 : hook_tree_tree_int_treep_bool_null (tree, int, tree *, bool)
     456              : {
     457            0 :   return NULL;
     458              : }
     459              : 
     460              : tree
     461        35128 : hook_tree_tree_bool_null (tree, bool)
     462              : {
     463        35128 :   return NULL;
     464              : }
     465              : 
     466              : tree
     467    477881740 : hook_tree_tree_tree_null (tree, tree)
     468              : {
     469    477881740 :   return NULL;
     470              : }
     471              : 
     472              : tree
     473        33450 : hook_tree_tree_tree_tree_null (tree, tree, tree)
     474              : {
     475        33450 :   return NULL;
     476              : }
     477              : 
     478              : tree
     479          481 : hook_tree_treeptr_tree_tree_int_boolptr_null (tree *, tree, tree, int, bool *)
     480              : {
     481          481 :   return NULL;
     482              : }
     483              : 
     484              : /* Generic hook that takes an rtx_insn *and returns a NULL string.  */
     485              : const char *
     486            0 : hook_constcharptr_const_rtx_insn_null (const rtx_insn *)
     487              : {
     488            0 :   return NULL;
     489              : }
     490              : 
     491              : const char *
     492            0 : hook_constcharptr_const_tree_const_tree_null (const_tree, const_tree)
     493              : {
     494            0 :   return NULL;
     495              : }
     496              : 
     497              : const char *
     498            0 : hook_constcharptr_int_const_tree_null (int, const_tree)
     499              : {
     500            0 :   return NULL;
     501              : }
     502              : 
     503              : const char *
     504            0 : hook_constcharptr_int_const_tree_const_tree_null (int, const_tree, const_tree)
     505              : {
     506            0 :   return NULL;
     507              : }
     508              : 
     509              : /* Generic hook that takes a const_tree and returns NULL_TREE.  */
     510              : tree
     511   3028810003 : hook_tree_const_tree_null (const_tree)
     512              : {
     513   3028810003 :   return NULL;
     514              : }
     515              : 
     516              : /* Generic hook that takes no arguments and returns a NULL_TREE.  */
     517              : tree
     518            0 : hook_tree_void_null (void)
     519              : {
     520            0 :   return NULL;
     521              : }
     522              : 
     523              : /* Generic hook that takes a rtx_insn * and an int and returns a bool.  */
     524              : 
     525              : bool
     526            0 : hook_bool_rtx_insn_int_false (rtx_insn *, int)
     527              : {
     528            0 :   return false;
     529              : }
     530              : 
     531              : /* Generic hook that takes a rtx_insn * and an int and returns void.  */
     532              : 
     533              : void
     534            0 : hook_void_rtx_insn_int (rtx_insn *, int)
     535              : {
     536            0 : }
     537              : 
     538              : /* Generic hook that takes a struct gcc_options * and returns void.  */
     539              : 
     540              : void
     541         1371 : hook_void_gcc_optionsp (struct gcc_options *)
     542              : {
     543         1371 : }
     544              : 
     545              : /* Generic hook that takes an unsigned int and returns true.  */
     546              : 
     547              : bool
     548            0 : hook_bool_uint_true (unsigned int)
     549              : {
     550            0 :   return true;
     551              : }
     552              : 
     553              : /* Generic hook that takes an unsigned int, an unsigned int pointer and
     554              :    returns false.  */
     555              : 
     556              : bool
     557      3270398 : hook_bool_uint_uintp_false (unsigned int, unsigned int *)
     558              : {
     559      3270398 :   return false;
     560              : }
     561              : 
     562              : /* Generic hook that takes a register class and returns false.  */
     563              : bool
     564      1777149 : hook_bool_reg_class_t_false (reg_class_t regclass ATTRIBUTE_UNUSED)
     565              : {
     566      1777149 :   return false;
     567              : }
     568              : 
     569              : /* Generic hook that takes 2 machine_modes and a register class and
     570              :    returns true.  */
     571              : bool
     572            0 : hook_bool_mode_mode_reg_class_t_true (machine_mode, machine_mode, reg_class_t)
     573              : {
     574            0 :   return true;
     575              : }
     576              : 
     577              : /* Generic hook that takes a machine_mode and 2 register classes
     578              :    and returns false.  */
     579              : bool
     580            0 : hook_bool_mode_reg_class_t_reg_class_t_false (machine_mode, reg_class_t,
     581              :                                               reg_class_t)
     582              : {
     583            0 :   return false;
     584              : }
     585              : 
     586              : /* Generic hook that takes a mode and an unsigned HOST_WIDE_INT and
     587              :    returns no mode.  */
     588              : 
     589              : opt_machine_mode
     590     67628019 : hook_optmode_mode_uhwi_none (machine_mode, unsigned HOST_WIDE_INT)
     591              : {
     592     67628019 :   return opt_machine_mode ();
     593              : }
     594              : 
     595              : /* Generic hook that takes a string_slice and a locations and returns false.  */
     596              : 
     597              : bool
     598          596 : hook_stringslice_locationtptr_true (string_slice, location_t *)
     599              : {
     600          596 :   return true;
     601              : }
     602              : 
     603              : bool
     604            0 : hook_stringslice_consttree_stringslice_consttree_unreachable (string_slice,
     605              :                                                               const_tree,
     606              :                                                               string_slice,
     607              :                                                               const_tree)
     608              : {
     609            0 :   gcc_unreachable ();
     610              : }
        

Generated by: LCOV version 2.5.0-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.