Пример #1
0
static void
mp_set_body_hitmiss(int edge_id, int hm_id, int set)
{
    int		    i, num, ts0, ts, offset, mblk_id = 1, set1;
    tcfg_node_t	    *bbi;
    loop_t	    *lp;

    bbi = tcfg_edges[edge_id]->dst; 
    lp = bbi_hm_list[bbi->id][hm_id];
    num = bbi->bb->num_inst;
    set1 = SET(bbi->bb->sa);
    if (set1 == set)
	bodies[edge_id][0].ic_flag = IC_UNCLEAR;
    else
	bodies[edge_id][0].ic_flag = get_mblk_hitmiss(bbi, 0, lp);
    for (i = 1; i < num; i++) {
	offset = CACHE_LINE(bbi->bb->code[i].addr);
	if (offset == 0) {
	    set1 = SET(bbi->bb->code[i].addr);
	    if (set1 == set)
		bodies[edge_id][i].ic_flag = IC_UNCLEAR;
	    else
		bodies[edge_id][i].ic_flag = get_mblk_hitmiss(bbi, mblk_id, lp);
	    mblk_id++;
	}
    }
}
Пример #2
0
static void
est_start_unit()
{
    int		    num_b, num_e, offset, i, t, unit_estimated = 0;
    tcfg_node_t	    *bbi = tcfg[0];
    tcfg_edge_t	    *e;
    code_link_t	    *elog;

    num_b = tcfg[0]->bb->num_inst;
    start_body[0].ic_flag = IC_MISS;
    for (i = 1; i < num_b; i++) {
	offset = CACHE_LINE(bbi->bb->code[i].addr);
	if (offset == 0)
	    start_body[i].ic_flag = IC_MISS;
    }

    for (e = bbi->out; e != NULL; e = e->next_out) {
	for (elog = epilogs[e->id]; elog != NULL; elog = elog->next) {
	    num_e = elog->num_inst;
	    create_egraph(NULL, 0, elog->code, num_e, start_body, num_b,
		    BP_CPRED, loops[0]);
	    t = est_egraph();
	    if (t > start_time)
		start_time = t;
	    unit_estimated = 1;
	}
    }

    if (unit_estimated == 0) {
	create_egraph(NULL, 0, NULL, 0, start_body, num_b, BP_CPRED, loops[0]);
	t = est_egraph();
	if (t > start_time)
	    start_time = t;
    }
}
Пример #3
0
void _cache_writeback(CACHE_t *cache, size_t block_n, BLOCK_t *block, MEMBUF_t *mem) {

    debug("Writing back block %zu of set %zu from %scache to %08X.\n",
            block_n, block->tag & (cache->n_sets - 1), cache->name, block->tag);

    size_t set = block->tag & (cache->n_sets - 1);

    memcpy(&(*mem)[block->tag - MIPS_RESERVE],
        CACHE_LINE(cache, set, block_n), 
        cache->n_words * sizeof(b32));
}
Пример #4
0
static void
get_loop_affected_sets(int lp_id, tcfg_edge_t *mp_edge, int num_inst)
{
    tcfg_edge_t		*edge;
    tcfg_node_t		*bbi;
    tcfg_elink_t	*elink;
    int			offset, i, k, set, tag;

    if (mp_edge == mp_edge->src->out)
	edge = mp_edge->next_out;
    else
	edge = mp_edge->src->out;
    if (edge->flags == 1)
	return;

    for (i = num_inst; i < num_mp_insts[edge->id]; i++) {
	offset = CACHE_LINE(mp_insts[edge->id][i]->addr);
	if (offset == 0)
	    break;
    }
    memset(num_mp_set_tags, 0, cache.ns * sizeof(int));
    for (; i < num_mp_insts[edge->id]; i++) {
	set = SET(mp_insts[edge->id][i]->addr);
	if (num_mp_set_tags[set] == cache.na)
	    continue;
	tag = TAG(mp_insts[edge->id][i]->addr);
	if (num_mp_set_tags[set] == 0) {
	    mp_set_tags[set][0] = tag;
	    num_mp_set_tags[set] = 1;
	} else {
	    for (k = 0; k < num_mp_set_tags[set]; k++) {
		if (tag == mp_set_tags[set][k])
		    break;
	    }
	    if (k == num_mp_set_tags[set]) {
		mp_set_tags[set][k] = tag;
		num_mp_set_tags[set]++;
	    }
	}
    }

    for (set = 0; set < cache.ns; set++) {
	i = num_mblk_conflicts[lp_id][set];
	if (i > cache.na)
	    continue;
	if ((num_mp_set_tags[set] + i) > cache.na) {
	    elink = (tcfg_elink_t *) calloc(1, sizeof(tcfg_elink_t *));
	    elink->edge = edge;
	    elink->next = mp_affected_sets[lp_id][set];
	    mp_affected_sets[lp_id][set] = elink;
	}
    }
}