This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
current_output_insn
- To: gcc-patches at gcc dot gnu dot org
- Subject: current_output_insn
- From: Richard Henderson <rth at cygnus dot com>
- Date: Mon, 29 May 2000 15:05:37 -0700
I think the way I implemented branch prediction for ia64 is
bordering on criminally gross. And as I found myself about
to do the exact same thing for i960, I thought I should
remedy the situation.
There is a new variable current_output_insn that holds the
insn we're currently outputting. Thus one can use simple
tags like %+, and have print_operand examine the notes on
the instruction to figure out what to print.
r~
* final.c (current_output_insn): New.
(final_scan_insn): Set it.
* output.h: Declare it.
Index: final.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/final.c,v
retrieving revision 1.132
diff -c -p -d -r1.132 final.c
*** final.c 2000/05/25 15:21:50 1.132
--- final.c 2000/05/29 21:48:53
*************** Boston, MA 02111-1307, USA. */
*** 140,146 ****
#endif
/* Last insn processed by final_scan_insn. */
! static rtx debug_insn = 0;
/* Line number of last NOTE. */
static int last_linenum;
--- 140,147 ----
#endif
/* Last insn processed by final_scan_insn. */
! static rtx debug_insn;
! rtx current_output_insn;
/* Line number of last NOTE. */
static int last_linenum;
*************** final_scan_insn (insn, file, optimize, p
*** 2925,2931 ****
NOTICE_UPDATE_CC (body, insn);
#endif
! debug_insn = insn;
#if defined (DWARF2_UNWIND_INFO)
/* If we push arguments, we want to know where the calls are. */
--- 2926,2932 ----
NOTICE_UPDATE_CC (body, insn);
#endif
! current_output_insn = debug_insn = insn;
#if defined (DWARF2_UNWIND_INFO)
/* If we push arguments, we want to know where the calls are. */
*************** final_scan_insn (insn, file, optimize, p
*** 3007,3013 ****
INSN_DELETED_P (insn) = 1;
#endif
! debug_insn = 0;
}
}
return NEXT_INSN (insn);
--- 3008,3014 ----
INSN_DELETED_P (insn) = 1;
#endif
! current_output_insn = debug_insn = 0;
}
}
return NEXT_INSN (insn);
Index: output.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/output.h,v
retrieving revision 1.50
diff -c -p -d -r1.50 output.h
*** output.h 2000/05/25 15:21:50 1.50
--- output.h 2000/05/29 21:48:53
*************** extern FILE *rtl_dump_file;
*** 444,451 ****
#endif
/* Nonnull if the insn currently being emitted was a COND_EXEC pattern. */
-
extern struct rtx_def *current_insn_predicate;
/* Decide whether DECL needs to be in a writable section. RELOC is the same
as for SELECT_SECTION. */
--- 444,453 ----
#endif
/* Nonnull if the insn currently being emitted was a COND_EXEC pattern. */
extern struct rtx_def *current_insn_predicate;
+
+ /* Last insn processed by final_scan_insn. */
+ extern struct rtx_def *current_output_insn;
/* Decide whether DECL needs to be in a writable section. RELOC is the same
as for SELECT_SECTION. */