Lines Matching refs:tab

1418 static void ir_hashtab_resize(ir_hashtab *tab)  argument
1420 uint32_t old_hash_size = (uint32_t)(-(int32_t)tab->mask);
1421 char *old_data = tab->data;
1422 uint32_t size = tab->size * 2;
1429 tab->data = data + (hash_size * sizeof(uint32_t));
1430 tab->mask = (uint32_t)(-(int32_t)hash_size);
1431 tab->size = size;
1433 memcpy(tab->data, old_data, tab->count * sizeof(ir_hashtab_bucket));
1436 i = tab->count;
1438 p = (ir_hashtab_bucket*)tab->data;
1440 uint32_t key = p->key | tab->mask;
1441 p->next = ((uint32_t*)tab->data)[(int32_t)key];
1442 ((uint32_t*)tab->data)[(int32_t)key] = pos;
1448 void ir_hashtab_init(ir_hashtab *tab, uint32_t size) argument
1454 tab->data = (data + (hash_size * sizeof(uint32_t)));
1455 tab->mask = (uint32_t)(-(int32_t)hash_size);
1456 tab->size = size;
1457 tab->count = 0;
1458 tab->pos = 0;
1461 void ir_hashtab_free(ir_hashtab *tab) argument
1463 uint32_t hash_size = (uint32_t)(-(int32_t)tab->mask);
1464 char *data = (char*)tab->data - (hash_size * sizeof(uint32_t));
1466 tab->data = NULL;
1469 ir_ref ir_hashtab_find(const ir_hashtab *tab, uint32_t key) argument
1471 const char *data = (const char*)tab->data;
1472 uint32_t pos = ((uint32_t*)data)[(int32_t)(key | tab->mask)];
1485 bool ir_hashtab_add(ir_hashtab *tab, uint32_t key, ir_ref val) argument
1487 char *data = (char*)tab->data;
1488 uint32_t pos = ((uint32_t*)data)[(int32_t)(key | tab->mask)];
1499 if (UNEXPECTED(tab->count >= tab->size)) {
1500 ir_hashtab_resize(tab);
1501 data = tab->data;
1504 pos = tab->pos;
1505 tab->pos += sizeof(ir_hashtab_bucket);
1506 tab->count++;
1510 key |= tab->mask;
1521 void ir_hashtab_key_sort(ir_hashtab *tab) argument
1526 if (!tab->count) {
1530 qsort(tab->data, tab->count, sizeof(ir_hashtab_bucket), ir_hashtab_key_cmp);
1532 hash_size = ir_hashtab_hash_size(tab->size);
1533 memset((char*)tab->data - (hash_size * sizeof(uint32_t)), -1, hash_size * sizeof(uint32_t));
1535 i = tab->count;
1537 p = (ir_hashtab_bucket*)tab->data;
1539 uint32_t key = p->key | tab->mask;
1540 p->next = ((uint32_t*)tab->data)[(int32_t)key];
1541 ((uint32_t*)tab->data)[(int32_t)key] = pos;
1547 static void ir_addrtab_resize(ir_hashtab *tab) argument
1549 uint32_t old_hash_size = (uint32_t)(-(int32_t)tab->mask);
1550 char *old_data = tab->data;
1551 uint32_t size = tab->size * 2;
1558 tab->data = data + (hash_size * sizeof(uint32_t));
1559 tab->mask = (uint32_t)(-(int32_t)hash_size);
1560 tab->size = size;
1562 memcpy(tab->data, old_data, tab->count * sizeof(ir_addrtab_bucket));
1565 i = tab->count;
1567 p = (ir_addrtab_bucket*)tab->data;
1569 uint32_t key = (uint32_t)p->key | tab->mask;
1570 p->next = ((uint32_t*)tab->data)[(int32_t)key];
1571 ((uint32_t*)tab->data)[(int32_t)key] = pos;
1577 void ir_addrtab_init(ir_hashtab *tab, uint32_t size) argument
1583 tab->data = (data + (hash_size * sizeof(uint32_t)));
1584 tab->mask = (uint32_t)(-(int32_t)hash_size);
1585 tab->size = size;
1586 tab->count = 0;
1587 tab->pos = 0;
1590 void ir_addrtab_free(ir_hashtab *tab) argument
1592 uint32_t hash_size = (uint32_t)(-(int32_t)tab->mask);
1593 char *data = (char*)tab->data - (hash_size * sizeof(uint32_t));
1595 tab->data = NULL;
1598 ir_ref ir_addrtab_find(const ir_hashtab *tab, uint64_t key) argument
1600 const char *data = (const char*)tab->data;
1601 uint32_t pos = ((uint32_t*)data)[(int32_t)(key | tab->mask)];
1614 void ir_addrtab_set(ir_hashtab *tab, uint64_t key, ir_ref val) argument
1616 char *data = (char*)tab->data;
1617 uint32_t pos = ((uint32_t*)data)[(int32_t)(key | tab->mask)];
1629 if (UNEXPECTED(tab->count >= tab->size)) {
1630 ir_addrtab_resize(tab);
1631 data = tab->data;
1634 pos = tab->pos;
1635 tab->pos += sizeof(ir_addrtab_bucket);
1636 tab->count++;
1640 key |= tab->mask;