Design a method to select predicate branches based on exploration counts
[c11tester.git] / funcnode.cc
1 #include "action.h"
2 #include "history.h"
3 #include "funcnode.h"
4 #include "funcinst.h"
5 #include "predicate.h"
6 #include "concretepredicate.h"
7
8 #include "model.h"
9
10 FuncNode::FuncNode(ModelHistory * history) :
11         history(history),
12         exit_count(0),
13         marker(1),
14         func_inst_map(),
15         inst_list(),
16         entry_insts(),
17         predicate_tree_position(),
18         edge_table(32),
19         out_edges()
20 {
21         predicate_tree_entry = new Predicate(NULL, true);
22         predicate_tree_entry->add_predicate_expr(NOPREDICATE, NULL, true);
23
24         // Memories that are reclaimed after each execution
25         action_list_buffer = new SnapList<action_list_t *>();
26         read_locations = new loc_set_t();
27         write_locations = new loc_set_t();
28         val_loc_map = new HashTable<uint64_t, loc_set_t *, uint64_t, 0>();
29         loc_may_equal_map = new HashTable<void *, loc_set_t *, uintptr_t, 0>();
30
31         //values_may_read_from = new value_set_t();
32 }
33
34 /* Reallocate snapshotted memories when new executions start */
35 void FuncNode::set_new_exec_flag()
36 {
37         action_list_buffer = new SnapList<action_list_t *>();
38         read_locations = new loc_set_t();
39         write_locations = new loc_set_t();
40         val_loc_map = new HashTable<uint64_t, loc_set_t *, uint64_t, 0>();
41         loc_may_equal_map = new HashTable<void *, loc_set_t *, uintptr_t, 0>();
42
43         //values_may_read_from = new value_set_t();
44 }
45
46 /* Check whether FuncInst with the same type, position, and location
47  * as act has been added to func_inst_map or not. If not, add it.
48  *
49  * Note: currently, actions with the same position are filtered out by process_action,
50  * so the collision list of FuncInst is not used. May remove it later. 
51  */
52 void FuncNode::add_inst(ModelAction *act)
53 {
54         ASSERT(act);
55         const char * position = act->get_position();
56
57         /* THREAD* actions, ATOMIC_LOCK, ATOMIC_TRYLOCK, and ATOMIC_UNLOCK
58          * actions are not tagged with their source line numbers
59          */
60         if (position == NULL)
61                 return;
62
63         if ( func_inst_map.contains(position) ) {
64                 FuncInst * inst = func_inst_map.get(position);
65
66                 ASSERT(inst->get_type() == act->get_type());
67                 int curr_execution_number = model->get_execution_number();
68
69                 /* Reset locations when new executions start */
70                 if (inst->get_execution_number() != curr_execution_number) {
71                         inst->set_location(act->get_location());
72                         inst->set_execution_number(curr_execution_number);
73                 }
74
75                 if (inst->get_location() != act->get_location())
76                         inst->not_single_location();
77
78                 return;
79         }
80
81         FuncInst * func_inst = new FuncInst(act, this);
82
83         func_inst_map.put(position, func_inst);
84         inst_list.push_back(func_inst);
85 }
86
87 /* Get the FuncInst with the same type, position, and location
88  * as act
89  *
90  * @return FuncInst with the same type, position, and location as act */
91 FuncInst * FuncNode::get_inst(ModelAction *act)
92 {
93         ASSERT(act);
94         const char * position = act->get_position();
95
96         /* THREAD* actions, ATOMIC_LOCK, ATOMIC_TRYLOCK, and ATOMIC_UNLOCK
97          * actions are not tagged with their source line numbers
98          */
99         if (position == NULL)
100                 return NULL;
101
102         FuncInst * inst = func_inst_map.get(position);
103         if (inst == NULL)
104                 return NULL;
105
106         action_type inst_type = inst->get_type();
107         action_type act_type = act->get_type();
108
109         // else if branch: an RMWRCAS action is converted to a RMW or READ action
110         if (inst_type == act_type)
111                 return inst;
112         else if (inst_type == ATOMIC_RMWRCAS &&
113                         (act_type == ATOMIC_RMW || act_type == ATOMIC_READ))
114                 return inst;
115
116         return NULL;
117 }
118
119
120 void FuncNode::add_entry_inst(FuncInst * inst)
121 {
122         if (inst == NULL)
123                 return;
124
125         mllnode<FuncInst *> * it;
126         for (it = entry_insts.begin(); it != NULL; it = it->getNext()) {
127                 if (inst == it->getVal())
128                         return;
129         }
130
131         entry_insts.push_back(inst);
132 }
133
134 /**
135  * @brief Convert ModelAdtion list to FuncInst list 
136  * @param act_list A list of ModelActions
137  */
138 void FuncNode::update_tree(action_list_t * act_list)
139 {
140         if (act_list == NULL || act_list->size() == 0)
141                 return;
142
143         HashTable<void *, value_set_t *, uintptr_t, 0> * write_history = history->getWriteHistory();
144
145         /* build inst_list from act_list for later processing */
146         func_inst_list_t inst_list;
147         action_list_t rw_act_list;
148
149         for (sllnode<ModelAction *> * it = act_list->begin(); it != NULL; it = it->getNext()) {
150                 ModelAction * act = it->getVal();
151                 FuncInst * func_inst = get_inst(act);
152                 void * loc = act->get_location();
153
154                 if (func_inst == NULL)
155                         continue;
156
157                 inst_list.push_back(func_inst);
158                 bool act_added = false;
159
160                 if (act->is_write()) {
161                         rw_act_list.push_back(act);
162                         act_added = true;
163                         if (!write_locations->contains(loc)) {
164                                 write_locations->add(loc);
165                                 history->update_loc_wr_func_nodes_map(loc, this);
166                         }
167                 }
168
169                 if (act->is_read()) {
170                         if (!act_added)
171                                 rw_act_list.push_back(act);
172
173                         /* If func_inst may only read_from a single location, then:
174                          *
175                          * The first time an action reads from some location,
176                          * import all the values that have been written to this
177                          * location from ModelHistory and notify ModelHistory
178                          * that this FuncNode may read from this location.
179                          */
180                         if (!read_locations->contains(loc) && func_inst->is_single_location()) {
181                                 read_locations->add(loc);
182                                 value_set_t * write_values = write_history->get(loc);
183                                 add_to_val_loc_map(write_values, loc);
184                                 history->update_loc_rd_func_nodes_map(loc, this);
185                         }
186                 }
187         }
188
189 //      model_print("function %s\n", func_name);
190 //      print_val_loc_map();
191
192         update_inst_tree(&inst_list);
193         update_predicate_tree(&rw_act_list);
194
195 //      print_predicate_tree();
196 }
197
198 /** 
199  * @brief Link FuncInsts in inst_list  - add one FuncInst to another's predecessors and successors
200  * @param inst_list A list of FuncInsts
201  */
202 void FuncNode::update_inst_tree(func_inst_list_t * inst_list)
203 {
204         if (inst_list == NULL)
205                 return;
206         else if (inst_list->size() == 0)
207                 return;
208
209         /* start linking */
210         sllnode<FuncInst *>* it = inst_list->begin();
211         sllnode<FuncInst *>* prev;
212
213         /* add the first instruction to the list of entry insts */
214         FuncInst * entry_inst = it->getVal();
215         add_entry_inst(entry_inst);
216
217         it = it->getNext();
218         while (it != NULL) {
219                 prev = it->getPrev();
220
221                 FuncInst * prev_inst = prev->getVal();
222                 FuncInst * curr_inst = it->getVal();
223
224                 prev_inst->add_succ(curr_inst);
225                 curr_inst->add_pred(prev_inst);
226
227                 it = it->getNext();
228         }
229 }
230
231 void FuncNode::update_predicate_tree(action_list_t * act_list)
232 {
233         if (act_list == NULL || act_list->size() == 0)
234                 return;
235
236         incr_marker();
237
238         /* Map a FuncInst to the its predicate */
239         HashTable<FuncInst *, Predicate *, uintptr_t, 0> inst_pred_map(128);
240
241         // Number FuncInsts to detect loops
242         HashTable<FuncInst *, uint32_t, uintptr_t, 0> inst_id_map(128);
243         uint32_t inst_counter = 0;
244
245         /* Only need to store the locations of read actions */
246         HashTable<void *, ModelAction *, uintptr_t, 0> loc_act_map(128);
247
248         sllnode<ModelAction *> *it = act_list->begin();
249         Predicate * curr_pred = predicate_tree_entry;
250         while (it != NULL) {
251                 ModelAction * next_act = it->getVal();
252                 FuncInst * next_inst = get_inst(next_act);
253                 next_inst->set_associated_act(next_act, marker);
254
255                 SnapVector<Predicate *> unset_predicates = SnapVector<Predicate *>();
256                 bool branch_found = follow_branch(&curr_pred, next_inst, next_act, &unset_predicates);
257
258                 // A branch with unset predicate expression is detected
259                 if (!branch_found && unset_predicates.size() != 0) {
260                         ASSERT(unset_predicates.size() == 1);
261                         Predicate * one_branch = unset_predicates[0];
262
263                         bool amended = amend_predicate_expr(&curr_pred, next_inst, next_act);
264                         if (amended)
265                                 continue;
266                         else {
267                                 curr_pred = one_branch;
268                                 branch_found = true;
269                         }
270                 }
271
272                 // Detect loops
273                 if (!branch_found && inst_id_map.contains(next_inst)) {
274                         FuncInst * curr_inst = curr_pred->get_func_inst();
275                         uint32_t curr_id = inst_id_map.get(curr_inst);
276                         uint32_t next_id = inst_id_map.get(next_inst);
277
278                         if (curr_id >= next_id) {
279                                 Predicate * old_pred = inst_pred_map.get(next_inst);
280                                 Predicate * back_pred = old_pred->get_parent();
281
282                                 curr_pred->add_backedge(back_pred);
283                                 curr_pred = back_pred;
284
285                                 continue;
286                         }
287                 }
288
289                 // Generate new branches
290                 if (!branch_found) {
291                         SnapVector<struct half_pred_expr *> half_pred_expressions;
292                         infer_predicates(next_inst, next_act, &loc_act_map, &half_pred_expressions);
293                         generate_predicates(&curr_pred, next_inst, &half_pred_expressions);
294                         continue;
295                 }
296
297                 if (next_act->is_write())
298                         curr_pred->set_write(true);
299
300                 if (next_act->is_read()) {
301                         loc_act_map.put(next_act->get_location(), next_act);
302                 }
303
304                 inst_pred_map.put(next_inst, curr_pred);
305                 if (!inst_id_map.contains(next_inst))
306                         inst_id_map.put(next_inst, inst_counter++);
307
308                 it = it->getNext();
309                 curr_pred->incr_count();
310         }
311 }
312
313 /* Given curr_pred and next_inst, find the branch following curr_pred that
314  * contains next_inst and the correct predicate. 
315  * @return true if branch found, false otherwise.
316  */
317 bool FuncNode::follow_branch(Predicate ** curr_pred, FuncInst * next_inst,
318         ModelAction * next_act, SnapVector<Predicate *> * unset_predicates)
319 {
320         /* Check if a branch with func_inst and corresponding predicate exists */
321         bool branch_found = false;
322         ModelVector<Predicate *> * branches = (*curr_pred)->get_children();
323         for (uint i = 0; i < branches->size(); i++) {
324                 Predicate * branch = (*branches)[i];
325                 if (branch->get_func_inst() != next_inst)
326                         continue;
327
328                 /* Check against predicate expressions */
329                 bool predicate_correct = true;
330                 PredExprSet * pred_expressions = branch->get_pred_expressions();
331                 PredExprSetIter * pred_expr_it = pred_expressions->iterator();
332
333                 /* Only read and rmw actions my have unset predicate expressions */
334                 if (pred_expressions->getSize() == 0) {
335                         predicate_correct = false;
336                         unset_predicates->push_back(branch);
337                 }
338
339                 while (pred_expr_it->hasNext()) {
340                         pred_expr * pred_expression = pred_expr_it->next();
341                         uint64_t last_read, next_read;
342                         bool equality;
343
344                         switch(pred_expression->token) {
345                                 case NOPREDICATE:
346                                         predicate_correct = true;
347                                         break;
348                                 case EQUALITY:
349                                         FuncInst * to_be_compared;
350                                         ModelAction * last_act;
351
352                                         to_be_compared = pred_expression->func_inst;
353                                         last_act = to_be_compared->get_associated_act(marker);
354
355                                         last_read = last_act->get_reads_from_value();
356                                         next_read = next_act->get_reads_from_value();
357                                         equality = (last_read == next_read);
358                                         if (equality != pred_expression->value)
359                                                 predicate_correct = false;
360
361                                         break;
362                                 case NULLITY:
363                                         next_read = next_act->get_reads_from_value();
364                                         equality = ((void*)next_read == NULL);
365                                         if (equality != pred_expression->value)
366                                                 predicate_correct = false;
367                                         break;
368                                 default:
369                                         predicate_correct = false;
370                                         model_print("unkown predicate token\n");
371                                         break;
372                         }
373                 }
374
375                 if (predicate_correct) {
376                         *curr_pred = branch;
377                         branch_found = true;
378                         break;
379                 }
380         }
381
382         return branch_found;
383 }
384
385 /* Infer predicate expressions, which are generated in FuncNode::generate_predicates */
386 void FuncNode::infer_predicates(FuncInst * next_inst, ModelAction * next_act,
387         HashTable<void *, ModelAction *, uintptr_t, 0> * loc_act_map,
388         SnapVector<struct half_pred_expr *> * half_pred_expressions)
389 {
390         void * loc = next_act->get_location();
391
392         if (next_inst->is_read()) {
393                 /* read + rmw */
394                 if ( loc_act_map->contains(loc) ) {
395                         ModelAction * last_act = loc_act_map->get(loc);
396                         FuncInst * last_inst = get_inst(last_act);
397                         struct half_pred_expr * expression = new half_pred_expr(EQUALITY, last_inst);
398                         half_pred_expressions->push_back(expression);
399                 } else if ( next_inst->is_single_location() ){
400                         loc_set_t * loc_may_equal = loc_may_equal_map->get(loc);
401
402                         if (loc_may_equal != NULL) {
403                                 loc_set_iter * loc_it = loc_may_equal->iterator();
404                                 while (loc_it->hasNext()) {
405                                         void * neighbor = loc_it->next();
406                                         if (loc_act_map->contains(neighbor)) {
407                                                 ModelAction * last_act = loc_act_map->get(neighbor);
408                                                 FuncInst * last_inst = get_inst(last_act);
409
410                                                 struct half_pred_expr * expression = new half_pred_expr(EQUALITY, last_inst);
411                                                 half_pred_expressions->push_back(expression);
412                                         }
413                                 }
414                         }
415                 } else {
416                         // next_inst is not single location
417                         uint64_t read_val = next_act->get_reads_from_value();
418
419                         // only infer NULLITY predicate when it is actually NULL.
420                         if ( (void*)read_val == NULL) {
421                                 struct half_pred_expr * expression = new half_pred_expr(NULLITY, NULL);
422                                 half_pred_expressions->push_back(expression);
423                         }
424                 }
425         } else {
426                 /* Pure writes */
427                 // TODO: do anything here?
428         }
429 }
430
431 /* Able to generate complex predicates when there are multiple predciate expressions */
432 void FuncNode::generate_predicates(Predicate ** curr_pred, FuncInst * next_inst,
433         SnapVector<struct half_pred_expr *> * half_pred_expressions)
434 {
435         if (half_pred_expressions->size() == 0) {
436                 Predicate * new_pred = new Predicate(next_inst);
437                 (*curr_pred)->add_child(new_pred);
438                 new_pred->set_parent(*curr_pred);
439
440                 /* entry predicates and predicates containing pure write actions
441                  * have no predicate expressions */
442                 if ( (*curr_pred)->is_entry_predicate() )
443                         new_pred->add_predicate_expr(NOPREDICATE, NULL, true);
444                 else if (next_inst->is_write()) {
445                         /* next_inst->is_write() <==> pure writes */
446                         new_pred->add_predicate_expr(NOPREDICATE, NULL, true);
447                 }
448
449                 return;
450         }
451
452         SnapVector<Predicate *> predicates;
453
454         struct half_pred_expr * half_expr = (*half_pred_expressions)[0];
455         predicates.push_back(new Predicate(next_inst));
456         predicates.push_back(new Predicate(next_inst));
457
458         predicates[0]->add_predicate_expr(half_expr->token, half_expr->func_inst, true);
459         predicates[1]->add_predicate_expr(half_expr->token, half_expr->func_inst, false);
460
461         for (uint i = 1; i < half_pred_expressions->size(); i++) {
462                 half_expr = (*half_pred_expressions)[i];
463
464                 uint old_size = predicates.size();
465                 for (uint j = 0; j < old_size; j++) {
466                         Predicate * pred = predicates[j];
467                         Predicate * new_pred = new Predicate(next_inst);
468                         new_pred->copy_predicate_expr(pred);
469
470                         pred->add_predicate_expr(half_expr->token, half_expr->func_inst, true);
471                         new_pred->add_predicate_expr(half_expr->token, half_expr->func_inst, false);
472
473                         predicates.push_back(new_pred);
474                 }
475         }
476
477         for (uint i = 0; i < predicates.size(); i++) {
478                 Predicate * pred= predicates[i];
479                 (*curr_pred)->add_child(pred);
480                 pred->set_parent(*curr_pred);
481         }
482
483         /* Free memories allocated by infer_predicate */
484         for (uint i = 0; i < half_pred_expressions->size(); i++) {
485                 struct half_pred_expr * tmp = (*half_pred_expressions)[i];
486                 snapshot_free(tmp);
487         }
488 }
489
490 /* Amend predicates that contain no predicate expressions. Currenlty only amend with NULLITY predicates */
491 bool FuncNode::amend_predicate_expr(Predicate ** curr_pred, FuncInst * next_inst, ModelAction * next_act)
492 {
493         // there should only be only child
494         Predicate * unset_pred = (*curr_pred)->get_children()->back();
495         uint64_t read_val = next_act->get_reads_from_value();
496
497         // only generate NULLITY predicate when it is actually NULL.
498         if ( !next_inst->is_single_location() && (void*)read_val == NULL ) {
499                 Predicate * new_pred = new Predicate(next_inst);
500
501                 (*curr_pred)->add_child(new_pred);
502                 new_pred->set_parent(*curr_pred);
503
504                 unset_pred->add_predicate_expr(NULLITY, NULL, false);
505                 new_pred->add_predicate_expr(NULLITY, NULL, true);
506
507                 return true;
508         }
509
510         return false;
511 }
512
513 void FuncNode::add_to_val_loc_map(uint64_t val, void * loc)
514 {
515         loc_set_t * locations = val_loc_map->get(val);
516
517         if (locations == NULL) {
518                 locations = new loc_set_t();
519                 val_loc_map->put(val, locations);
520         }
521
522         update_loc_may_equal_map(loc, locations);
523         locations->add(loc);
524         // values_may_read_from->add(val);
525 }
526
527 void FuncNode::add_to_val_loc_map(value_set_t * values, void * loc)
528 {
529         if (values == NULL)
530                 return;
531
532         value_set_iter * it = values->iterator();
533         while (it->hasNext()) {
534                 uint64_t val = it->next();
535                 add_to_val_loc_map(val, loc);
536         }
537 }
538
539 void FuncNode::update_loc_may_equal_map(void * new_loc, loc_set_t * old_locations)
540 {
541         if ( old_locations->contains(new_loc) )
542                 return;
543
544         loc_set_t * neighbors = loc_may_equal_map->get(new_loc);
545
546         if (neighbors == NULL) {
547                 neighbors = new loc_set_t();
548                 loc_may_equal_map->put(new_loc, neighbors);
549         }
550
551         loc_set_iter * loc_it = old_locations->iterator();
552         while (loc_it->hasNext()) {
553                 // new_loc: { old_locations, ... }
554                 void * member = loc_it->next();
555                 neighbors->add(member);
556
557                 // for each i in old_locations, i : { new_loc, ... }
558                 loc_set_t * _neighbors = loc_may_equal_map->get(member);
559                 if (_neighbors == NULL) {
560                         _neighbors = new loc_set_t();
561                         loc_may_equal_map->put(member, _neighbors);
562                 }
563                 _neighbors->add(new_loc);
564         }
565 }
566
567 /* Every time a thread enters a function, set its position to the predicate tree entry */
568 void FuncNode::init_predicate_tree_position(thread_id_t tid)
569 {
570         int thread_id = id_to_int(tid);
571         if (predicate_tree_position.size() <= (uint) thread_id)
572                 predicate_tree_position.resize(thread_id + 1);
573
574         predicate_tree_position[thread_id] = predicate_tree_entry;
575 }
576
577 void FuncNode::set_predicate_tree_position(thread_id_t tid, Predicate * pred)
578 {
579         int thread_id = id_to_int(tid);
580         predicate_tree_position[thread_id] = pred;
581 }
582
583 /* @return The position of a thread in a predicate tree */
584 Predicate * FuncNode::get_predicate_tree_position(thread_id_t tid)
585 {
586         int thread_id = id_to_int(tid);
587         return predicate_tree_position[thread_id];
588 }
589
590 /* Make sure elements of thrd_inst_act_map are initialized properly when threads enter functions */
591 void FuncNode::init_inst_act_map(thread_id_t tid)
592 {
593         int thread_id = id_to_int(tid);
594         SnapVector<inst_act_map_t *> * thrd_inst_act_map = history->getThrdInstActMap(func_id);
595         uint old_size = thrd_inst_act_map->size();
596
597         if (thrd_inst_act_map->size() <= (uint) thread_id) {
598                 uint new_size = thread_id + 1;
599                 thrd_inst_act_map->resize(new_size);
600
601                 for (uint i = old_size; i < new_size; i++)
602                         (*thrd_inst_act_map)[i] = new inst_act_map_t(128);
603         }
604 }
605
606 /* Reset elements of thrd_inst_act_map when threads exit functions */
607 void FuncNode::reset_inst_act_map(thread_id_t tid)
608 {
609         int thread_id = id_to_int(tid);
610         SnapVector<inst_act_map_t *> * thrd_inst_act_map = history->getThrdInstActMap(func_id);
611
612         inst_act_map_t * map = (*thrd_inst_act_map)[thread_id];
613         map->reset();
614 }
615
616 void FuncNode::update_inst_act_map(thread_id_t tid, ModelAction * read_act)
617 {
618         int thread_id = id_to_int(tid);
619         SnapVector<inst_act_map_t *> * thrd_inst_act_map = history->getThrdInstActMap(func_id);
620
621         inst_act_map_t * map = (*thrd_inst_act_map)[thread_id];
622         FuncInst * read_inst = get_inst(read_act);
623         map->put(read_inst, read_act);
624 }
625
626 inst_act_map_t * FuncNode::get_inst_act_map(thread_id_t tid)
627 {
628         int thread_id = id_to_int(tid);
629         SnapVector<inst_act_map_t *> * thrd_inst_act_map = history->getThrdInstActMap(func_id);
630
631         return (*thrd_inst_act_map)[thread_id];
632 }
633
634 /* Add FuncNodes that this node may follow */
635 void FuncNode::add_out_edge(FuncNode * other)
636 {
637         if ( !edge_table.contains(other) ) {
638                 edge_table.put(other, OUT_EDGE);
639                 out_edges.push_back(other);
640                 return;
641         }
642
643         edge_type_t edge = edge_table.get(other);
644         if (edge == IN_EDGE) {
645                 edge_table.put(other, BI_EDGE);
646                 out_edges.push_back(other);
647         }
648 }
649
650 /* Compute the distance between this FuncNode and the target node.
651  * Return -1 if the target node is unreachable or the actual distance
652  * is greater than max_step.
653  */
654 int FuncNode::compute_distance(FuncNode * target, int max_step)
655 {
656         if (target == NULL)
657                 return -1;
658         else if (target == this)
659                 return 0;
660
661         SnapList<FuncNode *> queue;
662         HashTable<FuncNode *, int, uintptr_t, 0> distances(128);
663
664         queue.push_back(this);
665         distances.put(this, 0);
666
667         while (!queue.empty()) {
668                 FuncNode * curr = queue.front();
669                 queue.pop_front();
670                 int dist = distances.get(curr);
671
672                 if (max_step <= dist)
673                         return -1;
674
675                 ModelList<FuncNode *> * outEdges = curr->get_out_edges();
676                 mllnode<FuncNode *> * it;
677                 for (it = outEdges->begin(); it != NULL; it = it->getNext()) {
678                         FuncNode * out_node = it->getVal();
679
680                         /* This node has not been visited before */
681                         if ( !distances.contains(out_node) ) {
682                                 if (out_node == target)
683                                         return dist + 1;
684
685                                 queue.push_back(out_node);
686                                 distances.put(out_node, dist + 1);
687                         }
688                 }
689         }
690
691         /* Target node is unreachable */
692         return -1;
693 }
694
695 void FuncNode::print_predicate_tree()
696 {
697         model_print("digraph function_%s {\n", func_name);
698         predicate_tree_entry->print_pred_subtree();
699         model_print("}\n");     // end of graph
700 }
701
702 void FuncNode::print_val_loc_map()
703 {
704 /*
705         value_set_iter * val_it = values_may_read_from->iterator();
706         while (val_it->hasNext()) {
707                 uint64_t value = val_it->next();
708                 model_print("val %llx: ", value);
709
710                 loc_set_t * locations = val_loc_map->get(value);
711                 loc_set_iter * loc_it = locations->iterator();
712                 while (loc_it->hasNext()) {
713                         void * location = loc_it->next();
714                         model_print("%p ", location);
715                 }
716                 model_print("\n");
717         }
718 */
719 }