MONITOR_CFLAGS = @sim_monitor@
MODEL_CFLAGS = @sim_model@ @sim_default_model@ @sim_model_issue@
TERMIO_CFLAGS = @sim_termio@
+SWITCH_CFLAGS = @sim_switch@
CONFIG_CFLAGS = \
$(SMP_CFLAGS) \
$(XOR_ENDIAN_CFLAGS) \
$(FLOAT_CFLAGS) \
$(MONITOR_CFLAGS) \
$(MODEL_CFLAGS) \
- $(TERMIO_CFLAGS)
+ $(TERMIO_CFLAGS) \
+ $(SWITCH_CFLAGS)
SIM_FPU_CFLAGS = -DHAVE_COMMON_FPU -I../common -I${srcdir}/../common
STD_CFLAGS = $(CFLAGS) $(WERROR_CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(WARN_CFLAGS) $(INCLUDES) $(INCGNU) $(SIM_FPU_CFLAGS)
IGEN_ICACHE = @sim_icache@
IGEN_SMP = @sim_igen_smp@
IGEN_LINE_NR = @sim_line_nr@
-DGEN_FLAGS = @sim_switch@
+DGEN_FLAGS =
IGEN_FLAGS = \
$(IGEN_DECODE_MECHANISM) \
/****************************************************************/
-int spreg_lookup_table = 1;
enum {
nr_of_sprs = 1024,
};
spreg_table_entry *entry;
char **attribute;
int spreg_nr;
+ int spreg_lookup_table;
lf_print__gnu_copyleft(file);
lf_printf(file, "\n");
}
lf_printf(file, "spr_%s(sprs spr)\n", *attribute);
lf_printf(file, "{\n");
- if (spreg_lookup_table
- || strcmp(*attribute, "name") == 0
- || strcmp(*attribute, "index") == 0)
- lf_printf(file, " return spr_info[spr].%s;\n",
- *attribute);
- else {
+ spreg_lookup_table = !(strcmp(*attribute, "name") == 0
+ || strcmp(*attribute, "index") == 0);
+ if (spreg_lookup_table) {
spreg_table_entry *entry;
+ lf_printf(file, "#ifdef WITH_SPREG_SWITCH_TABLE\n");
lf_printf(file, " switch (spr) {\n");
for (entry = table->sprs; entry != NULL; entry = entry->next) {
if (strcmp(*attribute, "is_valid") == 0) {
lf_printf(file, " return 1;\n");
lf_printf(file, " }\n");
lf_printf(file, " return 0;\n");
+ lf_printf(file, "#else\n");
}
+ lf_printf(file, " return spr_info[spr].%s;\n",
+ *attribute);
+ if (spreg_lookup_table)
+ lf_printf(file, "#endif\n");
lf_printf(file, "}\n");
}
if (argc <= 1) {
printf("Usage: dgen ...\n");
- printf("-s Use switch instead of table\n");
printf("-n <file-name> Use this as cpp line numbering name\n");
printf("-h Output header file\n");
printf("-p <spreg-file> Output spreg.h(P) or spreg.c(p)\n");
fprintf(stderr, "\t-%c %s\n", ch, ( optarg ? optarg : ""));
#endif
switch(ch) {
- case 's':
- spreg_lookup_table = 0;
- break;
case 'r':
sprs = spreg_table_load(optarg);
break;