Home | History | Annotate | Line # | Download | only in s390
      1  1.1  mrg /* Subroutines for the D front end on the IBM S/390 and zSeries architectures.
      2  1.1  mrg    Copyright (C) 2017-2022 Free Software Foundation, Inc.
      3  1.1  mrg 
      4  1.1  mrg GCC is free software; you can redistribute it and/or modify
      5  1.1  mrg it under the terms of the GNU General Public License as published by
      6  1.1  mrg the Free Software Foundation; either version 3, or (at your option)
      7  1.1  mrg any later version.
      8  1.1  mrg 
      9  1.1  mrg GCC is distributed in the hope that it will be useful,
     10  1.1  mrg but WITHOUT ANY WARRANTY; without even the implied warranty of
     11  1.1  mrg MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     12  1.1  mrg GNU General Public License for more details.
     13  1.1  mrg 
     14  1.1  mrg You should have received a copy of the GNU General Public License
     15  1.1  mrg along with GCC; see the file COPYING3.  If not see
     16  1.1  mrg <http://www.gnu.org/licenses/>.  */
     17  1.1  mrg 
     18  1.1  mrg #define IN_TARGET_CODE 1
     19  1.1  mrg 
     20  1.1  mrg #include "config.h"
     21  1.1  mrg #include "system.h"
     22  1.1  mrg #include "coretypes.h"
     23  1.1  mrg #include "tm.h"
     24  1.1  mrg #include "tm_d.h"
     25  1.1  mrg #include "d/d-target.h"
     26  1.1  mrg #include "d/d-target-def.h"
     27  1.1  mrg 
     28  1.1  mrg /* Implement TARGET_D_CPU_VERSIONS for S/390 and zSeries targets.  */
     29  1.1  mrg 
     30  1.1  mrg void
     31  1.1  mrg s390_d_target_versions (void)
     32  1.1  mrg {
     33  1.1  mrg   if (TARGET_ZARCH)
     34  1.1  mrg     d_add_builtin_version ("SystemZ");
     35  1.1  mrg   else if (TARGET_64BIT)
     36  1.1  mrg     d_add_builtin_version ("S390X");
     37  1.1  mrg   else
     38  1.1  mrg     d_add_builtin_version ("S390");
     39  1.1  mrg 
     40  1.1  mrg   if (TARGET_SOFT_FLOAT)
     41  1.1  mrg     d_add_builtin_version ("D_SoftFloat");
     42  1.1  mrg   else if (TARGET_HARD_FLOAT)
     43  1.1  mrg     d_add_builtin_version ("D_HardFloat");
     44  1.1  mrg }
     45  1.1  mrg 
     46  1.1  mrg /* Handle a call to `__traits(getTargetInfo, "floatAbi")'.  */
     47  1.1  mrg 
     48  1.1  mrg static tree
     49  1.1  mrg s390_d_handle_target_float_abi (void)
     50  1.1  mrg {
     51  1.1  mrg   const char *abi;
     52  1.1  mrg 
     53  1.1  mrg   if (TARGET_HARD_FLOAT)
     54  1.1  mrg     abi = "hard";
     55  1.1  mrg   else if (TARGET_SOFT_FLOAT)
     56  1.1  mrg     abi = "soft";
     57  1.1  mrg   else
     58  1.1  mrg     abi = "";
     59  1.1  mrg 
     60  1.1  mrg   return build_string_literal (strlen (abi) + 1, abi);
     61  1.1  mrg }
     62  1.1  mrg 
     63  1.1  mrg /* Implement TARGET_D_REGISTER_CPU_TARGET_INFO.  */
     64  1.1  mrg 
     65  1.1  mrg void
     66  1.1  mrg s390_d_register_target_info (void)
     67  1.1  mrg {
     68  1.1  mrg   const struct d_target_info_spec handlers[] = {
     69  1.1  mrg     { "floatAbi", s390_d_handle_target_float_abi },
     70  1.1  mrg     { NULL, NULL },
     71  1.1  mrg   };
     72  1.1  mrg 
     73  1.1  mrg   d_add_target_info_handlers (handlers);
     74  1.1  mrg }
     75