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
6feacd09
Commit
6feacd09
authored
Jul 02, 1998
by
Michael Meissner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch reg_n_info structure to use varrays
From-SVN: r20894
parent
39403d82
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
148 additions
and
57 deletions
+148
-57
gcc/ChangeLog
+24
-0
gcc/Makefile.in
+0
-0
gcc/basic-block.h
+2
-2
gcc/flow.c
+1
-1
gcc/regclass.c
+108
-32
gcc/regs.h
+13
-22
No files found.
gcc/ChangeLog
View file @
6feacd09
...
...
@@ -18,13 +18,37 @@ Thu Jul 2 14:34:48 1998 David Edelsohn <edelsohn@mhpcc.edu>
Thu Jul 2 14:16:11 1998 Michael Meissner <meissner@cygnus.com>
* varray.{c,h}: New files to provide virtual array support.
* Makefile.in (OBJS): Add varray.o.
(varray.o): Add new file.
(REGS_H): New variable for dependencies for files including
regs.h. Add varray.h and files it includes. Change all regs.h
dependencies to $(REGS_H).
* toplev.c (x{m,re}alloc): If size is 0, allocate 1 byte.
(xcalloc): Provide frontend for calloc.
* {tree,rtl}.h (xcalloc): Add declaration.
* basic-block.h (REG_BASIC_BLOCK): Convert reg_n_info to be a
varray.
* regs.h (toplevel): Include varray.h.
(reg_n_info): Switch to use a varray.
(REG_*): Ditto.
(allocate_reg_info): Change num_regs argument to be size_t.
* regclass.c (reg_info_data): New structure to remember groups of
reg_info structures allocated that are to be zeroed.
({pref,alt}class_buffer): New statics to hold buffers
allocate_reg_info allocates for {pref,alt}class_buffer.
(regclass): Use {pref,alt}class_buffer to initialize
{pref,alt}class.
(allocate_reg_info): Switch to make reg_n_info use varrays.
Allocate buffers for the preferred and alter register class
information. Change num_regs argument to be size_t, not int.
* flow.c (reg_n_info): Switch to use varrays.
Thu Jul 2 10:11:47 1998 Robert Lipe <robertl@dgii.com>
* install.texi (sco3.2v5): Document new --with-gnu-as flag.
...
...
gcc/Makefile.in
View file @
6feacd09
This diff is collapsed.
Click to expand it.
gcc/basic-block.h
View file @
6feacd09
/* Define control and data flow tables, and regsets.
Copyright (C) 1987, 1997 Free Software Foundation, Inc.
Copyright (C) 1987, 1997
, 1998
Free Software Foundation, Inc.
This file is part of GNU CC.
...
...
@@ -132,7 +132,7 @@ extern regset regs_live_at_setjmp;
#define REG_BLOCK_UNKNOWN -1
#define REG_BLOCK_GLOBAL -2
#define REG_BASIC_BLOCK(N) (
reg_n_info[(N)].
basic_block)
#define REG_BASIC_BLOCK(N) (
VARRAY_REG (reg_n_info, N)->
basic_block)
/* List of integers.
These are used for storing things like predecessors, etc.
...
...
gcc/flow.c
View file @
6feacd09
...
...
@@ -174,7 +174,7 @@ static int num_scratch;
/* Indexed by n, giving various register information */
reg_info
*
reg_n_info
;
varray_type
reg_n_info
;
/* Size of the reg_n_info table. */
...
...
gcc/regclass.c
View file @
6feacd09
...
...
@@ -193,6 +193,21 @@ static rtx top_of_stack[MAX_MACHINE_MODE];
#endif
/* HAVE_SECONDARY_RELOADS */
/* Linked list of reg_info structures allocated for reg_n_info array.
Grouping all of the allocated structures together in one lump
means only one call to bzero to clear them, rather than n smaller
calls. */
struct
reg_info_data
{
struct
reg_info_data
*
next
;
/* next set of reg_info structures */
size_t
min_index
;
/* minimum index # */
size_t
max_index
;
/* maximum index # */
char
used_p
;
/* non-zero if this has been used previously */
reg_info
data
[
1
];
/* beginning of the reg_info data */
};
static
struct
reg_info_data
*
reg_info_head
;
/* Function called only once to initialize the above data on reg usage.
Once this is done, various switches may override. */
...
...
@@ -637,6 +652,10 @@ static char *prefclass;
static
char
*
altclass
;
/* Allocated buffers for prefclass and altclass. */
static
char
*
prefclass_buffer
;
static
char
*
altclass_buffer
;
/* Record the depth of loops that we are in. */
static
int
loop_depth
;
...
...
@@ -987,8 +1006,8 @@ regclass (f, nregs)
if
(
pass
==
0
)
{
prefclass
=
(
char
*
)
oballoc
(
nregs
)
;
altclass
=
(
char
*
)
oballoc
(
nregs
)
;
prefclass
=
prefclass_buffer
;
altclass
=
altclass_buffer
;
}
for
(
i
=
FIRST_PSEUDO_REGISTER
;
i
<
nregs
;
i
++
)
...
...
@@ -1750,29 +1769,36 @@ auto_inc_dec_reg_p (reg, mode)
void
allocate_reg_info
(
num_regs
,
new_p
,
renumber_p
)
in
t
num_regs
;
size_
t
num_regs
;
int
new_p
;
int
renumber_p
;
{
static
in
t
regno_allocated
=
0
;
static
size_
t
regno_allocated
=
0
;
static
short
*
renumber
=
(
short
*
)
0
;
int
i
;
int
size_info
;
int
size_renumber
;
int
min
=
(
new_p
)
?
0
:
reg_n_max
;
/* If this message come up, and you want to fix it, then all of the tables
like reg_renumber, etc. that use short will have to be found and lengthed
to int or HOST_WIDE_INT. */
size_t
size_info
;
size_t
size_renumber
;
size_t
min
=
(
new_p
)
?
0
:
reg_n_max
;
struct
reg_info_data
*
reg_data
;
struct
reg_info_data
*
reg_next
;
/* Free up all storage allocated */
if
(
num_regs
<
0
)
{
if
(
reg_n_info
)
{
free
((
char
*
)
reg_n_info
);
free
((
char
*
)
renumber
);
reg_n_info
=
(
reg_info
*
)
0
;
VARRAY_FREE
(
reg_n_info
);
for
(
reg_data
=
reg_info_head
;
reg_data
;
reg_data
=
reg_next
)
{
reg_next
=
reg_data
->
next
;
free
((
char
*
)
reg_data
);
}
free
(
prefclass_buffer
);
free
(
altclass_buffer
);
prefclass_buffer
=
(
char
*
)
0
;
altclass_buffer
=
(
char
*
)
0
;
reg_info_head
=
(
struct
reg_info_data
*
)
0
;
renumber
=
(
short
*
)
0
;
}
regno_allocated
=
0
;
...
...
@@ -1782,48 +1808,98 @@ allocate_reg_info (num_regs, new_p, renumber_p)
if
(
num_regs
>
regno_allocated
)
{
size_t
old_allocated
=
regno_allocated
;
regno_allocated
=
num_regs
+
(
num_regs
/
20
);
/* add some slop space */
size_info
=
regno_allocated
*
sizeof
(
reg_info
);
size_renumber
=
regno_allocated
*
sizeof
(
short
);
if
(
!
reg_n_info
)
{
reg_n_info
=
(
reg_info
*
)
xmalloc
(
size_info
);
renumber
=
(
short
*
)
xmalloc
(
size_renumber
);
}
else
if
(
new_p
)
/* if we're zapping everything, no need to realloc */
{
free
((
char
*
)
reg_n_info
);
free
((
char
*
)
renumber
);
reg_n_info
=
(
reg_info
*
)
xmalloc
(
size_info
);
VARRAY_REG_INIT
(
reg_n_info
,
regno_allocated
,
"reg_n_info"
);
renumber
=
(
short
*
)
xmalloc
(
size_renumber
);
prefclass_buffer
=
(
char
*
)
xmalloc
(
regno_allocated
);
altclass_buffer
=
(
char
*
)
xmalloc
(
regno_allocated
);
}
else
{
reg_n_info
=
(
reg_info
*
)
xrealloc
((
char
*
)
reg_n_info
,
size_info
);
renumber
=
(
short
*
)
xrealloc
((
char
*
)
renumber
,
size_renumber
);
VARRAY_GROW
(
reg_n_info
,
regno_allocated
);
if
(
new_p
)
/* if we're zapping everything, no need to realloc */
{
free
((
char
*
)
renumber
);
free
((
char
*
)
prefclass_buffer
);
free
((
char
*
)
altclass_buffer
);
renumber
=
(
short
*
)
xmalloc
(
size_renumber
);
prefclass_buffer
=
(
char
*
)
xmalloc
(
regno_allocated
);
altclass_buffer
=
(
char
*
)
xmalloc
(
regno_allocated
);
}
else
{
renumber
=
(
short
*
)
xrealloc
((
char
*
)
renumber
,
size_renumber
);
prefclass_buffer
=
(
char
*
)
xrealloc
((
char
*
)
prefclass_buffer
,
regno_allocated
);
altclass_buffer
=
(
char
*
)
xrealloc
((
char
*
)
altclass_buffer
,
regno_allocated
);
}
}
size_info
=
(
regno_allocated
-
old_allocated
)
*
sizeof
(
reg_info
)
+
sizeof
(
struct
reg_info_data
)
-
sizeof
(
reg_info
);
reg_data
=
(
struct
reg_info_data
*
)
xcalloc
(
size_info
,
1
);
reg_data
->
min_index
=
old_allocated
;
reg_data
->
max_index
=
regno_allocated
-
1
;
reg_data
->
next
=
reg_info_head
;
reg_info_head
=
reg_data
;
}
reg_n_max
=
num_regs
;
if
(
min
<
num_regs
)
{
bzero
((
char
*
)
&
reg_n_info
[
min
],
(
num_regs
-
min
)
*
sizeof
(
reg_info
));
for
(
i
=
min
;
i
<
num_regs
;
i
++
)
/* Loop through each of the segments allocated for the actual
reg_info pages, and set up the pointers, zero the pages, etc. */
for
(
reg_data
=
reg_info_head
;
reg_data
;
reg_data
=
reg_next
)
{
REG_BASIC_BLOCK
(
i
)
=
REG_BLOCK_UNKNOWN
;
renumber
[
i
]
=
-
1
;
size_t
min_index
=
reg_data
->
min_index
;
size_t
max_index
=
reg_data
->
max_index
;
reg_next
=
reg_data
->
next
;
if
(
min_index
<=
num_regs
)
{
size_t
max
=
(
max_index
>
num_regs
)
?
num_regs
:
max_index
;
if
(
!
reg_data
->
used_p
)
/* page just allocated with calloc */
reg_data
->
used_p
=
1
;
/* no need to zero */
else
bzero
((
char
*
)
&
reg_data
->
data
,
sizeof
(
reg_info
)
*
(
max
-
min_index
+
1
));
for
(
i
=
min_index
;
i
<=
max
;
i
++
)
{
VARRAY_REG
(
reg_n_info
,
i
)
=
&
reg_data
->
data
[
i
-
min_index
];
REG_BASIC_BLOCK
(
i
)
=
REG_BLOCK_UNKNOWN
;
renumber
[
i
]
=
-
1
;
prefclass_buffer
[
i
]
=
(
char
)
NO_REGS
;
altclass_buffer
[
i
]
=
(
char
)
NO_REGS
;
}
}
}
}
/* If {pref,alt}class have already been allocated, update the pointers to
the newly realloced ones. */
if
(
prefclass
)
{
prefclass
=
prefclass_buffer
;
altclass
=
altclass_buffer
;
}
if
(
renumber_p
)
reg_renumber
=
renumber
;
/* Tell the regset code about the new number of registers */
MAX_REGNO_REG_SET
(
num_regs
,
new_p
,
renumber_p
);
reg_n_max
=
num_regs
;
}
...
...
gcc/regs.h
View file @
6feacd09
/* Define per-register tables for data flow info and register allocation.
Copyright (C) 1987, 1993, 1994, 1995, 1997 Free Software Foundation, Inc.
Copyright (C) 1987, 1993, 1994, 1995, 1997
, 1998
Free Software Foundation, Inc.
This file is part of GNU CC.
...
...
@@ -19,6 +19,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "varray.h"
#define REG_BYTES(R) mode_size[(int) GET_MODE (R)]
...
...
@@ -60,30 +61,20 @@ typedef struct reg_info_def {
char
changes_size
;
/* whether (SUBREG (REG n)) changes size */
}
reg_info
;
extern
reg_info
*
reg_n_info
;
extern
varray_type
reg_n_info
;
extern
unsigned
int
reg_n_max
;
/* Check for REG_N_xxx macros being in bound, return N for use as an
index. */
#ifdef ENABLE_CHECKING
#define REG_N_CHECK(N) \
((((unsigned)(N) < (unsigned)reg_n_max) \
? 0 : (fatal ("Register %d out of bounds", (N)), 0)), (N))
#else
#define REG_N_CHECK(N) (N)
#endif
/* Indexed by n, gives number of times (REG n) is used or set.
References within loops may be counted more times. */
#define REG_N_REFS(N) (
reg_n_info[REG_N_CHECK (N)].
refs)
#define REG_N_REFS(N) (
VARRAY_REG (reg_n_info, N)->
refs)
/* Indexed by n, gives number of times (REG n) is set.
??? both regscan and flow allocate space for this. We should settle
on just copy. */
#define REG_N_SETS(N) (
reg_n_info[REG_N_CHECK (N)].
sets)
#define REG_N_SETS(N) (
VARRAY_REG (reg_n_info, N)->
sets)
/* Indexed by N, gives number of insns in which register N dies.
Note that if register N is live around loops, it can die
...
...
@@ -91,13 +82,13 @@ extern unsigned int reg_n_max;
So this is only a reliable indicator of how many regions of life there are
for registers that are contained in one basic block. */
#define REG_N_DEATHS(N) (
reg_n_info[REG_N_CHECK (N)].
deaths)
#define REG_N_DEATHS(N) (
VARRAY_REG (reg_n_info, N)->
deaths)
/* Indexed by N; says whether a pseudo register N was ever used
within a SUBREG that changes the size of the reg. Some machines prohibit
such objects to be in certain (usually floating-point) registers. */
#define REG_CHANGES_SIZE(N) (
reg_n_info[REG_N_CHECK (N)].
changes_size)
#define REG_CHANGES_SIZE(N) (
VARRAY_REG (reg_n_info, N)->
changes_size)
/* Get the number of consecutive words required to hold pseudo-reg N. */
...
...
@@ -116,7 +107,7 @@ extern unsigned int reg_n_max;
/* Indexed by N, gives number of CALL_INSNS across which (REG n) is live. */
#define REG_N_CALLS_CROSSED(N) (
reg_n_info[REG_N_CHECK (N)].
calls_crossed)
#define REG_N_CALLS_CROSSED(N) (
VARRAY_REG (reg_n_info, N)->
calls_crossed)
/* Total number of instructions at which (REG n) is live.
The larger this is, the less priority (REG n) gets for
...
...
@@ -133,7 +124,7 @@ extern unsigned int reg_n_max;
is not required. global.c makes an allocno for this but does
not try to assign a hard register to it. */
#define REG_LIVE_LENGTH(N) (
reg_n_info[REG_N_CHECK (N)].
live_length)
#define REG_LIVE_LENGTH(N) (
VARRAY_REG (reg_n_info, N)->
live_length)
/* Vector of substitutions of register numbers,
used to map pseudo regs into hardware regs.
...
...
@@ -165,7 +156,7 @@ extern enum machine_mode reg_raw_mode[FIRST_PSEUDO_REGISTER];
It is sometimes adjusted for subsequent changes during loop,
but not adjusted by cse even if cse invalidates it. */
#define REGNO_FIRST_UID(N) (
reg_n_info[REG_N_CHECK (N)].
first_uid)
#define REGNO_FIRST_UID(N) (
VARRAY_REG (reg_n_info, N)->
first_uid)
/* Vector indexed by regno; gives uid of last insn using that reg.
This is computed by reg_scan for use by cse and loop.
...
...
@@ -173,11 +164,11 @@ extern enum machine_mode reg_raw_mode[FIRST_PSEUDO_REGISTER];
but not adjusted by cse even if cse invalidates it.
This is harmless since cse won't scan through a loop end. */
#define REGNO_LAST_UID(N) (
reg_n_info[REG_N_CHECK (N)].
last_uid)
#define REGNO_LAST_UID(N) (
VARRAY_REG (reg_n_info, N)->
last_uid)
/* Similar, but includes insns that mention the reg in their notes. */
#define REGNO_LAST_NOTE_UID(N) (
reg_n_info[REG_N_CHECK (N)].
last_note_uid)
#define REGNO_LAST_NOTE_UID(N) (
VARRAY_REG (reg_n_info, N)->
last_note_uid)
/* This is reset to LAST_VIRTUAL_REGISTER + 1 at the start of each function.
After rtl generation, it is 1 plus the largest register number used. */
...
...
@@ -230,4 +221,4 @@ extern int *scratch_block;
extern
int
scratch_list_length
;
/* Allocate reg_n_info tables */
extern
void
allocate_reg_info
PROTO
((
in
t
,
int
,
int
));
extern
void
allocate_reg_info
PROTO
((
size_
t
,
int
,
int
));
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