[PATCH] Re: Option -fprofile-arcs fails for target avr and fr30

Jie Zhang zhangjie@magima.com.cn
Mon May 19 02:55:00 GMT 2003


Jie Zhang wrote:

> Hi, I have a question about using -fprofile-arcs option on avr and 
> fr30 targets for gcc-3.3.
>
> Avr and fr30 targets have no DI mode add instructions, nor add with 
> carry instructions. But profile instrument code needs DI mode add. GCC 
> has to translate the DImode add into a sequence of instructions. That 
> will introduce new jump_insn, which will cause make_edges abort. 
> Testing gcc.misc-tests/bprob-1.c reveals this problem.
>
> I think GCC should take this case into acount. But I have no good 
> method by now. Does anyone have good solution? Thanks!
>
> - J 

The following patch may fix this problem.

- J


2003-05-12  Jie Zhang  <zhangjie@magima.com.cn>

        Fix the FAILs of gcc.misc-tests/bprob-1.c and 
gcc.misc-tests/bprob-2.c
        on target avr and fr30.
        * cfgbuild.c (make_edges): Find JUMP_LABELs for the new JUMP_INSNs
        introduced by instrument code after jump optimization pass.

--- cfgbuild.c  2003-01-09 20:40:44.000000000 +0800
+++ cfgbuild-new.c      2003-05-19 09:58:23.000000000 +0800
@@ -398,8 +398,17 @@ make_edges (label_value_list, min, max,
          /* Otherwise, we have a plain conditional or unconditional 
jump.  */
          else
            {
+              rtx tmp;
+
+              /* Instrument code may introduce new JUMP_INSNs after jump
+                 optimization pass. So we find JUMP_LABELs for these new
+                 JUMP_INSNs. */
+              if (! JUMP_LABEL (insn) && (tmp = condjump_label (insn)))
+                JUMP_LABEL (insn) = XEXP (tmp, 0);
+
              if (! JUMP_LABEL (insn))
                abort ();
+
              make_label_edge (edge_cache, bb, JUMP_LABEL (insn), 0);
            }
        }



More information about the Gcc mailing list