Lines Matching refs:bm

343 struct bitmap2* bm2_insert(struct bitmap* const bm, const UWord a1);
379 Bool bm_cache_lookup(struct bitmap* const bm, const UWord a1,
383 tl_assert(bm);
391 if (a1 == bm->cache[0].a1)
393 *bm2 = bm->cache[0].bm2;
398 if (a1 == bm->cache[1].a1)
400 *bm2 = bm->cache[1].bm2;
405 if (a1 == bm->cache[2].a1)
407 *bm2 = bm->cache[2].bm2;
408 bm_cache_rotate(bm->cache, 3);
413 if (a1 == bm->cache[3].a1)
415 *bm2 = bm->cache[3].bm2;
416 bm_cache_rotate(bm->cache, 4);
421 if (a1 == bm->cache[4].a1)
423 *bm2 = bm->cache[4].bm2;
424 bm_cache_rotate(bm->cache, 5);
429 if (a1 == bm->cache[5].a1)
431 *bm2 = bm->cache[5].bm2;
432 bm_cache_rotate(bm->cache, 6);
437 if (a1 == bm->cache[6].a1)
439 *bm2 = bm->cache[6].bm2;
440 bm_cache_rotate(bm->cache, 7);
445 if (a1 == bm->cache[7].a1)
447 *bm2 = bm->cache[7].bm2;
448 bm_cache_rotate(bm->cache, 8);
457 void bm_update_cache(struct bitmap* const bm,
462 tl_assert(bm);
469 bm->cache[7] = bm->cache[6];
472 bm->cache[6] = bm->cache[5];
475 bm->cache[5] = bm->cache[4];
478 bm->cache[4] = bm->cache[3];
481 bm->cache[3] = bm->cache[2];
484 bm->cache[2] = bm->cache[1];
487 bm->cache[1] = bm->cache[0];
489 bm->cache[0].a1 = a1;
490 bm->cache[0].bm2 = bm2;
494 * Look up the address a1 in bitmap bm and return a pointer to a potentially
499 * @param bm bitmap pointer.
502 const struct bitmap2* bm2_lookup(struct bitmap* const bm, const UWord a1)
507 tl_assert(bm);
510 if (! bm_cache_lookup(bm, a1, &bm2))
512 bm2 = VG_(OSetGen_Lookup)(bm->oset, &a1);
513 bm_update_cache(bm, a1, bm2);
519 * Look up the address a1 in bitmap bm and return a pointer to a second
523 * @param bm bitmap pointer.
527 bm2_lookup_exclusive(struct bitmap* const bm, const UWord a1)
532 tl_assert(bm);
535 if (! bm_cache_lookup(bm, a1, &bm2))
537 bm2 = VG_(OSetGen_Lookup)(bm->oset, &a1);
556 * @param bm bitmap pointer.
562 struct bitmap2* bm2_insert(struct bitmap* const bm, const UWord a1)
567 tl_assert(bm);
572 bm2 = VG_(OSetGen_AllocNode)(bm->oset, sizeof(*bm2));
574 VG_(OSetGen_Insert)(bm->oset, bm2);
576 bm_update_cache(bm, a1, bm2);
582 struct bitmap2* bm2_insert_copy(struct bitmap* const bm,
587 bm2_copy = bm2_insert(bm, bm2->addr);
593 * Look up the address a1 in bitmap bm, and insert it if not found.
596 * @param bm bitmap pointer.
600 struct bitmap2* bm2_lookup_or_insert(struct bitmap* const bm, const UWord a1)
605 tl_assert(bm);
608 if (bm_cache_lookup(bm, a1, &bm2))
612 bm2 = bm2_insert(bm, a1);
618 bm2 = VG_(OSetGen_Lookup)(bm->oset, &a1);
621 bm2 = bm2_insert(bm, a1);
624 bm_update_cache(bm, a1, bm2);
630 * Look up the address a1 in bitmap bm, and insert it if not found.
634 * @param bm bitmap pointer.
637 struct bitmap2* bm2_lookup_or_insert_exclusive(struct bitmap* const bm,
640 return bm2_lookup_or_insert(bm, a1);
644 void bm2_remove(struct bitmap* const bm, const UWord a1)
649 tl_assert(bm);
652 bm2 = VG_(OSetGen_Remove)(bm->oset, &a1);
653 VG_(OSetGen_FreeNode)(bm->oset, bm2);
655 bm_update_cache(bm, a1, NULL);
659 void bm_access_aligned_load(struct bitmap* const bm,
665 tl_assert(bm);
668 bm2 = bm2_lookup_or_insert_exclusive(bm, address_msb(a1));
675 void bm_access_aligned_store(struct bitmap* const bm,
681 tl_assert(bm);
684 bm2 = bm2_lookup_or_insert_exclusive(bm, address_msb(a1));
691 Bool bm_aligned_load_has_conflict_with(struct bitmap* const bm,
697 tl_assert(bm);
700 bm2 = bm2_lookup(bm, address_msb(a));
708 Bool bm_aligned_store_has_conflict_with(struct bitmap* const bm,
714 tl_assert(bm);
717 bm2 = bm2_lookup(bm, address_msb(a));