comparison gcc/config/sh/sh-c.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents a06113de4d67
children 84e7813d76e9
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* Pragma handling for GCC for Renesas / SuperH SH. 1 /* Pragma handling for GCC for Renesas / SuperH SH.
2 Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2 Copyright (C) 1993-2017 Free Software Foundation, Inc.
3 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
4 Contributed by Joern Rennecke <joern.rennecke@st.com>. 3 Contributed by Joern Rennecke <joern.rennecke@st.com>.
5 4
6 This file is part of GCC. 5 This file is part of GCC.
7 6
8 GCC is free software; you can redistribute it and/or modify 7 GCC is free software; you can redistribute it and/or modify
20 <http://www.gnu.org/licenses/>. */ 19 <http://www.gnu.org/licenses/>. */
21 20
22 #include "config.h" 21 #include "config.h"
23 #include "system.h" 22 #include "system.h"
24 #include "coretypes.h" 23 #include "coretypes.h"
25 #include "tm.h" 24 #include "target.h"
26 #include "tree.h" 25 #include "c-family/c-common.h"
26 #include "memmodel.h"
27 #include "tm_p.h" 27 #include "tm_p.h"
28 #include "stringpool.h"
29 #include "attribs.h"
28 30
29 /* Handle machine specific pragmas to be semi-compatible with Renesas 31 /* Handle machine specific pragmas to be semi-compatible with Renesas
30 compiler. */ 32 compiler. */
31 33
32 /* Add ATTR to the attributes of the current function. If there is no 34 /* Add ATTR to the attributes of the current function. If there is no
64 void 66 void
65 sh_pr_nosave_low_regs (struct cpp_reader *pfile ATTRIBUTE_UNUSED) 67 sh_pr_nosave_low_regs (struct cpp_reader *pfile ATTRIBUTE_UNUSED)
66 { 68 {
67 sh_add_function_attribute ("nosave_low_regs"); 69 sh_add_function_attribute ("nosave_low_regs");
68 } 70 }
71
72 #define builtin_define(TXT) cpp_define (pfile, TXT)
73 #define builtin_assert(TXT) cpp_assert (pfile, TXT)
74
75 /* Implement the TARGET_CPU_CPP_BUILTINS macro */
76 void
77 sh_cpu_cpp_builtins (cpp_reader* pfile)
78 {
79 builtin_define ("__sh__");
80 builtin_assert ("cpu=sh");
81 builtin_assert ("machine=sh");
82 switch ((int) sh_cpu)
83 {
84 case PROCESSOR_SH1:
85 builtin_define ("__sh1__");
86 builtin_define ("__SH1__");
87 break;
88 case PROCESSOR_SH2:
89 builtin_define ("__sh2__");
90 builtin_define ("__SH2__");
91 break;
92 case PROCESSOR_SH2E:
93 builtin_define ("__SH2E__");
94 break;
95 case PROCESSOR_SH2A:
96 builtin_define ("__SH2A__");
97 if (TARGET_SH2A_DOUBLE)
98 builtin_define (TARGET_FPU_SINGLE
99 ? "__SH2A_SINGLE__" : "__SH2A_DOUBLE__");
100 else
101 builtin_define (TARGET_FPU_ANY
102 ? "__SH2A_SINGLE_ONLY__" : "__SH2A_NOFPU__");
103 break;
104 case PROCESSOR_SH3:
105 builtin_define ("__sh3__");
106 builtin_define ("__SH3__");
107 if (TARGET_HARD_SH4)
108 builtin_define ("__SH4_NOFPU__");
109 break;
110 case PROCESSOR_SH3E:
111 builtin_define (TARGET_HARD_SH4 ? "__SH4_SINGLE_ONLY__" : "__SH3E__");
112 break;
113 case PROCESSOR_SH4:
114 builtin_define (TARGET_FPU_SINGLE ? "__SH4_SINGLE__" : "__SH4__");
115 break;
116 case PROCESSOR_SH4A: \
117 builtin_define ("__SH4A__");
118 builtin_define (TARGET_SH4
119 ? (TARGET_FPU_SINGLE ? "__SH4_SINGLE__" : "__SH4__")
120 : TARGET_FPU_ANY ? "__SH4_SINGLE_ONLY__"
121 : "__SH4_NOFPU__");
122 break;
123 }
124 if (TARGET_FPU_ANY)
125 builtin_define ("__SH_FPU_ANY__");
126 if (TARGET_FPU_DOUBLE)
127 builtin_define ("__SH_FPU_DOUBLE__");
128 if (TARGET_HITACHI)
129 builtin_define ("__HITACHI__");
130 if (TARGET_FMOVD)
131 builtin_define ("__FMOVD_ENABLED__");
132 if (TARGET_FDPIC)
133 {
134 builtin_define ("__SH_FDPIC__");
135 builtin_define ("__FDPIC__");
136 }
137 builtin_define (TARGET_LITTLE_ENDIAN
138 ? "__LITTLE_ENDIAN__" : "__BIG_ENDIAN__");
139
140 cpp_define_formatted (pfile, "__SH_ATOMIC_MODEL_%s__",
141 selected_atomic_model ().cdef_name);
142 }