This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Condition Code Status, cc_status


> Innerhalb der Definition der Maschinen Macros beschaeftige ich mich
> gerade mit dem Condition Code Status. Doch ich weiss nicht so richtig,
> was das Makro NOTICE_UPDATE_CC aussagen soll.

I suggest that look into the GCC manual. You can do so by either
searching the *.texi input, or using an info viewer. NOTICE_UPDATE_CC
is explained in (gcc)Condition Code, and further referenced in
(gcc)Regs and Memory, (gcc)Jump Patterns, and (gcc)Insn Attributes.

> In der GCC-Source-Code-Datei condition.h wird nur gesagt, dass in den
> Komponenten value1 und value2 zwei gleiche RTL-Ausdruecke gespeichert
> werden. Was heisst das genau ?

As far as I understand, this is used in a machine dependent way. It
might be used to save the expressions last used in a compare
instruction. The peephole optimizer might chose to drop insns if the
value of the condition code has not changed. However, if you change a
register that was involved in the condition test, the condition code
is not useful any more, so you have to reset it.

> In den Maschinenbeschreibungen, die ich mir angesehen habe (-> i386.h,
> pdp11.h), wird value1 meist auf SET_SRC(exp) und value2 auf
> SET_DEST(exp) gesetzt. Warum ?

The only usage of value1 and value2 I can find is in final.c; if these
are set, the instruction setting them is deleted (rather, ignored) as
redundant.

> Warum werden value1 und value2 unter bestimmten Bedingungen oft wieder
> auf 0 gesetzt ?

See above. If a register set invalidates the outcome of an earlier
compare insn, a later compare insn comparing the same registers must
still be executed.

It might be possible to leave value1 and value2 always 0. Then the
compiler just won't optimize those extra compare insns away.

> Wofuer muss ich das Makro CC_STATUS_MDEP definieren ?

See the Index of the GCC manual.

> Muss ich von cc_status.flags die verschiedenen Flags (CC_REVERSED,
> CC_NOT_POSITIVE, ...) beruecksichtigen ?

You don't have to. The important thing is that the condition code used
in the jump always reflects the condition code set in the test
instruction. If that is not the case, you must set the flags correctly.
See final.c how this is used.

> Wo werden denn die einzelnen Status-Bits des Stausregisters meiner
> spezifischen Zielmaschine, wie z.B. Overflow, Carry, Zero, Parity ...,
> repraesentiert ?

See the overview of condition codes in the manual. Typically, you only
have a single register cc0, representing all of them. You then use
cc_status to carry information from a test insn to the jump insn.

Hope this helps,
Martin

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]