Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
22fa5b8a
Commit
22fa5b8a
authored
27 years ago
by
Michael Meissner
Committed by
Michael Meissner
27 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add EXECUTE_IF_AND_IN_{BITMAP,REG_SET}, and bitmap_print
From-SVN: r15071
parent
9b2c548c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
163 additions
and
10 deletions
+163
-10
gcc/ChangeLog
+17
-0
gcc/basic-block.h
+6
-0
gcc/bitmap.c
+64
-10
gcc/bitmap.h
+76
-0
No files found.
gcc/ChangeLog
View file @
22fa5b8a
Thu Sep 4 11:04:21 1997 Michael Meissner <meissner@cygnus.com>
* bitmap.h (EXECUTE_IF_AND_IN_BITMAP): New macro, to iterate over
two bitmaps ANDed together.
(bitmap_print): Declare.
* bitmap.c (function_obstack): Don't declare any more.
(bitmap_obstack): Obstack for allocating links from.
(bitmap_obstack_init): New static to say whether to initialize
bitmap_obstack.
(bitmap_element_allocate): Use bitmap_obstack to allocate from.
(bitmap_release_memory): Free all memory allocated from
bitmap_obstack.
* basic-block.h (EXECUTE_IF_AND_IN_REG_SET): New macro, invoke
EXECUTE_IF_AND_IN_BITMAP.
Wed Sep 3 10:39:42 1997 Jim Wilson <wilson@cygnus.com>
* alias.c (true_dependence): Address with AND can alias scalars.
...
...
This diff is collapsed.
Click to expand it.
gcc/basic-block.h
View file @
22fa5b8a
...
...
@@ -73,6 +73,12 @@ do { \
#define EXECUTE_IF_AND_COMPL_IN_REG_SET(REGSET1, REGSET2, MIN, REGNUM, CODE) \
EXECUTE_IF_AND_COMPL_IN_BITMAP (REGSET1, REGSET2, MIN, REGNUM, CODE)
/* Loop over all registers in REGSET1 and REGSET2, starting with MIN, setting
REGNUM to the register number and executing CODE for all registers that are
set in both regsets. */
#define EXECUTE_IF_AND_IN_REG_SET(REGSET1, REGSET2, MIN, REGNUM, CODE) \
EXECUTE_IF_AND_IN_BITMAP (REGSET1, REGSET2, MIN, REGNUM, CODE)
/* Allocate a register set with oballoc. */
#define OBSTACK_ALLOC_REG_SET(OBSTACK) BITMAP_OBSTACK_ALLOC (OBSTACK)
...
...
This diff is collapsed.
Click to expand it.
gcc/bitmap.c
View file @
22fa5b8a
...
...
@@ -26,12 +26,9 @@ Boston, MA 02111-1307, USA. */
#include "regs.h"
#include "basic-block.h"
/* The contents of the current function definition are allocated
in this obstack, and all are freed at the end of the function.
For top-level functions, this is temporary_obstack.
Separate obstacks are made for nested functions. */
extern
struct
obstack
*
function_obstack
;
/* Obstack to allocate bitmap elements from. */
static
struct
obstack
bitmap_obstack
;
static
int
bitmap_obstack_init
=
FALSE
;
#ifndef INLINE
...
...
@@ -95,8 +92,39 @@ bitmap_element_allocate (head)
bitmap_free
=
element
->
next
;
}
else
element
=
(
bitmap_element
*
)
obstack_alloc
(
function_obstack
,
sizeof
(
bitmap_element
));
{
/* We can't use gcc_obstack_init to initialize the obstack since
print-rtl.c now calls bitmap functions, and bitmap is linked
into the gen* functions. */
if
(
!
bitmap_obstack_init
)
{
bitmap_obstack_init
=
TRUE
;
/* Let particular systems override the size of a chunk. */
#ifndef OBSTACK_CHUNK_SIZE
#define OBSTACK_CHUNK_SIZE 0
#endif
/* Let them override the alloc and free routines too. */
#ifndef OBSTACK_CHUNK_ALLOC
#define OBSTACK_CHUNK_ALLOC xmalloc
#endif
#ifndef OBSTACK_CHUNK_FREE
#define OBSTACK_CHUNK_FREE free
#endif
#if !defined(__GNUC__) || (__GNUC__ < 2)
#define __alignof__(type) 0
#endif
obstack_specify_allocation
(
&
bitmap_obstack
,
OBSTACK_CHUNK_SIZE
,
__alignof__
(
bitmap_element
),
(
void
*
(
*
)
())
OBSTACK_CHUNK_ALLOC
,
(
void
(
*
)
())
OBSTACK_CHUNK_FREE
);
}
element
=
(
bitmap_element
*
)
obstack_alloc
(
&
bitmap_obstack
,
sizeof
(
bitmap_element
));
}
#if BITMAP_ELEMENT_WORDS == 2
element
->
bits
[
0
]
=
element
->
bits
[
1
]
=
0
;
...
...
@@ -573,11 +601,37 @@ debug_bitmap (head)
bitmap_debug_file
(
stdout
,
head
);
}
/* Release any memory allocated by bitmaps. Since we allocate off of the
function_obstack, just zap the free list. */
/* Function to print out the contents of a bitmap. Unlike bitmap_debug_file,
it does not print anything but the bits. */
void
bitmap_print
(
file
,
head
,
prefix
,
suffix
)
FILE
*
file
;
bitmap
head
;
char
*
prefix
;
char
*
suffix
;
{
char
*
comma
=
""
;
int
i
;
fputs
(
prefix
,
file
);
EXECUTE_IF_SET_IN_BITMAP
(
head
,
0
,
i
,
{
fprintf
(
file
,
"%s%d"
,
comma
,
i
);
comma
=
", "
;
});
fputs
(
suffix
,
file
);
}
/* Release any memory allocated by bitmaps. */
void
bitmap_release_memory
()
{
bitmap_free
=
0
;
if
(
bitmap_obstack_init
)
{
bitmap_obstack_init
=
FALSE
;
obstack_free
(
&
bitmap_obstack
,
NULL_PTR
);
}
}
This diff is collapsed.
Click to expand it.
gcc/bitmap.h
View file @
22fa5b8a
...
...
@@ -88,6 +88,9 @@ extern int bitmap_bit_p PROTO((bitmap, int));
extern
void
bitmap_debug
PROTO
((
bitmap
));
extern
void
bitmap_debug_file
STDIO_PROTO
((
FILE
*
,
bitmap
));
/* Print a bitmap */
extern
void
bitmap_print
STDIO_PROTO
((
FILE
*
,
bitmap
,
char
*
,
char
*
));
/* Initialize a bitmap header. */
extern
bitmap
bitmap_initialize
PROTO
((
bitmap
));
...
...
@@ -237,3 +240,76 @@ do { \
word_num_ = 0; \
} \
} while (0)
/* Loop over all bits in BITMAP1 and BITMAP2, starting with MIN, setting
BITNUM to the bit number and executing CODE for all bits that are set in
the both bitmaps. */
#define EXECUTE_IF_AND_IN_BITMAP(BITMAP1, BITMAP2, MIN, BITNUM, CODE) \
do { \
bitmap_element *ptr1_ = (BITMAP1)->first; \
bitmap_element *ptr2_ = (BITMAP2)->first; \
unsigned int indx_ = (MIN) / BITMAP_ELEMENT_ALL_BITS; \
unsigned bit_num_ = (MIN) % ((unsigned) HOST_BITS_PER_WIDE_INT); \
unsigned word_num_ = (((MIN) / ((unsigned) HOST_BITS_PER_WIDE_INT)) \
% BITMAP_ELEMENT_WORDS); \
\
/* Find the block the minimum bit is in in the first bitmap. */
\
while (ptr1_ != 0 && ptr1_->indx < indx_) \
ptr1_ = ptr1_->next; \
\
if (ptr1_ != 0 && ptr1_->indx != indx_) \
{ \
bit_num_ = 0; \
word_num_ = 0; \
} \
\
for (; ptr1_ != 0 ; ptr1_ = ptr1_->next) \
{ \
/* Advance BITMAP2 to the equivalent link */
\
while (ptr2_ != 0 && ptr2_->indx < ptr1_->indx) \
ptr2_ = ptr2_->next; \
\
if (ptr2_ == 0) \
{ \
/* If there are no more elements in BITMAP2, exit loop now.*/
\
ptr1_ = (bitmap_element *)0; \
break; \
} \
else if (ptr2_->indx > ptr1_->indx) \
{ \
bit_num_ = word_num_ = 0; \
continue; \
} \
\
for (; word_num_ < BITMAP_ELEMENT_WORDS; word_num_++) \
{ \
unsigned HOST_WIDE_INT word_ = (ptr1_->bits[word_num_] \
& ptr2_->bits[word_num_]); \
if (word_ != 0) \
{ \
for (; bit_num_ < HOST_BITS_PER_WIDE_INT; bit_num_++) \
{ \
unsigned HOST_WIDE_INT mask_ \
= ((unsigned HOST_WIDE_INT)1) << bit_num_; \
\
if ((word_ & mask_) != 0) \
{ \
word_ &= ~ mask_; \
(BITNUM) = (ptr1_->indx * BITMAP_ELEMENT_ALL_BITS \
+ word_num_ * HOST_BITS_PER_WIDE_INT \
+ bit_num_); \
\
CODE; \
if (word_ == 0) \
break; \
} \
} \
} \
\
bit_num_ = 0; \
} \
\
word_num_ = 0; \
} \
} while (0)
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment