On Mon, 2005-02-21 at 19:05 +0100, Steven Bosscher wrote: > On Feb 21, 2005 06:22 PM, Jeffrey A Law <[EMAIL PROTECTED]> wrote: > > I realize that we are trying to write clean, easy to read code by using > > a level of abstraction, but the abstraction is really getting in the > > way of achieving reasonable compile-time performance. > > I don't think this is a problem with abstraction in general, but more > with very lame attempts at abstraction, like this one, in the critical > paths. Looks like just ill design in this case. INHO this kind of style is a fundamental problem when using abstraction layers and lazily allocation/initialization of data structures (regardless of whether or not the abstraction comes from macros or inlined functions).
It's particularly problematical in languages which provide the ability to hide the underlying implementation and force all accesses to go through methods. If the class doesn't provide methods which assume the underlying data has already been allocated/initialized/checked, then performance suffers (Having dealt with this problem in large C++ codebases in my past, it's something I know to look for...) > > > Comments? > > Nice catch! I just hope we don't have too many of these ;-) Well, even within cse.c we still have all the accesses to REG_QTY which have the same basic structure. So code like this will exhibit the same behavior: if (REG_P (x) && REGNO_QTY_VALID_P (REGNO (x))) { int x_q = REG_QTY (REGNO (x)); struct qty_table_elem *x_ent = &qty_table[x_q]; if (GET_MODE (x) == x_ent->mode && x_ent->const_rtx != NULL_RTX) return 0; } And when you start looking at everywhere we use REG_QTY/REG_QTY_VALID_P you start to cry. I'll be experimenting with dropping the abstraction layer for those too to see if there's any noticeable improvement. cse.c is kinda odd in that its profile is so bloody flat -- which is sometimes a good indicator that we're burning too much time just trying to access key data structures. We certainly have other places which are potential problem areas. For example get_stmt_ann, get_var_ann and friends all do the same kind of thing. jeff