> Ian Lance Taylor <ian at airs dot com> writes: > We would like to eliminate cc0 and the associated machinery from the > compiler, because it is complicated and not supported on popular or > modern processors. Here is a plan which I think could accomplish that > without unreasonable effort.
I pre-apologize if this is a dumb question, but: Does GCC truley need to identify/treat condition state registers uniquely from any other value produced as a result of a calculation? As it would seem that condition state dependencies may be tracked just as any other defined (virtual or physical) register value dependency is between instructions; as it seems that the only thing unique about the machine's condition state value, is that it tends to be an implied vs. explicit operand of an instruction, just as accumulators tend to be in some machines? Where then it would seem that as long as a target accurately describes it's instruction dependencies on any implied register operands it chooses to partition machine state into; they may be treated just any register value dependency would be, irrespective of it's value or purpose? Thereby GCC need only designate the statically determined "branch condition" as a function of a single previously computed register value as compared against 0* to a logical branch instruction in addition to a basic block label; which the target may implement as being composed of any combination of instruction and/or register value dependencies specified as necessary; without GCC needing to be aware of their purpose, only it's dependencies? (* as 0 tends to be the basis of all arithmetic and logical operation result comparisons, including comparison operations themselves, which tend to be simply a subtraction, who's result is compared against 0, but not saved; therefore truly, explicit comparison operations are optimizations, and not a fundamental operation, so should never be explicitly required. i.e.: conditional branching should be based on the canonical comparison of an arbitrary value against 0: (set rx (op ...)) ;; rx is the result of an arbitrary operation (branch bc rx label) ;; (branch bc rx label) :: if (rx bc 0) goto label; Where some targets may need to generate an explicit subtract (or compare), or others may specify an implied register in which the result of rx ?? 0 is stored in and the branch is dependant on, or that branch may compute the comparison between rx and 0 itself, etc....)