(root)/
gcc-13.2.0/
gcc/
m2/
gm2-gcc/
m2expr.h
       1  /* m2expr.h header file for m2expr.cc.
       2  
       3  Copyright (C) 2012-2023 Free Software Foundation, Inc.
       4  Contributed by Gaius Mulley <gaius@glam.ac.uk>.
       5  
       6  This file is part of GNU Modula-2.
       7  
       8  GNU Modula-2 is free software; you can redistribute it and/or modify
       9  it under the terms of the GNU General Public License as published by
      10  the Free Software Foundation; either version 3, or (at your option)
      11  any later version.
      12  
      13  GNU Modula-2 is distributed in the hope that it will be useful, but
      14  WITHOUT ANY WARRANTY; without even the implied warranty of
      15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      16  General Public License for more details.
      17  
      18  You should have received a copy of the GNU General Public License
      19  along with GNU Modula-2; see the file COPYING3.  If not see
      20  <http://www.gnu.org/licenses/>.  */
      21  
      22  #if !defined(m2expr_h)
      23  #define m2expr_h
      24  #if defined(m2expr_c)
      25  #if defined(__GNUG__)
      26  #define EXTERN extern "C"
      27  #else /* !__GNUG__.  */
      28  #define EXTERN
      29  #endif /* !__GNUG__.  */
      30  #else /* !m2expr_c.  */
      31  #if defined(__GNUG__)
      32  #define EXTERN extern "C"
      33  #else /* !__GNUG__.  */
      34  #define EXTERN extern
      35  #endif /* !__GNUG__.  */
      36  #endif /* !m2expr_c.  */
      37  
      38  EXTERN void m2expr_BuildBinaryForeachWordDo (
      39      location_t location, tree type, tree op1, tree op2, tree op3,
      40      tree (*binop) (location_t, tree, tree, bool), bool is_op1lvalue,
      41      bool is_op2lvalue, bool is_op3lvalue, bool is_op1const, bool is_op2const,
      42      bool is_op3const);
      43  EXTERN tree m2expr_BuildCmplx (location_t location, tree type, tree real,
      44                                 tree imag);
      45  EXTERN tree m2expr_BuildIm (tree op1);
      46  EXTERN tree m2expr_BuildRe (tree op1);
      47  EXTERN tree m2expr_BuildAbs (location_t location, tree t);
      48  EXTERN tree m2expr_BuildCap (location_t location, tree t);
      49  EXTERN int m2expr_DetermineSign (tree e);
      50  EXTERN bool m2expr_AreRealOrComplexConstantsEqual (tree e1, tree e2);
      51  EXTERN bool m2expr_AreConstantsEqual (tree e1, tree e2);
      52  EXTERN bool m2expr_IsFalse (tree t);
      53  EXTERN bool m2expr_IsTrue (tree t);
      54  EXTERN tree m2expr_BuildIndirect (location_t location, tree target, tree type);
      55  EXTERN tree m2expr_BuildComponentRef (location_t location, tree record,
      56                                        tree field);
      57  EXTERN tree m2expr_BuildArray (location_t location, tree type, tree array,
      58                                 tree index, tree lowIndice);
      59  EXTERN void m2expr_BuildIfNotInRangeGoto (location_t location, tree var,
      60                                            tree low, tree high, char *label);
      61  EXTERN void m2expr_BuildIfInRangeGoto (location_t location, tree var, tree low,
      62                                         tree high, char *label);
      63  EXTERN void m2expr_BuildForeachWordInSetDoIfExpr (
      64      location_t location, tree type, tree op1, tree op2, bool is_op1lvalue,
      65      bool is_op2lvalue, bool is_op1const, bool is_op2const,
      66      tree (*expr) (location_t, tree, tree), char *label);
      67  EXTERN void m2expr_BuildIfNotVarInVar (location_t location, tree type,
      68                                         tree varset, tree varel, bool is_lvalue,
      69                                         tree low, tree high ATTRIBUTE_UNUSED,
      70                                         char *label);
      71  EXTERN void m2expr_BuildIfVarInVar (location_t location, tree type,
      72                                      tree varset, tree varel, bool is_lvalue,
      73                                      tree low, tree high ATTRIBUTE_UNUSED,
      74                                      char *label);
      75  EXTERN void m2expr_BuildIfNotConstInVar (location_t location, tree type,
      76                                           tree varset, tree constel,
      77                                           bool is_lvalue, int fieldno,
      78                                           char *label);
      79  EXTERN void m2expr_BuildIfConstInVar (location_t location, tree type,
      80                                        tree varset, tree constel, bool is_lvalue,
      81                                        int fieldno, char *label);
      82  EXTERN tree m2expr_BuildIsNotSubset (location_t location, tree op1, tree op2);
      83  EXTERN tree m2expr_BuildIsSubset (location_t location, tree op1, tree op2);
      84  EXTERN tree m2expr_BuildIsNotSuperset (location_t location, tree op1,
      85                                         tree op2);
      86  EXTERN tree m2expr_BuildIsSuperset (location_t location, tree op1, tree op2);
      87  EXTERN tree m2expr_BuildNotEqualTo (location_t location, tree op1, tree op2);
      88  EXTERN tree m2expr_BuildEqualTo (location_t location, tree op1, tree op2);
      89  EXTERN tree m2expr_BuildGreaterThanOrEqual (location_t location, tree op1,
      90                                              tree op2);
      91  EXTERN tree m2expr_BuildLessThanOrEqual (location_t location, tree op1,
      92                                           tree op2);
      93  EXTERN tree m2expr_BuildGreaterThan (location_t location, tree op1, tree op2);
      94  EXTERN tree m2expr_BuildLessThan (location_t location, tree op1, tree op2);
      95  EXTERN tree m2expr_BuildLogicalDifference (location_t location, tree op1,
      96                                             tree op2, bool needconvert);
      97  EXTERN tree m2expr_BuildSymmetricDifference (location_t location, tree op1,
      98                                               tree op2, bool needconvert);
      99  EXTERN tree m2expr_BuildLogicalAnd (location_t location, tree op1, tree op2,
     100                                      bool needconvert);
     101  EXTERN tree m2expr_BuildLogicalOr (location_t location, tree op1, tree op2,
     102                                     bool needconvert);
     103  EXTERN tree m2expr_BuildLogicalOrAddress (location_t location, tree op1,
     104                                            tree op2, bool needconvert);
     105  EXTERN tree m2expr_BuildOffset (location_t location, tree record, tree field,
     106                                  bool needconvert ATTRIBUTE_UNUSED);
     107  EXTERN tree m2expr_BuildOffset1 (location_t location, tree field,
     108                                   bool needconvert ATTRIBUTE_UNUSED);
     109  EXTERN tree m2expr_BuildAddr (location_t location, tree op1, bool needconvert);
     110  EXTERN tree m2expr_BuildSize (location_t location, tree op1,
     111                                bool needconvert ATTRIBUTE_UNUSED);
     112  EXTERN tree m2expr_BuildTBitSize (location_t location, tree type);
     113  EXTERN tree m2expr_BuildSetNegate (location_t location, tree op1,
     114                                     bool needconvert);
     115  EXTERN tree m2expr_BuildNegate (location_t location, tree op1,
     116                                  bool needconvert);
     117  EXTERN tree m2expr_BuildNegateCheck (location_t location, tree arg,
     118                                       tree lowest, tree min, tree max);
     119  EXTERN tree m2expr_BuildTrunc (tree op1);
     120  EXTERN tree m2expr_BuildCoerce (location_t location, tree des, tree type,
     121                                  tree expr);
     122  EXTERN tree m2expr_RemoveOverflow (tree t);
     123  EXTERN bool m2expr_TreeOverflow (tree t);
     124  
     125  EXTERN unsigned int m2expr_StringLength (tree string);
     126  EXTERN tree m2expr_FoldAndStrip (tree t);
     127  EXTERN int m2expr_interpret_integer (location_t location,
     128  				     const char *str, unsigned int base,
     129                                       unsigned HOST_WIDE_INT *low,
     130                                       HOST_WIDE_INT *high);
     131  EXTERN int m2expr_interpret_m2_integer (location_t location,
     132  					const char *str, unsigned int base,
     133                                          unsigned int *low, int *high,
     134  					bool *needsLong, bool *needsUnsigned);
     135  
     136  EXTERN tree m2expr_BuildAddCheck (location_t location, tree op1, tree op2,
     137                                    tree lowest, tree min, tree max);
     138  EXTERN tree m2expr_BuildSubCheck (location_t location, tree op1, tree op2,
     139                                    tree lowest, tree min, tree max);
     140  EXTERN tree m2expr_BuildMultCheck (location_t location, tree op1, tree op2,
     141                                     tree lowest, tree min, tree max);
     142  
     143  EXTERN tree m2expr_BuildAdd (location_t location, tree op1, tree op2,
     144                               bool needconvert);
     145  EXTERN tree m2expr_BuildSub (location_t location, tree op1, tree op2,
     146                               bool needconvert);
     147  EXTERN tree m2expr_BuildDivTrunc (location_t location, tree op1, tree op2,
     148                                    bool needconvert);
     149  EXTERN tree m2expr_BuildDivTruncCheck (location_t location, tree op1, tree op2,
     150  				       tree lowest, tree min, tree max);
     151  EXTERN tree m2expr_BuildModTrunc (location_t location, tree op1, tree op2,
     152                                    bool needconvert);
     153  
     154  EXTERN tree m2expr_BuildDivCeil (location_t location, tree op1, tree op2,
     155                                   bool needconvert);
     156  EXTERN tree m2expr_BuildModCeil (location_t location, tree op1, tree op2,
     157                                   bool needconvert);
     158  
     159  EXTERN tree m2expr_BuildDivFloor (location_t location, tree op1, tree op2,
     160                                    bool needconvert);
     161  EXTERN tree m2expr_BuildModFloor (location_t location, tree op1, tree op2,
     162                                    bool needconvert);
     163  
     164  EXTERN tree m2expr_BuildDivM2 (location_t location, tree op1, tree op2,
     165                                 bool needsconvert);
     166  EXTERN tree m2expr_BuildModM2 (location_t location, tree op1, tree op2,
     167                                 bool needsconvert);
     168  EXTERN tree m2expr_BuildDivM2Check (location_t location, tree op1, tree op2,
     169  			            tree lowest, tree min, tree max);
     170  
     171  EXTERN tree m2expr_BuildModM2Check (location_t location, tree op1, tree op2,
     172                                    tree lowest, tree min, tree max);
     173  
     174  EXTERN tree m2expr_BuildLSL (location_t location, tree op1, tree op2,
     175                               bool needconvert);
     176  
     177  EXTERN tree m2expr_BuildLSR (location_t location, tree op1, tree op2,
     178                               bool needconvert);
     179  
     180  EXTERN void m2expr_BuildLogicalShift (location_t location, tree op1, tree op2,
     181                                        tree op3, tree nBits ATTRIBUTE_UNUSED,
     182                                        bool needconvert);
     183  
     184  EXTERN tree m2expr_BuildLRL (location_t location, tree op1, tree op2,
     185                               bool needconvert);
     186  
     187  EXTERN tree m2expr_BuildLRR (location_t location, tree op1, tree op2,
     188                               bool needconvert);
     189  EXTERN tree m2expr_BuildMult (location_t location, tree op1, tree op2,
     190                                bool needconvert);
     191  
     192  EXTERN tree m2expr_BuildRRotate (location_t location, tree op1, tree nBits,
     193                                   bool needconvert);
     194  EXTERN tree m2expr_BuildLRotate (location_t location, tree op1, tree nBits,
     195                                   bool needconvert);
     196  
     197  EXTERN tree m2expr_BuildMask (location_t location, tree nBits,
     198                                bool needconvert);
     199  EXTERN tree m2expr_BuildLRLn (location_t location, tree op1, tree op2,
     200                                tree nBits, bool needconvert);
     201  EXTERN tree m2expr_BuildLRRn (location_t location, tree op1, tree op2,
     202                                tree nBits, bool needconvert);
     203  EXTERN void m2expr_BuildLogicalRotate (location_t location, tree op1, tree op2,
     204                                         tree op3, tree nBits, bool needconvert);
     205  EXTERN void m2expr_BuildBinarySetDo (
     206      location_t location, tree settype, tree op1, tree op2, tree op3,
     207      void (*binop) (location_t, tree, tree, tree, tree, bool), bool is_op1lvalue,
     208      bool is_op2lvalue, bool is_op3lvalue, tree nBits, tree unbounded,
     209      tree varproc, tree leftproc, tree rightproc);
     210  
     211  EXTERN tree m2expr_GetSizeOf (location_t location, tree type);
     212  EXTERN tree m2expr_GetSizeOfInBits (tree type);
     213  
     214  EXTERN tree m2expr_GetCardinalZero (location_t location);
     215  EXTERN tree m2expr_GetCardinalOne (location_t location);
     216  EXTERN tree m2expr_GetIntegerZero (location_t location);
     217  EXTERN tree m2expr_GetIntegerOne (location_t location);
     218  EXTERN tree m2expr_GetWordZero (location_t location);
     219  EXTERN tree m2expr_GetWordOne (location_t location);
     220  EXTERN tree m2expr_GetPointerZero (location_t location);
     221  EXTERN tree m2expr_GetPointerOne (location_t location);
     222  
     223  EXTERN int m2expr_CompareTrees (tree e1, tree e2);
     224  EXTERN tree m2expr_build_unary_op (location_t location ATTRIBUTE_UNUSED,
     225                                     enum tree_code code, tree arg,
     226                                     int flag ATTRIBUTE_UNUSED);
     227  EXTERN tree m2expr_build_binary_op (location_t location, enum tree_code code,
     228                                      tree op1, tree op2, int convert);
     229  EXTERN tree m2expr_build_binary_op_check (location_t location,
     230                                            enum tree_code code, tree op1,
     231                                            tree op2, bool needconvert,
     232                                            tree lowest, tree min, tree max);
     233  EXTERN void m2expr_ConstantExpressionWarning (tree value);
     234  EXTERN tree m2expr_BuildAddAddress (location_t location, tree op1, tree op2);
     235  EXTERN tree m2expr_BuildRDiv (location_t location, tree op1, tree op2,
     236                                bool needconvert);
     237  EXTERN int m2expr_GetCstInteger (tree cst);
     238  
     239  EXTERN void m2expr_init (location_t location);
     240  
     241  #undef EXTERN
     242  #endif  /* m2expr_h.  */