From 9ef4c6ef3c6a37f382303c6fc4f9bea1b7e85e28 Mon Sep 17 00:00:00 2001 From: John Carr Date: Sun, 6 Sep 1998 05:52:01 +0000 Subject: [PATCH] final.c (final): If a label is reached only from a single jump... d * final.c (final): If a label is reached only from a single jump, call NOTICE_UPDATE_CC on the jump and its predecessor before emitting the insn after the label. * i386.h: Add AMD K6 support. Change TARGET_* macros to use table lookup. (INITIALIZE_TRAMPOLINE): Improve trampoline code. (ADJUST_COST): Change definition to call function in i386.c. (ISSUE_RATE): Define as 2 for anything newer than an 80486. * i386.c: Add AMD K6 support. Add constants for feature tests used by TARGET_* macros. (split_di): If before reload, call gen_lowpart and gen_highpart. (x86_adjust_cost): New function. (put_jump_code): New function. (print_operand): New codes 'D' and 'd'. * i386.md: New insn types. New insn attribute "memory". Redefine scheduling parameters to use new types and add AMD K6 support. Explicitly set type of most insns. (move insns): K6 prefers movl $0,reg to xorl reg,reg. Pentium Pro and K6 prefer movl $1,reg to incl reg. (adddi3, subdi3): Set cc_status. (DImode shift patterns): Change label counters from HOST_WIDE_INT to int; x86 can't have more than 2^31 DImode shifts per file. (setcc): Combine all setcc patterns. Allow writing memory. Combine all jump patterns using match_operator. (*bzero): Name pattern. Emit mutliple stos instructions when that is faster than rep stos. (xordi3, anddi3, iordi3): Simplify DImode logical patterns and add define_split. * ch/Make-lang.in: Comment ^L characters. Sun make doesn't like them. From-SVN: r22290 --- gcc/final.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/gcc/final.c b/gcc/final.c index 0938e221d5e..454ab6c71f5 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -1980,6 +1980,18 @@ final (first, file, optimize, prescan) max_uid = INSN_UID (insn); if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0) line_note_exists[NOTE_LINE_NUMBER (insn)] = 1; +#ifdef HAVE_cc0 + /* If CC tracking across branches is enabled, record the insn which + jumps to each branch only reached from one place. */ + if (GET_CODE (insn) == JUMP_INSN) + { + rtx lab = JUMP_LABEL (insn); + if (lab && LABEL_NUSES (lab) == 1) + { + LABEL_REFS (lab) = insn; + } + } +#endif } /* Initialize insn_eh_region table if eh is being used. */ @@ -2283,7 +2295,30 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) ASM_OUTPUT_ALIGN (file, align); #endif } +#ifdef HAVE_cc0 CC_STATUS_INIT; + /* If this label is reached from only one place, set the condition + codes from the instruction just before the branch. */ + if (LABEL_NUSES (insn) == 1) + { + rtx jump = LABEL_REFS (insn); + rtx barrier = prev_nonnote_insn (insn); + rtx prev; + /* If the LABEL_REFS field of this label has been set to point + at a branch, the predecessor of the branch is a regular + insn, and that branch is the only way to reach this label, + set the condition codes based on the branch and its + predecessor. */ + if (barrier && GET_CODE (barrier) == BARRIER + && jump && GET_CODE (jump) == JUMP_INSN + && (prev = prev_nonnote_insn (jump)) + && GET_CODE (prev) == INSN) + { + NOTICE_UPDATE_CC (PATTERN (prev), prev); + NOTICE_UPDATE_CC (PATTERN (jump), jump); + } + } +#endif if (prescan > 0) break; new_block = 1; -- 2.30.2