-rm -f SYSCALLS.c
test-protoize-simple: ./protoize ./unprotoize $(GCC_PASSES)
- -rm -f tmp-proto.*
+ -rm -f tmp-proto.[cso]
cp $(srcdir)/protoize.c tmp-proto.c
chmod u+w tmp-proto.c
- ./protoize -N -B ./ -c "-B./ -Wall -Wwrite-strings $(CFLAGS) \
- $(INCLUDES) \
+ ./protoize -N -B ./ -x getopt.h -c "-B./ -Wall -Wwrite-strings \
+ $(CFLAGS) $(INCLUDES) \
-DGCC_INCLUDE_DIR=0 \
-DGPLUSPLUS_INCLUDE_DIR=0 \
-DCROSS_INCLUDE_DIR=0 \
-DSTD_PROTO_DIR=0" tmp-proto.c
- @echo Expect 324 lines of differences.
- diff $(srcdir)/protoize.c tmp-proto.c | wc -l
- ./unprotoize -N -c "-B./ -Wall -Wwrite-strings $(CFLAGS) \
- $(INCLUDES) \
+ @echo '**********' Expect 402 lines of differences.
+ -diff $(srcdir)/protoize.c tmp-proto.c > tmp-proto.diff
+ -wc -l tmp-proto.diff
+ ./unprotoize -N -x getopt.h -c "-B./ -Wall -Wwrite-strings \
+ $(CFLAGS) $(INCLUDES) \
-DGCC_INCLUDE_DIR=0 \
-DGPLUSPLUS_INCLUDE_DIR=0 \
-DCROSS_INCLUDE_DIR=0 \
-DSTD_PROTO_DIR=0" tmp-proto.c
@echo Expect zero differences.
diff $(srcdir)/protoize.c tmp-proto.c | cat
- -rm -f tmp-proto.*
+ -rm -f tmp-proto.[cso]
\f
# Remake the info files.
-rm -f tmplibgcc* tmpcopy
for name in $(LIB1FUNCS); do rm -f $${name}.c; done
# Delete other temporary files.
- -rm -f tmp-float.h tmp-*proto.1 tmp-gcc.xtar.Z tmp-limits.h gccnew
- -rm -f tmp-foo1 tmp-foo2 tmp-proto.c
+ -rm -f tmp-float.h tmp-gcc.xtar.Z tmp-limits.h gccnew
+ -rm -f tmp-foo1 tmp-foo2 tmp-proto.*
# Delete the stamp files.
-rm -f stamp-* tmp-*
# Delete debugging dump files.
ln $(bindir)/gcc $(bindir)/gcc-$(target)-1; \
mv $(bindir)/gcc-$(target)-1 $(bindir)/gcc-$(target); \
fi
+ -rm -f $(bindir)/c++
$(INSTALL_PROGRAM) $(srcdir)/c++ $(bindir)/c++
+ -rm -f $(bindir)/g++
$(INSTALL_PROGRAM) $(srcdir)/g++ $(bindir)/g++
-rm -f $(libsubdir)/cpp
$(INSTALL_PROGRAM) cpp $(libsubdir)/cpp
char *name;
tree type;
enum built_in_function function_code;
+ TREE_NO_UNUSED_WARNING (decl) = 1;
char *library_name;
{
tree decl = build_decl (FUNCTION_DECL, get_identifier (name), type);
DECL_BUILT_IN_NONANSI (decl) = 1;
if (library_name)
DECL_ASSEMBLER_NAME (decl) = get_identifier (library_name);
+ TREE_NO_UNUSED_WARNING (decl) = 1;
make_decl_rtl (decl, 0, 1);
pushdecl (decl);
if (function_code != NOT_BUILT_IN)
not on in our mode. */
const_op = INTVAL (op1);
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
being compared has only that single significant bit (e.g., it was
}
/* 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)
{
case LT:
- /* < 1 is equivalent to <= 0 */
- if (const_op == 1)
+ /* < C is equivalent to <= (C - 1) */
+ if (const_op > 0)
{
- op1 = const0_rtx;
- const_op = 0;
+ const_op -= 1;
+ op1 = gen_rtx (CONST_INT, VOIDmode, const_op);
code = LE;
/* ... fall through to LE case below. */
}
break;
case LE:
- /* <= -1 is equivalent to < 0 */
- if (op1 == constm1_rtx)
- op1 = const0_rtx, const_op = 0, code = LT;
+ /* <= C is equivalent to < (C + 1); we do this for C < 0 */
+ if (const_op < 0)
+ {
+ 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
a zero sign bit, we can replace this with == 0. */
break;
case GE:
- /* >= 1 is equivalent to > 0. */
- if (const_op == 1)
+ /* >= C is equivalent to > (C - 1). */
+ if (const_op > 0)
{
- op1 = const0_rtx;
- const_op = 0;
+ const_op -= 1;
+ op1 = gen_rtx (CONST_INT, VOIDmode, const_op);
code = GT;
/* ... fall through to GT below. */
}
break;
case GT:
- /* > -1 is equivalent to >= 0. */
- if (op1 == constm1_rtx)
- op1 = const0_rtx, const_op = 0, code = GE;
+ /* > C is equivalent to >= (C + 1); we do this for C < 0*/
+ if (const_op < 0)
+ {
+ 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
a zero sign bit, we can replace this with != 0. */
code = NE;
break;
- case GEU:
- /* unsigned >= 1 is equivalent to != 0 */
- if (const_op == 1)
- op1 = const0_rtx, const_op = 0, code = NE;
- break;
-
case LTU:
- /* unsigned < 1 is equivalent to == 0 */
- if (const_op == 1)
- op1 = const0_rtx, const_op = 0, code = EQ;
- break;
+ /* < C is equivalent to <= (C - 1). */
+ if (const_op > 0)
+ {
+ const_op -= 1;
+ op1 = gen_rtx (CONST_INT, VOIDmode, const_op);
+ code = LEU;
+ /* ... fall through ... */
+ }
+ else
+ break;
case LEU:
/* unsigned <= 0 is equivalent to == 0 */
code = EQ;
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:
/* unsigned > 0 is equivalent to != 0 */
if (const_op == 0)
case REG:
i = REGNO (x);
- if (i >= FIRST_PSEUDO_REGISTER && reg_renumber[i] == -1
- && ((reg_equiv_address[i]
- && refers_to_regno_for_reload_p (regno, endregno,
- reg_equiv_address[i], 0))
- || (reg_equiv_mem[i]
- && refers_to_regno_for_reload_p (regno, endregno,
- XEXP (reg_equiv_mem[i], 0),
- 0))))
- return 1;
+ /* If this is a pseudo, a hard register must not have been allocated.
+ X must therefore either be a constant or be in memory. */
+ if (i >= FIRST_PSEUDO_REGISTER)
+ {
+ if (reg_equiv_memory_loc[i])
+ return refers_to_regno_for_reload_p (regno, endregno,
+ reg_equiv_memory_loc[i], 0);
+
+ if (reg_equiv_constant[i])
+ return 0;
+
+ abort ();
+ }
return (endregno > i
&& regno < i + (i < FIRST_PSEUDO_REGISTER
else if (GET_CODE (x) == REG)
{
regno = REGNO (x);
- if (regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] == -1
- && ((reg_equiv_address[regno]
- && reg_overlap_mentioned_for_reload_p (reg_equiv_address[regno],
- in))
- || (reg_equiv_mem[regno]
- && reg_overlap_mentioned_for_reload_p (reg_equiv_mem[regno],
- in))))
- return 1;
+
+ /* If this is a pseudo, it must not have been assigned a hard register.
+ Therefore, it must either be in memory or be a constant. */
+
+ if (regno >= FIRST_PSEUDO_REGISTER)
+ {
+ if (reg_equiv_memory_loc[regno])
+ return refers_to_mem_for_reload_p (in);
+ else if (reg_equiv_constant[regno])
+ return 0;
+ abort ();
+ }
}
else if (CONSTANT_P (x))
return 0;
else if (GET_CODE (x) == MEM)
- {
- 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;
- }
+ return refers_to_mem_for_reload_p (in);
else if (GET_CODE (x) == SCRATCH || GET_CODE (x) == PC
|| GET_CODE (x) == CC0)
return reg_mentioned_p (x, in);
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;
+}
\f
#if 0
prior to any register elimination (such as frame pointer to stack
pointer). Depending on whether or not it is a valid address, this value
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.
This is used when the address is not valid as a memory address