1#!/bin/sh 2# Generate csky_tables.opt from the lists in *.def. 3# Copyright (C) 2018-2019 Free Software Foundation, Inc. 4# Contributed by C-SKY Microsystems and Mentor Graphics. 5# 6# This file is part of GCC. 7# 8# GCC 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# GCC is distributed in the hope that it will be useful, 14# but WITHOUT ANY WARRANTY; without even the implied warranty of 15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16# GNU General Public License for more details. 17# 18# You should have received a copy of the GNU General Public License 19# along with GCC; see the file COPYING3. If not see 20# <http://www.gnu.org/licenses/>. 21 22cat <<EOF 23; -*- buffer-read-only: t -*- 24; Generated automatically by csky_genopt.sh from csky_cores.def. 25 26; Copyright (C) 2018-2019 Free Software Foundation, Inc. 27; 28; This file is part of GCC. 29; 30; GCC is free software; you can redistribute it and/or modify it under 31; the terms of the GNU General Public License as published by the Free 32; Software Foundation; either version 3, or (at your option) any later 33; version. 34; 35; GCC is distributed in the hope that it will be useful, but WITHOUT ANY 36; WARRANTY; without even the implied warranty of MERCHANTABILITY or 37; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 38; for more details. 39; 40; You should have received a copy of the GNU General Public License 41; along with GCC; see the file COPYING3. If not see 42; <http://www.gnu.org/licenses/>. 43 44Enum 45Name(csky_processor_type) Type(enum csky_processor_type) 46Known CSKY CPUs (for use with the -mcpu= options): 47 48EOF 49 50awk -F'[(, ]+' '/^CSKY_CORE/ { 51 name = $2 52 enum = $3 53 gsub("\"", "", name) 54 print "EnumValue" 55 print "Enum(csky_processor_type) String(" name ") Value( TARGET_CPU_" enum ")" 56 print "" 57}' $1/csky_cores.def 58 59cat <<EOF 60Enum 61Name(csky_arch) Type(int) 62Known CSKY architectures (for use with the -march= option): 63 64EOF 65 66awk -F'[(, ]+' 'BEGIN { 67 value = 0 68} 69/^CSKY_ARCH/ { 70 name = $2 71 gsub("\"", "", name) 72 print "EnumValue" 73 print "Enum(csky_arch) String(" name ") Value(" value ")" 74 print "" 75 value++ 76}' $1/csky_cores.def 77 78cat <<EOF 79Enum 80Name(csky_fpu) Type(enum csky_fpu_type) 81Known CSKY FPUs (for use with the -mfpu= option): 82 83EOF 84 85awk -F'[(, ]+' ' 86/^CSKY_FPU/ { 87 name = $2 88 enum = $3 89 gsub("\"", "", name) 90 print "EnumValue" 91 print "Enum(csky_fpu) String(" name ") Value(TARGET_FPU_" enum ")" 92 print "" 93} 94END { 95 print "EnumValue" 96 print "Enum(csky_fpu) String(auto) Value(TARGET_FPU_auto)" 97}' $1/csky_cores.def 98