1 /* This file is part of the program psim.
3 Copyright 1994, 1995, 2003 Andrew Cagney
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, see <http://www.gnu.org/licenses/>.
25 #include "filter-ppc.h"
27 #include "ld-decode.h"
33 #include "gen-semantics.h"
34 #include "gen-support.h"
37 print_support_function_name(lf
*file
,
38 table_entry
*function
,
39 int is_function_definition
)
41 if (it_is("internal", function
->fields
[insn_flags
])) {
42 lf_print__function_type(file
, SEMANTIC_FUNCTION_TYPE
, "PSIM_INLINE_SUPPORT",
43 (is_function_definition
? "\n" : " "));
44 print_function_name(file
,
45 function
->fields
[function_name
],
47 function_name_prefix_semantics
);
48 lf_printf(file
, "\n(%s)", SEMANTIC_FUNCTION_FORMAL
);
49 if (!is_function_definition
)
51 lf_printf(file
, "\n");
54 lf_print__function_type(file
,
55 function
->fields
[function_type
],
56 "PSIM_INLINE_SUPPORT",
57 (is_function_definition
? "\n" : " "));
58 lf_printf(file
, "%s\n(%s)%s",
59 function
->fields
[function_name
],
60 function
->fields
[function_param
],
61 (is_function_definition
? "\n" : ";\n"));
67 support_h_function(insn_table
*entry
,
70 table_entry
*function
)
72 ASSERT(function
->fields
[function_type
] != NULL
);
73 ASSERT(function
->fields
[function_param
] != NULL
);
74 print_support_function_name(file
,
77 lf_printf(file
, "\n");
82 gen_support_h(insn_table
*table
,
85 /* output a declaration for all functions */
86 insn_table_traverse_function(table
,
89 lf_printf(file
, "\n");
90 lf_printf(file
, "#if (SUPPORT_INLINE & INCLUDE_MODULE)\n");
91 lf_printf(file
, "# include \"support.c\"\n");
92 lf_printf(file
, "#endif\n");
96 support_c_function(insn_table
*table
,
99 table_entry
*function
)
101 ASSERT(function
->fields
[function_type
] != NULL
);
102 print_support_function_name(file
,
104 1/*!is_definition*/);
105 table_entry_print_cpp_line_nr(file
, function
);
106 lf_printf(file
, "{\n");
108 lf_print__c_code(file
, function
->annex
);
109 if (it_is("internal", function
->fields
[insn_flags
])) {
110 lf_printf(file
, "error(\"Internal function must longjump\\n\");\n");
111 lf_printf(file
, "return 0;\n");
114 lf_printf(file
, "}\n");
115 lf_print__internal_ref(file
);
116 lf_printf(file
, "\n");
121 gen_support_c(insn_table
*table
,
124 lf_printf(file
, "#include \"cpu.h\"\n");
125 lf_printf(file
, "#include \"idecode.h\"\n");
126 lf_printf(file
, "#ifdef HAVE_COMMON_FPU\n");
127 lf_printf(file
, "#include \"sim-inline.h\"\n");
128 lf_printf(file
, "#include \"sim-fpu.h\"\n");
129 lf_printf(file
, "#endif\n");
130 lf_printf(file
, "#include \"support.h\"\n");
131 lf_printf(file
, "\n");
133 /* output a definition (c-code) for all functions */
134 insn_table_traverse_function(table
,