Mercurial > hg > CbC > CbC_gcc
comparison gcc/config/c6x/c6x.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 /* Target Code for TI C6X | 1 /* Target Code for TI C6X |
2 Copyright (C) 2010-2017 Free Software Foundation, Inc. | 2 Copyright (C) 2010-2018 Free Software Foundation, Inc. |
3 Contributed by Andrew Jenner <andrew@codesourcery.com> | 3 Contributed by Andrew Jenner <andrew@codesourcery.com> |
4 Contributed by Bernd Schmidt <bernds@codesourcery.com> | 4 Contributed by Bernd Schmidt <bernds@codesourcery.com> |
5 | 5 |
6 This file is part of GCC. | 6 This file is part of GCC. |
7 | 7 |
16 License for more details. | 16 License for more details. |
17 | 17 |
18 You should have received a copy of the GNU General Public License | 18 You should have received a copy of the GNU General Public License |
19 along with GCC; see the file COPYING3. If not see | 19 along with GCC; see the file COPYING3. If not see |
20 <http://www.gnu.org/licenses/>. */ | 20 <http://www.gnu.org/licenses/>. */ |
21 | |
22 #define IN_TARGET_CODE 1 | |
21 | 23 |
22 #include "config.h" | 24 #include "config.h" |
23 #include "system.h" | 25 #include "system.h" |
24 #include "coretypes.h" | 26 #include "coretypes.h" |
25 #include "backend.h" | 27 #include "backend.h" |
4633 | 4635 |
4634 static void | 4636 static void |
4635 c6x_gen_bundles (void) | 4637 c6x_gen_bundles (void) |
4636 { | 4638 { |
4637 basic_block bb; | 4639 basic_block bb; |
4638 rtx_insn *insn, *next, *last_call; | |
4639 | 4640 |
4640 FOR_EACH_BB_FN (bb, cfun) | 4641 FOR_EACH_BB_FN (bb, cfun) |
4641 { | 4642 { |
4642 rtx_insn *insn, *next; | 4643 rtx_insn *insn, *next; |
4643 /* The machine is eight insns wide. We can have up to six shadow | 4644 /* The machine is eight insns wide. We can have up to six shadow |
4700 } | 4701 } |
4701 if (at_end) | 4702 if (at_end) |
4702 break; | 4703 break; |
4703 } | 4704 } |
4704 } | 4705 } |
4705 /* Bundling, and emitting nops, can separate | |
4706 NOTE_INSN_CALL_ARG_LOCATION from the corresponding calls. Fix | |
4707 that up here. */ | |
4708 last_call = NULL; | |
4709 for (insn = get_insns (); insn; insn = next) | |
4710 { | |
4711 next = NEXT_INSN (insn); | |
4712 if (CALL_P (insn) | |
4713 || (INSN_P (insn) && GET_CODE (PATTERN (insn)) == SEQUENCE | |
4714 && CALL_P (XVECEXP (PATTERN (insn), 0, 0)))) | |
4715 last_call = insn; | |
4716 if (!NOTE_P (insn) || NOTE_KIND (insn) != NOTE_INSN_CALL_ARG_LOCATION) | |
4717 continue; | |
4718 if (NEXT_INSN (last_call) == insn) | |
4719 continue; | |
4720 SET_NEXT_INSN (PREV_INSN (insn)) = NEXT_INSN (insn); | |
4721 SET_PREV_INSN (NEXT_INSN (insn)) = PREV_INSN (insn); | |
4722 SET_PREV_INSN (insn) = last_call; | |
4723 SET_NEXT_INSN (insn) = NEXT_INSN (last_call); | |
4724 SET_PREV_INSN (NEXT_INSN (insn)) = insn; | |
4725 SET_NEXT_INSN (PREV_INSN (insn)) = insn; | |
4726 last_call = insn; | |
4727 } | |
4728 } | 4706 } |
4729 | 4707 |
4730 /* Emit a NOP instruction for CYCLES cycles after insn AFTER. Return it. */ | 4708 /* Emit a NOP instruction for CYCLES cycles after insn AFTER. Return it. */ |
4731 | 4709 |
4732 static rtx_insn * | 4710 static rtx_insn * |
4855 otherwise the caller will do it later. | 4833 otherwise the caller will do it later. |
4856 This function is called after final insn scheduling, but before creating | 4834 This function is called after final insn scheduling, but before creating |
4857 the SEQUENCEs that represent execute packets. */ | 4835 the SEQUENCEs that represent execute packets. */ |
4858 | 4836 |
4859 static void | 4837 static void |
4860 reorg_split_calls (rtx_insn **call_labels) | 4838 reorg_split_calls (rtx_code_label **call_labels) |
4861 { | 4839 { |
4862 unsigned int reservation_mask = 0; | 4840 unsigned int reservation_mask = 0; |
4863 rtx_insn *insn = get_insns (); | 4841 rtx_insn *insn = get_insns (); |
4864 gcc_assert (NOTE_P (insn)); | 4842 gcc_assert (NOTE_P (insn)); |
4865 insn = next_real_insn (insn); | 4843 insn = next_real_insn (insn); |
5029 insns as required for correctness. CALL_LABELS is the array that | 5007 insns as required for correctness. CALL_LABELS is the array that |
5030 holds the return labels for call insns; we emit these here if | 5008 holds the return labels for call insns; we emit these here if |
5031 scheduling was run earlier. */ | 5009 scheduling was run earlier. */ |
5032 | 5010 |
5033 static void | 5011 static void |
5034 reorg_emit_nops (rtx_insn **call_labels) | 5012 reorg_emit_nops (rtx_code_label **call_labels) |
5035 { | 5013 { |
5036 bool first; | 5014 bool first; |
5037 rtx last_call; | 5015 rtx last_call; |
5038 rtx_insn *prev; | 5016 rtx_insn *prev; |
5039 int prev_clock, earliest_bb_end; | 5017 int prev_clock, earliest_bb_end; |
5967 | 5945 |
5968 free_delay_pairs (); | 5946 free_delay_pairs (); |
5969 } | 5947 } |
5970 sched_no_dce = false; | 5948 sched_no_dce = false; |
5971 | 5949 |
5972 rtx_insn **call_labels = XCNEWVEC (rtx_insn *, get_max_uid () + 1); | 5950 rtx_code_label **call_labels = XCNEWVEC (rtx_code_label *, get_max_uid () + 1); |
5973 | 5951 |
5974 reorg_split_calls (call_labels); | 5952 reorg_split_calls (call_labels); |
5975 | 5953 |
5976 if (c6x_flag_schedule_insns2) | 5954 if (c6x_flag_schedule_insns2) |
5977 { | 5955 { |