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]

[PATCH] Add XOR function to sbitmap, make basic block sbitmap functions conditional



The #ifndef doesn't change anything, it's just preparation for making
this stuff able to be used by other programs. Without defining that
define, you'll need the basic_block_info array, defined in flow, which
will pull in basically *all* of gcc, just so you could use sbitmaps.

The XOR function is so the new bitmap stuff can use it.

2001-07-26  Daniel Berlin  <dan@cgsoftware.com>

	* sbitmap.h: New prototype for sbitmap_a_xor_b.

	* sbitmap.c (sbitmap_a_xor_b): New function.
	#ifndef the basic block stuff so you can compile without it.

Index: sbitmap.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/sbitmap.c,v
retrieving revision 1.14
diff -c -3 -p -w -B -b -r1.14 sbitmap.c
*** sbitmap.c	2001/03/27 03:37:03	1.14
--- sbitmap.c	2001/07/26 19:08:01
*************** sbitmap_a_and_b (dst, a, b)
*** 230,235 ****
--- 230,260 ----
    return changed;
  }
  
+ /* Set DST to be (A xor B)).
+    Return non-zero if any change is made. */
+ 
+ int
+ sbitmap_a_xor_b (dst, a, b)
+      sbitmap dst, a, b;
+ {
+   unsigned int i;
+   sbitmap_ptr dstp, ap, bp;
+   int changed = 0;
+   
+   for (dstp = dst->elms, ap = a->elms, bp = b->elms, i = 0; i < dst->size;
+        i++, dstp++)
+     {
+       SBITMAP_ELT_TYPE tmp = *ap++ ^ *bp++;
+       
+       if (*dstp != tmp)
+ 	{
+ 	  changed = 1;
+ 	  *dstp = tmp;
+ 	}
+     }
+   return changed;
+ }
+ 
  /* Set DST to be (A or B)).
     Return non-zero if any change is made.  */
  
*************** sbitmap_a_and_b_or_c (dst, a, b, c)
*** 323,329 ****
  
    return changed;
  }
! 
  /* Set the bitmap DST to the intersection of SRC of successors of
     block number BB, using the new flow graph structures.  */
  
--- 348,354 ----
  
    return changed;
  }
! #ifndef NO_BASIC_BLOCK_STUFF
  /* Set the bitmap DST to the intersection of SRC of successors of
     block number BB, using the new flow graph structures.  */
  
*************** sbitmap_union_of_preds (dst, src, bb)
*** 483,489 ****
  	  *r++ |= *p++;
        }
  }
! 
  /* Return number of first bit set in the bitmap, -1 if none.  */
  
  int
--- 508,514 ----
  	  *r++ |= *p++;
        }
  }
! #endif
  /* Return number of first bit set in the bitmap, -1 if none.  */
  
  int
Index: sbitmap.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/sbitmap.h,v
retrieving revision 1.13
diff -c -3 -p -w -B -b -r1.13 sbitmap.h
*** sbitmap.h	2001/05/26 01:31:35	1.13
--- sbitmap.h	2001/07/26 19:08:01
*************** extern int sbitmap_a_and_b_or_c		PARAMS 
*** 112,117 ****
--- 112,118 ----
  						 sbitmap));
  extern int sbitmap_a_and_b		PARAMS ((sbitmap, sbitmap, sbitmap));
  extern int sbitmap_a_or_b		PARAMS ((sbitmap, sbitmap, sbitmap));
+ extern int sbitmap_a_xor_b              PARAMS ((sbitmap, sbitmap, sbitmap));
  extern int sbitmap_a_subset_b_p		PARAMS ((sbitmap, sbitmap));
  
  extern int sbitmap_first_set_bit	PARAMS ((sbitmap));

-- 
"I'm so hyper...  (Said with a very dull voice.)
"-Steven Wright


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