This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

[patch] Fix sched-deps DEP_POSTPONED, ds_t documentation


Hello,

While working on a sched-deps based delay slot scheduler, I've come to
the conclusion that the dependencies themselves must indicate whether
the dependent ref is delayed. So I started hacking sched-deps and ran
into trouble... It turns out there is a problem introduced along with
DEP_POSTPONED last year, but the real problem is the complicated ds_t
representation and the unclear documentation. The first *6* bits on a
ds_t were reserved for the dependence type, and two more bits were
reserved for HARD_DEP and DEP_CANCELLED:

-/* First '6' stands for 4 dep type bits and the HARD_DEP and DEP_CANCELLED
-   bits.
-   Second '4' stands for BEGIN_{DATA, CONTROL}, BE_IN_{DATA, CONTROL}
-   dep weakness.  */
-#define BITS_PER_DEP_WEAK ((BITS_PER_DEP_STATUS - 6) / 4)

But DEP_POSTPONED adds another bit:

/* Instruction has non-speculative dependence.  This bit represents the
   property of an instruction - not the one of a dependence.
  Therefore, it can appear only in the TODO_SPEC field of an instruction.  */
#define HARD_DEP (DEP_CONTROL << 1)

/* Set in the TODO_SPEC field of an instruction for which new_ready
   has decided not to schedule it speculatively.  */
 #define DEP_POSTPONED (HARD_DEP << 1)

/* Set if a dependency is cancelled via speculation.  */
#define DEP_CANCELLED (DEP_POSTPONED << 1)

I wanted to add another flag, DEP_DELAYED, and optimistically just
added another bit, the compiler started warning, etc.


So far we seem to've gotten away with this because the sign bit on a
ds_t was unused:

/* We exclude sign bit.  */
#define BITS_PER_DEP_STATUS (HOST_BITS_PER_INT - 1)


The attached patch extends the ds_t documentation to clarify in a
comment how all the bits are used. I've made ds_t and dw_t unsigned
int, because ds_t is just a collection of bits, and dw_t is unsigned.
The target hooks I had to update are all only used by ia64.

I opportunistically reserved the one left-over bit for my own purposes ;-)

Bootstrapped&tested on ia64-unknown-linux-gnu and on
powerpc64-unknown-linux-gnu unix-{,-m32).
OK for trunk?

Ciao!
Steven

Attachment: fix_ds_t.diff.txt
Description: Text document


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