Commit 78a0d70c by Zack Weinberg

frame.c (find_fde): Convert for loop to do-while so compiler sees it's always…

frame.c (find_fde): Convert for loop to do-while so compiler sees it's always executed at least once.

	* frame.c (find_fde): Convert for loop to do-while so compiler
	sees it's always executed at least once.
	* libgcc2.c (BBINBUFSIZE): Kill.
	(__bb_init_prg): Use fgets.
	(__bb_exit_trace_func): Don't paste strings.
	* unroll.c (unroll_loop): Initialize unroll_type, not
	unroll_number, and tweak logic to match.

	* i386.c (ix86_expand_int_movcc): Add explicit 'return 0' in
	all failure paths.
	(ix86_flags_dependant): Likewise.  Disentangle control flow.
	(ix86_sched_reorder): Break guts out to
	ix86_sched_reorder_pentium and ix86_sched_reorder_ppro.
	(ix86_sched_reorder_ppro): Initialize pair2 and insnp before
	any possible use.

	* i386.h (MACHINE_STATE_SAVE, MACHINE_STATE_RESTORE): Don't
	use string concatenation.  Don't save and restore esi.

	* fixinc/Makefile.in (fixincl.sh): Don't depend on inclhack.def.
	(machname.h): Remove script to separate file.  Use two-step
	sequence so target is not created if script fails.
	* fixinc/gen-machname.h: New file.  Handle case where no non-reserved
	identifiers are defined.
	* fixinc/fixlib.c (mn_get_regexps): Return a flag: if MN_NAME_PAT is
	an empty string, machine_name doesn't need to do anything at
	all.
	(is_cxx_header): Add more cases to regexp.
	* fixinc/fixlib.h: Update prototype.
	* fixinc/fixtests.c, fixinc/fixfixes.c: Update callers of
	mn_get_regexps.
	* fixinc/fixincl.c: Define NO_BOGOSITY.

	* fixinc/inclhack.def (no_double_slash, else_endif_label): Ifdef out.
	(hp_sysfile): Add missing comma.
	(math_exception): Put the wrapper ifdefs at the beginning and
	the end of the file.
	* fixinc/fixincl.x, fixinc/inclhack.sh: Regenerate.

