Lines Matching defs:CLG_
47 CommandLineOptions CLG_(clo);
48 Statistics CLG_(stat);
49 Bool CLG_(instrument_state) = True; /* Instrumentation on ? */
52 exec_state CLG_(current_state);
59 static void CLG_(init_statistics)(Statistics* s)
109 CLG_(bb_base) + ii->instr_offset, ii->instr_size);
111 if (!CLG_(current_state).collect) return;
115 CLG_(current_state).cost[ fullOffset(EG_BUS) ]++;
117 if (CLG_(current_state).nonskipped)
118 cost_Bus = CLG_(current_state).nonskipped->skipped + fullOffset(EG_BUS);
120 cost_Bus = CLG_(cost_base) + ii->cost_offset + ii->eventset->offset[EG_BUS];
138 CLG_(bb_base) + ii->instr_offset, taken);
140 miss = 1 & do_cond_branch_predict(CLG_(bb_base) + ii->instr_offset, taken);
142 if (!CLG_(current_state).collect) return;
146 if (CLG_(current_state).nonskipped)
147 cost_Bc = CLG_(current_state).nonskipped->skipped + fullOffset(EG_BC);
149 cost_Bc = CLG_(cost_base) + ii->cost_offset + ii->eventset->offset[EG_BC];
152 CLG_(current_state).cost[ fullOffset_Bc ]++;
155 CLG_(current_state).cost[ fullOffset_Bc+1 ]++;
168 CLG_(bb_base) + ii->instr_offset, actual_dst);
170 miss = 1 & do_ind_branch_predict(CLG_(bb_base) + ii->instr_offset, actual_dst);
172 if (!CLG_(current_state).collect) return;
176 if (CLG_(current_state).nonskipped)
177 cost_Bi = CLG_(current_state).nonskipped->skipped + fullOffset(EG_BI);
179 cost_Bi = CLG_(cost_base) + ii->cost_offset + ii->eventset->offset[EG_BI];
182 CLG_(current_state).cost[ fullOffset_Bi ]++;
185 CLG_(current_state).cost[ fullOffset_Bi+1 ]++;
393 ev->inode->eventset = CLG_(sets).base;
397 ev->inode->eventset = CLG_(add_event_group)(ev->inode->eventset,
403 ev->inode->eventset = CLG_(add_event_group)(ev->inode->eventset,
408 ev->inode->eventset = CLG_(add_event_group)(ev->inode->eventset,
413 ev->inode->eventset = CLG_(add_event_group)(ev->inode->eventset,
418 ev->inode->eventset = CLG_(add_event_group)(ev->inode->eventset,
465 helperName = CLG_(cachesim).log_1I1Dr_name;
466 helperAddr = CLG_(cachesim).log_1I1Dr;
477 helperName = CLG_(cachesim).log_1I1Dw_name;
478 helperAddr = CLG_(cachesim).log_1I1Dw;
488 helperName = CLG_(cachesim).log_3I0D_name;
489 helperAddr = CLG_(cachesim).log_3I0D;
499 helperName = CLG_(cachesim).log_2I0D_name;
500 helperAddr = CLG_(cachesim).log_2I0D;
508 helperName = CLG_(cachesim).log_1I0D_name;
509 helperAddr = CLG_(cachesim).log_1I0D;
517 helperName = CLG_(cachesim).log_0I1Dr_name;
518 helperAddr = CLG_(cachesim).log_0I1Dr;
528 helperName = CLG_(cachesim).log_0I1Dw_name;
529 helperAddr = CLG_(cachesim).log_0I1Dw;
598 if (!CLG_(clo).simulate_cache) return;
616 if (!CLG_(clo).simulate_cache) return;
637 if (!CLG_(clo).simulate_cache) return;
671 if (!CLG_(clo).simulate_branch) return;
691 if (!CLG_(clo).simulate_branch) return;
708 if (!CLG_(clo).collect_bus) return;
747 CLG_(stat).distinct_instrs++;
807 * Called from CLG_(get_bb)
809 void CLG_(collectBlockInfo)(IRSB* sbIn,
894 VG_(fnptr_to_fnentry)( & CLG_(setup_bbcc) ),
901 IRSB* CLG_(instrument)( VgCallbackClosure* closure,
922 if (! CLG_(instrument_state)) {
956 clgs.bb = CLG_(get_bb)(origAddr, sbIn, &(clgs.seen_before));
1096 * This heuristic is precalculated in CLG_(collectBlockInfo)().
1158 (UWord) &CLG_(current_state).jmps_passed,
1210 (UWord) &CLG_(current_state).jmps_passed,
1265 CLG_(delete_bb)(orig_addr);
1270 /*--- CLG_(fini)() and related function ---*/
1279 for(i = 0; i < CLG_(current_call_stack).sp; i++) {
1280 if (!CLG_(current_call_stack).entry[i].jcc) continue;
1283 CLG_(copy_cost)( CLG_(sets).full,
1284 CLG_(current_call_stack).entry[i].enter_cost,
1285 CLG_(current_state).cost );
1286 CLG_(current_call_stack).entry[i].jcc->call_counter = 0;
1289 CLG_(forall_bbccs)(CLG_(zero_bbcc));
1292 CLG_(copy_cost)( CLG_(sets).full,
1293 t->lastdump_cost, CLG_(current_state).cost );
1296 void CLG_(zero_all_cost)(Bool only_current_thread)
1302 zero_thread_cost(CLG_(get_current_thread)());
1304 CLG_(forall_threads)(zero_thread_cost);
1314 while(CLG_(current_state).sig !=0)
1315 CLG_(post_signal)(CLG_(current_tid),CLG_(current_state).sig);
1318 while(CLG_(current_call_stack).sp>0)
1319 CLG_(pop_call_stack)();
1322 CLG_(init_exec_state)( &CLG_(current_state) );
1323 CLG_(current_fn_stack).top = CLG_(current_fn_stack).bottom;
1329 CLG_(zero_cost)( CLG_(sets).full, CLG_(current_state).cost );
1335 void CLG_(set_instrument_state)(Char* reason, Bool state)
1337 if (CLG_(instrument_state) == state) {
1342 CLG_(instrument_state) = state;
1349 CLG_(forall_threads)(unwind_thread);
1350 CLG_(forall_threads)(zero_state_cost);
1351 (*CLG_(cachesim).clear)();
1360 Bool CLG_(handle_client_request)(ThreadId tid, UWord *args, UWord *ret)
1367 CLG_(dump_profile)("Client Request", True);
1375 CLG_(dump_profile)(buf, True);
1381 CLG_(zero_all_cost)(True);
1386 CLG_(current_state).collect = !CLG_(current_state).collect;
1388 CLG_(current_state).collect ? "ON" : "OFF");
1393 CLG_(set_instrument_state)("Client Request", True);
1398 CLG_(set_instrument_state)("Client Request", False);
1424 void CLG_(pre_syscalltime)(ThreadId tid, UInt syscallno,
1427 if (CLG_(clo).collect_systime) {
1439 void CLG_(post_syscalltime)(ThreadId tid, UInt syscallno,
1442 if (CLG_(clo).collect_systime &&
1443 CLG_(current_state).bbcc) {
1460 CLG_(current_state).cost[o] ++;
1461 CLG_(current_state).cost[o+1] += diff;
1462 if (!CLG_(current_state).bbcc->skipped)
1463 CLG_(init_cost_lz)(CLG_(sets).full,
1464 &(CLG_(current_state).bbcc->skipped));
1465 CLG_(current_state).bbcc->skipped[o] ++;
1466 CLG_(current_state).bbcc->skipped[o+1] += diff;
1489 total = CLG_(total_cost);
1528 (*CLG_(cachesim).finish)();
1532 CLG_(forall_threads)(unwind_thread);
1534 CLG_(dump_profile)(0, False);
1536 CLG_(finish_command)();
1543 CLG_(stat).full_debug_BBs +
1544 CLG_(stat).fn_name_debug_BBs +
1545 CLG_(stat).file_line_debug_BBs +
1546 CLG_(stat).no_debug_BBs;
1550 CLG_(stat).distinct_objs);
1552 CLG_(stat).distinct_files);
1554 CLG_(stat).distinct_fns);
1556 CLG_(stat).distinct_contexts);
1558 CLG_(stat).distinct_bbs);
1560 CLG_(costarray_entries), CLG_(costarray_chunks));
1562 CLG_(stat).distinct_bbccs);
1564 CLG_(stat).distinct_jccs);
1566 CLG_(stat).distinct_skips);
1571 CLG_(stat).full_debug_BBs * 100 / BB_lookups,
1572 CLG_(stat).full_debug_BBs);
1574 CLG_(stat).file_line_debug_BBs * 100 / BB_lookups,
1575 CLG_(stat).file_line_debug_BBs);
1577 CLG_(stat).fn_name_debug_BBs * 100 / BB_lookups,
1578 CLG_(stat).fn_name_debug_BBs);
1580 CLG_(stat).no_debug_BBs * 100 / BB_lookups,
1581 CLG_(stat).no_debug_BBs);
1584 CLG_(stat).bbcc_clones);
1586 CLG_(stat).bb_retranslations);
1588 CLG_(stat).distinct_instrs);
1592 CLG_(stat).cxt_lru_misses);
1594 CLG_(stat).bbcc_lru_misses);
1596 CLG_(stat).jcc_lru_misses);
1598 CLG_(stat).bb_executions);
1600 CLG_(stat).call_counter);
1602 CLG_(stat).jcnd_counter);
1604 CLG_(stat).jump_counter);
1606 CLG_(stat).rec_call_counter);
1608 CLG_(stat).ret_counter);
1613 CLG_(sprint_eventmapping)(buf, CLG_(dumpmap));
1615 CLG_(sprint_mappingcost)(buf, CLG_(dumpmap), CLG_(total_cost));
1620 total = CLG_(total_cost);
1623 if (CLG_(clo).simulate_cache) {
1627 if (CLG_(clo).simulate_branch) {
1640 if (CLG_(clo).simulate_cache)
1641 (*CLG_(cachesim).printstat)(l1, l2, l3);
1643 if (CLG_(clo).simulate_branch)
1649 void CLG_(fini)(Int exitcode)
1666 /* throttle calls to CLG_(run_thread) by number of BBs executed */
1670 CLG_(run_thread)( tid );
1674 void CLG_(post_clo_init)(void)
1679 CLG_DEBUG(1, " dump threads: %s\n", CLG_(clo).separate_threads ? "Yes":"No");
1680 CLG_DEBUG(1, " call sep. : %d\n", CLG_(clo).separate_callers);
1681 CLG_DEBUG(1, " rec. sep. : %d\n", CLG_(clo).separate_recursions);
1683 if (!CLG_(clo).dump_line && !CLG_(clo).dump_instr && !CLG_(clo).dump_bb) {
1685 CLG_(clo).dump_line = True;
1688 CLG_(init_dumps)();
1689 CLG_(init_command)();
1691 (*CLG_(cachesim).post_clo_init)();
1693 CLG_(init_eventsets)();
1694 CLG_(init_statistics)(& CLG_(stat));
1695 CLG_(init_cost_lz)( CLG_(sets).full, &CLG_(total_cost) );
1698 CLG_(init_obj_table)();
1699 CLG_(init_cxt_table)();
1700 CLG_(init_bb_hash)();
1702 CLG_(init_threads)();
1703 CLG_(run_thread)(1);
1705 CLG_(instrument_state) = CLG_(clo).instrument_atstart;
1714 void CLG_(pre_clo_init)(void)
1724 VG_(basic_tool_funcs) (CLG_(post_clo_init),
1725 CLG_(instrument),
1726 CLG_(fini));
1731 VG_(needs_command_line_options)(CLG_(process_cmd_line_option),
1732 CLG_(print_usage),
1733 CLG_(print_debug_usage));
1735 VG_(needs_client_requests)(CLG_(handle_client_request));
1736 VG_(needs_syscall_wrapper)(CLG_(pre_syscalltime),
1737 CLG_(post_syscalltime));
1740 VG_(track_pre_deliver_signal) ( & CLG_(pre_signal) );
1741 VG_(track_post_deliver_signal)( & CLG_(post_signal) );
1743 CLG_(set_clo_defaults)();
1746 VG_DETERMINE_INTERFACE_VERSION(CLG_(pre_clo_init))