diff options
author | Claudiu Zissulescu <claziss@synopsys.com> | 2016-12-16 13:56:21 +0100 |
---|---|---|
committer | Claudiu Zissulescu <claziss@gcc.gnu.org> | 2016-12-16 13:56:21 +0100 |
commit | e04ea1daa924a2dd211ef5e222b42c4f9e29d8e4 (patch) | |
tree | a94285599d8bd451e45d16b1e609c3f8ed57acb4 /gcc | |
parent | d476b53c3651786fa283f89ad9434731f4f902e9 (diff) | |
download | gcc-e04ea1daa924a2dd211ef5e222b42c4f9e29d8e4.zip gcc-e04ea1daa924a2dd211ef5e222b42c4f9e29d8e4.tar.gz gcc-e04ea1daa924a2dd211ef5e222b42c4f9e29d8e4.tar.bz2 |
[ARC] Rework code for profiling.
gcc/
2016-12-16 Claudiu Zissulescu <claziss@synopsys.com>
* config/arc/arc.h (LINK_SPEC): Tidy up.
(ENDFILE_SPEC): Likewise.
(LIB_SPEC): Likewise.
(STARTFILE_SPEC): Include gcrt0 when profiling.
(FUNCTION_PROFILER): Use __mcount.
* config/arc/arc.opt (mucb-mcount): Remove.
* doc/invoke.texi (ARC): Remove mucb-mcount doc.
* arc/arc-protos.h (arc_profile_call): Remove.
* config/arc/arc.c (write_profile_sections): Likewise.
(arc_profile_call): Likewise.
(unspec_prof_hash): Likewise.
(unspec_prof_htab_eq): Likewise.
(arc_legitimate_constant_p): Remove UNSPEC_PROF.
(arc_reorg): Remove call to write_profile_sections.
* config/arc/arc.md (call): Remove call to arc_profile_call.
(call_value): Likewise.
(sibcall): Likewise.
(sibcall_value): Likewise.
(define_constants): Remove UNSPEC_PROF.
libgcc/
* config.host (arc*-*-linux-uclibc*): Remove libgmon, crtg, and
crtgend.
(arc*-*-elf*): Likewise.
* config/arc/t-arc: Remove old gmon lib targets.
* config/arc/crtg.S: Remove.
* config/arc/crtgend.S: Likewise.
* config/arc/gmon/atomic.h: Likewise.
* config/arc/gmon/auxreg.h: Likewise.
* config/arc/gmon/dcache_linesz.S: Likewise.
* config/arc/gmon/gmon.c: Likewise.
* config/arc/gmon/machine-gmon.h: Likewise.
* config/arc/gmon/mcount.c: Likewise.
* config/arc/gmon/prof-freq-stub.S: Likewise.
* config/arc/gmon/prof-freq.c: Likewise.
* config/arc/gmon/profil.S: Likewise.
* config/arc/gmon/sys/gmon.h: Likewise.
* config/arc/gmon/sys/gmon_out.h: Likewise.
* config/arc/t-arc-newlib: Likewise.
* config/arc/t-arc700-uClibc: Renamed to t-arc-uClibc.
From-SVN: r243742
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 22 | ||||
-rw-r--r-- | gcc/config/arc/arc-protos.h | 1 | ||||
-rw-r--r-- | gcc/config/arc/arc.c | 152 | ||||
-rw-r--r-- | gcc/config/arc/arc.h | 28 | ||||
-rw-r--r-- | gcc/config/arc/arc.md | 35 | ||||
-rw-r--r-- | gcc/config/arc/arc.opt | 4 | ||||
-rw-r--r-- | gcc/doc/invoke.texi | 8 |
7 files changed, 39 insertions, 211 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fe59c99..e5f92a4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,27 @@ 2016-12-16 Claudiu Zissulescu <claziss@synopsys.com> + * config/arc/arc.h (LINK_SPEC): Tidy up. + (ENDFILE_SPEC): Likewise. + (LIB_SPEC): Likewise. + (STARTFILE_SPEC): Include gcrt0 when profiling. + (FUNCTION_PROFILER): Use __mcount. + * config/arc/arc.opt (mucb-mcount): Remove. + * doc/invoke.texi (ARC): Remove mucb-mcount doc. + * arc/arc-protos.h (arc_profile_call): Remove. + * config/arc/arc.c (write_profile_sections): Likewise. + (arc_profile_call): Likewise. + (unspec_prof_hash): Likewise. + (unspec_prof_htab_eq): Likewise. + (arc_legitimate_constant_p): Remove UNSPEC_PROF. + (arc_reorg): Remove call to write_profile_sections. + * config/arc/arc.md (call): Remove call to arc_profile_call. + (call_value): Likewise. + (sibcall): Likewise. + (sibcall_value): Likewise. + (define_constants): Remove UNSPEC_PROF. + +2016-12-16 Claudiu Zissulescu <claziss@synopsys.com> + * config/arc/arc.md (mulsidi_600): Change to insn_and_split, generate new mul64 insn for core multiplication work. (umulsidi_600): Likewise, but use mulu64 insn. diff --git a/gcc/config/arc/arc-protos.h b/gcc/config/arc/arc-protos.h index bdbf7ce..d896fe9 100644 --- a/gcc/config/arc/arc-protos.h +++ b/gcc/config/arc/arc-protos.h @@ -70,7 +70,6 @@ extern bool arc_raw_symbolic_reference_mentioned_p (rtx, bool); extern bool arc_legitimate_pic_operand_p (rtx); extern bool arc_is_longcall_p (rtx); extern bool arc_is_shortcall_p (rtx); -extern bool arc_profile_call (rtx callee); extern bool valid_brcc_with_delay_p (rtx *); extern bool small_data_pattern (rtx , machine_mode); extern rtx arc_rewrite_small_data (rtx); diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index a0aa16e..9a72786 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -3610,97 +3610,6 @@ arc_print_operand_address (FILE *file , rtx addr) } } -/* Called via walk_stores. DATA points to a hash table we can use to - establish a unique SYMBOL_REF for each counter, which corresponds to - a caller-callee pair. - X is a store which we want to examine for an UNSPEC_PROF, which - would be an address loaded into a register, or directly used in a MEM. - If we found an UNSPEC_PROF, if we encounter a new counter the first time, - write out a description and a data allocation for a 32 bit counter. - Also, fill in the appropriate symbol_ref into each UNSPEC_PROF instance. */ - -static void -write_profile_sections (rtx dest ATTRIBUTE_UNUSED, rtx x, void *data) -{ - rtx *srcp, src; - htab_t htab = (htab_t) data; - rtx *slot; - - if (GET_CODE (x) != SET) - return; - srcp = &SET_SRC (x); - if (MEM_P (*srcp)) - srcp = &XEXP (*srcp, 0); - else if (MEM_P (SET_DEST (x))) - srcp = &XEXP (SET_DEST (x), 0); - src = *srcp; - if (GET_CODE (src) != CONST) - return; - src = XEXP (src, 0); - if (GET_CODE (src) != UNSPEC || XINT (src, 1) != UNSPEC_PROF) - return; - - gcc_assert (XVECLEN (src, 0) == 3); - if (!htab_elements (htab)) - { - output_asm_insn (".section .__arc_profile_desc, \"a\"\n" - "\t.long %0 + 1\n", - &XVECEXP (src, 0, 0)); - } - slot = (rtx *) htab_find_slot (htab, src, INSERT); - if (*slot == HTAB_EMPTY_ENTRY) - { - static int count_nr; - char buf[24]; - rtx count; - - *slot = src; - sprintf (buf, "__prof_count%d", count_nr++); - count = gen_rtx_SYMBOL_REF (Pmode, xstrdup (buf)); - XVECEXP (src, 0, 2) = count; - output_asm_insn (".section\t.__arc_profile_desc, \"a\"\n" - "\t.long\t%1\n" - "\t.section\t.__arc_profile_counters, \"aw\"\n" - "\t.type\t%o2, @object\n" - "\t.size\t%o2, 4\n" - "%o2:\t.zero 4", - &XVECEXP (src, 0, 0)); - *srcp = count; - } - else - *srcp = XVECEXP (*slot, 0, 2); -} - -/* Hash function for UNSPEC_PROF htab. Use both the caller's name and - the callee's name (if known). */ - -static hashval_t -unspec_prof_hash (const void *x) -{ - const_rtx u = (const_rtx) x; - const_rtx s1 = XVECEXP (u, 0, 1); - - return (htab_hash_string (XSTR (XVECEXP (u, 0, 0), 0)) - ^ (s1->code == SYMBOL_REF ? htab_hash_string (XSTR (s1, 0)) : 0)); -} - -/* Equality function for UNSPEC_PROF htab. Two pieces of UNSPEC_PROF rtl - shall refer to the same counter if both caller name and callee rtl - are identical. */ - -static int -unspec_prof_htab_eq (const void *x, const void *y) -{ - const_rtx u0 = (const_rtx) x; - const_rtx u1 = (const_rtx) y; - const_rtx s01 = XVECEXP (u0, 0, 1); - const_rtx s11 = XVECEXP (u1, 0, 1); - - return (!strcmp (XSTR (XVECEXP (u0, 0, 0), 0), - XSTR (XVECEXP (u1, 0, 0), 0)) - && rtx_equal_p (s01, s11)); -} - /* Conditional execution support. This is based on the ARM port but for now is much simpler. @@ -5438,7 +5347,6 @@ arc_legitimate_constant_p (machine_mode mode, rtx x) case UNSPEC_TLS_GD: case UNSPEC_TLS_IE: case UNSPEC_TLS_OFF: - case UNSPEC_PROF: return true; default: @@ -6359,47 +6267,6 @@ arc_is_shortcall_p (rtx sym_ref) } -/* Emit profiling code for calling CALLEE. Return true if a special - call pattern needs to be generated. */ - -bool -arc_profile_call (rtx callee) -{ - rtx from = XEXP (DECL_RTL (current_function_decl), 0); - - if (TARGET_UCB_MCOUNT) - /* Profiling is done by instrumenting the callee. */ - return false; - - if (CONSTANT_P (callee)) - { - rtx count_ptr - = gen_rtx_CONST (Pmode, - gen_rtx_UNSPEC (Pmode, - gen_rtvec (3, from, callee, - CONST0_RTX (Pmode)), - UNSPEC_PROF)); - rtx counter = gen_rtx_MEM (SImode, count_ptr); - /* ??? The increment would better be done atomically, but as there is - no proper hardware support, that would be too expensive. */ - emit_move_insn (counter, - force_reg (SImode, plus_constant (SImode, counter, 1))); - return false; - } - else - { - rtx count_list_ptr - = gen_rtx_CONST (Pmode, - gen_rtx_UNSPEC (Pmode, - gen_rtvec (3, from, CONST0_RTX (Pmode), - CONST0_RTX (Pmode)), - UNSPEC_PROF)); - emit_move_insn (gen_rtx_REG (Pmode, 8), count_list_ptr); - emit_move_insn (gen_rtx_REG (Pmode, 9), callee); - return true; - } -} - /* Worker function for TARGET_RETURN_IN_MEMORY. */ static bool @@ -6621,25 +6488,6 @@ arc_reorg (void) cfun->machine->arc_reorg_started = 1; arc_reorg_in_progress = 1; - /* Emit special sections for profiling. */ - if (crtl->profile) - { - section *save_text_section; - rtx_insn *insn; - int size = get_max_uid () >> 4; - htab_t htab = htab_create (size, unspec_prof_hash, unspec_prof_htab_eq, - NULL); - - save_text_section = in_section; - for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) - if (NONJUMP_INSN_P (insn)) - walk_stores (PATTERN (insn), write_profile_sections, htab); - if (htab_elements (htab)) - in_section = 0; - switch_to_section (save_text_section); - htab_delete (htab); - } - /* Link up loop ends with their loop start. */ { for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h index f9512c4..87a2e11 100644 --- a/gcc/config/arc/arc.h +++ b/gcc/config/arc/arc.h @@ -121,12 +121,11 @@ extern const char *arc_cpu_to_as (int argc, const char **argv); -X %{mbig-endian:-EB} \ %{EB} %{EL} \ %{marclinux*} \ - %{!marclinux*: %{pg|p|profile:-marclinux_prof;: -marclinux}} \ + %{!marclinux*: -marclinux} \ %{!z:-z max-page-size=0x2000 -z common-page-size=0x2000} \ %{shared:-shared}" #else -#define LINK_SPEC "%{mbig-endian:-EB} %{EB} %{EL}\ - %{pg|p:-marcelf_prof;mA7|mARC700|mcpu=arc700|mcpu=ARC700: -marcelf}" +#define LINK_SPEC "%{mbig-endian:-EB} %{EB} %{EL}" #endif #if DEFAULT_LIBC != LIBC_UCLIBC @@ -135,7 +134,7 @@ extern const char *arc_cpu_to_as (int argc, const char **argv); #define EXTRA_SPECS \ { "arc_tls_extra_start_spec", ARC_TLS_EXTRA_START_SPEC }, \ -#define STARTFILE_SPEC "%{!shared:crt0.o%s} crti%O%s %{pg|p:crtg.o%s} " \ +#define STARTFILE_SPEC "%{pg|p:gcrt0.o%s}%{!pg:%{!p:crt0.o%s}} crti%O%s " \ "%(arc_tls_extra_start_spec) crtbegin.o%s" #else #define STARTFILE_SPEC \ @@ -143,7 +142,7 @@ extern const char *arc_cpu_to_as (int argc, const char **argv); #endif #if DEFAULT_LIBC != LIBC_UCLIBC -#define ENDFILE_SPEC "%{pg|p:crtgend.o%s} crtend.o%s crtn%O%s" +#define ENDFILE_SPEC "crtend.o%s crtn%O%s" #else #define ENDFILE_SPEC \ LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC) @@ -154,12 +153,11 @@ extern const char *arc_cpu_to_as (int argc, const char **argv); #define LIB_SPEC \ "%{pthread:-lpthread} \ %{shared:-lc} \ - %{!shared:%{pg|p|profile:-lgmon -u profil --defsym __profil=profil} -lc}" + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" #define TARGET_ASM_FILE_END file_end_indicate_exec_stack #else #undef LIB_SPEC -/* -lc_p not present for arc-elf32-* : ashwin */ -#define LIB_SPEC "%{!shared:%{g*:-lg} %{pg|p:-lgmon} -lc}" +#define LIB_SPEC "%{!shared:%{g*:-lg} -lc}" #endif #ifndef DRIVER_ENDIAN_SELF_SPECS @@ -916,12 +914,14 @@ extern int arc_initial_elimination_offset(int from, int to); (OFFSET) = arc_initial_elimination_offset ((FROM), (TO)) /* Output assembler code to FILE to increment profiler label # LABELNO - for profiling a function entry. - We actually emit the profiler code at the call site, so leave this one - empty. */ -#define FUNCTION_PROFILER(FILE, LABELNO) \ - if (TARGET_UCB_MCOUNT) \ - fprintf (FILE, "\t%s\n", arc_output_libcall ("__mcount")) + for profiling a function entry. */ +#define FUNCTION_PROFILER(FILE, LABELNO) \ + do { \ + if (flag_pic) \ + fprintf (FILE, "\tbl\t__mcount@plt\n"); \ + else \ + fprintf (FILE, "\tbl\t__mcount\n"); \ + } while (0); #define NO_PROFILE_COUNTERS 1 diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md index 6fe237e..2d3e19b 100644 --- a/gcc/config/arc/arc.md +++ b/gcc/config/arc/arc.md @@ -9,7 +9,7 @@ ;; Saurabh Verma (saurabh.verma@codito.com) ;; Ramana Radhakrishnan(ramana.radhakrishnan@codito.com) ;; -;; Profiling support and performance improvements by +;; Performance improvements by ;; Joern Rennecke (joern.rennecke@embecosm.com) ;; @@ -165,9 +165,7 @@ ]) (define_constants - [(UNSPEC_PROF 18) ; profile callgraph counter - - (R0_REG 0) + [(R0_REG 0) (R1_REG 1) (R2_REG 2) (R3_REG 3) @@ -4108,13 +4106,6 @@ gcc_assert (MEM_P (operands[0])); callee = XEXP (operands[0], 0); - if (crtl->profile && arc_profile_call (callee)) - { - emit_call_insn (gen_call_prof (gen_rtx_SYMBOL_REF (Pmode, - \"_mcount_call\"), - operands[1])); - DONE; - } /* This is to decide if we should generate indirect calls by loading the 32 bit address of the callee into a register before performing the branch and link - this exposes cse opportunities. @@ -4177,14 +4168,6 @@ gcc_assert (MEM_P (operands[1])); callee = XEXP (operands[1], 0); - if (crtl->profile && arc_profile_call (callee)) - { - emit_call_insn (gen_call_value_prof (operands[0], - gen_rtx_SYMBOL_REF (Pmode, - \"_mcount_call\"), - operands[2])); - DONE; - } /* See the comment in define_expand \"call\". */ if (GET_CODE (callee) != REG && (GET_CODE (callee) == PLUS || arc_is_longcall_p (callee))) @@ -4667,13 +4650,6 @@ if (operands[2] == NULL_RTX) operands[2] = const0_rtx; - if (crtl->profile && arc_profile_call (callee)) - { - emit_insn (gen_sibcall_prof - (gen_rtx_SYMBOL_REF (Pmode, \"_mcount_call\"), - operands[1], operands[2])); - DONE; - } if (GET_CODE (callee) != REG && (GET_CODE (callee) == PLUS || arc_is_longcall_p (callee))) XEXP (operands[0], 0) = force_reg (Pmode, callee); @@ -4693,13 +4669,6 @@ if (operands[3] == NULL_RTX) operands[3] = const0_rtx; - if (crtl->profile && arc_profile_call (XEXP (operands[1], 0))) - { - emit_insn (gen_sibcall_value_prof - (operands[0], gen_rtx_SYMBOL_REF (Pmode, \"_mcount_call\"), - operands[2], operands[3])); - DONE; - } if (GET_CODE (callee) != REG && arc_is_longcall_p (callee)) XEXP (operands[1], 0) = force_reg (Pmode, callee); }" diff --git a/gcc/config/arc/arc.opt b/gcc/config/arc/arc.opt index 31b305bb..ec4f055 100644 --- a/gcc/config/arc/arc.opt +++ b/gcc/config/arc/arc.opt @@ -409,10 +409,6 @@ mlra-priority-noncompact Target RejectNegative Var(arc_lra_prioritytag, ARC_LRA_PRIORITY_NONCOMPACT) Reduce priority for r0..r3 / r12..r15 with TARGET_REGISTER_PRIORITY. -mucb-mcount -Target Report Var(TARGET_UCB_MCOUNT) -instrument with mcount calls as in the ucb code. - ; backward-compatibility aliases, translated by DRIVER_SELF_SPECS mEA diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 9eda687..b729964 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -611,7 +611,7 @@ Objective-C and Objective-C++ Dialects}. -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol -mlong-calls -mmedium-calls -msdata @gol --mucb-mcount -mvolatile-cache -mtp-regno=@var{regno} @gol +-mvolatile-cache -mtp-regno=@var{regno} @gol -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol @@ -14726,12 +14726,6 @@ Do not generate sdata references. This is the default for tool chains built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets. -@item -mucb-mcount -@opindex mucb-mcount -Instrument with mcount calls as used in UCB code. I.e. do the -counting in the callee, not the caller. By default ARC instrumentation -counts in the caller. - @item -mvolatile-cache @opindex mvolatile-cache Use ordinarily cached memory accesses for volatile references. This is the |