static void print_support_function_name (lf *file, function_entry * function, int is_function_definition) { if (function->is_internal) { lf_print__function_type_function (file, print_semantic_function_type, "INLINE_SUPPORT", (is_function_definition ? "\n" : " ")); print_function_name (file, function->name, NULL, NULL, NULL, function_name_prefix_semantics); lf_printf (file, "\n("); lf_indent (file, +1); print_semantic_function_formal (file, 0); lf_indent (file, -1); lf_printf (file, ")"); if (!is_function_definition) lf_printf (file, ";"); lf_printf (file, "\n"); } else { /* map the name onto a globally valid name */ if (!is_function_definition && strcmp (options.module.support.prefix.l, "") != 0) { lf_indent_suppress (file); lf_printf (file, "#define %s %s%s\n", function->name, options.module.support.prefix.l, function->name); } lf_print__function_type (file, function->type, "INLINE_SUPPORT", (is_function_definition ? "\n" : " ")); lf_printf (file, "%s%s\n(", options.module.support.prefix.l, function->name); if (options.gen.smp) lf_printf (file, "sim_cpu *cpu, %sinstruction_address cia, int MY_INDEX", options.module.support.prefix.l); else lf_printf (file, "SIM_DESC sd, %sinstruction_address cia, int MY_INDEX", options.module.support.prefix.l); if (function->param != NULL && strlen (function->param) > 0) lf_printf (file, ", %s", function->param); lf_printf (file, ")%s", (is_function_definition ? "\n" : ";\n")); } }
static void print_semantic_function_header (lf *file, const char *basename, const char *format_name, opcode_bits *expanded_bits, int is_function_definition, int nr_prefetched_words) { int indent; lf_printf (file, "\n"); lf_print__function_type_function (file, print_semantic_function_type, "EXTERN_SEMANTICS", (is_function_definition ? "\n" : " ")); indent = print_function_name (file, basename, format_name, NULL, expanded_bits, function_name_prefix_semantics); if (is_function_definition) { indent += lf_printf (file, " "); lf_indent (file, +indent); } else { lf_printf (file, "\n"); } lf_printf (file, "("); lf_indent (file, +1); print_semantic_function_formal (file, nr_prefetched_words); lf_indent (file, -1); lf_printf (file, ")"); if (is_function_definition) { lf_indent (file, -indent); } else { lf_printf (file, ";"); } lf_printf (file, "\n"); }
static void gen_semantics_h (lf *file, insn_list *semantics, int max_nr_words) { int word_nr; insn_list *semantic; for (word_nr = -1; word_nr <= max_nr_words; word_nr++) { lf_printf (file, "typedef "); print_semantic_function_type (file); lf_printf (file, " %sidecode_semantic", options.module.global.prefix.l); if (word_nr >= 0) lf_printf (file, "_%d", word_nr); lf_printf (file, "\n("); lf_indent (file, +1); print_semantic_function_formal (file, word_nr); lf_indent (file, -1); lf_printf (file, ");\n"); lf_printf (file, "\n"); } switch (options.gen.code) { case generate_calls: for (semantic = semantics; semantic != NULL; semantic = semantic->next) { /* Ignore any special/internal instructions */ if (semantic->insn->nr_words == 0) continue; print_semantic_declaration (file, semantic->insn, semantic->expanded_bits, semantic->opcodes, semantic->nr_prefetched_words); } break; case generate_jumps: lf_print__this_file_is_empty (file, "generating jumps"); break; } }