From 4803a34aa2e83749b072d1b30106fd3dae5f1cf5 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Fri, 22 May 1992 17:22:42 -0400 Subject: [PATCH] *** empty log message *** From-SVN: r1057 --- gcc/Makefile.in | 23 +++++++------ gcc/c-decl.c | 2 ++ gcc/combine.c | 73 ++++++++++++++++++++++++++--------------- gcc/reload.c | 86 ++++++++++++++++++++++++++++++------------------- gcc/reload1.c | 2 +- 5 files changed, 116 insertions(+), 70 deletions(-) diff --git a/gcc/Makefile.in b/gcc/Makefile.in index f742ebfe8e8..389885def84 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1148,26 +1148,27 @@ SYSCALLS.c.X: $(srcdir)/sys-types.h $(srcdir)/sys-protos.h $(GCC_PASSES) -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] # Remake the info files. @@ -1203,8 +1204,8 @@ mostlyclean: -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. @@ -1374,7 +1375,9 @@ install-common: native install-dir 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 diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 267267b272e..c52b462ad4c 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -2617,6 +2617,7 @@ builtin_function (name, type, function_code, library_name) 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); @@ -2629,6 +2630,7 @@ builtin_function (name, type, function_code, library_name) 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) diff --git a/gcc/combine.c b/gcc/combine.c index af6f67d553d..d5473cb0878 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -6572,7 +6572,7 @@ simplify_comparison (code, pop0, pop1) 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 @@ -6590,16 +6590,17 @@ simplify_comparison (code, pop0, pop1) } /* 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. */ } @@ -6607,9 +6608,13 @@ simplify_comparison (code, pop0, pop1) 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. */ @@ -6621,11 +6626,11 @@ simplify_comparison (code, pop0, pop1) 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. */ } @@ -6633,9 +6638,13 @@ simplify_comparison (code, pop0, pop1) 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. */ @@ -6646,17 +6655,17 @@ simplify_comparison (code, pop0, pop1) 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 */ @@ -6664,6 +6673,18 @@ simplify_comparison (code, pop0, pop1) 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) diff --git a/gcc/reload.c b/gcc/reload.c index 23a2811b6fe..526cade581e 100644 --- a/gcc/reload.c +++ b/gcc/reload.c @@ -4264,15 +4264,19 @@ refers_to_regno_for_reload_p (regno, endregno, x, loc) 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 @@ -4372,34 +4376,23 @@ reg_overlap_mentioned_for_reload_p (x, in) 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); @@ -4411,6 +4404,33 @@ reg_overlap_mentioned_for_reload_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; +} #if 0 diff --git a/gcc/reload1.c b/gcc/reload1.c index 4597703422b..7f2a9fc63ff 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -89,7 +89,7 @@ rtx *reg_equiv_constant; 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 -- 2.30.2