5.6 How a machine description becomes an instruction

Source references in this chapter are to GCC 15.2.0 (releases/gcc-15.2.0).

The Arm port names gen_addsi3 in 42 places in gcc/config/arm/arm.cc, for example to add an offset to a base register (arm.cc:8309). Search the checkout for its definition and you find none. Ask the compiler which pattern made an instruction, and it can answer *arm_addsi3, a name that no C function can have. Both names come from gcc/config/arm/arm.md, and neither is defined in C anywhere in the repository.

cc1 never reads a .md file. Generator programs read it while GCC builds, and write the C that cc1 runs: a gen_ function for each named pattern, one recogniser for all patterns, and the tables that join them. The name of a pattern decides which of these it gets.

This chapter assumes Chapter 5.1, for RTL and the count.c example, Chapter 5.5, for how expand picks a named pattern through an optab, and Chapter 2.4, for the generated files in build/gcc/. The target is the one from Chapter 5.5: arm-none-eabi-gcc -O2 -mcpu=cortex-m4.

md_file: the input that every generator reads

configure chooses one file per target. config.gcc sets cpu_type=arm for every arm*-*-* triple (config.gcc:375-376), and a target that names no md_file gets $cpu_type/$cpu_type.md (configure.ac:1943-1944). The makefile adds one shared file in front:

md_file=$(srcdir)/common.md $(srcdir)/config/@md_file@

Listing 5.6-1: two files make the machine description (gcc/Makefile.in:608).

common.md holds what all targets share, such as the r constraint (common.md:48-49). arm.md includes the rest of the port: the iterators, predicates and constraints (arm.md:397-403), one pipeline description per core, cortex-m4.md among them (:460), and the Thumb-2 patterns in thumb2.md (:13135). Each generator rule in gcc/Makefile.in runs a build/gen* program over $(md_file) and writes into build/gcc/ (Makefile.in:2742-2806). These are the generators this chapter follows:

GeneratorWritesWhat cc1 gets
gencodesinsn-codes.henum insn_code, one CODE_FOR_ per named pattern
genflagsinsn-flags.ha HAVE_ macro and a gen_ prototype per named pattern
genemitinsn-emit-N.ccthe gen_ functions, and the bodies of splits
genrecoginsn-recog-N.cc, insn-recog.hrecog and split_insns
genoutputinsn-output.ccinsn_data[]: names, output templates, operand data
genopinitinsn-opinit.cc, insn-opinit.hthe optab table that Chapter 5.5 reads
genattrtabinsn-attrtab.cc, insn-dfatab.cc, insn-latencytab.ccattribute functions and scheduler tables
genpredsinsn-preds.cc, tm-preds.h, tm-constrs.hpredicate and constraint functions

Most of them also read insn-conditions.md. genconditions collects the C condition of every pattern into a program that the build compiler compiles and runs, and its output records which conditions are constant (Makefile.in:2809-2820). A condition can "turn out to be always false when the compiler is built", and then most generators "can simply ignore the entire pattern" (genconditions.cc:20-26).

The numbered files are recent. At releases/gcc-13.3.0, insn-emit.cc and insn-recog.cc were single files (Makefile.in:2447-2449). GCC 14 split the emitter (Makefile.in:238-242 at releases/gcc-14.1.0), and GCC 15 split the recogniser into the same number of files (Makefile.in:243-246). Chapter 2.4 covers the build side.

define_expand "addsi3": one named pattern, four generated artefacts

This is the pattern behind gen_addsi3:

(define_expand "addsi3"
  [(set (match_operand:SI          0 "s_register_operand")
	(plus:SI (match_operand:SI 1 "s_register_operand")
		 (match_operand:SI 2 "reg_or_int_operand")))]
  "TARGET_EITHER"
  "
  if (TARGET_32BIT && CONST_INT_P (operands[2]))
    {
      arm_split_constant (PLUS, SImode, NULL_RTX,
	                  INTVAL (operands[2]), operands[0], operands[1],
			  optimize && can_create_pseudo_p ());
      DONE;
    }
  "
)

Listing 5.6-2: the addsi3 expander (gcc/config/arm/arm.md:905-919).

