Example #1
0
scoring::ContingencyTableNode* scoring::ADTree::makeContabLeafList(varset variables, bitset &records) {
    if (variables == zero) {
        ContingencyTableNode *ct = new ContingencyTableNode(records.count(), 0, 1);
        return ct;
    }

    int firstIndex = VARSET_FIND_FIRST_SET(variables); // first set bit
    int cardinality = network.getCardinality(firstIndex);
    ContingencyTableNode *ct = new ContingencyTableNode(0, cardinality, 0);
    varset remainingVariables = VARSET_CLEAR(variables, firstIndex); // clear bit

    BITSET_CREATE(r, recordCount);
    for (int k = 0; k < cardinality; k++) {
        BITSET_CLEAR(r);
        BITSET_OR(r, records);
        BITSET_AND(r, consistentRecords[firstIndex][k]);

        if (BITSET_COUNT(r) > 0) {
            ContingencyTableNode *child = makeContabLeafList(remainingVariables, r);
            ct->setChild(k, child);
            ct->leafCount += child->leafCount;
        }
    }

    return ct;
}
Example #2
0
static bool
set_ssa_def_dead(nir_ssa_def *def, void *void_live)
{
   BITSET_WORD *live = void_live;

   BITSET_CLEAR(live, def->live_index);

   return true;
}
Example #3
0
void
nouveau_state_emit(struct gl_context *ctx)
{
	struct nouveau_context *nctx = to_nouveau_context(ctx);
	const struct nouveau_driver *drv = context_drv(ctx);
	int i;

	while ((i = nouveau_next_dirty_state(ctx)) >= 0) {
		BITSET_CLEAR(nctx->dirty, i);
		drv->emit[i](ctx, i);
	}

	BITSET_ZERO(nctx->dirty);
}
bool
fs_visitor::dead_code_eliminate()
{
   bool progress = false;

   calculate_live_intervals();

   int num_vars = live_intervals->num_vars;
   BITSET_WORD *live = ralloc_array(NULL, BITSET_WORD, BITSET_WORDS(num_vars));

   foreach_block (block, cfg) {
      memcpy(live, live_intervals->bd[block->num].liveout,
             sizeof(BITSET_WORD) * BITSET_WORDS(num_vars));

      foreach_inst_in_block_reverse(fs_inst, inst, block) {
         if (inst->dst.file == GRF &&
             !inst->has_side_effects() &&
             !inst->writes_flag()) {
            bool result_live = false;

            if (inst->regs_written == 1) {
               int var = live_intervals->var_from_reg(&inst->dst);
               result_live = BITSET_TEST(live, var);
            } else {
               int var = live_intervals->var_from_vgrf[inst->dst.reg];
               for (int i = 0; i < inst->regs_written; i++) {
                  result_live = result_live || BITSET_TEST(live, var + i);
               }
            }

            if (!result_live) {
               progress = true;

               if (inst->writes_accumulator) {
                  inst->dst = fs_reg(retype(brw_null_reg(), inst->dst.type));
               } else {
                  inst->opcode = BRW_OPCODE_NOP;
                  continue;
               }
            }
         }

         if (inst->dst.file == GRF) {
            if (!inst->is_partial_write()) {
               int var = live_intervals->var_from_vgrf[inst->dst.reg];
               for (int i = 0; i < inst->regs_written; i++) {
                  BITSET_CLEAR(live, var + inst->dst.reg_offset + i);
               }
            }
         }

         for (int i = 0; i < inst->sources; i++) {
            if (inst->src[i].file == GRF) {
               int var = live_intervals->var_from_vgrf[inst->src[i].reg];

               for (int j = 0; j < inst->regs_read(this, i); j++) {
                  BITSET_SET(live, var + inst->src[i].reg_offset + j);
               }
            }
         }
      }
   }