This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
profiling on the c4x
- To: egcs-patches at cygnus dot com
- Subject: profiling on the c4x
- From: Herman ten Brugge <Haj dot Ten dot Brugge at net dot HCC dot nl>
- Date: Sun, 25 Oct 1998 09:30:13 +0000 (WET)
Hello,
The code in profile.c does not handle a JUMP_INSN inside a PARALLEL.
This insn is generated on the c4x for the repeat_block_end.
The definition for the repeat_block_end is (from c4x.md):
(define_insn "repeat_block_end"
[(set (pc)
(if_then_else (ne (reg:QI 27) (const_int 0))
(label_ref (match_operand 1 "" ""))
(pc)))
(use (match_operand:QI 0 "immediate_operand" ""))
(use (reg:QI 25))
(use (reg:QI 26))
(set (reg:QI 27)
(plus:QI (reg:QI 27)
(const_int -1)))]
""
"*
return c4x_rptb_nop_p(insn) ? \"nop\" : \"\";"
[(set_attr "type" "repeat")])
This pattern together with rptb_top allows zero overhead loops on the
c4x target.
The patch fixes a core dump when compiling with the '-fprofile-arcs' option.
I added the new code to the branch_prob function.
Herman.
1998-10-19 Herman A.J. ten Brugge <Haj.Ten.Brugge@net.HCC.nl>
* profile.c (branch_prob) Add code for JUMP_INSN inside PARALLEL.
--- profile.c.org Mon Oct 19 17:42:39 1998
+++ profile.c Mon Oct 19 17:43:40 1998
@@ -750,7 +750,18 @@ branch_prob (f, dump_file)
/* Make an arc from this jump to the label of the
jump table. This will instrument the number of
times the switch statement is executed. */
- if (GET_CODE (XVECEXP (pattern, 0, 1)) == USE)
+ /* Check for zero overhead loop first */
+ if (GET_CODE (XVECEXP (pattern, 0, 0)) == SET
+ && SET_DEST (XVECEXP (pattern, 0, 0)) == pc_rtx
+ && GET_CODE (XEXP (XVECEXP (pattern, 0, 0), 1)) ==
+ IF_THEN_ELSE)
+ {
+ tem = XEXP( XEXP (XVECEXP (pattern, 0, 0), 1), 1);
+ if (GET_CODE (tem) != LABEL_REF)
+ abort ();
+ dest = label_to_bb[CODE_LABEL_NUMBER (XEXP (tem, 0))];
+ }
+ else if (GET_CODE (XVECEXP (pattern, 0, 1)) == USE)
{
tem = XEXP (XVECEXP (pattern, 0, 1), 0);
if (GET_CODE (tem) != LABEL_REF)
--
-------------------------------------------------------------------------
Herman ten Brugge Email: Haj.Ten.Brugge@net.HCC.nl