A define_expand has a name, an RTL template, a condition, and C code that runs before the template is used. addsi3 is a standard name: the operation, the mode SI, and the operand count. Each match_operand has a predicate and no constraint string. The expander only builds RTL, and a define_insn with constraints must match the result later. The condition is TARGET_EITHER, which the port defines as 1 (arm.h:148). In 32-bit code, for a constant operand, the C code calls arm_split_constant, which emits "a sequence of insns to handle a large constant" (arm.cc:4740-4752), and then DONE. For a register operand the C code does nothing, and the template becomes the insn. The internals manual documents these outcomes under Overview and Expander Definitions, and the standard names under Standard Names.

Four generators turn this one form into four things.

gencodes gives it a number. It writes one enumerator per named pattern:

static void
gen_insn (md_rtx_info *info)
{
  const char *name = XSTR (info->def, 0);
  int truth = maybe_eval_c_test (XSTR (info->def, 2));

  /* Don't mention instructions whose names are the null string
     or begin with '*'.  They are in the machine description just
     to be recognized.  */
  if (name[0] != 0 && name[0] != '*')
    {
      if (truth == 0)
	printf (",\n   CODE_FOR_%s = CODE_FOR_nothing", name);
      else
	printf (",\n  CODE_FOR_%s = %d", name, info->index);
    }
}

Listing 5.6-3: where CODE_FOR_addsi3 comes from (gcc/gencodes.cc:31-47).

info->index counts every define_insn and define_expand in md_file, in order. It starts at 1, "to make 0 available for CODE_FOR_nothing" (gensupport.cc:3140-3141), the first value in insn-codes.h (gencodes.cc:69). A pattern whose condition is always false keeps its name with the value CODE_FOR_nothing, so C code that names it still compiles.

genflags gives it a HAVE_addsi3 macro, whose value is the condition, and a prototype for gen_addsi3 (genflags.cc:107, :178-195).

genemit writes gen_addsi3. The function opens an insn sequence, copies its arguments into operands[], pastes in the C code, emits the template, and returns the sequence (genemit.cc:458-565). Two macros give DONE and FAIL their meaning:

