Re: Compiling external programs for SPIM Target results in an infinite loop afer executing cc1.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2013/6/4 Aniket Deole <aniket.deole@xxxxxxxxx>:
> Hello,
>
> We are building GCC for the Mips Simulator "SPIM".
> We have previously built the same for GCC 4.6.2, and are now trying to
> build it for 4.7.2.
>
> We are experiencing an issue related to the cbranchsi4 in GCC 4.7.2,
> machine description wherein, GCC is compiled correctly and cc1 is
> generated. But while compiling an external C program having
> conditional statements using cc1, the compilation goes in an infinite
> loop.
>
> We were able to rectify this infinite loop by removing an SI from the
> instruction for the first match operator clause.
>
> But we are not sure as to why this fix is required with respect to the
> different GCC versions 4.6.2 and 4.7.2.
>
> ---------------------------------------------------------------
> GCC 4.6.2 MD:
> --------------------------
> (define_insn "cbranchsi4"
>        [(set (pc)
>              (if_then_else
>
>              (match_operator:SI 0 "comparison_operator"
>
>              [(match_operand:SI 1 "register_operand" "")
>              (match_operand:SI 2 "register_operand" "")])
>              (label_ref (match_operand 3 "" ""))
>                           (pc)))]
>              ""
>              "* return conditional_insn(GET_CODE(operands[0]),operands,0); "
> )
> --------------------------------------------------------------
> GCC 4.7.2 MD:
> ---------------------------
> (define_insn "cbranchsi4"
>      [(set (pc)
>              (if_then_else
>
>              (match_operator 0 "comparison_operator"
>
>              [(match_operand:SI 1 "register_operand" "")
>              (match_operand:SI 2 "register_operand" "")])
>              (label_ref (match_operand 3 "" ""))
>                           (pc)))]
>               ""
>              "* return conditional_insn(GET_CODE(operands[0]),operands,0); "
> )
>
> Thank You,
> ---------------------------------
> Aniket Deole
> aniket.deole@xxxxxxxxx

Hi, Aniket,

It's hard tell why your cc1 went into infinite loop.
It requires tracing gcc code by yourself.

However, refer to to GCC Internal, 10.10 Comparison Operations:
"If the comparison operation is being tested
 (e.g., the first operand of an if_then_else),
 the mode must be VOIDmode."

IIUC, the mode of cbranch pattern is determined by
the compared operands, not comparison operator.
The comparison operator is supposed to be VOIDmode and many
optimization/simplification phases are based on such principle.

So I would guess it was just lucky that you did not suffer
any compilation problems with your 4.6.2 MD design.


Best regards,
jasonwucj




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux