Home | History | Annotate | Download | only in callgrind

Lines Matching refs:bb

3 /*---                                                         bb.c ---*/
32 /*--- Basic block (BB) operations ---*/
35 /* BB hash, resizable */
44 bbs.table = (BB**) CLG_MALLOC("cl.bb.ibh.1",
45 bbs.size * sizeof(BB*));
57 * - BB base as object file offset
65 /* double size of bb table */
70 BB **new_table, *curr, *next;
74 new_table = (BB**) CLG_MALLOC("cl.bb.rbt.1",
75 new_size * sizeof(BB*));
106 CLG_DEBUG(0, "Resize BB Hash: %d => %d (entries %d, conflicts %d/%d)\n",
117 * Allocate new BB structure (including space for event type list)
121 static BB* new_bb(obj_node* obj, PtrdiffT offset,
124 BB* bb;
127 /* check fill degree of bb hash table and resize if needed (>80%) */
132 size = sizeof(BB) + instr_count * sizeof(InstrInfo)
134 bb = (BB*) CLG_MALLOC("cl.bb.nb.1", size);
135 VG_(memset)(bb, 0, size);
137 bb->obj = obj;
138 bb->offset = offset;
140 bb->instr_count = instr_count;
141 bb->cjmp_count = cjmp_count;
142 bb->cjmp_inverted = cjmp_inverted;
143 bb->jmp = (CJmpInfo*) &(bb->instr[instr_count]);
144 bb->instr_len = 0;
145 bb->cost_count = 0;
146 bb->sect_kind = VG_(DebugInfo_sect_kind)(NULL, 0, offset + obj->offset);
147 bb->fn = 0;
148 bb->line = 0;
149 bb->is_entry = 0;
150 bb->bbcc_list = 0;
151 bb->last_bbcc = 0;
153 /* insert into BB hash table */
155 bb->next = bbs.table[idx];
156 bbs.table[idx] = bb;
166 CLG_(print_bb)(0, bb);
171 CLG_(get_fn_node)(bb);
173 return bb;
177 /* get the BB structure for a BB start address */
179 BB* lookup_bb(obj_node* obj, PtrdiffT offset)
181 BB* bb;
185 bb = bbs.table[idx];
187 while(bb) {
188 if ((bb->obj == obj) && (bb->offset == offset)) break;
189 bb = bb->next;
193 obj->name, offset, bb);
194 return bb;
227 /* Get the BB structure for a BB start address.
228 * If the BB has to be created, the IRBB is needed to
233 * is called from CLG_(instrument)() and a BB already exists:
235 * - The ELF object of the BB was unmapped and mapped again.
237 * looking up a BB keyed by (obj_node, file offset).
239 * bbIn==0 is possible for artifical BB without real code.
240 * Such a BB is created when returning to an unknown function.
242 BB* CLG_(get_bb)(Addr addr, IRSB* bbIn, /*OUT*/ Bool *seen_before)
244 BB* bb;
249 CLG_DEBUG(5, "+ get_bb(BB %#lx)\n", addr);
252 bb = lookup_bb(obj, addr - obj->offset);
258 *seen_before = bb ? True : False;
260 if (bb->instr_count != n_instrs) {
262 "ERROR: BB Retranslation Mismatch at BB %#lx\n", addr);
269 bb->obj->name, bb->obj->offset,
270 bb->offset, bb->instr_count);
271 CLG_ASSERT(bb->instr_count == n_instrs );
273 CLG_ASSERT(bb->cjmp_count == n_jmps );
276 CLG_DEBUG(5, "- get_bb(BB %#lx): seen before.\n", addr);
277 return bb;
280 bb = new_bb(obj, addr - obj->offset, n_instrs, n_jmps, cjmp_inverted);
282 CLG_DEBUG(5, "- get_bb(BB %#lx)\n", addr);
284 return bb;
287 /* Delete the BB info for the bb with unredirected entry-point
291 BB *bb, *bp;
298 bb = bbs.table[idx];
300 /* bb points at the current bb under consideration, and bp is the
303 while(bb) {
304 if ((bb->obj == obj) && (bb->offset == offset)) break;
305 bp = bb;
306 bb = bb->next;
309 if (bb == NULL) {
315 * was off at BB translation time, ie. no BB was created.
324 tl_assert(bb == bbs.table[idx]);
325 bbs.table[idx] = bb->next;
327 tl_assert(bb != bbs.table[idx]);
328 bp->next = bb->next;
332 obj->name, offset, bb, bb->bbcc_list);
334 if (bb->bbcc_list == 0) {
339 size = sizeof(BB)
340 + bb->instr_count * sizeof(InstrInfo)
341 + (bb->cjmp_count+1) * sizeof(CJmpInfo);
342 VG_(memset)( bb, 0xAA, size );
343 CLG_FREE(bb);
346 CLG_DEBUG(3, " delete_bb: BB in use, can not free!\n");