This is the patch series I spoke about at Cauldron in the talk "A proposal for typesafe RTL"; slides here: http://dmalcolm.fedorapeople.org/presentations/cauldron-2014/rtl
They can also be seen at: https://dmalcolm.fedorapeople.org/gcc/patch-backups/rtx-classes/v20/ The aim of the patch series is to improve the type-safety and readability of the backend by introducing subclasses of rtx (actually rtx_def) for *instructions*, and also for EXPR_LIST, INSN_LIST, SEQUENCE. That way we can document directly in the code the various places that manipulate insn chains vs other kinds of rtx node. An example of a bug detected using this approach: in mn10300.c there was dead code of the form: if (GET_CODE (insn) == PARALLEL) insn = XVECEXP (insn, 0, 0); where the test should really have been on "PATTERN (insn)", not "insn": if (GET_CODE (PATTERN (insn)) == PARALLEL) insn = XVECEXP (PATTERN (insn), 0, 0); [as discussed in https://gcc.gnu.org/ml/gcc/2014-07/msg00078.html] The class hierarchy looks like this (using indentation to show inheritance, and indicating the invariants): class rtx_def; class rtx_expr_list; /* GET_CODE (X) == EXPR_LIST */ class rtx_insn_list; /* GET_CODE (X) == INSN_LIST */ class rtx_sequence; /* GET_CODE (X) == SEQUENCE */ class rtx_insn; /* INSN_CHAIN_CODE_P (GET_CODE (X)) */ class rtx_real_insn; /* INSN_P (X) */ class rtx_debug_insn; /* DEBUG_INSN_P (X) */ class rtx_nonjump_insn; /* NONJUMP_INSN_P (X) */ class rtx_jump_insn; /* JUMP_P (X) */ class rtx_call_insn; /* CALL_P (X) */ class rtx_jump_table_data; /* JUMP_TABLE_DATA_P (X) */ class rtx_barrier; /* BARRIER_P (X) */ class rtx_code_label; /* LABEL_P (X) */ class rtx_note; /* NOTE_P (X) */ The patch series converts roughly 4300 places in the code from using rtx to the more concrete rtx_insn *, in such places as: * the core types within basic blocks * hundreds of function params, struct fields, etc. e.g. within register allocators, schedulers * "insn" and "curr_insn" within .md files (peephole, attributes, define_bypass guards) * insn_t in sel-sched-ir.h * Target hooks: updated params of 25 of them * Debug hooks: "label" and "var_location" etc The patch series also contains some cleanups using inline methods: * being able to get rid of this boilerplate everywhere that jump tables are handled: if (GET_CODE (PATTERN (table)) == ADDR_VEC) vec = XVEC (PATTERN (table), 0); else vec = XVEC (PATTERN (table), 1); in favor of a helper method (inlined): vec = table->get_labels (); * having a subclass for EXPR_LIST allows for replacing this kind of thing: for (x = forced_labels; x; x = XEXP (x, 1)) if (XEXP (x, 0)) set_label_offsets (XEXP (x, 0), NULL_RTX, 1); with the following, which captures that it's an EXPR_LIST, and makes it clearer that we're simply walking a singly-linked list: for (rtx_expr_list *x = forced_labels; x; x = x->next ()) if (x->element ()) set_label_offsets (x->element (), NULL_RTX, 1); There are some surface details to the patches: * class names. The subclass names correspond to the lower_case name from rtl.def, with an "rtx_" prefix. "rtx_insn" and "rtx_real_insn" don't correspond to concrete node kinds, and hence I had to invent the names. (In an earlier version of the patches these were "rtx_base_insn" and "rtx_insn" respectively, but the former occurred much more than the latter and so it seemed better to use the shorter spelling for the common case). * there's a NULL_RTX define in rtl.h. In an earlier version of the patch I added a NULL_INSN define, but in this version I simply use NULL, and I'm in two minds about whether a NULL_INSN is desirable (would we have a NULL_FOO for all of the subclasses?). I like having a strong distinction between arbitrary RTL nodes vs instructions, so maybe there's a case for NULL_INSN, but not for the subclasses? * I added an "rtx_real_insn" subclass for the INSN_P predicate, adding the idea of a PATTERN, a basic_block, and a location - but I hardly use this anywhere. That said, it seems to be a real concept in the code, so I added it. * "pointerness" of the types. "rtx" is a typedef to "rtx_def *" i.e. there's an implicit pointer. In the discussion about using C++ classes for gimple statements: https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01427.html Richi said: > To followup myself here, it's because 'tree' is a typedef to a pointer > and thus 'const tree' is different from 'const tree_node *'. > > Not sure why we re-introduced the 'mistake' of making 'tree' a pointer > when we introduced 'gimple'. If we were to make 'gimple' the class > type itself we can use gimple *, const gimple * and also const gimple & > (when a NULL pointer is not expected). So in the following patches the pointerness is explicit: the patches refer to: rtx_insn *insn; rather than just: rtx_insn insn; and so one can write: const rtx_insn *insn and the "constness" applies to the insn, not to the pointer. But we could go either way here: the class could be "rtx_insn_def", with "rtx_insn" a typedef to an "rtx_insn_def *" etc with: class rtx_def; class rtx_expr_list_def; /* GET_CODE (X) == EXPR_LIST */ class rtx_insn_list_def; /* GET_CODE (X) == INSN_LIST */ class rtx_sequence_def; /* GET_CODE (X) == SEQUENCE */ class rtx_insn_def; /* INSN_CHAIN_CODE_P (GET_CODE (X)) */ class rtx_real_insn_def; /* INSN_P (X) */ class rtx_debug_insn_def; /* DEBUG_INSN_P (X) */ class rtx_nonjump_insn_def; /* NONJUMP_INSN_P (X) */ class rtx_jump_insn_def; /* JUMP_P (X) */ class rtx_call_insn_def; /* CALL_P (X) */ class rtx_jump_table_data_def; /* JUMP_TABLE_DATA_P (X) */ class rtx_barrier_def; /* BARRIER_P (X) */ class rtx_code_label_def; /* LABEL_P (X) */ class rtx_note_def; /* NOTE_P (X) */ and a family of typedefs of pointers to the classes: typedef rtx_def *rtx; typedef rtx_expr_list_def *rtx_expr_list; typedef rtx_insn_list_def *rtx_insn_list; typedef rtx_sequence_def *rtx_sequence; typedef rtx_insn_def *rtx_insn; typedef rtx_real_insn_def *rtx_real_insn; typedef rtx_debug_insn_def *rtx_debug_insn; typedef rtx_nonjump_insn_def *rtx_nonjump_insn; typedef rtx_jump_insn_def *rtx_jump_insn; typedef rtx_call_insn_def *rtx_call_insn; typedef rtx_jump_table_data_def *rtx_jump_table_data; typedef rtx_barrier_def *rtx_barrier; typedef rtx_code_label_def *rtx_code_label; typedef rtx_note_def *rtx_note; * Should as_a <rtx_insn *> accept a NULL pointer? It's possible to make the is_a_helper cope with NULL, but this adds an extra conditional. I instead added an as_a_nullable<> cast, so that you can explicitly add a check against NULL before checking the code of the rtx node. But maybe it's cleaner to simply have is_a_helper<rtx_insn *> cope with NULL? Some deeper questions: * should rtx_insn eventually be a separate class from rtx, separating insn chain nodes from rtx nodes? I don't know if that's a worthwhile longterm goal, but this patch series gets us somewhere closer to being able to achieve that. (actually getting there would be a much more invasive set of patches). To keep this reviewable, and to try to mitigate bitrot, I've chopped it up into numerous relatively small patches. The aim is that at every patch, the code correctly builds on all supported configurations. That said, there's a complicated dependency graph of types in gcc's code, so to tame that, the patch series is divided into 6 phases: * phase 1 adds "scaffolding": in various places, strengthen the return types from internal APIs and macros so as to promise an rtx_insn * rather than a plain rtx. For example, the DEP_PRO/DEP_CON macros in sched-int.h which lookup fields within struct _dep become inline functions that return rtx_insn * (using checked casts). In this way, stronger type information can be used by subsequent patches whilst avoiding the chicken-and-egg issue since writes to the fields can still be arbitrary rtx nodes, according to the type system at least. * phase 2: an alphabetical tour of the backend: a series of patches, from alias.c through web.c, each patch touching one file, strengthening the types within it as much as we can at that point. The patches sometimes make use of the alphabetic ordering in order to use APIs that have already been strengthened to work on rtx_insn. * phase 3: similar to phase 2, but for the various config subdirectories. * phase 4: tears down the scaffolding, replacing checked casts as much as possible by strengthening core fields of core types. For example, we eventually reach the point in sched-int.h where the fields "pro" and "con" within struct _dep can become rtx_insn *, and hence DEP_PRO/DEP_CON can be converted back to plain macros, without needing the checked cast. * phase 5: all of the above was for instructions; this phase adds three subclasses for other node kinds. I experimented with subclasses for various node kinds; these three seemed most appropriate: EXPR_LIST, INSN_LIST, SEQUENCE. I kept these as a separate phase as Jeff asked me to separate them from the instruction patches, to avoid complicating things, but I think these three are also a worthwhile cleanup with relatively little complexity. * phase 6: (new since my Cauldron talk): this phase freely uses EXPR_LIST, INSN_LIST, SEQUENCE to do cleanups that were awkward without them. In particular, by the end of this phase, NEXT_INSN() and PREV_INSN() require rtx_insn * rather than plain rtx. Correctness =========== In theory, these patches should not affect the outwardly-visible behavior of the compiler, merely enable various kinds of errors to be more easily detected when the compiler is built, and to improve the readability of the code. The patches (and my control for testing) has been on top of r211061, which being from 2014-05-29 is now two months old, but hopefully is still reviewable; naturally I'll perform bootstrap and regression testing for each patch in turn before committing. I've successfully bootsrapped & regression-tested the end-result of the attached patches on: * x86_64 Linux (Fedora 20) * powerpc64-unknown-linux-gnu (Fedora 18; gcc110 in buildfarm) * s390x-ibm-linux-gnu (RHEL 7) I've also repeatedly bootstrapped this on x86_64 at many stages of assembling the patch series. There are 204 configurations in the list in contrib/config-list.mk, however 12 failed to work for a control build; so I patched my config-list.mk accordingly: # Which of the above are known to currently not work? KNOWN_BROKEN= # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55143 KNOWN_BROKEN += alpha64-dec-vms alpha-dec-vms # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55144 KNOWN_BROKEN += bfin-linux-uclibc cris-linux crisv32-linux # Discussion at: https://gcc.gnu.org/ml/gcc/2013-11/msg00574.html # but this doesn't seem to have been filed in BZ KNOWN_BROKEN += i686-interix3OPT-enable-obsolete # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47098 KNOWN_BROKEN += i686-openbsd3.0 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55143 KNOWN_BROKEN += ia64-hp-vms # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61287 KNOWN_BROKEN += nios2-elf nios2-linux-gnu # See e.g. https://www.mail-archive.com/gcc@gcc.gnu.org/msg70568.html # but this doesn't seem to have been filed in BZ KNOWN_BROKEN += vax-openbsd # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48904 KNOWN_BROKEN += x86_64-knetbsd-gnu LIST= $(filter-out $(KNOWN_BROKEN),$(FULL_LIST)) With that, I've successfully built the patches on 193 configurations, both the end state of the patch series, and at many places along the way. I've manually verified the build for nios2-elf *without* ada, to work around PR61287. Hence I believe that this should continue to build on every supported target. Performance =========== I tested the performance with --enable-checking=release using two large files (kdecore.cc, bigcode.c), comparing a control build to a patched build. There were no significant differences in compilation time: Compilation of kdecore.cc at -O3 with -g for x86_64-unknown-linux-gnu: usr control: [47.58, 47.99, 47.6, 47.8, 47.74, 47.76, 47.81, 47.9, 47.91, 47.99, 48.14, 47.77, 47.65, 47.86, 47.96, 47.74, 48.09, 47.97, 47.86, 47.79, 48.17, 47.76, 47.88, 47.85, 48.24, 48.01, 47.98, 47.91, 48.12, 47.7, 47.75, 47.69, 47.83, 47.82, 47.76, 48.05, 47.85, 48.05, 48.25, 47.95] experiment: [47.65, 47.68, 47.67, 47.73, 47.91, 48.27, 47.83, 48.0, 47.95, 47.75, 47.72, 47.81, 47.98, 48.36, 47.67, 47.72, 47.81, 47.83, 47.89, 47.67, 47.72, 47.74, 47.79, 47.77, 47.67, 48.78, 47.88, 47.76, 47.96, 47.71, 47.87, 47.77, 47.82, 47.74, 47.77, 48.28, 47.78, 47.62, 47.67, 47.72] Min: 47.580000 -> 47.620000: 1.00x slower Avg: 47.888250 -> 47.843000: 1.00x faster Not significant Stddev: 0.16618 -> 0.22717: 1.3670x larger Timeline: http://goo.gl/ikKUwD Compilation of kdecore.cc at -O3 with -g for x86_64-unknown-linux-gnu: sys control: [6.29, 6.04, 6.31, 6.15, 6.24, 6.19, 6.2, 6.18, 6.0, 6.15, 6.12, 6.34, 6.26, 6.09, 6.24, 6.16, 6.0, 6.25, 6.19, 6.2, 6.23, 6.24, 6.19, 6.22, 6.22, 6.26, 6.18, 6.11, 6.16, 6.24, 6.19, 6.23, 6.33, 6.14, 6.21, 6.2, 6.23, 6.14, 6.23, 6.13] experiment: [6.3, 6.19, 6.21, 6.21, 6.21, 6.25, 6.19, 6.1, 6.13, 6.12, 6.19, 6.09, 6.31, 6.23, 6.2, 6.22, 6.21, 6.22, 6.09, 6.15, 6.14, 6.26, 6.09, 6.11, 6.3, 6.19, 6.14, 6.14, 6.14, 6.17, 6.12, 6.11, 6.24, 6.26, 6.21, 6.17, 6.16, 6.18, 6.19, 6.15] Min: 6.000000 -> 6.090000: 1.01x slower Avg: 6.192000 -> 6.182250: 1.00x faster Not significant Stddev: 0.07653 -> 0.05925: 1.2918x smaller Timeline: http://goo.gl/3r9lQJ Compilation of kdecore.cc at -O3 with -g for x86_64-unknown-linux-gnu: wall control: [54.16, 54.21, 54.1, 54.12, 54.16, 54.13, 54.19, 54.26, 54.09, 54.32, 54.44, 54.29, 54.09, 54.13, 54.38, 54.08, 54.27, 54.41, 54.22, 54.16, 54.58, 54.17, 54.24, 54.25, 54.64, 54.44, 54.34, 54.2, 54.46, 54.13, 54.12, 54.1, 54.35, 54.14, 54.15, 54.43, 54.26, 54.37, 54.66, 54.26] experiment: [54.21, 54.24, 54.09, 54.3, 54.46, 54.86, 54.34, 54.39, 54.4, 54.17, 54.16, 54.16, 54.48, 54.82, 54.11, 54.13, 54.25, 54.32, 54.24, 54.08, 54.11, 54.19, 54.07, 54.06, 54.16, 55.23, 54.21, 54.1, 54.34, 54.13, 54.18, 54.11, 54.25, 54.23, 54.17, 54.64, 54.15, 53.99, 54.05, 54.06] Min: 54.080000 -> 53.990000: 1.00x faster Avg: 54.262500 -> 54.266000: 1.00x slower Not significant Stddev: 0.15337 -> 0.24797: 1.6169x larger Timeline: http://goo.gl/Gbk0RB Compilation of kdecore.cc at -O3 with -g for x86_64-unknown-linux-gnu: ggc control: [1264522.0, 1264525.0, 1264523.0, 1264524.0, 1264522.0, 1264520.0, 1264524.0, 1264517.0, 1264523.0, 1264529.0, 1264518.0, 1264522.0, 1264531.0, 1264519.0, 1264524.0, 1264518.0, 1264533.0, 1264522.0, 1264524.0, 1264529.0, 1264515.0, 1264525.0, 1264526.0, 1264523.0, 1264523.0, 1264531.0, 1264526.0, 1264524.0, 1264518.0, 1264521.0, 1264522.0, 1264520.0, 1264523.0, 1264520.0, 1264525.0, 1264532.0, 1264524.0, 1264524.0, 1264519.0, 1264525.0] experiment: [1264530.0, 1264523.0, 1264523.0, 1264524.0, 1264531.0, 1264523.0, 1264528.0, 1264519.0, 1264516.0, 1264524.0, 1264522.0, 1264524.0, 1264522.0, 1264525.0, 1264520.0, 1264522.0, 1264518.0, 1264518.0, 1264519.0, 1264523.0, 1264522.0, 1264517.0, 1264528.0, 1264525.0, 1264519.0, 1264522.0, 1264522.0, 1264519.0, 1264519.0, 1264523.0, 1264532.0, 1264526.0, 1264526.0, 1264520.0, 1264525.0, 1264530.0, 1264529.0, 1264525.0, 1264527.0, 1264523.0] Mem max: 1264533.000 -> 1264532.000: 1.0000x smaller Usage over time: http://goo.gl/OPqL9P Compilation of big-code.c at -O3 with -g for x86_64-unknown-linux-gnu: usr control: [36.16, 36.13, 36.13, 36.33, 36.16, 36.12, 36.07, 36.19, 36.11, 36.58, 36.14, 36.53, 36.19, 36.17, 36.16, 36.19, 36.22, 36.34, 36.14, 36.13, 36.12, 36.38, 36.17, 36.28, 36.38, 36.15, 36.13, 36.16, 36.23, 36.17, 36.16, 36.07, 36.24, 36.17, 36.11, 36.14, 36.14, 36.12, 36.15, 36.21] experiment: [36.15, 36.09, 36.16, 36.23, 36.14, 36.11, 36.16, 36.16, 36.15, 36.14, 36.2, 36.2, 36.22, 36.15, 36.14, 36.23, 36.23, 36.15, 36.19, 36.09, 36.12, 36.26, 36.18, 36.14, 36.23, 36.18, 36.19, 36.13, 36.42, 36.15, 36.16, 36.18, 36.19, 36.12, 36.16, 36.3, 36.1, 36.13, 36.19, 36.3] Min: 36.070000 -> 36.090000: 1.00x slower Avg: 36.196750 -> 36.178000: 1.00x faster Not significant Stddev: 0.11136 -> 0.06366: 1.7494x smaller Timeline: http://goo.gl/TbdnnN Compilation of big-code.c at -O3 with -g for x86_64-unknown-linux-gnu: sys control: [1.31, 1.3, 1.33, 1.42, 1.35, 1.34, 1.34, 1.32, 1.32, 1.27, 1.32, 1.29, 1.3, 1.3, 1.29, 1.33, 1.3, 1.3, 1.28, 1.29, 1.3, 1.39, 1.31, 1.36, 1.32, 1.29, 1.33, 1.33, 1.29, 1.29, 1.31, 1.36, 1.25, 1.29, 1.33, 1.33, 1.38, 1.28, 1.39, 1.27] experiment: [1.24, 1.31, 1.27, 1.34, 1.39, 1.35, 1.27, 1.26, 1.28, 1.38, 1.32, 1.29, 1.25, 1.26, 1.28, 1.27, 1.3, 1.26, 1.29, 1.31, 1.35, 1.27, 1.34, 1.28, 1.22, 1.28, 1.43, 1.33, 1.28, 1.29, 1.26, 1.33, 1.28, 1.34, 1.32, 1.26, 1.41, 1.35, 1.3, 1.34] Min: 1.250000 -> 1.220000: 1.02x faster Avg: 1.317500 -> 1.304500: 1.01x faster Not significant Stddev: 0.03607 -> 0.04701: 1.3032x larger Timeline: http://goo.gl/ocXV2i Compilation of big-code.c at -O3 with -g for x86_64-unknown-linux-gnu: wall control: [37.59, 37.54, 37.57, 37.86, 37.62, 37.57, 37.52, 37.63, 37.54, 37.96, 37.57, 37.93, 37.61, 37.58, 37.56, 37.63, 37.63, 37.75, 37.54, 37.54, 37.53, 37.89, 37.59, 37.75, 37.8, 37.55, 37.58, 37.6, 37.63, 37.57, 37.58, 37.54, 37.59, 37.57, 37.55, 37.58, 37.62, 37.51, 37.65, 37.59] experiment: [37.5, 37.5, 37.53, 37.68, 37.64, 37.57, 37.54, 37.53, 37.54, 37.62, 37.63, 37.6, 37.58, 37.52, 37.53, 37.6, 37.65, 37.52, 37.59, 37.51, 37.58, 37.64, 37.63, 37.53, 37.56, 37.57, 37.73, 37.57, 37.82, 37.55, 37.52, 37.62, 37.59, 37.58, 37.6, 37.67, 37.62, 37.6, 37.6, 37.75] Min: 37.510000 -> 37.500000: 1.00x faster Avg: 37.625250 -> 37.592750: 1.00x faster Not significant Stddev: 0.11404 -> 0.06943: 1.6425x smaller Timeline: http://goo.gl/WT5UGE Compilation of big-code.c at -O3 with -g for x86_64-unknown-linux-gnu: ggc control: [657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0] experiment: [657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0, 657274.0] Mem max: 657274.000 -> 657274.000: no change Usage over time: http://goo.gl/ogWEOG As for the performance of a regular build i.e. with as_a<> checks *enabled*; looking at the wallclock time taken for a bootstrap and regression test, for my s390 builds (with -j3) I saw: s390 control: "make" time: 68 mins "make check" time: 122 mins total time: 190 mins s390 experiment: "make" time: 70 mins "make check" time: 126 mins total time: 196 mins showing a 3% increase, presumably due to the as_a and as_a_nullable checks. i.e. a release build shows no change in performance; a debug build shows a 3% increase in time taken to bootstrap and regression test. I believe the debug build could be sped up with further patches to eliminate the checked casts. Summary ======= OK for trunk? Dave Patch list and overall diffstat follow: David Malcolm (236): Convert lab_rtx_for_bb from pointer_map_t to pointer_map<rtx> JUMP_LABEL is not always a LABEL config/mn10300: Fix missing PATTERN in PARALLEL handling PHASE 1: Initial "scaffolding" commits Introduce as_a_nullable Introduce rtx_insn subclass of rtx_def New function: for_each_rtx_in_insn Split BB_HEAD et al into BB_HEAD/SET_BB_HEAD variants Replace BB_HEAD et al macros with functions Split NEXT_INSN/PREV_INSN into lvalue and rvalue forms Replace PREV_INSN et al macros with functions Convert DF_REF_INSN to a function for now DEP_PRO/DEP_CON scaffolding VINSN_INSN_RTX scaffolding BB_NOTE_LIST scaffolding BND_TO scaffolding Add subclasses for the various kinds of instruction Strengthen return types of various {next|prev}_*insn from rtx to rtx_insn * Strengthen return type of gen_label_rtx Return rtx_insn from get_insns/get_last_insn entry_of_function returns an insn Make tablejump_p accept a rtx_jump_table_data ** delete_trivially_dead_insns works on insns last_call_insn returns an rtx_call_insn * make_insn_raw returns an rtx_insn bb_note returns a rtx_note * asan_emit_stack_protection returns an insn cfgexpand.c: Use rtx_insn rtl_data.x_parm_birth_insn is an insn Convert various rtx to rtx_note * emit_jump_table_data returns an rtx_jump_table_data * emit_* functions return rtx_insn emit_move et al return rtx_insn * next_cc0_user and prev_cc0_setter scaffolding Return types of unlink_insn_chain and duplicate_insn_chain get_last_bb_insn returns an rtx_insn sel_bb_{head|end} return rtx_insn find_first_parameter_load returns an rtx_insn create_insn_rtx_from_pattern and create_copy_of_insn_rtx return rtx_insn Use rtx_insn internally within generated functions Debug hooks: use rtx_insn and rtx_code_label try_split returns an rtx_insn peephole returns an rtx_insn Pass "insn" as an rtx_insn within generated get_attr_ fns in insn-attrtab.c define_bypass guard functions take a pair of rtx_insn delete_related_insns returns an rtx_insn PHASE 2: Per-file commits in main source directory alias.c: Use rtx_insn asan.c: strengthen some rtx locals auto-inc-dec.c: strengthen various rtx to rtx_insn * bb-reorder.c: Use rtx_insn bt-load.c: Use rtx_insn builtins.c: strengthen various rtx to rtx_insn * and other subclasses calls.c: Use rtx_insn caller-save.c: Use rtx_insn cfgbuild.c: Use rtx_insn cfgcleanup.c: Use rtx_insn (also touches basic-block.h and ifcvt.c) cfgloop.c: Use rtx_insn cfgloopanal.c: Use rtx_insn cfgrtl.c: Use rtx subclasses combine.c: Use rtx_insn combine-stack-adj.c: Use rtx_insn compare-elim.c: Use rtx_insn cprop.c: Use rtx_insn cse.c: Use rtx_insn dce.c: Use rtx subclasses ddg: Use rtx_insn df-*.c: Use rtx_insn dwarf2cfi.c: Use rtx_insn dwarf2out.c: Use rtx_insn except.*: Use rtx_insn (also touches function.h) explow.c: Use rtx_insn and rtx_code_label expmed.c: Use rtx_insn and rtx_code_label expr.c: Use rtx_insn and rtx_code_label final.c: Use rtx_insn (also touches output.c and config/arc/arc.c) function.c: Use rtx_insn fwprop.c: Use rtx_insn genpeep.c: peephole requires an rtx_insn gcse.c: Use rtx_insn haifa-sched.c: Use rtx_insn hw-doloop: Use rtx_insn (touches config/bfin/bfin.c) ifcvt.c: Use rtx_insn init-regs.c: rtx_insn internal-fn.c: Use rtx_insn and rtx_code_label ira: Use rtx_insn in various places jump.c: Use rtx_insn in a few places (also touches rtl.h and cfgexpand.c) loop-doloop.c: Use rtx_insn in a few places loop-invariant.c: Use rtx_insn in various places loop-iv.c: Use rtx_insn (also touches cfgloop.h and loop-unroll.c) loop-unroll.c: Use rtx_insn (also touches basic-block.h) lower-subreg.c: Use rtx_insn lra: use rtx_insn mode-switching.c: Use rtx_insn get_ebb_head_tail works with rtx_insn modulo-sched.c: Use rtx_insn in various places optabs.c: Use rtx_insn and rtx_code_label postreload-gcse.c: Use rtx_insn in various places postreload.c: Use rtx_insn (also touches rtl.h and cprop.c) predict.*: Use rtx_insn (also touches function.c and config/cris/cris.c) print-rtl.c: Use rtx_insn for various debug_ functions (also touches config/rs6000/rs6000.c) recog.c: Use rtx_insn ree.c: Use rtx_insn reg-stack.c: Use rtx_insn regcprop.c: Use rtx_insn reginfo.c: Use rtx_insn (also touches rtl.h) regrename.c: Use rtx_insn regstat.c: Use rtx_insn reload: Use rtx_insn (also touches caller-save.c and config/arc/arc) resource.c: Use rtx_insn rtlanal.c: Use rtx_insn sched-deps.c: Use rtx_insn sched-ebb.c: Use rtx_insn (requires touching sched-int.h and config/c6x/c6x.c) sched-rgn.c: Use rtx_insn in a couple of places sel-sched.c: Use rtx_insn sel-sched-ir.c: Use rtx_insn shrink-wrap.*: Use rtx_insn (touches config/i386/i386.c) stack-ptr-mod.c: Use rtx_insn stmt.c: Use rtx_insn store-motion.c: Use rtx_insn valtrack.c: Use rtx_insn varasm.c: Use rtx_insn var-tracking.c: Use rtx_insn web.c: Use rtx_insn PHASE 3: Per-config subdir commits config/aarch64/aarch64.c: Use rtx_insn config/alpha/alpha.c: Use rtx_insn config/arc: Use rtx_insn config/arm: Use rtx_insn and rtx_code_label config/avr: Use rtx_insn config/bfin: Use rtx_insn config/c6x: Use rtx_insn config/epiphany: Use rtx_insn config/h8300: Use rtx_insn config/i386/i386.c: Use rtx_code_label config/i386/i386: Use rtx_insn config/ia64/ia64.c: Use rtx_insn config/iq2000: Use rtx_insn config/m68k: Use rtx_insn config/mep: Use rtx_insn and rtx_code_label config/microblaze/microblaze.c: Use rtx_insn and rtx_code_label config/mips: Use rtx_insn and rtx_code_label config/nds32: Use rtx_insn config/pa: Use rtx_insn config/picochip: Use rtx_insn config/rs6000: Use rtx_insn config/rx: Use rtx_insn config/s390: Use rtx_insn and rtx_code_label config/score/score.c: Use rtx_insn config/sh: Use rtx_insn and rtx_code_label config/sparc: Use rtx_insn config/spu/spu.c: Use rtx_insn config/tilegx: Use rtx_insn config/tilepro: Use rtx_insn config/v850: Use rtx_insn config/xtensa: Use rtx_insn and rtx_code_label PHASE 4: Removal of scaffolding struct eh_landing_pad_d: field "landing_pad" is an rtx_code_label Remove BB_FOOTER scaffolding Convert edge_def.insns.r to rtx_insn * function.c and shrink-wrap.*: more rtx_insn reorder_insns requires rtx_insn * delete_insn_and_edges takes an rtx_insn * unshare_all_rtl_again takes an rtx_insn * Add rtx_jump_table_data::get_labels method struct haifa_sched_info: prev_head and next_tail shorten_branches takes an rtx_insn final accepts an rtx_insn final_start_function takes an rtx_insn Strengthen haifa_sched_info callbacks and 3 scheduler hooks Eliminate BB_NOTE_LIST scaffolding du_chain.insn is an rtx_insn sel-sched-ir.h: Make ilist_t work on insn_t rather than rtx insn_t becomes an rtx_insn * Remove VINSN_INSN_RTX scaffolding Remove DEP_PRO/CON scaffolding cselib and incdec Tighten up params of create_basic_block_structure Remove BB_HEAD, BB_END, BB_HEADER scaffolding cselib_record_sets_hook takes an rtx_insn Params of add_insn and unlink_insn_chain Strengthen fields in struct sequence_stack and struct emit_status get_last_insn_anywhere returns an rtx_insn Strengthen various insn emission functions Use rtx_insn in more places in sel-sched.c Use rtx_insn in more places in fwprop.c Various condition-handling calls duplicate_insn_chain accepts rtx_insn Use rtx_insn in more places in haifa-sched.c Various scheduling strengthenings Remove insn_addresses_new from 'various scheduling strengthenings' Remove DF_REF_INSN scaffolding Tweak to dse.c cselib (also touches sched-deps.c) Use rtx_insn for various target.def hooks Convert PATTERN from a macro to a pair of inline functions Convert various INSN accessors in rtl.h to inline functions Tweak to ira-lives.c PHASE 5: Additional rtx subclasses Introduce rtx_insn_list subclass of rtx_def Use rtx_insn_list in various places Introduce rtx_sequence subclass of rtx_def dwarf2cfi.c: Use rtx_sequence except.c: Use rtx_sequence final.c: Use rtx_sequence function.c: Use rtx_sequence jump.c: Use rtx_sequence reorg.c: Use rtx_sequence resource.c: Use rtx_sequence sched-vis.c: Use rtx_sequence varasm.c: Use rtx_sequence Introduce rtx_expr_list subclass of rtx_def Use rtx_expr_list for expr_status.x_forced_labels rtl_data.x_nonlocal_goto_handler_labels becomes an rtx_expr_list rtl_data.x_stack_slot_list becomes an rtx_expr_list Use rtx_expr_list in various places PHASE 6: Use extra rtx_def subclasses Add JUMP_LABEL_AS_INSN Use rtx subclasses in more places in reorg.c Make SET_NEXT_INSN/SET_PREV_INSN require an rtx_insn Strengthen return_label and naked_return_label to rtx_code_label * Add insn method to rtx_expr_list Use rtx_insn in more places in dwarf2cfi.c inside_basic_block_p requires a const rtx_insn * insn_current_reference_address takes an rtx_insn Work towards NEXT_INSN/PREV_INSN requiring insns as their params Delete find_last_value find_first_parameter_load params and return type tablejump_p takes an rtx_insn NEXT_INSN and PREV_INSN take a const rtx_insn Make INSN_HAS_LOCATION require an rtx_insn Make insn_addresses_new require an rtx_insn Use rtx_insn in various places in resource.[ch] dfa_clear_single_insn_cache takes an rtx_insn Strengthen params to active_insn_between Make next_insn and previous_insn require an rtx_insn * END OF PATCHES: Delete rtx-classes-status.txt gcc/alias.c | 3 +- gcc/asan.c | 11 +- gcc/asan.h | 4 +- gcc/auto-inc-dec.c | 54 +-- gcc/basic-block.h | 31 +- gcc/bb-reorder.c | 30 +- gcc/bt-load.c | 37 +- gcc/builtins.c | 47 +- gcc/caller-save.c | 18 +- gcc/calls.c | 47 +- gcc/cfgbuild.c | 44 +- gcc/cfgcleanup.c | 98 +++-- gcc/cfgexpand.c | 75 ++-- gcc/cfgloop.c | 2 +- gcc/cfgloop.h | 9 +- gcc/cfgloopanal.c | 8 +- gcc/cfgrtl.c | 365 ++++++++-------- gcc/combine-stack-adj.c | 49 ++- gcc/combine.c | 464 ++++++++++---------- gcc/compare-elim.c | 19 +- gcc/config/aarch64/aarch64.c | 25 +- gcc/config/alpha/alpha.c | 69 +-- gcc/config/arc/arc-protos.h | 16 +- gcc/config/arc/arc.c | 109 ++--- gcc/config/arc/arc.md | 8 +- gcc/config/arc/constraints.md | 2 +- gcc/config/arm/arm-protos.h | 6 +- gcc/config/arm/arm.c | 137 +++--- gcc/config/avr/avr-log.c | 2 +- gcc/config/avr/avr-protos.h | 69 +-- gcc/config/avr/avr.c | 153 +++---- gcc/config/bfin/bfin-protos.h | 2 +- gcc/config/bfin/bfin.c | 96 +++-- gcc/config/c6x/c6x-protos.h | 4 +- gcc/config/c6x/c6x.c | 206 ++++----- gcc/config/cris/cris.c | 11 +- gcc/config/epiphany/epiphany-protos.h | 6 +- gcc/config/epiphany/epiphany.c | 26 +- gcc/config/epiphany/mode-switch-use.c | 2 +- gcc/config/epiphany/resolve-sw-modes.c | 5 +- gcc/config/frv/frv.c | 61 +-- gcc/config/h8300/h8300-protos.h | 4 +- gcc/config/h8300/h8300.c | 19 +- gcc/config/i386/i386-protos.h | 14 +- gcc/config/i386/i386.c | 278 ++++++------ gcc/config/i386/winnt.c | 2 +- gcc/config/ia64/ia64.c | 193 +++++---- gcc/config/iq2000/iq2000-protos.h | 11 +- gcc/config/iq2000/iq2000.c | 24 +- gcc/config/iq2000/iq2000.md | 4 +- gcc/config/m32c/m32c.c | 4 +- gcc/config/m32r/m32r.c | 4 +- gcc/config/m68k/m68k-protos.h | 7 +- gcc/config/m68k/m68k.c | 43 +- gcc/config/mcore/mcore-protos.h | 2 +- gcc/config/mcore/mcore.c | 28 +- gcc/config/mep/mep-protos.h | 18 +- gcc/config/mep/mep.c | 262 ++++++------ gcc/config/microblaze/microblaze.c | 28 +- gcc/config/microblaze/microblaze.md | 4 +- gcc/config/mips/mips-protos.h | 16 +- gcc/config/mips/mips.c | 237 ++++++----- gcc/config/mips/mips.md | 2 +- gcc/config/mn10300/mn10300.c | 12 +- gcc/config/nds32/nds32-protos.h | 2 +- gcc/config/nds32/nds32.c | 6 +- gcc/config/pa/pa-protos.h | 40 +- gcc/config/pa/pa.c | 81 ++-- gcc/config/picochip/picochip-protos.h | 3 +- gcc/config/picochip/picochip.c | 59 +-- gcc/config/rs6000/rs6000-protos.h | 4 +- gcc/config/rs6000/rs6000.c | 82 ++-- gcc/config/rx/rx-protos.h | 2 +- gcc/config/rx/rx.c | 2 +- gcc/config/s390/s390-protos.h | 8 +- gcc/config/s390/s390.c | 186 ++++---- gcc/config/score/score.c | 5 +- gcc/config/sh/sh-protos.h | 23 +- gcc/config/sh/sh.c | 279 ++++++------ gcc/config/sh/sh.md | 11 +- gcc/config/sh/sh_optimize_sett_clrt.cc | 12 +- gcc/config/sh/sh_treg_combine.cc | 35 +- gcc/config/sparc/sparc-protos.h | 20 +- gcc/config/sparc/sparc.c | 68 +-- gcc/config/spu/spu.c | 67 +-- gcc/config/spu/spu.md | 4 +- gcc/config/stormy16/stormy16.c | 6 +- gcc/config/tilegx/tilegx-protos.h | 8 +- gcc/config/tilegx/tilegx.c | 93 ++-- gcc/config/tilepro/tilepro-protos.h | 8 +- gcc/config/tilepro/tilepro.c | 89 ++-- gcc/config/v850/v850-protos.h | 2 +- gcc/config/v850/v850.c | 30 +- gcc/config/xtensa/xtensa-protos.h | 2 +- gcc/config/xtensa/xtensa.c | 23 +- gcc/coretypes.h | 19 + gcc/cprop.c | 54 +-- gcc/cse.c | 121 +++--- gcc/cselib.c | 24 +- gcc/cselib.h | 12 +- gcc/dbxout.c | 8 +- gcc/dce.c | 46 +- gcc/ddg.c | 28 +- gcc/ddg.h | 8 +- gcc/debug.c | 9 +- gcc/debug.h | 8 +- gcc/df-core.c | 24 +- gcc/df-problems.c | 67 +-- gcc/df-scan.c | 49 +-- gcc/df.h | 64 +-- gcc/doc/tm.texi | 42 +- gcc/dse.c | 26 +- gcc/dwarf2cfi.c | 79 ++-- gcc/dwarf2out.c | 30 +- gcc/emit-rtl.c | 588 ++++++++++++++----------- gcc/emit-rtl.h | 12 +- gcc/except.c | 80 ++-- gcc/except.h | 4 +- gcc/explow.c | 30 +- gcc/expmed.c | 61 +-- gcc/expr.c | 84 ++-- gcc/expr.h | 8 +- gcc/final.c | 168 ++++---- gcc/function.c | 93 ++-- gcc/function.h | 26 +- gcc/fwprop.c | 40 +- gcc/gcse.c | 108 ++--- gcc/genattr.c | 10 +- gcc/genattrtab.c | 13 +- gcc/genautomata.c | 12 +- gcc/genconditions.c | 2 +- gcc/genemit.c | 8 +- gcc/gengenrtl.c | 4 +- gcc/genoutput.c | 4 +- gcc/genpeep.c | 5 +- gcc/genrecog.c | 29 +- gcc/haifa-sched.c | 572 +++++++++++++------------ gcc/hooks.c | 16 +- gcc/hooks.h | 8 +- gcc/hw-doloop.c | 13 +- gcc/hw-doloop.h | 6 +- gcc/ifcvt.c | 218 +++++----- gcc/init-regs.c | 4 +- gcc/insn-addr.h | 2 +- gcc/internal-fn.c | 33 +- gcc/ira-build.c | 10 +- gcc/ira-conflicts.c | 10 +- gcc/ira-costs.c | 13 +- gcc/ira-emit.c | 27 +- gcc/ira-int.h | 8 +- gcc/ira-lives.c | 8 +- gcc/ira.c | 64 +-- gcc/ira.h | 2 +- gcc/is-a.h | 24 ++ gcc/jump.c | 65 +-- gcc/lists.c | 70 +-- gcc/loop-doloop.c | 19 +- gcc/loop-invariant.c | 27 +- gcc/loop-iv.c | 42 +- gcc/loop-unroll.c | 59 +-- gcc/lower-subreg.c | 49 ++- gcc/lra-assigns.c | 2 +- gcc/lra-coalesce.c | 21 +- gcc/lra-constraints.c | 138 +++--- gcc/lra-eliminations.c | 12 +- gcc/lra-int.h | 34 +- gcc/lra-lives.c | 2 +- gcc/lra-spills.c | 9 +- gcc/lra.c | 84 ++-- gcc/mode-switching.c | 21 +- gcc/modulo-sched.c | 64 +-- gcc/optabs.c | 161 ++++--- gcc/output.h | 18 +- gcc/postreload-gcse.c | 66 +-- gcc/postreload.c | 56 +-- gcc/predict.c | 18 +- gcc/predict.h | 2 +- gcc/print-rtl.c | 24 +- gcc/recog.c | 39 +- gcc/recog.h | 2 +- gcc/ree.c | 45 +- gcc/reg-stack.c | 89 ++-- gcc/regcprop.c | 20 +- gcc/reginfo.c | 10 +- gcc/regrename.c | 22 +- gcc/regrename.h | 2 +- gcc/regstat.c | 4 +- gcc/reload.c | 39 +- gcc/reload.h | 14 +- gcc/reload1.c | 217 +++++----- gcc/reorg.c | 463 ++++++++++---------- gcc/resource.c | 91 ++-- gcc/resource.h | 8 +- gcc/rtl.h | 757 +++++++++++++++++++++++++++------ gcc/rtlanal.c | 136 +++--- gcc/sched-deps.c | 215 +++++----- gcc/sched-ebb.c | 60 +-- gcc/sched-int.h | 147 +++---- gcc/sched-rgn.c | 110 ++--- gcc/sched-vis.c | 25 +- gcc/sdbout.c | 6 +- gcc/sel-sched-dump.c | 8 +- gcc/sel-sched-dump.h | 2 +- gcc/sel-sched-ir.c | 135 +++--- gcc/sel-sched-ir.h | 88 ++-- gcc/sel-sched.c | 89 ++-- gcc/shrink-wrap.c | 29 +- gcc/shrink-wrap.h | 14 +- gcc/stack-ptr-mod.c | 2 +- gcc/stmt.c | 4 +- gcc/store-motion.c | 70 +-- gcc/target.def | 58 +-- gcc/targhooks.c | 2 +- gcc/targhooks.h | 2 +- gcc/tree-cfg.c | 14 + gcc/tree-outof-ssa.c | 4 +- gcc/tree-ssa-loop-ivopts.c | 8 +- gcc/valtrack.c | 13 +- gcc/valtrack.h | 2 +- gcc/var-tracking.c | 59 +-- gcc/varasm.c | 11 +- gcc/vmsdbgout.c | 4 +- gcc/web.c | 4 +- 223 files changed, 6733 insertions(+), 5524 deletions(-) -- 1.8.5.3