comparison gcc/config/vax/vax.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 /* Subroutines for insn-output.c for VAX. 1 /* Subroutines for insn-output.c for VAX.
2 Copyright (C) 1987-2018 Free Software Foundation, Inc. 2 Copyright (C) 1987-2020 Free Software Foundation, Inc.
3 3
4 This file is part of GCC. 4 This file is part of GCC.
5 5
6 GCC is free software; you can redistribute it and/or modify 6 GCC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
52 static void vax_output_mi_thunk (FILE *, tree, HOST_WIDE_INT, 52 static void vax_output_mi_thunk (FILE *, tree, HOST_WIDE_INT,
53 HOST_WIDE_INT, tree); 53 HOST_WIDE_INT, tree);
54 static int vax_address_cost_1 (rtx); 54 static int vax_address_cost_1 (rtx);
55 static int vax_address_cost (rtx, machine_mode, addr_space_t, bool); 55 static int vax_address_cost (rtx, machine_mode, addr_space_t, bool);
56 static bool vax_rtx_costs (rtx, machine_mode, int, int, int *, bool); 56 static bool vax_rtx_costs (rtx, machine_mode, int, int, int *, bool);
57 static rtx vax_function_arg (cumulative_args_t, machine_mode, 57 static rtx vax_function_arg (cumulative_args_t, const function_arg_info &);
58 const_tree, bool); 58 static void vax_function_arg_advance (cumulative_args_t,
59 static void vax_function_arg_advance (cumulative_args_t, machine_mode, 59 const function_arg_info &);
60 const_tree, bool);
61 static rtx vax_struct_value_rtx (tree, int); 60 static rtx vax_struct_value_rtx (tree, int);
62 static rtx vax_builtin_setjmp_frame_value (void);
63 static void vax_asm_trampoline_template (FILE *); 61 static void vax_asm_trampoline_template (FILE *);
64 static void vax_trampoline_init (rtx, tree, rtx); 62 static void vax_trampoline_init (rtx, tree, rtx);
65 static poly_int64 vax_return_pops_args (tree, tree, poly_int64); 63 static poly_int64 vax_return_pops_args (tree, tree, poly_int64);
66 static bool vax_mode_dependent_address_p (const_rtx, addr_space_t); 64 static bool vax_mode_dependent_address_p (const_rtx, addr_space_t);
67 static HOST_WIDE_INT vax_starting_frame_offset (void); 65 static HOST_WIDE_INT vax_starting_frame_offset (void);
97 #define TARGET_FUNCTION_ARG_ADVANCE vax_function_arg_advance 95 #define TARGET_FUNCTION_ARG_ADVANCE vax_function_arg_advance
98 96
99 #undef TARGET_STRUCT_VALUE_RTX 97 #undef TARGET_STRUCT_VALUE_RTX
100 #define TARGET_STRUCT_VALUE_RTX vax_struct_value_rtx 98 #define TARGET_STRUCT_VALUE_RTX vax_struct_value_rtx
101 99
102 #undef TARGET_BUILTIN_SETJMP_FRAME_VALUE
103 #define TARGET_BUILTIN_SETJMP_FRAME_VALUE vax_builtin_setjmp_frame_value
104
105 #undef TARGET_LRA_P 100 #undef TARGET_LRA_P
106 #define TARGET_LRA_P hook_bool_void_false 101 #define TARGET_LRA_P hook_bool_void_false
107 102
108 #undef TARGET_LEGITIMATE_ADDRESS_P 103 #undef TARGET_LEGITIMATE_ADDRESS_P
109 #define TARGET_LEGITIMATE_ADDRESS_P vax_legitimate_address_p 104 #define TARGET_LEGITIMATE_ADDRESS_P vax_legitimate_address_p
124 #define TARGET_OPTION_OVERRIDE vax_option_override 119 #define TARGET_OPTION_OVERRIDE vax_option_override
125 120
126 #undef TARGET_STARTING_FRAME_OFFSET 121 #undef TARGET_STARTING_FRAME_OFFSET
127 #define TARGET_STARTING_FRAME_OFFSET vax_starting_frame_offset 122 #define TARGET_STARTING_FRAME_OFFSET vax_starting_frame_offset
128 123
124 #undef TARGET_HAVE_SPECULATION_SAFE_VALUE
125 #define TARGET_HAVE_SPECULATION_SAFE_VALUE speculation_safe_value_not_needed
126
129 struct gcc_target targetm = TARGET_INITIALIZER; 127 struct gcc_target targetm = TARGET_INITIALIZER;
130 128
131 /* Set global variables as needed for the options enabled. */ 129 /* Set global variables as needed for the options enabled. */
132 130
133 static void 131 static void
169 int mask = 0; 167 int mask = 0;
170 HOST_WIDE_INT size; 168 HOST_WIDE_INT size;
171 rtx insn; 169 rtx insn;
172 170
173 for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) 171 for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
174 if (df_regs_ever_live_p (regno) && !call_used_regs[regno]) 172 if (df_regs_ever_live_p (regno) && !call_used_or_fixed_reg_p (regno))
175 mask |= 1 << regno; 173 mask |= 1 << regno;
176 174
177 insn = emit_insn (gen_procedure_entry_mask (GEN_INT (mask))); 175 insn = emit_insn (gen_procedure_entry_mask (GEN_INT (mask)));
178 RTX_FRAME_RELATED_P (insn) = 1; 176 RTX_FRAME_RELATED_P (insn) = 1;
179 177
1047 tree thunk ATTRIBUTE_UNUSED, 1045 tree thunk ATTRIBUTE_UNUSED,
1048 HOST_WIDE_INT delta, 1046 HOST_WIDE_INT delta,
1049 HOST_WIDE_INT vcall_offset ATTRIBUTE_UNUSED, 1047 HOST_WIDE_INT vcall_offset ATTRIBUTE_UNUSED,
1050 tree function) 1048 tree function)
1051 { 1049 {
1050 const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk));
1051
1052 assemble_start_function (thunk, fnname);
1052 fprintf (file, "\t.word 0x0ffc\n\taddl2 $" HOST_WIDE_INT_PRINT_DEC, delta); 1053 fprintf (file, "\t.word 0x0ffc\n\taddl2 $" HOST_WIDE_INT_PRINT_DEC, delta);
1053 asm_fprintf (file, ",4(%Rap)\n"); 1054 asm_fprintf (file, ",4(%Rap)\n");
1054 fprintf (file, "\tjmp "); 1055 fprintf (file, "\tjmp ");
1055 assemble_name (file, XSTR (XEXP (DECL_RTL (function), 0), 0)); 1056 assemble_name (file, XSTR (XEXP (DECL_RTL (function), 0), 0));
1056 fprintf (file, "+2\n"); 1057 fprintf (file, "+2\n");
1058 assemble_end_function (thunk, fnname);
1057 } 1059 }
1058 1060
1059 static rtx 1061 static rtx
1060 vax_struct_value_rtx (tree fntype ATTRIBUTE_UNUSED, 1062 vax_struct_value_rtx (tree fntype ATTRIBUTE_UNUSED,
1061 int incoming ATTRIBUTE_UNUSED) 1063 int incoming ATTRIBUTE_UNUSED)
1062 { 1064 {
1063 return gen_rtx_REG (Pmode, VAX_STRUCT_VALUE_REGNUM); 1065 return gen_rtx_REG (Pmode, VAX_STRUCT_VALUE_REGNUM);
1064 }
1065
1066 static rtx
1067 vax_builtin_setjmp_frame_value (void)
1068 {
1069 return hard_frame_pointer_rtx;
1070 } 1066 }
1071 1067
1072 /* Worker function for NOTICE_UPDATE_CC. */ 1068 /* Worker function for NOTICE_UPDATE_CC. */
1073 1069
1074 void 1070 void
2145 tree funtype ATTRIBUTE_UNUSED, poly_int64 size) 2141 tree funtype ATTRIBUTE_UNUSED, poly_int64 size)
2146 { 2142 {
2147 return size > 255 * 4 ? 0 : (HOST_WIDE_INT) size; 2143 return size > 255 * 4 ? 0 : (HOST_WIDE_INT) size;
2148 } 2144 }
2149 2145
2150 /* Define where to put the arguments to a function. 2146 /* Implement TARGET_FUNCTION_ARG. On the VAX all args are pushed. */
2151 Value is zero to push the argument on the stack,
2152 or a hard register in which to store the argument.
2153
2154 MODE is the argument's machine mode.
2155 TYPE is the data type of the argument (as a tree).
2156 This is null for libcalls where that information may
2157 not be available.
2158 CUM is a variable of type CUMULATIVE_ARGS which gives info about
2159 the preceding args and about the function being called.
2160 NAMED is nonzero if this argument is a named parameter
2161 (otherwise it is an extra parameter matching an ellipsis). */
2162
2163 /* On the VAX all args are pushed. */
2164 2147
2165 static rtx 2148 static rtx
2166 vax_function_arg (cumulative_args_t cum ATTRIBUTE_UNUSED, 2149 vax_function_arg (cumulative_args_t, const function_arg_info &)
2167 machine_mode mode ATTRIBUTE_UNUSED,
2168 const_tree type ATTRIBUTE_UNUSED,
2169 bool named ATTRIBUTE_UNUSED)
2170 { 2150 {
2171 return NULL_RTX; 2151 return NULL_RTX;
2172 } 2152 }
2173 2153
2174 /* Update the data in CUM to advance over an argument of mode MODE and 2154 /* Update the data in CUM to advance over argument ARG. */
2175 data type TYPE. (TYPE is null for libcalls where that information
2176 may not be available.) */
2177 2155
2178 static void 2156 static void
2179 vax_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, 2157 vax_function_arg_advance (cumulative_args_t cum_v,
2180 const_tree type, bool named ATTRIBUTE_UNUSED) 2158 const function_arg_info &arg)
2181 { 2159 {
2182 CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); 2160 CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
2183 2161
2184 *cum += (mode != BLKmode 2162 *cum += (arg.promoted_size_in_bytes () + 3) & ~3;
2185 ? (GET_MODE_SIZE (mode) + 3) & ~3
2186 : (int_size_in_bytes (type) + 3) & ~3);
2187 } 2163 }
2188 2164
2189 static HOST_WIDE_INT 2165 static HOST_WIDE_INT
2190 vax_starting_frame_offset (void) 2166 vax_starting_frame_offset (void)
2191 { 2167 {