Commit a494747c by Michael Meissner Committed by Jeff Law

acconfig.h (ENABLE_CHECKING): Undefine.

        * acconfig.h (ENABLE_CHECKING): Undefine.
        * configure.in (--enable-checking): New option.
        * flow.c (reg_n_max): New global variable.
        * regclass.c (allocate_reg_info): Keep reg_n_max up to date.
        Delete regno_max variable.
        * regs.h (REG_N_CHECK): Define.
        (REG_N_REFS, REG_N_SETS, REG_N_DEATHS): Use REG_N_CHECK.
        (REG_N_CHANGES_SIZE, REG_N_CALLS_CROSSED, REG_LIVE_LENGTH): Likewise.
        (REGNO_FIRST_UID, REGNO_LAST_UID, REGNO_LAST_NOTE_UID): Likewise.

Co-Authored-By: Martin v. Loewis <martin@mira.isdn.cs.tu-berlin.de>

From-SVN: r19708
parent 7dee3f36
Wed May 13 12:54:19 1998 Michael Meissner <meissner@cygnus.com>
Martin von Loewis <martin@mira.isdn.cs.tu-berlin.de>
* acconfig.h (ENABLE_CHECKING): Undefine.
* configure.in (--enable-checking): New option.
* flow.c (reg_n_max): New global variable.
* regclass.c (allocate_reg_info): Keep reg_n_max up to date.
Delete regno_max variable.
* regs.h (REG_N_CHECK): Define.
(REG_N_REFS, REG_N_SETS, REG_N_DEATHS): Use REG_N_CHECK.
(REG_N_CHANGES_SIZE, REG_N_CALLS_CROSSED, REG_LIVE_LENGTH): Likewise.
(REGNO_FIRST_UID, REGNO_LAST_UID, REGNO_LAST_NOTE_UID): Likewise.
Wed May 13 08:52:08 1998 J"orn Rennecke <amylaar@cygnus.co.uk>
* reload1.c (merge_assigned_reloads): Can merge
......
/* Define to "%p" if printf supports it, else machmode.h will define it. */
#undef HOST_PTR_PRINTF
/* Define if you want expensive run-time checks. */
#undef ENABLE_CHECKING
/* Define if your cpp understands the stringify operator. */
#undef HAVE_CPP_STRINGIFY
......
......@@ -2,6 +2,9 @@
/* Define to "%p" if printf supports it, else machmode.h will define it. */
#undef HOST_PTR_PRINTF
/* Define if you want expensive run-time checks. */
#undef ENABLE_CHECKING
/* Define if your cpp understands the stringify operator. */
#undef HAVE_CPP_STRINGIFY
......
......@@ -78,6 +78,12 @@ if [[ x$gxx_include_dir = x ]]; then
gxx_include_dir='${prefix}/include/g++'
fi
# Enable expensive internal checks
AC_ARG_ENABLE(checking,
[ --enable-checking enable expensive run-time checks.],
AC_DEFINE(ENABLE_CHECKING)
)
# Enable use of cpplib for C.
AC_ARG_ENABLE(c-cpplib,
[ --enable-c-cpplib Use cpplib for C.],
......
......@@ -175,6 +175,10 @@ static int num_scratch;
reg_info *reg_n_info;
/* Size of the reg_n_info table. */
unsigned int reg_n_max;
/* Element N is the next insn that uses (hard or pseudo) register number N
within the current basic block; or zero, if there is no such insn.
This is valid only during the final backward scan in propagate_block. */
......
......@@ -1754,12 +1754,11 @@ allocate_reg_info (num_regs, new_p, renumber_p)
int renumber_p;
{
static int regno_allocated = 0;
static int regno_max = 0;
static short *renumber = (short *)0;
int i;
int size_info;
int size_renumber;
int min = (new_p) ? 0 : regno_max;
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
......@@ -1776,7 +1775,7 @@ allocate_reg_info (num_regs, new_p, renumber_p)
renumber = (short *)0;
}
regno_allocated = 0;
regno_max = 0;
reg_n_max = 0;
return;
}
......@@ -1823,7 +1822,7 @@ allocate_reg_info (num_regs, new_p, renumber_p)
/* Tell the regset code about the new number of registers */
MAX_REGNO_REG_SET (num_regs, new_p, renumber_p);
regno_max = num_regs;
reg_n_max = num_regs;
}
......
......@@ -62,16 +62,28 @@ typedef struct reg_info_def {
extern reg_info *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[(N)].refs)
#define REG_N_REFS(N) (reg_n_info[REG_N_CHECK (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[(N)].sets)
#define REG_N_SETS(N) (reg_n_info[REG_N_CHECK (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
......@@ -79,13 +91,13 @@ extern reg_info *reg_n_info;
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[(N)].deaths)
#define REG_N_DEATHS(N) (reg_n_info[REG_N_CHECK (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[(N)].changes_size)
#define REG_CHANGES_SIZE(N) (reg_n_info[REG_N_CHECK (N)].changes_size)
/* Get the number of consecutive words required to hold pseudo-reg N. */
......@@ -104,7 +116,7 @@ extern reg_info *reg_n_info;
/* Indexed by N, gives number of CALL_INSNS across which (REG n) is live. */
#define REG_N_CALLS_CROSSED(N) (reg_n_info[(N)].calls_crossed)
#define REG_N_CALLS_CROSSED(N) (reg_n_info[REG_N_CHECK (N)].calls_crossed)
/* Total number of instructions at which (REG n) is live.
The larger this is, the less priority (REG n) gets for
......@@ -121,7 +133,7 @@ extern reg_info *reg_n_info;
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[(N)].live_length)
#define REG_LIVE_LENGTH(N) (reg_n_info[REG_N_CHECK (N)].live_length)
/* Vector of substitutions of register numbers,
used to map pseudo regs into hardware regs.
......@@ -153,7 +165,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[(N)].first_uid)
#define REGNO_FIRST_UID(N) (reg_n_info[REG_N_CHECK (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.
......@@ -161,11 +173,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[(N)].last_uid)
#define REGNO_LAST_UID(N) (reg_n_info[REG_N_CHECK (N)].last_uid)
/* Similar, but includes insns that mention the reg in their notes. */
#define REGNO_LAST_NOTE_UID(N) (reg_n_info[(N)].last_note_uid)
#define REGNO_LAST_NOTE_UID(N) (reg_n_info[REG_N_CHECK (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. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment