1/* Subroutines for the gcc driver. 2 Copyright (C) 2016-2020 Free Software Foundation, Inc. 3 Contributed by Claudiu Zissulescu <claziss@synopsys.com> 4 5 This file is part of GCC. 6 7 GCC is free software; you can redistribute it and/or modify it 8 under the terms of the GNU General Public License as published by 9 the Free Software Foundation; either version 3, or (at your option) 10 any later version. 11 12 GCC is distributed in the hope that it will be useful, but WITHOUT 13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 15 License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with GCC; see the file COPYING3. If not see 19 <http://www.gnu.org/licenses/>. */ 20 21#define IN_TARGET_CODE 1 22 23#include "config.h" 24#include "system.h" 25#include "coretypes.h" 26#include "tm.h" 27 28/* Returns command line parameters to pass to as. */ 29 30const char* 31arc_cpu_to_as (int argc, const char **argv) 32{ 33 const char *name = NULL; 34 const arc_cpu_t *arc_selected_cpu; 35 36 /* No argument, check what is the default cpu. */ 37 if (argc == 0) 38 { 39 arc_selected_cpu = &arc_cpu_types[(int) TARGET_CPU_DEFAULT]; 40 } 41 else 42 { 43 name = argv[0]; 44 for (arc_selected_cpu = arc_cpu_types; arc_selected_cpu->name; 45 arc_selected_cpu++) 46 { 47 if (strcmp (arc_selected_cpu->name, name) == 0) 48 break; 49 } 50 } 51 52 switch (arc_selected_cpu->arch_info->arch_id) 53 { 54 case BASE_ARCH_em: 55 if (arc_selected_cpu->flags & FL_CD) 56 name = "-mcode-density"; 57 else 58 name = ""; 59 if (arc_selected_cpu->flags & FL_FPUDA) 60 name = concat ("-mfpuda ", name, NULL); 61 if (arc_selected_cpu->flags & FL_SPFP) 62 name = concat ("-mspfp ", name, NULL); 63 if (arc_selected_cpu->flags & FL_DPFP) 64 name = concat ("-mdpfp ", name, NULL); 65 return concat ("-mcpu=arcem ", name, NULL); 66 case BASE_ARCH_hs: 67 return "-mcpu=archs"; 68 case BASE_ARCH_700: 69 if (arc_selected_cpu->processor == PROCESSOR_nps400) 70 return "-mcpu=nps400 -mEA"; 71 else 72 return "-mcpu=arc700 -mEA"; 73 case BASE_ARCH_6xx: 74 if (arc_selected_cpu->flags & FL_MUL64) 75 return "-mcpu=arc600 -mmul64 -mnorm"; 76 if (arc_selected_cpu->flags & FL_MUL32x16) 77 return "-mcpu=arc600 -mdsp-packa -mnorm"; 78 return "-mcpu=arc600 -mnorm"; 79 default: 80 gcc_unreachable (); 81 } 82 return NULL; 83} 84