From bfa30b22c7637187d60bc8a85ec3fee005fccbc4 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Mon, 11 May 1992 22:51:59 -0400 Subject: [PATCH] *** empty log message *** From-SVN: r961 --- gcc/cccp.c | 22 +++++++----- gcc/integrate.c | 3 +- gcc/reload.c | 96 +++++++++++++++++++++++++++++++++++++++++-------- gcc/reload1.c | 26 ++++++++------ gcc/tree.c | 22 ++++++------ 5 files changed, 125 insertions(+), 44 deletions(-) diff --git a/gcc/cccp.c b/gcc/cccp.c index 885412bd4bf..00c33802059 100644 --- a/gcc/cccp.c +++ b/gcc/cccp.c @@ -333,9 +333,6 @@ static enum {dump_none, dump_only, dump_names, dump_definitions} where they are defined. */ static int debug_output = 0; -/* Holds local startup time. */ -static struct tm *timebuf = NULL; - /* Nonzero indicates special processing used by the pcp program. The special effects of this mode are: @@ -3433,6 +3430,17 @@ handle_directive (ip, op) return 0; } +static struct tm * +timestamp () +{ + static struct tm *timebuf; + if (!timebuf) { + time_t t = time (0); + timebuf = localtime (&t); + } + return timebuf; +} + static char *monthnames[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", }; @@ -3451,6 +3459,7 @@ special_symbol (hp, op) int i, len; int true_indepth; FILE_BUF *ip = NULL; + struct tm *timebuf; int paren = 0; /* For special `defined' keyword */ @@ -3536,6 +3545,7 @@ special_symbol (hp, op) case T_DATE: case T_TIME: buf = (char *) alloca (20); + timebuf = timestamp (); if (hp->type == T_DATE) sprintf (buf, "\"%s %2d %4d\"", monthnames[timebuf->tm_mon], timebuf->tm_mday, timebuf->tm_year + 1900); @@ -8055,11 +8065,6 @@ initialize_builtins (inp, outp) FILE_BUF *inp; FILE_BUF *outp; { - time_t t; - - t = time (0); - timebuf = localtime (&t); - install ("__LINE__", -1, T_SPECLINE, 0, -1); install ("__DATE__", -1, T_DATE, 0, -1); install ("__FILE__", -1, T_FILE, 0, -1); @@ -8082,6 +8087,7 @@ initialize_builtins (inp, outp) { char directive[2048]; register struct directive *dp = &directive_table[0]; + struct tm *timebuf = timestamp (); sprintf (directive, " __BASE_FILE__ \"%s\"\n", instack[0].nominal_fname); diff --git a/gcc/integrate.c b/gcc/integrate.c index 8db6c514d22..fae93a1a394 100644 --- a/gcc/integrate.c +++ b/gcc/integrate.c @@ -1040,7 +1040,7 @@ rtx *global_const_equiv_map; /* Integrate the procedure defined by FNDECL. Note that this function may wind up calling itself. Since the static variables are not reentrant, we do not assign them until after the possibility - or recursion is eliminated. + of recursion is eliminated. If IGNORE is nonzero, do not produce a value. Otherwise store the value in TARGET if it is nonzero and that is convenient. @@ -1557,6 +1557,7 @@ expand_inline_function (fndecl, parms, target, ignore, type, structure_value_add case CODE_LABEL: copy = emit_label (map->label_map[CODE_LABEL_NUMBER (insn)]); + LABEL_NAME (copy) = LABEL_NAME (insn); map->const_age++; break; diff --git a/gcc/reload.c b/gcc/reload.c index a1415c2268c..4bc377019c0 100644 --- a/gcc/reload.c +++ b/gcc/reload.c @@ -547,7 +547,7 @@ push_reload (in, out, inloc, outloc, class, /* If IN appears in OUT, we can't share any input-only reload for IN. */ if (in != 0 && out != 0 && GET_CODE (out) == MEM && (GET_CODE (in) == REG || GET_CODE (in) == MEM) - && reg_overlap_mentioned_p (in, XEXP (out, 0))) + && reg_overlap_mentioned_for_reload_p (in, XEXP (out, 0))) dont_share = 1; /* Narrow down the class of register wanted if that is @@ -1104,8 +1104,8 @@ combine_reloads () /* Args reversed because the first arg seems to be the one that we imagine being modified while the second is the one that might be affected. */ - || (! reg_overlap_mentioned_p (reload_out[output_reload], - reload_in[i]) + || (! reg_overlap_mentioned_for_reload_p (reload_out[output_reload], + reload_in[i]) /* However, if the input is a register that appears inside the output, then we also can't share. Imagine (set (mem (reg 69)) (plus (reg 69) ...)). @@ -1113,8 +1113,8 @@ combine_reloads () result to be stored in memory, then that result will clobber the address of the memory ref. */ && ! (GET_CODE (reload_in[i]) == REG - && reg_overlap_mentioned_p (reload_in[i], - reload_out[output_reload]))))) + && reg_overlap_mentioned_for_reload_p (reload_in[i], + reload_out[output_reload]))))) { int j; @@ -1162,8 +1162,8 @@ combine_reloads () for (note = REG_NOTES (this_insn); note; note = XEXP (note, 1)) if (REG_NOTE_KIND (note) == REG_DEAD && GET_CODE (XEXP (note, 0)) == REG - && ! reg_overlap_mentioned_p (XEXP (note, 0), - reload_out[output_reload]) + && ! reg_overlap_mentioned_for_reload_p (XEXP (note, 0), + reload_out[output_reload]) && REGNO (XEXP (note, 0)) < FIRST_PSEUDO_REGISTER && HARD_REGNO_MODE_OK (REGNO (XEXP (note, 0)), reload_outmode[output_reload]) && TEST_HARD_REG_BIT (reg_class_contents[(int) reload_reg_class[output_reload]], @@ -4343,6 +4343,70 @@ refers_to_regno_for_reload_p (regno, endregno, x, loc) } return 0; } + +/* Nonzero if modifying X will affect IN. If X is a register or a SUBREG, + we check if any register number in X conflicts with the relevant register + numbers. If X is a constant, return 0. If X is a MEM, return 1 iff IN + contains a MEM (we don't bother checking for memory addresses that can't + conflict because we expect this to be a rare case. + + This function is similar to reg_overlap_mention_p in rtlanal.c except + that we look at equivalences for pseudos that didn't get hard registers. */ + +int +reg_overlap_mentioned_for_reload_p (x, in) + rtx x, in; +{ + int regno, endregno; + + if (GET_CODE (x) == SUBREG) + { + regno = REGNO (SUBREG_REG (x)); + if (regno < FIRST_PSEUDO_REGISTER) + regno += SUBREG_WORD (x); + } + 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; + } + 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; + } + else if (GET_CODE (x) == SCRATCH || GET_CODE (x) == PC + || GET_CODE (x) == CC0) + return reg_mentioned_p (x, in); + else + abort (); + + endregno = regno + (regno < FIRST_PSEUDO_REGISTER + ? HARD_REGNO_NREGS (regno, GET_MODE (x)) : 1); + + return refers_to_regno_for_reload_p (regno, endregno, in, 0); +} #if 0 @@ -4584,7 +4648,8 @@ find_equiv_reg (goal, insn, class, other, reload_reg_p, goalreg, mode) /* If we propose to get the value from the stack pointer or if GOAL is a MEM based on the stack pointer, we need a stable SP. */ if (valueno == STACK_POINTER_REGNUM - || (goal_mem && reg_overlap_mentioned_p (stack_pointer_rtx, goal))) + || (goal_mem && reg_overlap_mentioned_for_reload_p (stack_pointer_rtx, + goal))) need_stable_sp = 1; /* Reject VALUE if the copy-insn moved the wrong sort of datum. */ @@ -4595,9 +4660,10 @@ find_equiv_reg (goal, insn, class, other, reload_reg_p, goalreg, mode) and is also a register that appears in the address of GOAL. */ if (goal_mem && value == SET_DEST (PATTERN (where)) - && refers_to_regno_p (valueno, - valueno + HARD_REGNO_NREGS (valueno, mode), - goal, 0)) + && refers_to_regno_for_reload_p (valueno, + (valueno + + HARD_REGNO_NREGS (valueno, mode)), + goal, 0)) return 0; /* Reject registers that overlap GOAL. */ @@ -4710,7 +4776,7 @@ find_equiv_reg (goal, insn, class, other, reload_reg_p, goalreg, mode) && xregno + xnregs > valueno) return 0; if (goal_mem_addr_varies - && reg_overlap_mentioned_p (dest, goal)) + && reg_overlap_mentioned_for_reload_p (dest, goal)) return 0; } else if (goal_mem && GET_CODE (dest) == MEM @@ -4748,7 +4814,8 @@ find_equiv_reg (goal, insn, class, other, reload_reg_p, goalreg, mode) && xregno + xnregs > valueno) return 0; if (goal_mem_addr_varies - && reg_overlap_mentioned_p (dest, goal)) + && reg_overlap_mentioned_for_reload_p (dest, + goal)) return 0; } else if (goal_mem && GET_CODE (dest) == MEM @@ -4779,7 +4846,8 @@ find_equiv_reg (goal, insn, class, other, reload_reg_p, goalreg, mode) if (incno < valueno + valuenregs && incno >= valueno) return 0; if (goal_mem_addr_varies - && reg_overlap_mentioned_p (XEXP (link, 0), goal)) + && reg_overlap_mentioned_for_reload_p (XEXP (link, 0), + goal)) return 0; } } diff --git a/gcc/reload1.c b/gcc/reload1.c index 8a719d58def..127b22dcdbc 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -4272,7 +4272,8 @@ choose_reload_regs (insn, avoid_return_reg) if (equiv != 0) for (i = 0; i < n_earlyclobbers; i++) - if (reg_overlap_mentioned_p (equiv, reload_earlyclobbers[i])) + if (reg_overlap_mentioned_for_reload_p (equiv, + reload_earlyclobbers[i])) { reload_override_in[r] = equiv; equiv = 0; @@ -4600,7 +4601,8 @@ emit_reload_insns (insn) int k; for (k = 0; k < n_reloads; k++) if (reload_reg_rtx[k] != 0 && k != j - && reg_overlap_mentioned_p (reload_reg_rtx[k], oldequiv)) + && reg_overlap_mentioned_for_reload_p (reload_reg_rtx[k], + oldequiv)) { oldequiv = 0; break; @@ -4879,8 +4881,8 @@ emit_reload_insns (insn) prev != PREV_INSN (this_reload_insn); prev = PREV_INSN (prev)) if (GET_RTX_CLASS (GET_CODE (prev) == 'i') - && reg_overlap_mentioned_p (second_reload_reg, - PATTERN (prev))) + && reg_overlap_mentioned_for_reload_p (second_reload_reg, + PATTERN (prev))) { REG_NOTES (prev) = gen_rtx (EXPR_LIST, REG_DEAD, second_reload_reg, @@ -5008,8 +5010,8 @@ emit_reload_insns (insn) for (prev1 = this_reload_insn; prev1; prev1 = PREV_INSN (prev1)) if (GET_RTX_CLASS (GET_CODE (prev1) == 'i') - && reg_overlap_mentioned_p (oldequiv_reg, - PATTERN (prev1))) + && reg_overlap_mentioned_for_reload_p (oldequiv_reg, + PATTERN (prev1))) { REG_NOTES (prev1) = gen_rtx (EXPR_LIST, REG_DEAD, oldequiv_reg, @@ -5190,7 +5192,8 @@ emit_reload_insns (insn) for (p = PREV_INSN (first_output_reload_insn); p != prev_insn; p = PREV_INSN (p)) if (GET_RTX_CLASS (GET_CODE (p)) == 'i' - && reg_overlap_mentioned_p (reloadreg, PATTERN (p))) + && reg_overlap_mentioned_for_reload_p (reloadreg, + PATTERN (p))) REG_NOTES (p) = gen_rtx (EXPR_LIST, REG_DEAD, reloadreg, REG_NOTES (p)); @@ -5200,7 +5203,8 @@ emit_reload_insns (insn) for (p = PREV_INSN (first_output_reload_insn); p != prev_insn; p = PREV_INSN (p)) if (GET_RTX_CLASS (GET_CODE (p)) == 'i' - && reg_overlap_mentioned_p (second_reloadreg, PATTERN (p))) + && reg_overlap_mentioned_for_reload_p (second_reloadreg, + PATTERN (p))) REG_NOTES (p) = gen_rtx (EXPR_LIST, REG_DEAD, second_reloadreg, REG_NOTES (p)); #endif @@ -5253,8 +5257,10 @@ emit_reload_insns (insn) if (REG_NOTE_KIND (reg_notes) == REG_DEAD && GET_CODE (XEXP (reg_notes, 0)) == REG && ((GET_CODE (dest) != REG - && reg_overlap_mentioned_p (XEXP (reg_notes, 0), dest)) - || reg_overlap_mentioned_p (XEXP (reg_notes, 0), source))) + && reg_overlap_mentioned_for_reload_p (XEXP (reg_notes, 0), + dest)) + || reg_overlap_mentioned_for_reload_p (XEXP (reg_notes, 0), + source))) { *prev_reg_note = next_reg_notes; XEXP (reg_notes, 1) = REG_NOTES (insn1); diff --git a/gcc/tree.c b/gcc/tree.c index 2b914a66d73..5207ba1da02 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -3104,22 +3104,22 @@ int_fits_type_p (c, type) && !INT_CST_LT (c, TYPE_MIN_VALUE (type))); } -/* Return the innermost context enclosing FNDECL that is +/* Return the innermost context enclosing DECL that is a FUNCTION_DECL, or zero if none. */ tree -decl_function_context (fndecl) - tree fndecl; +decl_function_context (decl) + tree decl; { tree context; - if (TREE_CODE (fndecl) == ERROR_MARK) + if (TREE_CODE (decl) == ERROR_MARK) return 0; - if (TREE_CODE (fndecl) == SAVE_EXPR) - context = SAVE_EXPR_CONTEXT (fndecl); + if (TREE_CODE (decl) == SAVE_EXPR) + context = SAVE_EXPR_CONTEXT (decl); else - context = DECL_CONTEXT (fndecl); + context = DECL_CONTEXT (decl); while (context && TREE_CODE (context) != FUNCTION_DECL) { @@ -3138,15 +3138,15 @@ decl_function_context (fndecl) return context; } -/* Return the innermost context enclosing FNDECL that is +/* Return the innermost context enclosing DECL that is a RECORD_TYPE or UNION_TYPE, or zero if none. TYPE_DECLs and FUNCTION_DECLs are transparent to this function. */ tree -decl_type_context (fndecl) - tree fndecl; +decl_type_context (decl) + tree decl; { - tree context = DECL_CONTEXT (fndecl); + tree context = DECL_CONTEXT (decl); while (context) { -- 2.30.2