Lines Matching refs:bm

344 struct bitmap2* bm2_insert(struct bitmap* const bm, const UWord a1);
380 Bool bm_cache_lookup(struct bitmap* const bm, const UWord a1, in bm_cache_lookup() argument
384 tl_assert(bm); in bm_cache_lookup()
392 if (a1 == bm->cache[0].a1) in bm_cache_lookup()
394 *bm2 = bm->cache[0].bm2; in bm_cache_lookup()
399 if (a1 == bm->cache[1].a1) in bm_cache_lookup()
401 *bm2 = bm->cache[1].bm2; in bm_cache_lookup()
406 if (a1 == bm->cache[2].a1) in bm_cache_lookup()
408 *bm2 = bm->cache[2].bm2; in bm_cache_lookup()
409 bm_cache_rotate(bm->cache, 3); in bm_cache_lookup()
414 if (a1 == bm->cache[3].a1) in bm_cache_lookup()
416 *bm2 = bm->cache[3].bm2; in bm_cache_lookup()
417 bm_cache_rotate(bm->cache, 4); in bm_cache_lookup()
422 if (a1 == bm->cache[4].a1) in bm_cache_lookup()
424 *bm2 = bm->cache[4].bm2; in bm_cache_lookup()
425 bm_cache_rotate(bm->cache, 5); in bm_cache_lookup()
430 if (a1 == bm->cache[5].a1) in bm_cache_lookup()
432 *bm2 = bm->cache[5].bm2; in bm_cache_lookup()
433 bm_cache_rotate(bm->cache, 6); in bm_cache_lookup()
438 if (a1 == bm->cache[6].a1) in bm_cache_lookup()
440 *bm2 = bm->cache[6].bm2; in bm_cache_lookup()
441 bm_cache_rotate(bm->cache, 7); in bm_cache_lookup()
446 if (a1 == bm->cache[7].a1) in bm_cache_lookup()
448 *bm2 = bm->cache[7].bm2; in bm_cache_lookup()
449 bm_cache_rotate(bm->cache, 8); in bm_cache_lookup()
458 void bm_update_cache(struct bitmap* const bm, in bm_update_cache() argument
463 tl_assert(bm); in bm_update_cache()
470 bm->cache[7] = bm->cache[6]; in bm_update_cache()
473 bm->cache[6] = bm->cache[5]; in bm_update_cache()
476 bm->cache[5] = bm->cache[4]; in bm_update_cache()
479 bm->cache[4] = bm->cache[3]; in bm_update_cache()
482 bm->cache[3] = bm->cache[2]; in bm_update_cache()
485 bm->cache[2] = bm->cache[1]; in bm_update_cache()
488 bm->cache[1] = bm->cache[0]; in bm_update_cache()
490 bm->cache[0].a1 = a1; in bm_update_cache()
491 bm->cache[0].bm2 = bm2; in bm_update_cache()
503 const struct bitmap2* bm2_lookup(struct bitmap* const bm, const UWord a1) in bm2_lookup() argument
508 tl_assert(bm); in bm2_lookup()
511 if (! bm_cache_lookup(bm, a1, &bm2)) in bm2_lookup()
513 bm2 = VG_(OSetGen_Lookup)(bm->oset, &a1); in bm2_lookup()
514 bm_update_cache(bm, a1, bm2); in bm2_lookup()
528 bm2_lookup_exclusive(struct bitmap* const bm, const UWord a1) in bm2_lookup_exclusive() argument
533 tl_assert(bm); in bm2_lookup_exclusive()
536 if (! bm_cache_lookup(bm, a1, &bm2)) in bm2_lookup_exclusive()
538 bm2 = VG_(OSetGen_Lookup)(bm->oset, &a1); in bm2_lookup_exclusive()
563 struct bitmap2* bm2_insert(struct bitmap* const bm, const UWord a1) in bm2_insert() argument
568 tl_assert(bm); in bm2_insert()
573 bm2 = VG_(OSetGen_AllocNode)(bm->oset, sizeof(*bm2)); in bm2_insert()
575 VG_(OSetGen_Insert)(bm->oset, bm2); in bm2_insert()
577 bm_update_cache(bm, a1, bm2); in bm2_insert()
583 struct bitmap2* bm2_insert_copy(struct bitmap* const bm, in bm2_insert_copy() argument
588 bm2_copy = bm2_insert(bm, bm2->addr); in bm2_insert_copy()
601 struct bitmap2* bm2_lookup_or_insert(struct bitmap* const bm, const UWord a1) in bm2_lookup_or_insert() argument
606 tl_assert(bm); in bm2_lookup_or_insert()
609 if (bm_cache_lookup(bm, a1, &bm2)) in bm2_lookup_or_insert()
613 bm2 = bm2_insert(bm, a1); in bm2_lookup_or_insert()
619 bm2 = VG_(OSetGen_Lookup)(bm->oset, &a1); in bm2_lookup_or_insert()
622 bm2 = bm2_insert(bm, a1); in bm2_lookup_or_insert()
625 bm_update_cache(bm, a1, bm2); in bm2_lookup_or_insert()
638 struct bitmap2* bm2_lookup_or_insert_exclusive(struct bitmap* const bm, in bm2_lookup_or_insert_exclusive() argument
641 return bm2_lookup_or_insert(bm, a1); in bm2_lookup_or_insert_exclusive()
645 void bm2_remove(struct bitmap* const bm, const UWord a1) in bm2_remove() argument
650 tl_assert(bm); in bm2_remove()
653 bm2 = VG_(OSetGen_Remove)(bm->oset, &a1); in bm2_remove()
654 VG_(OSetGen_FreeNode)(bm->oset, bm2); in bm2_remove()
656 bm_update_cache(bm, a1, NULL); in bm2_remove()
660 void bm_access_aligned_load(struct bitmap* const bm, in bm_access_aligned_load() argument
666 tl_assert(bm); in bm_access_aligned_load()
669 bm2 = bm2_lookup_or_insert_exclusive(bm, address_msb(a1)); in bm_access_aligned_load()
676 void bm_access_aligned_store(struct bitmap* const bm, in bm_access_aligned_store() argument
682 tl_assert(bm); in bm_access_aligned_store()
685 bm2 = bm2_lookup_or_insert_exclusive(bm, address_msb(a1)); in bm_access_aligned_store()
692 Bool bm_aligned_load_has_conflict_with(struct bitmap* const bm, in bm_aligned_load_has_conflict_with() argument
698 tl_assert(bm); in bm_aligned_load_has_conflict_with()
701 bm2 = bm2_lookup(bm, address_msb(a)); in bm_aligned_load_has_conflict_with()
709 Bool bm_aligned_store_has_conflict_with(struct bitmap* const bm, in bm_aligned_store_has_conflict_with() argument
715 tl_assert(bm); in bm_aligned_store_has_conflict_with()
718 bm2 = bm2_lookup(bm, address_msb(a)); in bm_aligned_store_has_conflict_with()