Commit 4803a34a by Richard Kenner

*** empty log message ***

From-SVN: r1057
parent af189bf3
...@@ -1148,26 +1148,27 @@ SYSCALLS.c.X: $(srcdir)/sys-types.h $(srcdir)/sys-protos.h $(GCC_PASSES) ...@@ -1148,26 +1148,27 @@ SYSCALLS.c.X: $(srcdir)/sys-types.h $(srcdir)/sys-protos.h $(GCC_PASSES)
-rm -f SYSCALLS.c -rm -f SYSCALLS.c
test-protoize-simple: ./protoize ./unprotoize $(GCC_PASSES) test-protoize-simple: ./protoize ./unprotoize $(GCC_PASSES)
-rm -f tmp-proto.* -rm -f tmp-proto.[cso]
cp $(srcdir)/protoize.c tmp-proto.c cp $(srcdir)/protoize.c tmp-proto.c
chmod u+w tmp-proto.c chmod u+w tmp-proto.c
./protoize -N -B ./ -c "-B./ -Wall -Wwrite-strings $(CFLAGS) \ ./protoize -N -B ./ -x getopt.h -c "-B./ -Wall -Wwrite-strings \
$(INCLUDES) \ $(CFLAGS) $(INCLUDES) \
-DGCC_INCLUDE_DIR=0 \ -DGCC_INCLUDE_DIR=0 \
-DGPLUSPLUS_INCLUDE_DIR=0 \ -DGPLUSPLUS_INCLUDE_DIR=0 \
-DCROSS_INCLUDE_DIR=0 \ -DCROSS_INCLUDE_DIR=0 \
-DSTD_PROTO_DIR=0" tmp-proto.c -DSTD_PROTO_DIR=0" tmp-proto.c
@echo Expect 324 lines of differences. @echo '**********' Expect 402 lines of differences.
diff $(srcdir)/protoize.c tmp-proto.c | wc -l -diff $(srcdir)/protoize.c tmp-proto.c > tmp-proto.diff
./unprotoize -N -c "-B./ -Wall -Wwrite-strings $(CFLAGS) \ -wc -l tmp-proto.diff
$(INCLUDES) \ ./unprotoize -N -x getopt.h -c "-B./ -Wall -Wwrite-strings \
$(CFLAGS) $(INCLUDES) \
-DGCC_INCLUDE_DIR=0 \ -DGCC_INCLUDE_DIR=0 \
-DGPLUSPLUS_INCLUDE_DIR=0 \ -DGPLUSPLUS_INCLUDE_DIR=0 \
-DCROSS_INCLUDE_DIR=0 \ -DCROSS_INCLUDE_DIR=0 \
-DSTD_PROTO_DIR=0" tmp-proto.c -DSTD_PROTO_DIR=0" tmp-proto.c
@echo Expect zero differences. @echo Expect zero differences.
diff $(srcdir)/protoize.c tmp-proto.c | cat diff $(srcdir)/protoize.c tmp-proto.c | cat
-rm -f tmp-proto.* -rm -f tmp-proto.[cso]
# Remake the info files. # Remake the info files.
...@@ -1203,8 +1204,8 @@ mostlyclean: ...@@ -1203,8 +1204,8 @@ mostlyclean:
-rm -f tmplibgcc* tmpcopy -rm -f tmplibgcc* tmpcopy
for name in $(LIB1FUNCS); do rm -f $${name}.c; done for name in $(LIB1FUNCS); do rm -f $${name}.c; done
# Delete other temporary files. # Delete other temporary files.
-rm -f tmp-float.h tmp-*proto.1 tmp-gcc.xtar.Z tmp-limits.h gccnew -rm -f tmp-float.h tmp-gcc.xtar.Z tmp-limits.h gccnew
-rm -f tmp-foo1 tmp-foo2 tmp-proto.c -rm -f tmp-foo1 tmp-foo2 tmp-proto.*
# Delete the stamp files. # Delete the stamp files.
-rm -f stamp-* tmp-* -rm -f stamp-* tmp-*
# Delete debugging dump files. # Delete debugging dump files.
...@@ -1374,7 +1375,9 @@ install-common: native install-dir ...@@ -1374,7 +1375,9 @@ install-common: native install-dir
ln $(bindir)/gcc $(bindir)/gcc-$(target)-1; \ ln $(bindir)/gcc $(bindir)/gcc-$(target)-1; \
mv $(bindir)/gcc-$(target)-1 $(bindir)/gcc-$(target); \ mv $(bindir)/gcc-$(target)-1 $(bindir)/gcc-$(target); \
fi fi
-rm -f $(bindir)/c++
$(INSTALL_PROGRAM) $(srcdir)/c++ $(bindir)/c++ $(INSTALL_PROGRAM) $(srcdir)/c++ $(bindir)/c++
-rm -f $(bindir)/g++
$(INSTALL_PROGRAM) $(srcdir)/g++ $(bindir)/g++ $(INSTALL_PROGRAM) $(srcdir)/g++ $(bindir)/g++
-rm -f $(libsubdir)/cpp -rm -f $(libsubdir)/cpp
$(INSTALL_PROGRAM) cpp $(libsubdir)/cpp $(INSTALL_PROGRAM) cpp $(libsubdir)/cpp
......
...@@ -2617,6 +2617,7 @@ builtin_function (name, type, function_code, library_name) ...@@ -2617,6 +2617,7 @@ builtin_function (name, type, function_code, library_name)
char *name; char *name;
tree type; tree type;
enum built_in_function function_code; enum built_in_function function_code;
TREE_NO_UNUSED_WARNING (decl) = 1;
char *library_name; char *library_name;
{ {
tree decl = build_decl (FUNCTION_DECL, get_identifier (name), type); tree decl = build_decl (FUNCTION_DECL, get_identifier (name), type);
...@@ -2629,6 +2630,7 @@ builtin_function (name, type, function_code, library_name) ...@@ -2629,6 +2630,7 @@ builtin_function (name, type, function_code, library_name)
DECL_BUILT_IN_NONANSI (decl) = 1; DECL_BUILT_IN_NONANSI (decl) = 1;
if (library_name) if (library_name)
DECL_ASSEMBLER_NAME (decl) = get_identifier (library_name); DECL_ASSEMBLER_NAME (decl) = get_identifier (library_name);
TREE_NO_UNUSED_WARNING (decl) = 1;
make_decl_rtl (decl, 0, 1); make_decl_rtl (decl, 0, 1);
pushdecl (decl); pushdecl (decl);
if (function_code != NOT_BUILT_IN) if (function_code != NOT_BUILT_IN)
......
...@@ -6572,7 +6572,7 @@ simplify_comparison (code, pop0, pop1) ...@@ -6572,7 +6572,7 @@ simplify_comparison (code, pop0, pop1)
not on in our mode. */ not on in our mode. */
const_op = INTVAL (op1); const_op = INTVAL (op1);
if (mode_width <= HOST_BITS_PER_INT) if (mode_width <= HOST_BITS_PER_INT)
const_op &= GET_MODE_MASK (mode); const_op &= mask;
/* If we are comparing against a constant power of two and the value /* If we are comparing against a constant power of two and the value
being compared has only that single significant bit (e.g., it was being compared has only that single significant bit (e.g., it was
...@@ -6590,16 +6590,17 @@ simplify_comparison (code, pop0, pop1) ...@@ -6590,16 +6590,17 @@ simplify_comparison (code, pop0, pop1)
} }
/* Do some canonicalizations based on the comparison code. We prefer /* Do some canonicalizations based on the comparison code. We prefer
comparisons against zero and then prefer equality comparisons. */ comparisons against zero and then prefer equality comparisons.
If we can reduce the size of a constant, we will do that too. */
switch (code) switch (code)
{ {
case LT: case LT:
/* < 1 is equivalent to <= 0 */ /* < C is equivalent to <= (C - 1) */
if (const_op == 1) if (const_op > 0)
{ {
op1 = const0_rtx; const_op -= 1;
const_op = 0; op1 = gen_rtx (CONST_INT, VOIDmode, const_op);
code = LE; code = LE;
/* ... fall through to LE case below. */ /* ... fall through to LE case below. */
} }
...@@ -6607,9 +6608,13 @@ simplify_comparison (code, pop0, pop1) ...@@ -6607,9 +6608,13 @@ simplify_comparison (code, pop0, pop1)
break; break;
case LE: case LE:
/* <= -1 is equivalent to < 0 */ /* <= C is equivalent to < (C + 1); we do this for C < 0 */
if (op1 == constm1_rtx) if (const_op < 0)
op1 = const0_rtx, const_op = 0, code = LT; {
const_op += 1;
op1 = gen_rtx (CONST_INT, VOIDmode, const_op);
code = LT;
}
/* If we are doing a <= 0 comparison on a value known to have /* If we are doing a <= 0 comparison on a value known to have
a zero sign bit, we can replace this with == 0. */ a zero sign bit, we can replace this with == 0. */
...@@ -6621,11 +6626,11 @@ simplify_comparison (code, pop0, pop1) ...@@ -6621,11 +6626,11 @@ simplify_comparison (code, pop0, pop1)
break; break;
case GE: case GE:
/* >= 1 is equivalent to > 0. */ /* >= C is equivalent to > (C - 1). */
if (const_op == 1) if (const_op > 0)
{ {
op1 = const0_rtx; const_op -= 1;
const_op = 0; op1 = gen_rtx (CONST_INT, VOIDmode, const_op);
code = GT; code = GT;
/* ... fall through to GT below. */ /* ... fall through to GT below. */
} }
...@@ -6633,9 +6638,13 @@ simplify_comparison (code, pop0, pop1) ...@@ -6633,9 +6638,13 @@ simplify_comparison (code, pop0, pop1)
break; break;
case GT: case GT:
/* > -1 is equivalent to >= 0. */ /* > C is equivalent to >= (C + 1); we do this for C < 0*/
if (op1 == constm1_rtx) if (const_op < 0)
op1 = const0_rtx, const_op = 0, code = GE; {
const_op += 1;
op1 = gen_rtx (CONST_INT, VOIDmode, const_op);
code = GE;
}
/* If we are doing a > 0 comparison on a value known to have /* If we are doing a > 0 comparison on a value known to have
a zero sign bit, we can replace this with != 0. */ a zero sign bit, we can replace this with != 0. */
...@@ -6646,17 +6655,17 @@ simplify_comparison (code, pop0, pop1) ...@@ -6646,17 +6655,17 @@ simplify_comparison (code, pop0, pop1)
code = NE; code = NE;
break; break;
case GEU:
/* unsigned >= 1 is equivalent to != 0 */
if (const_op == 1)
op1 = const0_rtx, const_op = 0, code = NE;
break;
case LTU: case LTU:
/* unsigned < 1 is equivalent to == 0 */ /* < C is equivalent to <= (C - 1). */
if (const_op == 1) if (const_op > 0)
op1 = const0_rtx, const_op = 0, code = EQ; {
break; const_op -= 1;
op1 = gen_rtx (CONST_INT, VOIDmode, const_op);
code = LEU;
/* ... fall through ... */
}
else
break;
case LEU: case LEU:
/* unsigned <= 0 is equivalent to == 0 */ /* unsigned <= 0 is equivalent to == 0 */
...@@ -6664,6 +6673,18 @@ simplify_comparison (code, pop0, pop1) ...@@ -6664,6 +6673,18 @@ simplify_comparison (code, pop0, pop1)
code = EQ; code = EQ;
break; break;
case GEU:
/* >= C is equivalent to < (C - 1). */
if (const_op > 1)
{
const_op -= 1;
op1 = gen_rtx (CONST_INT, VOIDmode, const_op);
code = GTU;
/* ... fall through ... */
}
else
break;
case GTU: case GTU:
/* unsigned > 0 is equivalent to != 0 */ /* unsigned > 0 is equivalent to != 0 */
if (const_op == 0) if (const_op == 0)
......
...@@ -4264,15 +4264,19 @@ refers_to_regno_for_reload_p (regno, endregno, x, loc) ...@@ -4264,15 +4264,19 @@ refers_to_regno_for_reload_p (regno, endregno, x, loc)
case REG: case REG:
i = REGNO (x); i = REGNO (x);
if (i >= FIRST_PSEUDO_REGISTER && reg_renumber[i] == -1 /* If this is a pseudo, a hard register must not have been allocated.
&& ((reg_equiv_address[i] X must therefore either be a constant or be in memory. */
&& refers_to_regno_for_reload_p (regno, endregno, if (i >= FIRST_PSEUDO_REGISTER)
reg_equiv_address[i], 0)) {
|| (reg_equiv_mem[i] if (reg_equiv_memory_loc[i])
&& refers_to_regno_for_reload_p (regno, endregno, return refers_to_regno_for_reload_p (regno, endregno,
XEXP (reg_equiv_mem[i], 0), reg_equiv_memory_loc[i], 0);
0))))
return 1; if (reg_equiv_constant[i])
return 0;
abort ();
}
return (endregno > i return (endregno > i
&& regno < i + (i < FIRST_PSEUDO_REGISTER && regno < i + (i < FIRST_PSEUDO_REGISTER
...@@ -4372,34 +4376,23 @@ reg_overlap_mentioned_for_reload_p (x, in) ...@@ -4372,34 +4376,23 @@ reg_overlap_mentioned_for_reload_p (x, in)
else if (GET_CODE (x) == REG) else if (GET_CODE (x) == REG)
{ {
regno = REGNO (x); regno = REGNO (x);
if (regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] == -1
&& ((reg_equiv_address[regno] /* If this is a pseudo, it must not have been assigned a hard register.
&& reg_overlap_mentioned_for_reload_p (reg_equiv_address[regno], Therefore, it must either be in memory or be a constant. */
in))
|| (reg_equiv_mem[regno] if (regno >= FIRST_PSEUDO_REGISTER)
&& reg_overlap_mentioned_for_reload_p (reg_equiv_mem[regno], {
in)))) if (reg_equiv_memory_loc[regno])
return 1; return refers_to_mem_for_reload_p (in);
else if (reg_equiv_constant[regno])
return 0;
abort ();
}
} }
else if (CONSTANT_P (x)) else if (CONSTANT_P (x))
return 0; return 0;
else if (GET_CODE (x) == MEM) else if (GET_CODE (x) == MEM)
{ return refers_to_mem_for_reload_p (in);
char *fmt;
int i;
if (GET_CODE (in) == MEM)
return 1;
fmt = GET_RTX_FORMAT (GET_CODE (in));
for (i = GET_RTX_LENGTH (GET_CODE (in)) - 1; i >= 0; i--)
if (fmt[i] == 'e' && reg_overlap_mentioned_for_reload_p (x,
XEXP (in, i)))
return 1;
return 0;
}
else if (GET_CODE (x) == SCRATCH || GET_CODE (x) == PC else if (GET_CODE (x) == SCRATCH || GET_CODE (x) == PC
|| GET_CODE (x) == CC0) || GET_CODE (x) == CC0)
return reg_mentioned_p (x, in); return reg_mentioned_p (x, in);
...@@ -4411,6 +4404,33 @@ reg_overlap_mentioned_for_reload_p (x, in) ...@@ -4411,6 +4404,33 @@ reg_overlap_mentioned_for_reload_p (x, in)
return refers_to_regno_for_reload_p (regno, endregno, in, 0); return refers_to_regno_for_reload_p (regno, endregno, in, 0);
} }
/* Return nonzero if anything in X contains a MEM. Look also for pseudo
registers. */
int
refers_to_mem_for_reload_p (x)
rtx x;
{
char *fmt;
int i;
if (GET_CODE (x) == MEM)
return 1;
if (GET_CODE (x) == REG)
return (REGNO (x) >= FIRST_PSEUDO_REGISTER
&& reg_equiv_memory_loc[REGNO (x)]);
fmt = GET_RTX_FORMAT (GET_CODE (x));
for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--)
if (fmt[i] == 'e'
&& (GET_CODE (XEXP (x, i)) == MEM
|| refers_to_mem_for_reload_p (XEXP (x, i))))
return 1;
return 0;
}
#if 0 #if 0
......
...@@ -89,7 +89,7 @@ rtx *reg_equiv_constant; ...@@ -89,7 +89,7 @@ rtx *reg_equiv_constant;
prior to any register elimination (such as frame pointer to stack prior to any register elimination (such as frame pointer to stack
pointer). Depending on whether or not it is a valid address, this value pointer). Depending on whether or not it is a valid address, this value
is transferred to either reg_equiv_address or reg_equiv_mem. */ is transferred to either reg_equiv_address or reg_equiv_mem. */
static rtx *reg_equiv_memory_loc; rtx *reg_equiv_memory_loc;
/* Element N is the address of stack slot to which pseudo reg N is equivalent. /* Element N is the address of stack slot to which pseudo reg N is equivalent.
This is used when the address is not valid as a memory address This is used when the address is not valid as a memory address
......
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