LCOV - code coverage report
Current view: top level - gcc - gimple-expr.h (source / functions) Hit Total Coverage
Test: gcc.info Lines: 43 44 97.7 %
Date: 2020-05-30 12:51:24 Functions: 5 5 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* Header file for gimple decl, type and expressions.
       2                 :            :    Copyright (C) 2013-2020 Free Software Foundation, Inc.
       3                 :            : 
       4                 :            : This file is part of GCC.
       5                 :            : 
       6                 :            : GCC is free software; you can redistribute it and/or modify it under
       7                 :            : the terms of the GNU General Public License as published by the Free
       8                 :            : Software Foundation; either version 3, or (at your option) any later
       9                 :            : version.
      10                 :            : 
      11                 :            : GCC is distributed in the hope that it will be useful, but WITHOUT ANY
      12                 :            : WARRANTY; without even the implied warranty of MERCHANTABILITY or
      13                 :            : FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      14                 :            :  for more details.
      15                 :            : 
      16                 :            : You should have received a copy of the GNU General Public License
      17                 :            : along with GCC; see the file COPYING3.  If not see
      18                 :            : <http://www.gnu.org/licenses/>.  */
      19                 :            : 
      20                 :            : #ifndef GCC_GIMPLE_EXPR_H
      21                 :            : #define GCC_GIMPLE_EXPR_H
      22                 :            : 
      23                 :            : extern bool useless_type_conversion_p (tree, tree);
      24                 :            : 
      25                 :            : 
      26                 :            : extern void gimple_set_body (tree, gimple_seq);
      27                 :            : extern gimple_seq gimple_body (tree);
      28                 :            : extern bool gimple_has_body_p (tree);
      29                 :            : extern const char *gimple_decl_printable_name (tree, int);
      30                 :            : extern tree copy_var_decl (tree, tree, tree);
      31                 :            : extern tree create_tmp_var_name (const char *);
      32                 :            : extern tree create_tmp_var_raw (tree, const char * = NULL);
      33                 :            : extern tree create_tmp_var (tree, const char * = NULL);
      34                 :            : extern tree create_tmp_reg (tree, const char * = NULL);
      35                 :            : extern tree create_tmp_reg_fn (struct function *, tree, const char *);
      36                 :            : 
      37                 :            : 
      38                 :            : extern void extract_ops_from_tree (tree, enum tree_code *, tree *, tree *,
      39                 :            :                                    tree *);
      40                 :            : extern void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *,
      41                 :            :                                            tree *);
      42                 :            : extern bool is_gimple_lvalue (tree);
      43                 :            : extern bool is_gimple_condexpr (tree);
      44                 :            : extern bool is_gimple_condexpr_for_cond (tree);
      45                 :            : extern bool is_gimple_address (const_tree);
      46                 :            : extern bool is_gimple_invariant_address (const_tree);
      47                 :            : extern bool is_gimple_ip_invariant_address (const_tree);
      48                 :            : extern bool is_gimple_min_invariant (const_tree);
      49                 :            : extern bool is_gimple_ip_invariant (const_tree);
      50                 :            : extern bool is_gimple_reg (tree);
      51                 :            : extern bool is_gimple_val (tree);
      52                 :            : extern bool is_gimple_asm_val (tree);
      53                 :            : extern bool is_gimple_min_lval (tree);
      54                 :            : extern bool is_gimple_call_addr (tree);
      55                 :            : extern bool is_gimple_mem_ref_addr (tree);
      56                 :            : extern void flush_mark_addressable_queue (void);
      57                 :            : extern void mark_addressable (tree);
      58                 :            : extern bool is_gimple_reg_rhs (tree);
      59                 :            : 
      60                 :            : /* Return true if a conversion from either type of TYPE1 and TYPE2
      61                 :            :    to the other is not required.  Otherwise return false.  */
      62                 :            : 
      63                 :            : static inline bool
      64                 :  414245767 : types_compatible_p (tree type1, tree type2)
      65                 :            : {
      66                 :  414245767 :   return (type1 == type2
      67                 :  414245767 :           || (useless_type_conversion_p (type1, type2)
      68                 :   15179355 :               && useless_type_conversion_p (type2, type1)));
      69                 :            : }
      70                 :            : 
      71                 :            : /* Return true if TYPE is a suitable type for a scalar register variable.  */
      72                 :            : 
      73                 :            : static inline bool
      74                 :21119139498 : is_gimple_reg_type (tree type)
      75                 :            : {
      76                 :21113600108 :   return !AGGREGATE_TYPE_P (type);
      77                 :            : }
      78                 :            : 
      79                 :            : /* Return true if T is a variable.  */
      80                 :            : 
      81                 :            : static inline bool
      82                 :20574892392 : is_gimple_variable (tree t)
      83                 :            : {
      84                 :20574892392 :   return (TREE_CODE (t) == VAR_DECL
      85                 :20574892392 :           || TREE_CODE (t) == PARM_DECL
      86                 :16780706395 :           || TREE_CODE (t) == RESULT_DECL
      87                 :27929287056 :           || TREE_CODE (t) == SSA_NAME);
      88                 :            : }
      89                 :            : 
      90                 :            : /*  Return true if T is a GIMPLE identifier (something with an address).  */
      91                 :            : 
      92                 :            : static inline bool
      93                 : 2236452229 : is_gimple_id (tree t)
      94                 :            : {
      95                 : 2236452229 :   return (is_gimple_variable (t)
      96                 :  912289216 :           || TREE_CODE (t) == FUNCTION_DECL
      97                 :  894575746 :           || TREE_CODE (t) == LABEL_DECL
      98                 :  894483206 :           || TREE_CODE (t) == CONST_DECL
      99                 :            :           /* Allow string constants, since they are addressable.  */
     100                 :  893991916 :           || TREE_CODE (t) == STRING_CST);
     101                 :            : }
     102                 :            : 
     103                 :            : /* Return true if OP, an SSA name or a DECL is a virtual operand.  */
     104                 :            : 
     105                 :            : static inline bool
     106                 :41596473849 : virtual_operand_p (tree op)
     107                 :            : {
     108                 :29613510591 :   if (TREE_CODE (op) == SSA_NAME)
     109                 :34459460622 :     return SSA_NAME_IS_VIRTUAL_OPERAND (op);
     110                 :            : 
     111                 : 7137043202 :   if (TREE_CODE (op) == VAR_DECL)
     112                 : 2293270000 :     return VAR_DECL_IS_VIRTUAL_OPERAND (op);
     113                 :            : 
     114                 :            :   return false;
     115                 :            : }
     116                 :            : 
     117                 :            : /*  Return true if T is something whose address can be taken.  */
     118                 :            : 
     119                 :            : static inline bool
     120                 :  549128229 : is_gimple_addressable (tree t)
     121                 :            : {
     122                 : 1117413259 :   return (is_gimple_id (t) || handled_component_p (t)
     123                 :   19156057 :           || TREE_CODE (t) == TARGET_MEM_REF
     124                 :  568275130 :           || TREE_CODE (t) == MEM_REF);
     125                 :            : }
     126                 :            : 
     127                 :            : /* Return true if T is a valid gimple constant.  */
     128                 :            : 
     129                 :            : static inline bool
     130                 :11234135038 : is_gimple_constant (const_tree t)
     131                 :            : {
     132                 :11234135038 :   switch (TREE_CODE (t))
     133                 :            :     {
     134                 :            :     case INTEGER_CST:
     135                 :            :     case POLY_INT_CST:
     136                 :            :     case REAL_CST:
     137                 :            :     case FIXED_CST:
     138                 :            :     case COMPLEX_CST:
     139                 :            :     case VECTOR_CST:
     140                 :            :     case STRING_CST:
     141                 :            :       return true;
     142                 :            : 
     143                 : 4542480580 :     default:
     144                 : 4542480580 :       return false;
     145                 :            :     }
     146                 :            : }
     147                 :            : 
     148                 :            : /* A wrapper around extract_ops_from_tree with 3 ops, for callers which
     149                 :            :    expect to see only a maximum of two operands.  */
     150                 :            : 
     151                 :            : static inline void
     152                 :   20175291 : extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
     153                 :            :                        tree *op1)
     154                 :            : {
     155                 :   20175291 :   tree op2;
     156                 :   20175291 :   extract_ops_from_tree (expr, code, op0, op1, &op2);
     157                 :   20175291 :   gcc_assert (op2 == NULL_TREE);
     158                 :   20175291 : }
     159                 :            : 
     160                 :            : /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
     161                 :            :    associated with the callee if known.  Otherwise return NULL_TREE.  */
     162                 :            : 
     163                 :            : static inline tree
     164                 : 3638775619 : gimple_call_addr_fndecl (const_tree fn)
     165                 :            : {
     166                 : 3638775619 :   if (fn && TREE_CODE (fn) == ADDR_EXPR)
     167                 :            :     {
     168                 : 3466773625 :       tree fndecl = TREE_OPERAND (fn, 0);
     169                 : 3466773625 :       if (TREE_CODE (fndecl) == MEM_REF
     170                 :       2231 :           && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
     171                 : 3466775078 :           && integer_zerop (TREE_OPERAND (fndecl, 1)))
     172                 :          0 :         fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
     173                 : 3466773625 :       if (TREE_CODE (fndecl) == FUNCTION_DECL)
     174                 : 3466773142 :         return fndecl;
     175                 :            :     }
     176                 :            :   return NULL_TREE;
     177                 :            : }
     178                 :            : 
     179                 :            : #endif /* GCC_GIMPLE_EXPR_H */

Generated by: LCOV version 1.0

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 --enable-host-shared. GCC test suite is run with the built compiler.