This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[g77] Improve compile time for large data statements
- From: Bud Davis <bdavis9659 at comcast dot net>
- To: gfortran <fortran at gcc dot gnu dot org>, gcc-patches at gcc dot gnu dot org
- Date: Thu, 22 Apr 2004 17:38:36 -0500
- Subject: [g77] Improve compile time for large data statements
This is not a regression, but I propose that this patch be included in
the upcoming 3.4.1 release.
Initialization of large data statements / BLOCK DATA subroutines and
such trigger this warning:
d.f:4: warning:
DATA R / 0.500
^
Initialization of large (250000-unit) aggregate area `r' at (^) slow and
takes lots of memory during g77 compile
It is not kidding, a large block data subroutine can take several HOURS
to compile. Some aeronautical simulations have BLOCK DATA with several
hundred thousand individual items; it is not a rare event in f77 to
handle variable initialization this way.
This is caused by using a sorted linked list for handling the constant
pool in g77.
The patch replaces the linked list with a binary tree. The warning
probably still needs to stay, because worse case performance will be
identical to the linked list.
No testsuite entry is provided, however here is a short example that
will make a representative example to very that this patch decreases the
compilation time.
$ cat c.f
integer size / 250000 /
print*,' BLOCK DATA'
print*,' REAL R(',SIZE,')'
print*,' COMMON /ONE/ R'
print*,' DATA R / 0.500'
DO I = 1,SIZE-1
print*,' 1 ,',RAND() * 10000
ENDDO
print*,' 1/'
print*,' END'
end
$ g77 c.f
$ ./a.out >d.f
$ time g77 -c d.f
I compiled all of LAPACK with the -S option, and compared the generated
assembler files before and after the patch, no change. Done similar
comparisons with several 100K SLOC of code with no difference.
The big thing is I have not found a block data file that takes > 30
seconds to compile :)
Toon, the character1 routine had some debugging code (the malloc_verify
and the ffetarget_verify) which I removed.
--bud davis
2004-04-22 Bud Davis <bdavis9659@comcast.net>
* bld.h (_ffebld_constant_): removed unused field, changed
from linked list to tree:
* bld.c (ffebld_constant_new_*_val): changed from linked list
to binary tree for all data types.
Index: gcc/gcc/f/bld.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/f/bld.c,v
retrieving revision 1.16
diff -c -3 -p -r1.16 bld.c
*** gcc/gcc/f/bld.c 6 Jul 2003 20:32:16 -0000 1.16
--- gcc/gcc/f/bld.c 22 Apr 2004 22:05:43 -0000
***************
*** 1,5 ****
/* bld.c -- Implementation File (module.c template V1.0)
! Copyright (C) 1995, 1996, 2003 Free Software Foundation, Inc.
Contributed by James Craig Burley.
This file is part of GNU Fortran.
--- 1,5 ----
/* bld.c -- Implementation File (module.c template V1.0)
! Copyright (C) 1995, 1996, 2003, 2004 Free Software Foundation, Inc.
Contributed by James Craig Burley.
This file is part of GNU Fortran.
*************** ffebld_constant_new_character1 (ffelexTo
*** 382,419 ****
ffebldConstant
ffebld_constant_new_character1_val (ffetargetCharacter1 val)
{
- ffebldConstant c;
ffebldConstant nc;
! int cmp;
!
! ffetarget_verify_character1 (ffebld_constant_pool(), val);
!
! for (c = (ffebldConstant) &ffebld_constant_character1_;
! c->next != NULL;
! c = c->next)
! {
! malloc_verify_kp (ffebld_constant_pool(),
! c->next,
! sizeof (*(c->next)));
! ffetarget_verify_character1 (ffebld_constant_pool(),
! ffebld_constant_character1 (c->next));
! cmp = ffetarget_cmp_character1 (val,
! ffebld_constant_character1 (c->next));
! if (cmp == 0)
! return c->next;
! if (cmp > 0)
! break;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constCHARACTER1",
sizeof (*nc));
- nc->next = c->next;
nc->consttype = FFEBLD_constCHARACTER1;
nc->u.character1 = val;
nc->hook = FFECOM_constantNULL;
! c->next = nc;
return nc;
}
--- 382,433 ----
ffebldConstant
ffebld_constant_new_character1_val (ffetargetCharacter1 val)
{
ffebldConstant nc;
! ffebldConstant P;
! ffebldConstant Q;
! int cmp = 0;
! P = ffebld_constant_character1_;
! Q = P;
! if (!P)
! {
! /* make this node the root */
! nc = malloc_new_kp (ffebld_constant_pool(),
! "FFEBLD_constCHARACTER1",
! sizeof (*nc));
! nc->consttype = FFEBLD_constCHARACTER1;
! nc->u.character1 = val;
! nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
! ffebld_constant_character1_ = nc;
! return nc;
! }
! else
! while (P)
! {
! Q = P;
! cmp = ffetarget_cmp_character1 (val, ffebld_constant_character1 (P));
! if (cmp > 0)
! P = P->llink;
! else if (cmp < 0)
! P = P->rlink;
! else
! return P;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constCHARACTER1",
sizeof (*nc));
nc->consttype = FFEBLD_constCHARACTER1;
nc->u.character1 = val;
nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
+ if (cmp < 0)
+ Q->llink = nc;
+ else
+ Q->rlink = nc;
return nc;
}
*************** ffebld_constant_new_complex1 (ffebldCons
*** 443,475 ****
ffebldConstant
ffebld_constant_new_complex1_val (ffetargetComplex1 val)
{
- ffebldConstant c;
ffebldConstant nc;
! int cmp;
!
! for (c = (ffebldConstant) &ffebld_constant_complex1_;
! c->next != NULL;
! c = c->next)
! {
! cmp = ffetarget_cmp_real1 (val.real, ffebld_constant_complex1 (c->next).real);
! if (cmp == 0)
! cmp = ffetarget_cmp_real1 (val.imaginary,
! ffebld_constant_complex1 (c->next).imaginary);
! if (cmp == 0)
! return c->next;
! if (cmp > 0)
! break;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constCOMPLEX1",
sizeof (*nc));
- nc->next = c->next;
nc->consttype = FFEBLD_constCOMPLEX1;
nc->u.complex1 = val;
nc->hook = FFECOM_constantNULL;
! c->next = nc;
return nc;
}
--- 457,512 ----
ffebldConstant
ffebld_constant_new_complex1_val (ffetargetComplex1 val)
{
ffebldConstant nc;
! ffebldConstant P;
! ffebldConstant Q;
! int cmp = 0;
! P = ffebld_constant_complex1_;
! Q = P;
! if (!P)
! {
! /* make this node the root */
! nc = malloc_new_kp (ffebld_constant_pool(),
! "FFEBLD_constCOMPLEX1",
! sizeof (*nc));
! nc->consttype = FFEBLD_constCOMPLEX1;
! nc->u.complex1 = val;
! nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
! ffebld_constant_complex1_ = nc;
! return nc;
! }
! else
! while (P)
! {
! Q = P;
! cmp = ffetarget_cmp_real1 (val.real,
! ffebld_constant_complex1 (P).real);
! if (cmp == 0)
! cmp = ffetarget_cmp_real1 (val.imaginary,
! ffebld_constant_complex1 (P).imaginary);
! if (cmp > 0)
! P = P->llink;
! else if (cmp < 0)
! P = P->rlink;
! else
! return P;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constCOMPLEX1",
sizeof (*nc));
nc->consttype = FFEBLD_constCOMPLEX1;
nc->u.complex1 = val;
nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
+ if (cmp < 0)
+ Q->llink = nc;
+ else
+ Q->rlink = nc;
return nc;
}
*************** ffebld_constant_new_complex2 (ffebldCons
*** 499,531 ****
ffebldConstant
ffebld_constant_new_complex2_val (ffetargetComplex2 val)
{
- ffebldConstant c;
ffebldConstant nc;
! int cmp;
!
! for (c = (ffebldConstant) &ffebld_constant_complex2_;
! c->next != NULL;
! c = c->next)
! {
! cmp = ffetarget_cmp_real2 (val.real, ffebld_constant_complex2 (c->next).real);
! if (cmp == 0)
! cmp = ffetarget_cmp_real2 (val.imaginary,
! ffebld_constant_complex2 (c->next).imaginary);
! if (cmp == 0)
! return c->next;
! if (cmp > 0)
! break;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constCOMPLEX2",
sizeof (*nc));
- nc->next = c->next;
nc->consttype = FFEBLD_constCOMPLEX2;
nc->u.complex2 = val;
nc->hook = FFECOM_constantNULL;
! c->next = nc;
return nc;
}
--- 536,591 ----
ffebldConstant
ffebld_constant_new_complex2_val (ffetargetComplex2 val)
{
ffebldConstant nc;
! ffebldConstant P;
! ffebldConstant Q;
! int cmp = 0;
! P = ffebld_constant_complex2_;
! Q = P;
! if (!P)
! {
! /* make this node the root */
! nc = malloc_new_kp (ffebld_constant_pool(),
! "FFEBLD_constCOMPLEX2",
! sizeof (*nc));
! nc->consttype = FFEBLD_constCOMPLEX2;
! nc->u.complex2 = val;
! nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
! ffebld_constant_complex2_ = nc;
! return nc;
! }
! else
! while (P)
! {
! Q = P;
! cmp = ffetarget_cmp_real2 (val.real,
! ffebld_constant_complex2 (P).real);
! if (cmp == 0)
! cmp = ffetarget_cmp_real2 (val.imaginary,
! ffebld_constant_complex2 (P).imaginary);
! if (cmp > 0)
! P = P->llink;
! else if (cmp < 0)
! P = P->rlink;
! else
! return P;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constCOMPLEX2",
sizeof (*nc));
nc->consttype = FFEBLD_constCOMPLEX2;
nc->u.complex2 = val;
nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
+ if (cmp < 0)
+ Q->llink = nc;
+ else
+ Q->rlink = nc;
return nc;
}
*************** ffebld_constant_new_hollerith (ffelexTok
*** 550,579 ****
ffebldConstant
ffebld_constant_new_hollerith_val (ffetargetHollerith val)
{
- ffebldConstant c;
ffebldConstant nc;
! int cmp;
!
! for (c = (ffebldConstant) &ffebld_constant_hollerith_;
! c->next != NULL;
! c = c->next)
! {
! cmp = ffetarget_cmp_hollerith (val, ffebld_constant_hollerith (c->next));
! if (cmp == 0)
! return c->next;
! if (cmp > 0)
! break;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constHOLLERITH",
sizeof (*nc));
- nc->next = c->next;
nc->consttype = FFEBLD_constHOLLERITH;
nc->u.hollerith = val;
nc->hook = FFECOM_constantNULL;
! c->next = nc;
return nc;
}
--- 610,661 ----
ffebldConstant
ffebld_constant_new_hollerith_val (ffetargetHollerith val)
{
ffebldConstant nc;
! ffebldConstant P;
! ffebldConstant Q;
! int cmp = 0;
! P = ffebld_constant_hollerith_;
! Q = P;
! if (!P)
! {
! /* make this node the root */
! nc = malloc_new_kp (ffebld_constant_pool(),
! "FFEBLD_constHOLLERITH",
! sizeof (*nc));
! nc->consttype = FFEBLD_constHOLLERITH;
! nc->u.hollerith = val;
! nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
! ffebld_constant_hollerith_ = nc;
! return nc;
! }
! else
! while (P)
! {
! Q = P;
! cmp = ffetarget_cmp_hollerith (val, ffebld_constant_hollerith (P));
! if (cmp > 0)
! P = P->llink;
! else if (cmp < 0)
! P = P->rlink;
! else
! return P;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constHOLLERITH",
sizeof (*nc));
nc->consttype = FFEBLD_constHOLLERITH;
nc->u.hollerith = val;
nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
+ if (cmp < 0)
+ Q->llink = nc;
+ else
+ Q->rlink = nc;
return nc;
}
*************** ffebld_constant_new_integer1 (ffelexToke
*** 605,634 ****
ffebldConstant
ffebld_constant_new_integer1_val (ffetargetInteger1 val)
{
- ffebldConstant c;
- ffebldConstant nc;
- int cmp;
! for (c = (ffebldConstant) &ffebld_constant_integer1_;
! c->next != NULL;
! c = c->next)
! {
! cmp = ffetarget_cmp_integer1 (val, ffebld_constant_integer1 (c->next));
! if (cmp == 0)
! return c->next;
! if (cmp > 0)
! break;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constINTEGER1",
sizeof (*nc));
- nc->next = c->next;
nc->consttype = FFEBLD_constINTEGER1;
nc->u.integer1 = val;
nc->hook = FFECOM_constantNULL;
! c->next = nc;
return nc;
}
--- 687,739 ----
ffebldConstant
ffebld_constant_new_integer1_val (ffetargetInteger1 val)
{
! ffebldConstant nc;
! ffebldConstant P;
! ffebldConstant Q;
! int cmp = 0;
! P = ffebld_constant_integer1_;
! Q = P;
! if (!P)
! {
! /* make this node the root */
! nc = malloc_new_kp (ffebld_constant_pool(),
! "FFEBLD_constINTEGER1",
! sizeof (*nc));
! nc->consttype = FFEBLD_constINTEGER1;
! nc->u.integer1 = val;
! nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
! ffebld_constant_real1_ = nc;
! return nc;
! }
! else
! while (P)
! {
! Q = P;
! cmp = ffetarget_cmp_integer1 (val, ffebld_constant_integer1 (P));
! if (cmp > 0)
! P = P->llink;
! else if (cmp < 0)
! P = P->rlink;
! else
! return P;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constINTEGER1",
sizeof (*nc));
nc->consttype = FFEBLD_constINTEGER1;
nc->u.integer1 = val;
nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
+ if (cmp < 0)
+ Q->llink = nc;
+ else
+ Q->rlink = nc;
return nc;
}
*************** ffebld_constant_new_integer1_val (ffetar
*** 641,670 ****
ffebldConstant
ffebld_constant_new_integer2_val (ffetargetInteger2 val)
{
- ffebldConstant c;
ffebldConstant nc;
! int cmp;
!
! for (c = (ffebldConstant) &ffebld_constant_integer2_;
! c->next != NULL;
! c = c->next)
! {
! cmp = ffetarget_cmp_integer2 (val, ffebld_constant_integer2 (c->next));
! if (cmp == 0)
! return c->next;
! if (cmp > 0)
! break;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constINTEGER2",
sizeof (*nc));
- nc->next = c->next;
nc->consttype = FFEBLD_constINTEGER2;
nc->u.integer2 = val;
nc->hook = FFECOM_constantNULL;
! c->next = nc;
return nc;
}
--- 746,797 ----
ffebldConstant
ffebld_constant_new_integer2_val (ffetargetInteger2 val)
{
ffebldConstant nc;
! ffebldConstant P;
! ffebldConstant Q;
! int cmp = 0;
! P = ffebld_constant_integer2_;
! Q = P;
! if (!P)
! {
! /* make this node the root */
! nc = malloc_new_kp (ffebld_constant_pool(),
! "FFEBLD_constINTEGER2",
! sizeof (*nc));
! nc->consttype = FFEBLD_constINTEGER2;
! nc->u.integer2 = val;
! nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
! ffebld_constant_integer2_ = nc;
! return nc;
! }
! else
! while (P)
! {
! Q = P;
! cmp = ffetarget_cmp_integer2 (val, ffebld_constant_integer2 (P));
! if (cmp > 0)
! P = P->llink;
! else if (cmp < 0)
! P = P->rlink;
! else
! return P;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constINTEGER2",
sizeof (*nc));
nc->consttype = FFEBLD_constINTEGER2;
nc->u.integer2 = val;
nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
+ if (cmp < 0)
+ Q->llink = nc;
+ else
+ Q->rlink = nc;
return nc;
}
*************** ffebld_constant_new_integer2_val (ffetar
*** 677,706 ****
ffebldConstant
ffebld_constant_new_integer3_val (ffetargetInteger3 val)
{
- ffebldConstant c;
ffebldConstant nc;
! int cmp;
!
! for (c = (ffebldConstant) &ffebld_constant_integer3_;
! c->next != NULL;
! c = c->next)
! {
! cmp = ffetarget_cmp_integer3 (val, ffebld_constant_integer3 (c->next));
! if (cmp == 0)
! return c->next;
! if (cmp > 0)
! break;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constINTEGER3",
sizeof (*nc));
- nc->next = c->next;
nc->consttype = FFEBLD_constINTEGER3;
nc->u.integer3 = val;
nc->hook = FFECOM_constantNULL;
! c->next = nc;
return nc;
}
--- 804,855 ----
ffebldConstant
ffebld_constant_new_integer3_val (ffetargetInteger3 val)
{
ffebldConstant nc;
! ffebldConstant P;
! ffebldConstant Q;
! int cmp = 0;
! P = ffebld_constant_integer3_;
! Q = P;
! if (!P)
! {
! /* make this node the root */
! nc = malloc_new_kp (ffebld_constant_pool(),
! "FFEBLD_constINTEGER3",
! sizeof (*nc));
! nc->consttype = FFEBLD_constINTEGER3;
! nc->u.integer3 = val;
! nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
! ffebld_constant_integer3_ = nc;
! return nc;
! }
! else
! while (P)
! {
! Q = P;
! cmp = ffetarget_cmp_integer3 (val, ffebld_constant_integer3 (P));
! if (cmp > 0)
! P = P->llink;
! else if (cmp < 0)
! P = P->rlink;
! else
! return P;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constINTEGER3",
sizeof (*nc));
nc->consttype = FFEBLD_constINTEGER3;
nc->u.integer3 = val;
nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
+ if (cmp < 0)
+ Q->llink = nc;
+ else
+ Q->rlink = nc;
return nc;
}
*************** ffebld_constant_new_integer3_val (ffetar
*** 713,742 ****
ffebldConstant
ffebld_constant_new_integer4_val (ffetargetInteger4 val)
{
- ffebldConstant c;
ffebldConstant nc;
! int cmp;
!
! for (c = (ffebldConstant) &ffebld_constant_integer4_;
! c->next != NULL;
! c = c->next)
! {
! cmp = ffetarget_cmp_integer4 (val, ffebld_constant_integer4 (c->next));
! if (cmp == 0)
! return c->next;
! if (cmp > 0)
! break;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constINTEGER4",
sizeof (*nc));
- nc->next = c->next;
nc->consttype = FFEBLD_constINTEGER4;
nc->u.integer4 = val;
nc->hook = FFECOM_constantNULL;
! c->next = nc;
return nc;
}
--- 862,913 ----
ffebldConstant
ffebld_constant_new_integer4_val (ffetargetInteger4 val)
{
ffebldConstant nc;
! ffebldConstant P;
! ffebldConstant Q;
! int cmp = 0;
! P = ffebld_constant_integer4_;
! Q = P;
! if (!P)
! {
! /* make this node the root */
! nc = malloc_new_kp (ffebld_constant_pool(),
! "FFEBLD_constINTEGER4",
! sizeof (*nc));
! nc->consttype = FFEBLD_constINTEGER4;
! nc->u.integer4 = val;
! nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
! ffebld_constant_integer4_ = nc;
! return nc;
! }
! else
! while (P)
! {
! Q = P;
! cmp = ffetarget_cmp_integer4 (val, ffebld_constant_integer4 (P));
! if (cmp > 0)
! P = P->llink;
! else if (cmp < 0)
! P = P->rlink;
! else
! return P;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constINTEGER4",
sizeof (*nc));
nc->consttype = FFEBLD_constINTEGER4;
nc->u.integer4 = val;
nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
+ if (cmp < 0)
+ Q->llink = nc;
+ else
+ Q->rlink = nc;
return nc;
}
*************** ffebld_constant_new_logical1 (bool truth
*** 824,853 ****
ffebldConstant
ffebld_constant_new_logical1_val (ffetargetLogical1 val)
{
- ffebldConstant c;
ffebldConstant nc;
! int cmp;
!
! for (c = (ffebldConstant) &ffebld_constant_logical1_;
! c->next != NULL;
! c = c->next)
! {
! cmp = ffetarget_cmp_logical1 (val, ffebld_constant_logical1 (c->next));
! if (cmp == 0)
! return c->next;
! if (cmp > 0)
! break;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constLOGICAL1",
sizeof (*nc));
- nc->next = c->next;
nc->consttype = FFEBLD_constLOGICAL1;
nc->u.logical1 = val;
nc->hook = FFECOM_constantNULL;
! c->next = nc;
return nc;
}
--- 995,1046 ----
ffebldConstant
ffebld_constant_new_logical1_val (ffetargetLogical1 val)
{
ffebldConstant nc;
! ffebldConstant P;
! ffebldConstant Q;
! int cmp = 0;
! P = ffebld_constant_logical1_;
! Q = P;
! if (!P)
! {
! /* make this node the root */
! nc = malloc_new_kp (ffebld_constant_pool(),
! "FFEBLD_constLOGICAL1",
! sizeof (*nc));
! nc->consttype = FFEBLD_constLOGICAL1;
! nc->u.logical1 = val;
! nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
! ffebld_constant_logical1_ = nc;
! return nc;
! }
! else
! while (P)
! {
! Q = P;
! cmp = ffetarget_cmp_logical1 (val, ffebld_constant_logical1 (P));
! if (cmp > 0)
! P = P->llink;
! else if (cmp < 0)
! P = P->rlink;
! else
! return P;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constLOGICAL1",
sizeof (*nc));
nc->consttype = FFEBLD_constLOGICAL1;
nc->u.logical1 = val;
nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
+ if (cmp < 0)
+ Q->llink = nc;
+ else
+ Q->rlink = nc;
return nc;
}
*************** ffebld_constant_new_logical1_val (ffetar
*** 860,889 ****
ffebldConstant
ffebld_constant_new_logical2_val (ffetargetLogical2 val)
{
- ffebldConstant c;
ffebldConstant nc;
! int cmp;
!
! for (c = (ffebldConstant) &ffebld_constant_logical2_;
! c->next != NULL;
! c = c->next)
! {
! cmp = ffetarget_cmp_logical2 (val, ffebld_constant_logical2 (c->next));
! if (cmp == 0)
! return c->next;
! if (cmp > 0)
! break;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constLOGICAL2",
sizeof (*nc));
- nc->next = c->next;
nc->consttype = FFEBLD_constLOGICAL2;
nc->u.logical2 = val;
nc->hook = FFECOM_constantNULL;
! c->next = nc;
return nc;
}
--- 1053,1104 ----
ffebldConstant
ffebld_constant_new_logical2_val (ffetargetLogical2 val)
{
ffebldConstant nc;
! ffebldConstant P;
! ffebldConstant Q;
! int cmp = 0;
! P = ffebld_constant_logical2_;
! Q = P;
! if (!P)
! {
! /* make this node the root */
! nc = malloc_new_kp (ffebld_constant_pool(),
! "FFEBLD_constLOGICAL2",
! sizeof (*nc));
! nc->consttype = FFEBLD_constLOGICAL2;
! nc->u.logical2 = val;
! nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
! ffebld_constant_logical2_ = nc;
! return nc;
! }
! else
! while (P)
! {
! Q = P;
! cmp = ffetarget_cmp_logical2 (val, ffebld_constant_logical2 (P));
! if (cmp > 0)
! P = P->llink;
! else if (cmp < 0)
! P = P->rlink;
! else
! return P;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constLOGICAL2",
sizeof (*nc));
nc->consttype = FFEBLD_constLOGICAL2;
nc->u.logical2 = val;
nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
+ if (cmp < 0)
+ Q->llink = nc;
+ else
+ Q->rlink = nc;
return nc;
}
*************** ffebld_constant_new_logical2_val (ffetar
*** 896,925 ****
ffebldConstant
ffebld_constant_new_logical3_val (ffetargetLogical3 val)
{
- ffebldConstant c;
ffebldConstant nc;
! int cmp;
!
! for (c = (ffebldConstant) &ffebld_constant_logical3_;
! c->next != NULL;
! c = c->next)
! {
! cmp = ffetarget_cmp_logical3 (val, ffebld_constant_logical3 (c->next));
! if (cmp == 0)
! return c->next;
! if (cmp > 0)
! break;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constLOGICAL3",
sizeof (*nc));
- nc->next = c->next;
nc->consttype = FFEBLD_constLOGICAL3;
nc->u.logical3 = val;
nc->hook = FFECOM_constantNULL;
! c->next = nc;
return nc;
}
--- 1111,1162 ----
ffebldConstant
ffebld_constant_new_logical3_val (ffetargetLogical3 val)
{
ffebldConstant nc;
! ffebldConstant P;
! ffebldConstant Q;
! int cmp = 0;
! P = ffebld_constant_logical3_;
! Q = P;
! if (!P)
! {
! /* make this node the root */
! nc = malloc_new_kp (ffebld_constant_pool(),
! "FFEBLD_constLOGICAL3",
! sizeof (*nc));
! nc->consttype = FFEBLD_constLOGICAL3;
! nc->u.logical3 = val;
! nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
! ffebld_constant_logical3_ = nc;
! return nc;
! }
! else
! while (P)
! {
! Q = P;
! cmp = ffetarget_cmp_logical3 (val, ffebld_constant_logical3 (P));
! if (cmp > 0)
! P = P->llink;
! else if (cmp < 0)
! P = P->rlink;
! else
! return P;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constLOGICAL3",
sizeof (*nc));
nc->consttype = FFEBLD_constLOGICAL3;
nc->u.logical3 = val;
nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
+ if (cmp < 0)
+ Q->llink = nc;
+ else
+ Q->rlink = nc;
return nc;
}
*************** ffebld_constant_new_logical3_val (ffetar
*** 932,961 ****
ffebldConstant
ffebld_constant_new_logical4_val (ffetargetLogical4 val)
{
- ffebldConstant c;
ffebldConstant nc;
! int cmp;
!
! for (c = (ffebldConstant) &ffebld_constant_logical4_;
! c->next != NULL;
! c = c->next)
! {
! cmp = ffetarget_cmp_logical4 (val, ffebld_constant_logical4 (c->next));
! if (cmp == 0)
! return c->next;
! if (cmp > 0)
! break;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constLOGICAL4",
sizeof (*nc));
- nc->next = c->next;
nc->consttype = FFEBLD_constLOGICAL4;
nc->u.logical4 = val;
nc->hook = FFECOM_constantNULL;
! c->next = nc;
return nc;
}
--- 1169,1220 ----
ffebldConstant
ffebld_constant_new_logical4_val (ffetargetLogical4 val)
{
ffebldConstant nc;
! ffebldConstant P;
! ffebldConstant Q;
! int cmp = 0;
! P = ffebld_constant_logical4_;
! Q = P;
! if (!P)
! {
! /* make this node the root */
! nc = malloc_new_kp (ffebld_constant_pool(),
! "FFEBLD_constLOGICAL4",
! sizeof (*nc));
! nc->consttype = FFEBLD_constLOGICAL4;
! nc->u.logical4 = val;
! nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
! ffebld_constant_logical4_ = nc;
! return nc;
! }
! else
! while (P)
! {
! Q = P;
! cmp = ffetarget_cmp_logical4 (val, ffebld_constant_logical4 (P));
! if (cmp > 0)
! P = P->llink;
! else if (cmp < 0)
! P = P->rlink;
! else
! return P;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constLOGICAL4",
sizeof (*nc));
nc->consttype = FFEBLD_constLOGICAL4;
nc->u.logical4 = val;
nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
+ if (cmp < 0)
+ Q->llink = nc;
+ else
+ Q->rlink = nc;
return nc;
}
*************** ffebld_constant_new_real1 (ffelexToken i
*** 986,1015 ****
ffebldConstant
ffebld_constant_new_real1_val (ffetargetReal1 val)
{
- ffebldConstant c;
ffebldConstant nc;
! int cmp;
!
! for (c = (ffebldConstant) &ffebld_constant_real1_;
! c->next != NULL;
! c = c->next)
! {
! cmp = ffetarget_cmp_real1 (val, ffebld_constant_real1 (c->next));
! if (cmp == 0)
! return c->next;
! if (cmp > 0)
! break;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constREAL1",
sizeof (*nc));
- nc->next = c->next;
nc->consttype = FFEBLD_constREAL1;
nc->u.real1 = val;
nc->hook = FFECOM_constantNULL;
! c->next = nc;
return nc;
}
--- 1245,1296 ----
ffebldConstant
ffebld_constant_new_real1_val (ffetargetReal1 val)
{
ffebldConstant nc;
! ffebldConstant P;
! ffebldConstant Q;
! int cmp = 0;
! P = ffebld_constant_real1_;
! Q = P;
! if (!P)
! {
! /* make this node the root */
! nc = malloc_new_kp (ffebld_constant_pool(),
! "FFEBLD_constREAL1",
! sizeof (*nc));
! nc->consttype = FFEBLD_constREAL1;
! nc->u.real1 = val;
! nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
! ffebld_constant_real1_ = nc;
! return nc;
! }
! else
! while (P)
! {
! Q = P;
! cmp = ffetarget_cmp_real1 (val, ffebld_constant_real1 (P));
! if (cmp > 0)
! P = P->llink;
! else if (cmp < 0)
! P = P->rlink;
! else
! return P;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constREAL1",
sizeof (*nc));
nc->consttype = FFEBLD_constREAL1;
nc->u.real1 = val;
nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
+ if (cmp < 0)
+ Q->llink = nc;
+ else
+ Q->rlink = nc;
return nc;
}
*************** ffebld_constant_new_real2 (ffelexToken i
*** 1040,1069 ****
ffebldConstant
ffebld_constant_new_real2_val (ffetargetReal2 val)
{
- ffebldConstant c;
ffebldConstant nc;
! int cmp;
!
! for (c = (ffebldConstant) &ffebld_constant_real2_;
! c->next != NULL;
! c = c->next)
! {
! cmp = ffetarget_cmp_real2 (val, ffebld_constant_real2 (c->next));
! if (cmp == 0)
! return c->next;
! if (cmp > 0)
! break;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constREAL2",
sizeof (*nc));
- nc->next = c->next;
nc->consttype = FFEBLD_constREAL2;
nc->u.real2 = val;
nc->hook = FFECOM_constantNULL;
! c->next = nc;
return nc;
}
--- 1321,1372 ----
ffebldConstant
ffebld_constant_new_real2_val (ffetargetReal2 val)
{
ffebldConstant nc;
! ffebldConstant P;
! ffebldConstant Q;
! int cmp = 0;
! P = ffebld_constant_real2_;
! Q = P;
! if (!P)
! {
! /* make this node the root */
! nc = malloc_new_kp (ffebld_constant_pool(),
! "FFEBLD_constREAL2",
! sizeof (*nc));
! nc->consttype = FFEBLD_constREAL2;
! nc->u.real2 = val;
! nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
! ffebld_constant_real2_ = nc;
! return nc;
! }
! else
! while (P)
! {
! Q = P;
! cmp = ffetarget_cmp_real2 (val, ffebld_constant_real2 (P));
! if (cmp > 0)
! P = P->llink;
! else if (cmp < 0)
! P = P->rlink;
! else
! return P;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constREAL2",
sizeof (*nc));
nc->consttype = FFEBLD_constREAL2;
nc->u.real2 = val;
nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
+ if (cmp < 0)
+ Q->llink = nc;
+ else
+ Q->rlink = nc;
return nc;
}
*************** ffebld_constant_new_typeless_ov (ffelexT
*** 1203,1233 ****
ffebldConstant
ffebld_constant_new_typeless_val (ffebldConst type, ffetargetTypeless val)
{
- ffebldConstant c;
- ffebldConstant nc;
- int cmp;
! for (c = (ffebldConstant) &ffebld_constant_typeless_[type
! - FFEBLD_constTYPELESS_FIRST];
! c->next != NULL;
! c = c->next)
! {
! cmp = ffetarget_cmp_typeless (val, ffebld_constant_typeless (c->next));
! if (cmp == 0)
! return c->next;
! if (cmp > 0)
! break;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constTYPELESS",
sizeof (*nc));
- nc->next = c->next;
nc->consttype = type;
nc->u.typeless = val;
nc->hook = FFECOM_constantNULL;
! c->next = nc;
return nc;
}
--- 1506,1559 ----
ffebldConstant
ffebld_constant_new_typeless_val (ffebldConst type, ffetargetTypeless val)
{
! ffebldConstant nc;
! ffebldConstant P;
! ffebldConstant Q;
! int cmp = 0;
! P = ffebld_constant_typeless_[type
! - FFEBLD_constTYPELESS_FIRST];
! Q = P;
! if (!P)
! {
! /* make this node the root */
! nc = malloc_new_kp (ffebld_constant_pool(),
! "FFEBLD_constTYPELESS",
! sizeof (*nc));
! nc->consttype = type;
! nc->u.typeless = val;
! nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
! ffebld_constant_typeless_[type- FFEBLD_constTYPELESS_FIRST] = nc;
! return nc;
! }
! else
! while (P)
! {
! Q = P;
! cmp = ffetarget_cmp_typeless (val, ffebld_constant_typeless (P));
! if (cmp > 0)
! P = P->llink;
! else if (cmp < 0)
! P = P->rlink;
! else
! return P;
! }
nc = malloc_new_kp (ffebld_constant_pool(),
"FFEBLD_constTYPELESS",
sizeof (*nc));
nc->consttype = type;
nc->u.typeless = val;
nc->hook = FFECOM_constantNULL;
! nc->llink = NULL;
! nc->rlink = NULL;
+ if (cmp < 0)
+ Q->llink = nc;
+ else
+ Q->rlink = nc;
return nc;
}
Index: gcc/gcc/f/bld.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/f/bld.h,v
retrieving revision 1.14
diff -c -3 -p -r1.14 bld.h
*** gcc/gcc/f/bld.h 8 Jun 2003 12:22:24 -0000 1.14
--- gcc/gcc/f/bld.h 22 Apr 2004 22:05:43 -0000
*************** struct _ffebld_
*** 299,308 ****
struct _ffebld_constant_
{
! ffebldConstant next;
ffebldConstant first_complex; /* First complex const with me as
real. */
- ffebldConstant negated; /* We point to each other through here. */
ffebldConst consttype;
ffecomConstant hook; /* Whatever the compiler/backend wants! */
bool numeric; /* A numeric kind of constant. */
--- 299,308 ----
struct _ffebld_constant_
{
! ffebldConstant rlink;
! ffebldConstant llink;
ffebldConstant first_complex; /* First complex const with me as
real. */
ffebldConst consttype;
ffecomConstant hook; /* Whatever the compiler/backend wants! */
bool numeric; /* A numeric kind of constant. */