aboutsummaryrefslogtreecommitdiff
path: root/gcc/final.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@cygnus.com>1999-09-13 21:19:34 -0700
committerRichard Henderson <rth@gcc.gnu.org>1999-09-13 21:19:34 -0700
commit4bbf910eefafa77900eb9234feac7dce5451e18b (patch)
treeddfa019fe74f8976a92fcdd7a45d5f6e82b77a46 /gcc/final.c
parentc452dcde0ad257958078a4f0561f5bbd9d8763fa (diff)
downloadgcc-4bbf910eefafa77900eb9234feac7dce5451e18b.zip
gcc-4bbf910eefafa77900eb9234feac7dce5451e18b.tar.gz
gcc-4bbf910eefafa77900eb9234feac7dce5451e18b.tar.bz2
recog.h (INSN_OUTPUT_FORMAT_*): New.
* recog.h (INSN_OUTPUT_FORMAT_*): New. (struct insn_data): Merge `template' and `outfun' into `output'. Add `output_format'. * genoutput.c (INSN_OUTPUT_FORMAT_*): New. (struct data): Remove `outfun'; add `output_format'. (name_for_index): Remove declaration. (output_insn_data): Handle output formats. (process_template): Emit the bare array for @. (gen_expand, gen_split): Set output_format to NONE. * output.h (get_insn_template): Declare. * final.c (get_insn_template): New. (final_scan_insn): Use it. * toplev.c (compile_file): Likewise. * c4x/c4x.c (c4x_process_after_reload): Likewise. * i860/i860.c (output_delayed_branch): Likewise. (output_delay_insn): Likewise. From-SVN: r29389
Diffstat (limited to 'gcc/final.c')
-rw-r--r--gcc/final.c46
1 files changed, 30 insertions, 16 deletions
diff --git a/gcc/final.c b/gcc/final.c
index e81895b..7046344 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -2034,6 +2034,27 @@ final (first, file, optimize, prescan)
free_insn_eh_region ();
}
+const char *
+get_insn_template (code, insn)
+ int code;
+ rtx insn;
+{
+ const void *output = insn_data[code].output;
+ switch (insn_data[code].output_format)
+ {
+ case INSN_OUTPUT_FORMAT_SINGLE:
+ return (const char *) output;
+ case INSN_OUTPUT_FORMAT_MULTI:
+ return ((const char * const *) output)[which_alternative];
+ case INSN_OUTPUT_FORMAT_FUNCTION:
+ if (insn == NULL)
+ abort ();
+ return (* (insn_output_fn) output) (recog_data.operand, insn);
+
+ default:
+ abort ();
+ }
+}
/* The final scan for one insn, INSN.
Args are same as in `final', except that INSN
is the insn being scanned.
@@ -2895,25 +2916,18 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
dwarf2out_frame_debug (insn);
#endif
- /* If the proper template needs to be chosen by some C code,
- run that code and get the real template. */
+ /* Find the proper template for this insn. */
+ template = get_insn_template (insn_code_number, insn);
- template = insn_data[insn_code_number].template;
+ /* If the C code returns 0, it means that it is a jump insn
+ which follows a deleted test insn, and that test insn
+ needs to be reinserted. */
if (template == 0)
{
- template = ((*insn_data[insn_code_number].outfun)
- (recog_data.operand, insn));
-
- /* If the C code returns 0, it means that it is a jump insn
- which follows a deleted test insn, and that test insn
- needs to be reinserted. */
- if (template == 0)
- {
- if (prev_nonnote_insn (insn) != last_ignored_compare)
- abort ();
- new_block = 0;
- return prev_nonnote_insn (insn);
- }
+ if (prev_nonnote_insn (insn) != last_ignored_compare)
+ abort ();
+ new_block = 0;
+ return prev_nonnote_insn (insn);
}
/* If the template is the string "#", it means that this insn must