Mercurial > hg > CbC > CbC_gcc
comparison gcc/config/cr16/cr16.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 /* Output routines for CR16 processor. | 1 /* Output routines for CR16 processor. |
2 Copyright (C) 2012-2017 Free Software Foundation, Inc. | 2 Copyright (C) 2012-2018 Free Software Foundation, Inc. |
3 Contributed by KPIT Cummins Infosystems Limited. | 3 Contributed by KPIT Cummins Infosystems Limited. |
4 | 4 |
5 This file is part of GCC. | 5 This file is part of GCC. |
6 | 6 |
7 GCC is free software; you can redistribute it and/or modify it | 7 GCC is free software; you can redistribute it and/or modify it |
15 License for more details. | 15 License for more details. |
16 | 16 |
17 You should have received a copy of the GNU General Public License | 17 You should have received a copy of the GNU General Public License |
18 along with GCC; see the file COPYING3. If not see | 18 along with GCC; see the file COPYING3. If not see |
19 <http://www.gnu.org/licenses/>. */ | 19 <http://www.gnu.org/licenses/>. */ |
20 | |
21 #define IN_TARGET_CODE 1 | |
20 | 22 |
21 #include "config.h" | 23 #include "config.h" |
22 #include "system.h" | 24 #include "system.h" |
23 #include "coretypes.h" | 25 #include "coretypes.h" |
24 #include "backend.h" | 26 #include "backend.h" |
204 #define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings | 206 #define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings |
205 | 207 |
206 /* Table of machine attributes. */ | 208 /* Table of machine attributes. */ |
207 static const struct attribute_spec cr16_attribute_table[] = { | 209 static const struct attribute_spec cr16_attribute_table[] = { |
208 /* ISRs have special prologue and epilogue requirements. */ | 210 /* ISRs have special prologue and epilogue requirements. */ |
209 /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler, | 211 /* { name, min_len, max_len, decl_req, type_req, fn_type_req, |
210 affects_type_identity }. */ | 212 affects_type_identity, handler, exclude }. */ |
211 {"interrupt", 0, 0, false, true, true, NULL, false}, | 213 {"interrupt", 0, 0, false, true, true, false, NULL, NULL}, |
212 {NULL, 0, 0, false, false, false, NULL, false} | 214 {NULL, 0, 0, false, false, false, false, NULL, NULL} |
213 }; | 215 }; |
214 | 216 |
215 /* TARGET_ASM_UNALIGNED_xx_OP generates .?byte directive | 217 /* TARGET_ASM_UNALIGNED_xx_OP generates .?byte directive |
216 .?byte directive along with @c is not understood by assembler. | 218 .?byte directive along with @c is not understood by assembler. |
217 Therefore, make all TARGET_ASM_UNALIGNED_xx_OP same | 219 Therefore, make all TARGET_ASM_UNALIGNED_xx_OP same |
249 return true; | 251 return true; |
250 | 252 |
251 return false; | 253 return false; |
252 } | 254 } |
253 | 255 |
254 static int | 256 static poly_int64 |
255 cr16_return_pops_args (tree fundecl ATTRIBUTE_UNUSED, | 257 cr16_return_pops_args (tree, tree, poly_int64) |
256 tree funtype ATTRIBUTE_UNUSED, | |
257 int size ATTRIBUTE_UNUSED) | |
258 { | 258 { |
259 return 0; | 259 return 0; |
260 } | 260 } |
261 | 261 |
262 /* Returns true if data model selected via command line option | 262 /* Returns true if data model selected via command line option |
429 padding_locals = current_frame_info.var_size % stack_alignment; | 429 padding_locals = current_frame_info.var_size % stack_alignment; |
430 if (padding_locals) | 430 if (padding_locals) |
431 padding_locals = stack_alignment - padding_locals; | 431 padding_locals = stack_alignment - padding_locals; |
432 | 432 |
433 current_frame_info.var_size += padding_locals; | 433 current_frame_info.var_size += padding_locals; |
434 current_frame_info.total_size = current_frame_info.var_size | 434 current_frame_info.total_size |
435 + (ACCUMULATE_OUTGOING_ARGS | 435 = (current_frame_info.var_size |
436 ? crtl->outgoing_args_size : 0); | 436 + (ACCUMULATE_OUTGOING_ARGS |
437 ? (HOST_WIDE_INT) crtl->outgoing_args_size : 0)); | |
437 } | 438 } |
438 | 439 |
439 /* Implements the macro INITIAL_ELIMINATION_OFFSET, return the OFFSET. */ | 440 /* Implements the macro INITIAL_ELIMINATION_OFFSET, return the OFFSET. */ |
440 int | 441 int |
441 cr16_initial_elimination_offset (int from, int to) | 442 cr16_initial_elimination_offset (int from, int to) |
445 | 446 |
446 /* Compute this since we need to use current_frame_info.var_size. */ | 447 /* Compute this since we need to use current_frame_info.var_size. */ |
447 cr16_compute_frame (); | 448 cr16_compute_frame (); |
448 | 449 |
449 if (((from) == FRAME_POINTER_REGNUM) && ((to) == STACK_POINTER_REGNUM)) | 450 if (((from) == FRAME_POINTER_REGNUM) && ((to) == STACK_POINTER_REGNUM)) |
450 return (ACCUMULATE_OUTGOING_ARGS ? crtl->outgoing_args_size : 0); | 451 return (ACCUMULATE_OUTGOING_ARGS |
452 ? (HOST_WIDE_INT) crtl->outgoing_args_size : 0); | |
451 else if (((from) == ARG_POINTER_REGNUM) && ((to) == FRAME_POINTER_REGNUM)) | 453 else if (((from) == ARG_POINTER_REGNUM) && ((to) == FRAME_POINTER_REGNUM)) |
452 return (current_frame_info.reg_size + current_frame_info.var_size); | 454 return (current_frame_info.reg_size + current_frame_info.var_size); |
453 else if (((from) == ARG_POINTER_REGNUM) && ((to) == STACK_POINTER_REGNUM)) | 455 else if (((from) == ARG_POINTER_REGNUM) && ((to) == STACK_POINTER_REGNUM)) |
454 return (current_frame_info.reg_size + current_frame_info.var_size | 456 return (current_frame_info.reg_size + current_frame_info.var_size |
455 + (ACCUMULATE_OUTGOING_ARGS ? crtl->outgoing_args_size : 0)); | 457 + (ACCUMULATE_OUTGOING_ARGS |
458 ? (HOST_WIDE_INT) crtl->outgoing_args_size : 0)); | |
456 else | 459 else |
457 gcc_unreachable (); | 460 gcc_unreachable (); |
458 } | 461 } |
459 | 462 |
460 /* Register Usage. */ | 463 /* Register Usage. */ |
1855 to = current_frame_info.last_reg_to_save; | 1858 to = current_frame_info.last_reg_to_save; |
1856 word_cnt = 0; | 1859 word_cnt = 0; |
1857 | 1860 |
1858 for (i = current_frame_info.last_reg_to_save; i >= 0;) | 1861 for (i = current_frame_info.last_reg_to_save; i >= 0;) |
1859 { | 1862 { |
1860 if (!current_frame_info.save_regs[i] || 0 == i || split_here) | 1863 if (!current_frame_info.save_regs[i] || i == 0 || split_here) |
1861 { | 1864 { |
1862 /* This block of regs is pushed in one instruction. */ | 1865 /* This block of regs is pushed in one instruction. */ |
1863 if (0 == i && current_frame_info.save_regs[i]) | 1866 if (i == 0 && current_frame_info.save_regs[i]) |
1864 from = 0; | 1867 from = 0; |
1865 | 1868 |
1866 for (j = to; j >= from; --j) | 1869 for (j = to; j >= from; --j) |
1867 { | 1870 { |
1868 if (j < CR16_FIRST_DWORD_REGISTER) | 1871 if (j < CR16_FIRST_DWORD_REGISTER) |
2210 } | 2213 } |
2211 | 2214 |
2212 return ""; | 2215 return ""; |
2213 } | 2216 } |
2214 | 2217 |
2218 /* Implement PUSH_ROUNDING. */ | |
2219 | |
2220 poly_int64 | |
2221 cr16_push_rounding (poly_int64 bytes) | |
2222 { | |
2223 return (bytes + 1) & ~1; | |
2224 } | |
2225 | |
2215 /* Initialize 'targetm' variable which contains pointers to functions | 2226 /* Initialize 'targetm' variable which contains pointers to functions |
2216 and data relating to the target machine. */ | 2227 and data relating to the target machine. */ |
2217 | 2228 |
2218 struct gcc_target targetm = TARGET_INITIALIZER; | 2229 struct gcc_target targetm = TARGET_INITIALIZER; |