MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / read_counts

Function read_counts

src/gencpu.cpp:319–355  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

317}
318
319static void read_counts (void)
320{
321 FILE *file;
322 unsigned int opcode, count, total;
323 char name[20];
324 int nr = 0;
325 memset (counts, 0, 65536 * sizeof *counts);
326
327 count = 0;
328 file = fopen ("frequent.68k", "r");
329 if (file) {
330 if (fscanf (file, "Total: %u\n", &total) == 0) {
331 abort();
332 }
333 while (fscanf (file, "%x: %u %s\n", &opcode, &count, name) == 3) {
334 opcode_next_clev[nr] = 5;
335 opcode_last_postfix[nr] = -1;
336 opcode_map[nr++] = opcode;
337 counts[opcode] = count;
338 }
339 fclose (file);
340 }
341 if (nr == nr_cpuop_funcs)
342 return;
343 for (opcode = 0; opcode < 0x10000; opcode++) {
344 if (table68k[opcode].handler == -1 && table68k[opcode].mnemo != i_ILLG
345 && counts[opcode] == 0)
346 {
347 opcode_next_clev[nr] = 5;
348 opcode_last_postfix[nr] = -1;
349 opcode_map[nr++] = opcode;
350 counts[opcode] = count;
351 }
352 }
353 if (nr != nr_cpuop_funcs)
354 term();
355}
356
357static int genamode_cnt, genamode8r_offset[2];
358static int set_fpulimit;

Callers 3

generate_cpu_testFunction · 0.70
generate_cpuFunction · 0.70
mainFunction · 0.70

Calls 1

termFunction · 0.85

Tested by

no test coverage detected