static void gen_insn (rtx insn, int code) { const char *name = XSTR (insn, 0); int truth = maybe_eval_c_test (XSTR (insn, 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 ("#define CODE_FOR_%s CODE_FOR_nothing\n", name); else printf (" CODE_FOR_%s = %d,\n", name, code); } }
static void gen_insn (rtx insn) { const char *name = XSTR (insn, 0); const char *p; int len; int truth = maybe_eval_c_test (XSTR (insn, 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] == '*') return; len = strlen (name); if (len > max_id_len) max_id_len = len; if (truth == 0) /* Emit nothing. */; else if (truth == 1) printf ("#define HAVE_%s 1\n", name); else { /* Write the macro definition, putting \'s at the end of each line, if more than one. */ printf ("#define HAVE_%s (", name); for (p = XSTR (insn, 2); *p; p++) { if (IS_VSPACE (*p)) fputs (" \\\n", stdout); else putchar (*p); } fputs (")\n", stdout); } obstack_grow (&obstack, &insn, sizeof (rtx)); }
static void gen_proto (rtx insn) { int num = num_operands (insn); int i; const char *name = XSTR (insn, 0); int truth = maybe_eval_c_test (XSTR (insn, 2)); /* Many md files don't refer to the last two operands passed to the call patterns. This means their generator functions will be two arguments too short. Instead of changing every md file to touch those operands, we wrap the prototypes in macros that take the correct number of arguments. */ if (name[0] == 'c' || name[0] == 's') { if (!strcmp (name, "call") || !strcmp (name, "call_pop") || !strcmp (name, "sibcall") || !strcmp (name, "sibcall_pop")) gen_macro (name, num, 4); else if (!strcmp (name, "call_value") || !strcmp (name, "call_value_pop") || !strcmp (name, "sibcall_value") || !strcmp (name, "sibcall_value_pop")) gen_macro (name, num, 5); } if (truth != 0) printf ("extern rtx gen_%-*s (", max_id_len, name); else printf ("static inline rtx gen_%-*s (", max_id_len, name); if (num == 0) fputs ("void", stdout); else { for (i = 1; i < num; i++) fputs ("rtx, ", stdout); fputs ("rtx", stdout); } puts (");"); /* Some back ends want to take the address of generator functions, so we cannot simply use #define for these dummy definitions. */ if (truth == 0) { printf ("static inline rtx\ngen_%s", name); if (num > 0) { putchar ('('); for (i = 0; i < num-1; i++) printf ("rtx ARG_UNUSED (%c), ", 'a' + i); printf ("rtx ARG_UNUSED (%c))\n", 'a' + i); } else puts ("(void)"); puts ("{\n return 0;\n}"); } }