From-SVN: r31744
parent f2321837
......@@ -1288,11 +1288,11 @@ typedef struct ix86_args {
Note that function `__bb_trace_ret' must not change the
machine state, especially the flag register. To grant
this, you must output code to save and restore registers
either in this macro or in the macros MACHINE_STATE_SAVE_RET
and MACHINE_STATE_RESTORE_RET. The last two macros will be
either in this macro or in the macros MACHINE_STATE_SAVE
and MACHINE_STATE_RESTORE. The last two macros will be
used in the function `__bb_trace_ret', so you must make
sure that the function prologue does not change any
register prior to saving it with MACHINE_STATE_SAVE_RET.
register prior to saving it with MACHINE_STATE_SAVE.
else if profiling_block_flag != 0:
......@@ -1324,20 +1324,21 @@ emit_call_insn (gen_call (gen_rtx_MEM (Pmode, \
On the i386 the initialization code at the begin of
function `__bb_trace_func' contains a `sub' instruction
therefore we handle save and restore of the flag register
in the BLOCK_PROFILER macro. */
in the BLOCK_PROFILER macro.
Note that ebx, esi, and edi are callee-save, so we don't have to
preserve them explicitly. */
#define MACHINE_STATE_SAVE(ID) \
do { \
register int eax_ __asm__("eax"); \
register int ecx_ __asm__("ecx"); \
register int edx_ __asm__("edx"); \
register int esi_ __asm__("esi"); \
__asm__ __volatile__ ( \
"push{l} %0\n\t" \
"push{l} %1\n\t" \
"push{l} %2\n\t" \
"push{l} %3" \
: : "r"(eax_), "r"(ecx_), "r"(edx_), "r"(esi_)); \
__asm__ __volatile__ ("\
push{l} %0\n\t\
push{l} %1\n\t\
push{l} %2" \
: : "r"(eax_), "r"(ecx_), "r"(edx_)); \
} while (0);
#define MACHINE_STATE_RESTORE(ID) \
......@@ -1345,13 +1346,11 @@ do { \
register int eax_ __asm__("eax"); \
register int ecx_ __asm__("ecx"); \
register int edx_ __asm__("edx"); \
register int esi_ __asm__("esi"); \
__asm__ __volatile__ ( \
"pop{l} %3\n\t" \
"pop{l} %2\n\t" \
"pop{l} %1\n\t" \
"pop{l} %0" \
: "=r"(eax_), "=r"(ecx_), "=r"(edx_), "=r"(esi_)); \
__asm__ __volatile__ ("\
pop{l} %2\n\t\
pop{l} %1\n\t\
pop{l} %0" \
: "=r"(eax_), "=r"(ecx_), "=r"(edx_)); \
} while (0);
/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
......
# Makefile for GNU compilers.
# Copyright (C) 1998, 1999 Free Software Foundation, Inc.
# Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
#This file is part of GNU CC.
......@@ -101,7 +101,8 @@ fixincl.x: fixincl.tpl inclhack.def
inclhack.sh: inclhack.def inclhack.tpl hackshell.tpl
cd $(srcdir) ; ./genfixes $@
fixincl.sh: inclhack.def inclhack.tpl
# fixinc.sh, unlike the other two, has _no_ dependency on the .def file.
fixincl.sh: inclhack.tpl
cd $(srcdir) ; ./genfixes $@
clean:
......@@ -137,15 +138,6 @@ Makefile: Makefile.in ../config.status
cd .. \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
# Black magic.
# Note dependency on ASCII. \040 = space, \011 = tab, \012 = newline.
machname.h: ../specs
@tr -s '\040\011' '\012\012' < ../specs | \
sed -n 's/^.*-D\([a-zA-Z_][a-zA-Z0-9_]*\).*$$/\1/p' | sort -u | \
grep -v '^_[_A-Z]' > mn.T
@echo "Forbidden identifiers: `tr '\012' ' ' <mn.T`"
@sed 's/^/\\\\</; s/$$/\\\\>/' <mn.T | tr '\012' '|' > mn.T2
@echo '' >>mn.T2
@sed 's/^/#define MN_NAME_PAT "/; s/|$$/"/' < mn.T2 > machname.h
@-rm -f mn.T mn.T2
$(SHELL) $(srcdir)/gen-machname.h < ../specs > machname.T
mv -f machname.T machname.h
......@@ -566,7 +566,11 @@ FIX_PROC_HEAD( machine_name_fix )
char scratch[SCRATCHSZ];
size_t len;
mn_get_regexps (&label_re, &name_re, "machine_name_fix");
if (mn_get_regexps (&label_re, &name_re, "machine_name_fix"))
/* This platform doesn't need this fix. We can only get here if
someone is running fixfixes by hand, but let's be polite. */
goto done;
scratch[0] = '_';
scratch[1] = '_';
......
......@@ -33,6 +33,8 @@ Boston, MA 02111-1307, USA. */
#include "server.h"
#define NO_BOGOSITY
/* Quality Assurance Marker :-)
Any file that contains this string is presumed to have
......
......@@ -122,7 +122,11 @@ is_cxx_header (fname, text)
tSCC cxxpat[] = "\
extern[ \t]*\"C\\+\\+\"|\
-\\*-[ \t]*([mM]ode:[ \t]*)?[cC]\\+\\+[; \t]*-\\*-|\
template[ \t]*<";
template[ \t]*<|\
^[ \t]*class[ \t]|\
(public|private|protected):|\
^[ \t]*#[ \t]*pragma[ \t]+(interface|implementation)\
";
static regex_t cxxre;
static int compiled;
......@@ -187,12 +191,16 @@ static regex_t mn_name_re;
static int mn_compiled = 0;
void
int
mn_get_regexps( label_re, name_re, who )
regex_t **label_re;
regex_t **name_re;
tCC *who;
{
/* Maybe we don't need to do this fix at all? */
if (mn_name_pat[0] == '\0')
return 1;
if (! mn_compiled)
{
compile_re (mn_label_pat, &mn_label_re, 1, "label pattern", who);
......@@ -201,4 +209,5 @@ mn_get_regexps( label_re, name_re, who )
}
*label_re = &mn_label_re;
*name_re = &mn_name_re;
return 0;
}
......@@ -99,6 +99,6 @@ char * load_file_data _P_(( FILE* fp ));
t_bool is_cxx_header _P_(( tCC* filename, tCC* filetext ));
void compile_re _P_(( tCC* pat, regex_t* re, int match,
tCC *e1, tCC *e2 ));
void mn_get_regexps _P_(( regex_t** label_re, regex_t** name_re,
int mn_get_regexps _P_(( regex_t** label_re, regex_t** name_re,
tCC *who ));
#endif /* FIXINCLUDES_FIXLIB_H */
......@@ -275,7 +275,8 @@ TEST_FOR_FIX_PROC_HEAD( machine_name_test )
regmatch_t match[2];
tCC *base, *limit;
mn_get_regexps(&label_re, &name_re, "machine_name_test");
if (mn_get_regexps(&label_re, &name_re, "machine_name_test"))
return SKIP_FIX;
for (base = text;
regexec (label_re, base, 2, match, 0) == 0;
......
#! /bin/sh
# Copyright (C) 2000 Free Software Foundation, Inc.
# This file is part of GNU CC.
# GNU CC is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# GNU CC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with GNU CC; see the file COPYING. If not, write to
# the Free Software Foundation, 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
# This script extracts from the specs file all the predefined macros
# that are not in the C89 reserved namespace (the reserved namespace
# is all identifiers beginnning with two underscores or one underscore
# followed by a capital letter). The specs file is on standard input.
# A #define for a regular expression to find any of those macros in a
# header file is written to standard output.
# Note dependency on ASCII. \040 = space, \011 = tab, \012 = newline.
# tr ' ' '\n' is, alas, not portable.
tr -s '\040\011' '\012\012' |
sed -n 's/^.*-D\([a-zA-Z_][a-zA-Z0-9_]*\).*$/\1/p' |
sort -u > mn.T
if grep -v '^_[_A-Z]' mn.T > mn.U
then
echo "Forbidden identifiers: `tr '\012' ' ' <mn.U`" >&2
sed 's/^/\\\\</; s/$/\\\\>/' <mn.U | tr '\012' '|' > mn.V
echo '' >>mn.V
sed 's/^/#define MN_NAME_PAT "/; s/|$/"/' < mn.V
else
echo "No forbidden identifiers defined by this target" >&2
echo '#define MN_NAME_PAT ""'
fi
rm -f mn.[TUV]
exit 0
......@@ -765,6 +765,7 @@ fix = {
};
#ifdef OLD_CPP
/*
* Remove the double-slash comments. The "double_slash" test will
* try to ignore C++ headers by checking for "CC/", "xx/" and "++/"
......@@ -776,6 +777,7 @@ fix = {
c_test = "double_slash";
c_fix = "no_double_slash";
};
#endif
/*
......@@ -811,6 +813,7 @@ fix = {
};
#ifdef OLD_CPP
/*
* Fix else and endif directives that contain non-commentary text
*/
......@@ -824,6 +827,7 @@ fix = {
c_test = "else_endif_label";
c_fix = "else_endif_label";
};
#endif
/*
......@@ -846,7 +850,7 @@ fix = {
hackname = hp_sysfile;
files = sys/file.h;
select = "HPUX_SOURCE";
sed = 's/(\.\.\.)/(struct file * ...)/';
sed = 's/(\.\.\.)/(struct file *, ...)/';
};
......@@ -1282,88 +1286,23 @@ fix = {
* the class exception defined in the C++ file std/stdexcept.h. We
* redefine it to __math_exception. This is not a great fix, but I
* haven't been able to think of anything better.
* Note that we have to put the #ifdef/#endif blocks at beginning
* and end of file, because fixproto runs after us and may insert
* additional references to struct exception.
*/
fix = {
hackname = math_exception;
files = math.h;
select = "struct exception";
bypass = "We have a problem when using C\\+\\+";
sed = "/struct exception/i\\\n"
"#ifdef __cplusplus\\\n"
"#define exception __math_exception\\\n"
"#endif\n";
sed = "/struct exception/a\\\n"
"#ifdef __cplusplus\\\n"
"#undef exception\\\n"
"#endif\n";
#ifdef MATH_EXCEPTION_FIXED
sed = "/matherr/i\\\n"
sed = "1i\\\n"
"#ifdef __cplusplus\\\n"
"#define exception __math_exception\\\n"
"#endif\n";
sed = "/matherr/a\\\n"
sed = "$a\\\n"
"#ifdef __cplusplus\\\n"
"#undef exception\\\n"
"#endif\n";
I think this patch needs some more thinking.
This is from SVR4.2 (With '#' replaced with '@').
Perhaps we could do without the "/matherr/a" entries?
Can we bypass the entire fix if someone was astute
enough to have '#ifdef __cplusplus' anywhere in the file?
We can definitely do without the "/matherr/a" entries. They are
there to cover the case where matherr is declared with no prototype
-- extern int matherr(); -- but we don't need a fix then since there
is no reference to struct exception.
Bypassing on "#ifdef __cplusplus" is too optimistic, but I've stuck
in a bypass for the comment in the glibc 2.1 header that indicates
awareness of the problem. Hmm. Could we use a shell test that did
cpp -D__cplusplus | grep "struct exception" ?
*** /usr/include/math.h Fri Apr 3 18:54:59 1998
--- math.h Sun May 9 07:28:58 1999
***************
*** 25,31 ****
--- 25,37 ----
@ifndef __cplusplus
+ @ifdef __cplusplus
+ @define exception __math_exception
+ @endif
struct exception
+ @ifdef __cplusplus
+ @undef exception
+ @endif
{
int type;
char *name;
***************
*** 34,40 ****
--- 40,58 ----
double retval;
};
+ @ifdef __cplusplus
+ @define exception __math_exception
+ @endif
+ @ifdef __cplusplus
+ @define exception __math_exception
+ @endif
extern int matherr(struct exception *);
+ @ifdef __cplusplus
+ @undef exception
+ @endif
+ @ifdef __cplusplus
+ @undef exception
+ @endif
@endif /*__cplusplus*/
#endif
};
fix = {
......
......@@ -6,7 +6,7 @@
# files which are fixed to work correctly with ANSI C and placed in a
# directory that GNU C will search.
#
# This script contains 115 fixup scripts.
# This script contains 113 fixup scripts.
#
# See README-fixinc for more information.
#
......@@ -1264,22 +1264,6 @@ struct rusage;
#
# Fix No_Double_Slash
#
if ${FIXTESTS} ${file} double_slash
then
fixlist="${fixlist}
no_double_slash"
if [ ! -r ${DESTFILE} ]
then infile=${file}
else infile=${DESTFILE} ; fi
${FIXFIXES} ${file} no_double_slash < $infile > ${DESTDIR}/fixinc.tmp
rm -f ${DESTFILE}
mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
fi # end of c_test 'if'
#
# Fix Ecd_Cursor
#
case "${file}" in ./sunwindow/win_lock.h | \
......@@ -1330,22 +1314,6 @@ extern "C"\
#
# Fix End_Else_Label
#
if ${FIXTESTS} ${file} else_endif_label
then
fixlist="${fixlist}
end_else_label"
if [ ! -r ${DESTFILE} ]
then infile=${file}
else infile=${DESTFILE} ; fi
${FIXFIXES} ${file} else_endif_label < $infile > ${DESTDIR}/fixinc.tmp
rm -f ${DESTFILE}
mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
fi # end of c_test 'if'
#
# Fix Hp_Inline
#
case "${file}" in ./sys/spinlock.h )
......@@ -1379,7 +1347,7 @@ extern "C"\
then infile=${file}
else infile=${DESTFILE} ; fi
sed -e 's/(\.\.\.)/(struct file * ...)/' \
sed -e 's/(\.\.\.)/(struct file *, ...)/' \
< $infile > ${DESTDIR}/fixinc.tmp
rm -f ${DESTFILE}
mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
......@@ -2060,12 +2028,12 @@ static __inline__ double fake_hypot (x, y)\
then infile=${file}
else infile=${DESTFILE} ; fi
sed -e '/struct exception/i\
sed -e '1i\
#ifdef __cplusplus\
#define exception __math_exception\
#endif
' \
-e '/struct exception/a\
-e '$a\
#ifdef __cplusplus\
#undef exception\
#endif
......
......@@ -610,12 +610,14 @@ find_fde (void *pc)
{
fde **p = ob->fde_array;
for (; *p; ++p)
do
{
f = search_fdes (*p, pc);
if (f)
break;
p++;
}
while (*p);
}
else
f = search_fdes (ob->fde_begin, pc);
......
......@@ -1881,11 +1881,6 @@ __bb_fork_func (void)
#define BBINBUFSIZE 500
/* BBINBUFSIZE-1 with double quotes. We could use #BBINBUFSIZE or
"BBINBUFSIZE" but want to avoid trouble with preprocessors. */
#define BBINBUFSIZESTR "499"
struct bb_edge
{
struct bb_edge *next;
......@@ -2163,8 +2158,8 @@ found: ;
struct bb_edge *bucket = bb_hashbuckets[i];
for ( ; bucket; bucket = bucket->next )
{
fprintf (file, "Jump from block 0x%.*lx to "
"block 0x%.*lx executed %*lu time(s)\n",
fprintf (file,
"Jump from block 0x%.*lx to block 0x%.*lx executed %*lu time(s)\n",
addr_len, bucket->src_addr,
addr_len, bucket->dst_addr,
cnt_len, bucket->count);
......@@ -2235,8 +2230,12 @@ __bb_init_prg (void)
if (!(file = fopen ("bb.in", "r")))
return;
while(fscanf (file, " %" BBINBUFSIZESTR "s ", buf) != EOF)
while(fgets (buf, BBINBUFSIZE, file) != 0)
{
i = strlen (buf);
if (buf[i] == '\n')
buf[i--] = '\0';
p = buf;
if (*p == '-')
{
......
......@@ -234,7 +234,7 @@ unroll_loop (loop, insn_count, end_insert_before, strength_reduce_p)
{
int i, j;
unsigned HOST_WIDE_INT temp;
int unroll_number = 1;
int unroll_number;
rtx copy_start, copy_end;
rtx insn, sequence, pattern, tem;
int max_labelno, max_insnno;
......@@ -248,7 +248,7 @@ unroll_loop (loop, insn_count, end_insert_before, strength_reduce_p)
rtx start_label;
struct iv_class *bl;
int splitting_not_safe = 0;
enum unroll_types unroll_type;
enum unroll_types unroll_type = UNROLL_NAIVE;
int loop_preconditioned = 0;
rtx safety_label;
/* This points to the last real insn in the loop, which should be either
......@@ -437,7 +437,7 @@ unroll_loop (loop, insn_count, end_insert_before, strength_reduce_p)
/* Default case, calculate number of times to unroll loop based on its
size. */
if (unroll_number == 1)
if (unroll_type == UNROLL_NAIVE)
{
if (8 * insn_count < MAX_UNROLLED_INSNS)
unroll_number = 8;
......@@ -445,8 +445,6 @@ unroll_loop (loop, insn_count, end_insert_before, strength_reduce_p)
unroll_number = 4;
else
unroll_number = 2;
unroll_type = UNROLL_NAIVE;
}
/* Now we know how many times to unroll the loop. */
......
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