static void
emit_c_code (const char *code, bool can_fail_p, const char *name, FILE *file)
{
  if (can_fail_p)
    fprintf (file, "#define FAIL return (end_sequence (), _val)\n");
  else
    fprintf (file, "#define FAIL _Pragma (\"GCC error \\\"%s cannot FAIL\\\"\")"
	    " (void)0\n", name);
  fprintf (file, "#define DONE return (_val = get_insns (), "
	  "end_sequence (), _val)\n");

Listing 5.6-4: DONE and FAIL are return statements (gcc/genemit.cc:311-320).

DONE returns what the C code emitted, so the template is never reached. FAIL returns _val, which is still null (genemit.cc:511), and the caller must find another way. For an optab behind an internal function in internal-fn.def, a FAIL is a compile error in the generated file instead (genemit.cc:934-936). Above each function, genemit writes the .md file and line that it came from (genemit.cc:964-975).

genopinit puts it in the optab table. optabs.def gives the pattern names of add_optab as "add$P$a3" (optabs.def:118), where $a stands for a mode name in lower case (:29-33). genopinit tests every pattern name against these shapes (genopinit.cc:41-47, gensupport.cc:3896-3918). addsi3 fits, so the table gets a CODE_FOR_addsi3 entry, enabled by HAVE_addsi3 (genopinit.cc:364-368, :405). The lookup returns the entry only while that flag is set (:461-468). The same file defines GEN_FCN as insn_data[CODE].genfun (genopinit.cc:275). Chapter 5.5 follows expand from the optab to that call. This chapter starts where the call lands, in gen_addsi3.

*arm_addsi3: a star means "recognise only"

The insn that gen_addsi3 emits must later match a define_insn. For an SImode addition in 32-bit code, this is the pattern:

(define_insn_and_split "*arm_addsi3"
  [(set (match_operand:SI          0 "s_register_operand" "=rk,l,l ,l ,r ,k ,r,k ,r ,k ,r ,k,k,r ,k ,r")
	(plus:SI (match_operand:SI 1 "s_register_operand" "%0 ,l,0 ,l ,rk,k ,r,r ,rk,k ,rk,k,r,rk,k ,rk")
		 (match_operand:SI 2 "reg_or_int_operand" "rk ,l,Py,Pd,rI,rI,k,rI,Pj,Pj,L ,L,L,PJ,PJ,?n")))]
  "TARGET_32BIT"
  "@
   add%?\\t%0, %0, %2
   add%?\\t%0, %1, %2
   add%?\\t%0, %1, %2
   add%?\\t%0, %1, %2
   add%?\\t%0, %1, %2
   add%?\\t%0, %1, %2
   add%?\\t%0, %2, %1
   add%?\\t%0, %1, %2
   addw%?\\t%0, %1, %2
   addw%?\\t%0, %1, %2
   sub%?\\t%0, %1, #%n2
   sub%?\\t%0, %1, #%n2
   sub%?\\t%0, %1, #%n2
   subw%?\\t%0, %1, #%n2
   subw%?\\t%0, %1, #%n2
   #"

Listing 5.6-5: one addition, sixteen alternatives (gcc/config/arm/arm.md:940-961).

The star turns off three of the four artefacts. The comment in Listing 5.6-3 gives the reason: such patterns are "in the machine description just to be recognized". gencodes, genflags and genemit skip them (genflags.cc:167-171, genemit.cc:419-423), and find_optab rejects them on its first line (gensupport.cc:3901-3902). So there is no CODE_FOR_ and no gen_ function, and no C code can ask for this pattern by name. It still takes a number from the same count as addsi3, an entry in insn_data[], and a place in the recogniser.

genrecog turns all the define_insn forms into one decision tree. Its header comment states the contract of the function it writes:

   recog returns -1 if the rtx is not valid.  If the rtx is valid,
   recog returns a nonnegative number which is the insn code number
   for the pattern that matched.  This is the same as the order in the
   machine description of the entry that matched.  This number can be
   used as an index into various insn_* tables, such as insn_template,
   insn_outfun, and insn_n_operands (found in insn-output.cc).

Listing 5.6-6: what recog returns (gcc/genrecog.cc:26-31).

The tree tests the shape of the RTL first, then modes and predicates, then match_dups, and the C condition last (genrecog.cc:56-70). Here the condition is TARGET_32BIT, which is true in ARM state and in Thumb-2 (arm.h:162). The arm in the name is older than Thumb-2. A Cortex-M4 uses this pattern, although it has no ARM state.

define_insn_and_split is a shorthand. When gensupport.cc reads it, it makes a define_insn and a define_split from the same RTL, and removes the constraints from the split's copy (gensupport.cc:1132-1180). Every generator sees the two forms. A later section covers the split half.

Predicates and constraints: reg_or_int_operand and Py

Each match_operand in Listing 5.6-5 has two strings. The first is a predicate. genpreds turns predicates.md into C functions, and recog calls them, so a predicate decides whether the insn matches at all:

;; Reg, subreg(reg) or const_int.
(define_predicate "reg_or_int_operand"
  (ior (match_code "const_int")
       (match_operand 0 "s_register_operand")))

Listing 5.6-7: operand 2 is a register or any integer (gcc/config/arm/predicates.md:226-229).

The second string holds the constraints, one per alternative, separated by commas. Read Listing 5.6-5 in columns, and count alternatives from 0, as which_alternative does. Alternative 2 wants operand 0 in a low register (l), operand 1 in the same register as operand 0 (0), and operand 2 to be a Py constant:

(define_constraint "Py"
  "@internal In Thumb-2 state a constant in the range 0 to 255"
  (and (match_code "const_int")
       (match_test "TARGET_THUMB2 && ival >= 0 && ival <= 255")))

Listing 5.6-8: one constraint (gcc/config/arm/constraints.md:277-280).

Predicates and constraints work at different times. Before register allocation an operand is usually a pseudo register, which has no hard register yet. The predicate accepts it, and the insn is recognised. The register allocator then picks an alternative whose constraints it can satisfy, and Chapter 5.7 shows that choice in the dumps. At the end, final prints the template with the same index: output.multi[which_alternative] (final.cc:2023-2035). The @ that opens the template string in Listing 5.6-5 makes it one template per line, in alternative order, as Output Template documents.

Some of these letters are also asm constraints. The GCC manual documents l, k, I and L for inline assembly, in the Arm table under Machine Constraints, because extend.texi includes the internals manual's md.texi (extend.texi:12620, md.texi:2153). Constraints marked @internal, such as Py, Pj and Pd, are in neither manual. Their only documentation is the string in constraints.md.

arch and enabled: alternatives that a CPU switches off

Sixteen alternatives serve ARM state and Thumb-2 together. Attributes remove the alternatives that do not apply:

  [(set_attr "length" "2,4,4,4,4,4,4,4,4,4,4,4,4,4,4,16")
   (set_attr "predicable" "yes")
   (set_attr "predicable_short_it" "yes,yes,yes,yes,no,no,no,no,no,no,no,no,no,no,no,no")
   (set_attr "arch" "t2,t2,t2,t2,*,*,*,a,t2,t2,*,*,a,t2,t2,*")
   (set (attr "type") (if_then_else (match_operand 2 "const_int_operand" "")
		      (const_string "alu_imm")
		      (const_string "alu_sreg")))
 ]

Listing 5.6-9: the attributes of *arm_addsi3 (gcc/config/arm/arm.md:973-980).

arch takes one value per alternative: t2 for Thumb-2 only, a for ARM state only, and * for the default, any (arm.md:143-154). arch_enabled turns each value into yes or no with a C test, such as TARGET_THUMB2 for t2 (arm.md:172-174). The enabled attribute is no wherever arch_enabled is no (arm.md:253-269). The compiler knows the name enabled: it never uses an alternative for which enabled is no. The internals manual documents this under Disable Insn Alternatives.

-mcpu=cortex-m4 alone gives Thumb code. The Arm driver adds -mthumb for a Thumb-only CPU when the command line has neither -marm nor -mthumb (arm.h:2546-2553). So alternatives 7 and 12, the two marked a, are off for every addition in count.c.

define_split and the "#" template

The last alternative takes any constant (?n), and its template is "#". In the words of final.cc, a "#" template "means that this insn must be split" (final.cc:2805-2806). The second half of the define_insn_and_split says how:

  "TARGET_32BIT
   && CONST_INT_P (operands[2])
   && !const_ok_for_op (INTVAL (operands[2]), PLUS)
   && (reload_completed || !arm_eliminable_register (operands[1]))"
  [(clobber (const_int 0))]
  "
  arm_split_constant (PLUS, SImode, curr_insn,
	              INTVAL (operands[2]), operands[0],
		      operands[1], 0);
  DONE;
  "

Listing 5.6-10: the split condition and the split body (gcc/config/arm/arm.md:962-972).

The condition selects a constant that no single add accepts. The RTL (clobber (const_int 0)) is a placeholder, because the C code emits the new insns itself and ends with DONE, as the expander in Listing 5.6-2 did. genemit writes that C code into a split function, and genrecog writes split_insns, which matches an insn against every define_split (genrecog.cc:42-44).

The split passes call split_insns. The first, split1 (recog.cc:4481), runs before register allocation (passes.def:500). final is the last resort: a "#" that reaches it is split there, but only on a target without a length attribute (final.cc:2805-2822). Arm has one (arm.md:140-141), so on Arm the split passes must split every "#" insn before final.

The host compiler shows a whole pattern that must split. On x86-64, count.c's % goes through the <u>divmod<mode>4 expander (i386.md:11371). Its result has the shape of *divmod<mode>4, whose only template is "#" and whose split condition is reload_completed (i386.md:11607-11616). After register allocation it splits into a sign extension and *<u>divmod<mode>4_noext, whose template prints the divide instruction (:11868-11878). Chapter 5.7 shows what reload did in between.

Insn attributes: type for the scheduler, predicable for define_cond_exec

The attributes in Listing 5.6-9 feed two more mechanisms.

type is alu_imm when operand 2 is a constant and alu_sreg when it is not. The pipeline descriptions read it, together with tune, an attribute whose values are the CPU names from arm-cpus.in (arm-tune.md:1-2, :23-55). For -mcpu=cortex-m4 the name is cortexm4 (arm-cpus.in:1266-1267), and this reservation applies:

;; ALU and multiply is one cycle.
(define_insn_reservation "cortex_m4_alu" 1
  (and (eq_attr "tune" "cortexm4")
       (ior (eq_attr "type" "alu_imm,alus_imm,logic_imm,logics_imm,\
                             alu_sreg,alus_sreg,logic_reg,logics_reg,\
       ...
  "cortex_m4_ex")

Listing 5.6-11: an ALU insn on a Cortex-M4, abridged (gcc/config/arm/cortex-m4.md:31-48).

genattrtab writes the attribute functions, such as get_attr_type, into insn-attrtab.cc, and the scheduler's tables into insn-dfatab.cc and insn-latencytab.cc (Makefile.in:2788-2796). genautomata writes insn-automata.cc (Makefile.in:2726). The scheduler never compares the string alu_imm. It calls the generated functions. The internals manual documents the attribute language under Insn Attributes, and the pipeline forms under Processor pipeline description.

predicable "yes" connects the pattern to the port's one define_cond_exec:

(define_cond_exec
  [(match_operator 0 "arm_comparison_operator"
    [(match_operand 1 "cc_register" "")
     (const_int 0)])]
  "TARGET_32BIT
   && (!TARGET_NO_VOLATILE_CE || !volatile_refs_p (PATTERN (insn)))"
  ""
[(set_attr "predicated" "yes")]
)

Listing 5.6-12: the Arm predicate (gcc/config/arm/arm.md:12236-12244).

For each predicable define_insn, gensupport.cc builds a second insn. Its RTL wraps the original in a cond_exec with this condition, and its name is new:

      new_name = XNEWVAR (char, strlen XSTR (insn_elem->data, 0) + 4);
      sprintf (new_name, "*p %s", XSTR (insn_elem->data, 0));

Listing 5.6-13: the name of the predicated copy (gcc/gensupport.cc:2321-2322).

So the recogniser knows a pattern called *p *arm_addsi3, which is in no .md file. When a pass makes the addition conditional, the insn matches that copy. The %? in each template is where arm_print_operand writes the condition (arm.cc:24237-24239). The internals manual documents define_cond_exec under Conditional Execution.

Iterators: <Us>mulsidi3 is two expanders

A modern .md file writes many patterns once, with iterators:

(define_expand "<Us>mulsidi3"
  [(set (match_operand:DI 0 "s_register_operand")
	(mult:DI
	 (SE:DI (match_operand:SI 1 "s_register_operand"))
	 (SE:DI (match_operand:SI 2 "s_register_operand"))))]
  "TARGET_32BIT"
  {
      emit_insn (gen_<US>mull (gen_lowpart (SImode, operands[0]),
			       gen_highpart (SImode, operands[0]),
			       operands[1], operands[2]));
      DONE;
  }
)

Listing 5.6-14: a widening multiply, signed and unsigned (gcc/config/arm/arm.md:2420-2432).

SE is a code iterator over sign_extend and zero_extend (iterators.md:383). <Us> and <US> are code attributes, which map each code to a string:

;; Assembler mnemonics for signedness of widening operations.
(define_code_attr US [(sign_extend "s") (zero_extend "u")])
(define_code_attr Us [(sign_extend "") (zero_extend "u")])

Listing 5.6-15: the strings behind <US> and <Us> (gcc/config/arm/iterators.md:2093-2095).

So Listing 5.6-14 is two expanders: mulsidi3, which calls gen_smull, and umulsidi3, which calls gen_umull. A mode iterator does the same over modes. QHSI lists QI, HI and SI (iterators.md:39), so extend<mode>di2 defines extendqidi2, extendhidi2 and extendsidi2 (arm.md:5588-5590).

The reader expands iterators before any generator sees a form: read_rtx passes each one to apply_iterators (read-rtl.cc:1516). Every generator therefore sees concrete names, and genflags reports an "unresolved iterator" if a < survives (genflags.cc:152-156). The internals manual documents the syntax under Iterators.

For you, the consequence is that grep umulsidi3 finds no .md file. A build directory can print the description after expansion. The mddump target runs genmddump over $(md_file) (Makefile.in:2861-2863). It writes the description "with expanded iterators" to tmp-mddump.md, with a ;; file: line comment before each form (genmddump.cc:21-23, :51). This recipe was not run at the pin:

$ cd build/gcc && make mddump && grep -n -A3 '"umulsidi3"' tmp-mddump.md

From an instruction back to arm.md: -dp and -fdump-rtl-vregs

An obvious route is to read an insn code in -fdump-rtl-expand and look it up in insn-codes.h. Neither step works, as this section shows. These two commands do work, with an installed cross compiler and no build directory:

$ arm-none-eabi-gcc -O2 -mcpu=cortex-m4 -S -dp count.c
$ arm-none-eabi-gcc -O2 -mcpu=cortex-m4 -c -fdump-rtl-vregs count.c

-dp makes final add a comment to the assembler line of each insn. The GCC manual documents -dp under Developer Options. The comment holds the insn's UID, its cost and length, the pattern name from insn_data[], and /N for the alternative when the pattern has more than one (final.cc:3208-3233). On Arm the comment starts with @ (aout.h:318-320).

The name can differ from the one in an earlier dump. After register allocation, thumb2_reorg in arm.cc converts instructions "to their cc-clobbering variant if possible, since that allows us to use smaller encodings" (arm.cc:19410-19411). An addition between low registers can then match *thumb2_addsi_short, which clobbers the condition codes (thumb2.md:1296-1300).

The RTL dumps print the same name. An insn's code comes after its location (rtl.def:145), and print-rtl.cc writes the code, and then the name in braces when the code is not negative:

      if (flag_dump_unnumbered
	  && (is_insn || NOTE_P (in_rtx)))
	fputc ('#', m_outfile);
      else
	fprintf (m_outfile, " %d", value);

      if (is_insn && &INSN_CODE (in_rtx) == &XINT (in_rtx, idx)
	  && XINT (in_rtx, idx) >= 0
	  && (name = get_insn_name (XINT (in_rtx, idx))) != NULL)
	fprintf (m_outfile, " {%s}", name);

Listing 5.6-16: the code and the pattern name in a dump (gcc/print-rtl.cc:526-535).

The expand dump is the wrong place to look. Every new insn starts with code -1 (emit-rtl.cc:4134), and gen_addsi3 does not recognise what it emits. Recognition happens on demand, in recog_memoized, which calls recog once and stores the result in the insn (recog.h:318-324). So most insns in the expand dump show -1 and no name. The pass after expand, vregs (passes.def:453-457), walks every insn (function.cc:1980-1994) and, apart from a few special cases that involve virtual registers, calls extract_insn on it, which recognises the insn (recog.cc:2875-2880). The .vregs dump is the first in which almost every insn carries its pattern name. Chapter 5.2 explains the dump file names.

Do not search for the number. It is the pattern's position in this build's md_file (Listing 5.6-6), so another release, target or configuration gives another number. For a star name it also leads nowhere, because insn-codes.h has no entry for it (Listing 5.6-3). Search for the name:

$ grep -n '"\*arm_addsi3"' gcc/config/arm/*.md

That finds the define_insn_and_split at arm.md:940. If a name is not found, the generators made it. Remove a leading *p to get the predicated original, or look for the name written with an iterator. In a build directory the number indexes insn_data[] in insn-output.cc, whose name field is the string the dump printed (genoutput.cc:411-421). The gen_ functions in insn-emit-N.cc each carry the /* file:line */ comment from genemit, so a grep for arm.md:905 there finds gen_addsi3.

Three things to carry away

A .md file is input to the generators, never to cc1. Every gen_ function, every CODE_FOR_ and the recogniser exist only in build/gcc/.

The name decides the role. A standard name gets a gen_ function and an optab entry. A * name only takes part in recognition, and *p names and iterator names are made by the generators.

Find a pattern by its name, not its number. -dp and the dumps from vregs onwards print the name. The number is a position in one build's machine description.

Things that surprise people

The expand dump shows no pattern names. Nothing has asked recog yet. Use the vregs dump or a later one.

*arm_addsi3 matches Thumb-2 code. Its condition is TARGET_32BIT, which covers Thumb-2, and its arch attribute switches off the ARM-only alternatives.

grep umulsidi3 gcc/config/arm/*.md finds nothing. An iterator writes that name when the description is read.

Documentation coverage

The internals manual documents the machine description language in its Machine Desc chapter, gcc/doc/md.texi: the Overview (md.texi:55), Patterns (:103), Predicates (:879), Constraints (:1240), Disable Insn Alternatives (:4375), Standard Names (:4798), Expander Definitions (:9050), Insn Splitting (:9264), Insn Attributes (:10059), Processor pipeline description (:10852), Conditional Execution (:11372) and Iterators (:11851). The GCC manual includes the constraint nodes for asm users, with the Arm table under Machine Constraints (md.texi:1916, Arm at :2153, included at extend.texi:12620). -dp is in Developer Options (invoke.texi:20660-20665).

What is not documented:

  • A list of the generators and the files that each writes. The Passes node names a few, and still calls the emitter one file, insn-emit.cc (passes.texi:891-900).
  • That define_insn and define_expand share one numbering from 1, that 0 is CODE_FOR_nothing, and that a * pattern has a number but no CODE_FOR_.
  • That insns in the expand dump carry no code, and that vregs is the first pass to recognise them all.
  • That define_cond_exec makes patterns named *p NAME.
  • That make mddump prints the description after iterator expansion.
  • The @internal constraints, such as Py, outside constraints.md.

Next: register allocation, where IRA and LRA pick one alternative for each insn, and final prints its template.


All source references in this chapter are to GCC 15.2.0 (releases/gcc-15.2.0). Line numbers in other releases will differ; the surrounding code rarely does. Where behaviour itself changed across a major version, it is flagged inline.