Example #1
0
//GVN try to assign a value numbers to expressions.
bool IR_GVN::perform(OPT_CTX & oc)
{
	IR_BB_LIST * bbl = m_ru->get_bb_list();
	if (bbl->get_elem_count() == 0) { return false; }

	START_TIMER_AFTER();
	m_ru->check_valid_and_recompute(&oc, OPT_DU_CHAIN, OPT_DU_REF, OPT_RPO,
									OPT_DOM, OPT_UNDEF);

	LIST<IR_BB*> * tbbl = m_cfg->get_bblist_in_rpo();
	IS_TRUE0(tbbl->get_elem_count() == bbl->get_elem_count());

	UINT count = 0;
	bool change = true;

	#ifdef DEBUG_GVN
	while (change && count < 10) {
		change = false;
	#endif
		for (IR_BB * bb = tbbl->get_head();
			 bb != NULL; bb = tbbl->get_next()) {
			process_bb(bb, change);
		} //end for BB
		count++;
	#ifdef DEBUG_GVN
	} //end while
	IS_TRUE0(!change && count <= 2);
	#endif

	//dump();
	END_TIMER_AFTER(get_opt_name());
	IS_TRUE0(verify());
	m_is_valid = true;
	return true;
}
Example #2
0
int configure_accelerator(MachineState *ms)
{
    const char *p;
    char buf[10];
    int ret;
    bool accel_initialised = false;
    bool init_failed = false;
    AccelClass *acc = NULL;

    p = qemu_opt_get(qemu_get_machine_opts(), "accel");
    if (p == NULL) {
        /* Use the default "accelerator", tcg */
        p = "tcg";
    }

    while (!accel_initialised && *p != '\0') {
        if (*p == ':') {
            p++;
        }
        p = get_opt_name(buf, sizeof(buf), p, ':');
        acc = accel_find(buf);
        if (!acc) {
            fprintf(stderr, "\"%s\" accelerator not found.\n", buf);
            continue;
        }
        if (acc->available && !acc->available()) {
            printf("%s not supported for this target\n",
                   acc->name);
            continue;
        }
        ret = accel_init_machine(acc, ms);
        if (ret < 0) {
            init_failed = true;
            fprintf(stderr, "failed to initialize %s: %s\n",
                    acc->name,
                    strerror(-ret));
        } else {
            accel_initialised = true;
        }
    }

    if (!accel_initialised) {
        if (!init_failed) {
            fprintf(stderr, "No accelerator found!\n");
        }
        exit(1);
    }

    if (init_failed) {
        fprintf(stderr, "Back to %s accelerator.\n", acc->name);
    }

    return !accel_initialised;
}
Example #3
0
File: accel.c Project: 8tab/qemu
void configure_accelerator(MachineState *ms)
{
    const char *accel, *p;
    char buf[10];
    int ret;
    bool accel_initialised = false;
    bool init_failed = false;
    AccelClass *acc = NULL;

    accel = qemu_opt_get(qemu_get_machine_opts(), "accel");
    if (accel == NULL) {
        /* Use the default "accelerator", tcg */
        accel = "tcg";
    }

    p = accel;
    while (!accel_initialised && *p != '\0') {
        if (*p == ':') {
            p++;
        }
        p = get_opt_name(buf, sizeof(buf), p, ':');
        acc = accel_find(buf);
        if (!acc) {
            continue;
        }
        if (acc->available && !acc->available()) {
            printf("%s not supported for this target\n",
                   acc->name);
            continue;
        }
        ret = accel_init_machine(acc, ms);
        if (ret < 0) {
            init_failed = true;
            error_report("failed to initialize %s: %s",
                         acc->name, strerror(-ret));
        } else {
            accel_initialised = true;
        }
    }

    if (!accel_initialised) {
        if (!init_failed) {
            error_report("-machine accel=%s: No accelerator found", accel);
        }
        exit(1);
    }

    if (init_failed) {
        error_report("Back to %s accelerator", acc->name);
    }
}