05974d781ad52bfac0445b3dcaeb98dfabcd990d
[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         }
310 }
311
312 /* Given curr_pred and next_inst, find the branch following curr_pred that
313  * contains next_inst and the correct predicate. 
314  * @return true if branch found, false otherwise.
315  */
316 bool FuncNode::follow_branch(Predicate ** curr_pred, FuncInst * next_inst,
317         ModelAction * next_act, SnapVector<Predicate *> * unset_predicates)
318 {
319         /* Check if a branch with func_inst and corresponding predicate exists */
320         bool branch_found = false;
321         ModelVector<Predicate *> * branches = (*curr_pred)->get_children();
322         for (uint i = 0; i < branches->size(); i++) {
323                 Predicate * branch = (*branches)[i];
324                 if (branch->get_func_inst() != next_inst)
325                         continue;
326
327                 /* Check against predicate expressions */
328                 bool predicate_correct = true;
329                 PredExprSet * pred_expressions = branch->get_pred_expressions();
330                 PredExprSetIter * pred_expr_it = pred_expressions->iterator();
331
332                 /* Only read and rmw actions my have unset predicate expressions */
333                 if (pred_expressions->getSize() == 0) {
334                         predicate_correct = false;
335                         unset_predicates->push_back(branch);
336                 }
337
338                 while (pred_expr_it->hasNext()) {
339                         pred_expr * pred_expression = pred_expr_it->next();
340                         uint64_t last_read, next_read;
341                         bool equality;
342
343                         switch(pred_expression->token) {
344                                 case NOPREDICATE:
345                                         predicate_correct = true;
346                                         break;
347                                 case EQUALITY:
348                                         FuncInst * to_be_compared;
349                                         ModelAction * last_act;
350
351                                         to_be_compared = pred_expression->func_inst;
352                                         last_act = to_be_compared->get_associated_act(marker);
353
354                                         last_read = last_act->get_reads_from_value();
355                                         next_read = next_act->get_reads_from_value();
356                                         equality = (last_read == next_read);
357                                         if (equality != pred_expression->value)
358                                                 predicate_correct = false;
359
360                                         break;
361                                 case NULLITY:
362                                         next_read = next_act->get_reads_from_value();
363                                         equality = ((void*)next_read == NULL);
364                                         if (equality != pred_expression->value)
365                                                 predicate_correct = false;
366                                         break;
367                                 default:
368                                         predicate_correct = false;
369                                         model_print("unkown predicate token\n");
370                                         break;
371                         }
372                 }
373
374                 if (predicate_correct) {
375                         *curr_pred = branch;
376                         branch_found = true;
377                         break;
378                 }
379         }
380
381         return branch_found;
382 }
383
384 /* Infer predicate expressions, which are generated in FuncNode::generate_predicates */
385 void FuncNode::infer_predicates(FuncInst * next_inst, ModelAction * next_act,
386         HashTable<void *, ModelAction *, uintptr_t, 0> * loc_act_map,
387         SnapVector<struct half_pred_expr *> * half_pred_expressions)
388 {
389         void * loc = next_act->get_location();
390
391         if (next_inst->is_read()) {
392                 /* read + rmw */
393                 if ( loc_act_map->contains(loc) ) {
394                         ModelAction * last_act = loc_act_map->get(loc);
395                         FuncInst * last_inst = get_inst(last_act);
396                         struct half_pred_expr * expression = new half_pred_expr(EQUALITY, last_inst);
397                         half_pred_expressions->push_back(expression);
398                 } else if ( next_inst->is_single_location() ){
399                         loc_set_t * loc_may_equal = loc_may_equal_map->get(loc);
400
401                         if (loc_may_equal != NULL) {
402                                 loc_set_iter * loc_it = loc_may_equal->iterator();
403                                 while (loc_it->hasNext()) {
404                                         void * neighbor = loc_it->next();
405                                         if (loc_act_map->contains(neighbor)) {
406                                                 ModelAction * last_act = loc_act_map->get(neighbor);
407                                                 FuncInst * last_inst = get_inst(last_act);
408
409                                                 struct half_pred_expr * expression = new half_pred_expr(EQUALITY, last_inst);
410                                                 half_pred_expressions->push_back(expression);
411                                         }
412                                 }
413                         }
414                 } else {
415                         // next_inst is not single location
416                         uint64_t read_val = next_act->get_reads_from_value();
417
418                         // only infer NULLITY predicate when it is actually NULL.
419                         if ( (void*)read_val == NULL) {
420                                 struct half_pred_expr * expression = new half_pred_expr(NULLITY, NULL);
421                                 half_pred_expressions->push_back(expression);
422                         }
423                 }
424         } else {
425                 /* Pure writes */
426                 // TODO: do anything here?
427         }
428 }
429
430 /* Able to generate complex predicates when there are multiple predciate expressions */
431 void FuncNode::generate_predicates(Predicate ** curr_pred, FuncInst * next_inst,
432         SnapVector<struct half_pred_expr *> * half_pred_expressions)
433 {
434         if (half_pred_expressions->size() == 0) {
435                 Predicate * new_pred = new Predicate(next_inst);
436                 (*curr_pred)->add_child(new_pred);
437                 new_pred->set_parent(*curr_pred);
438
439                 /* entry predicates and predicates containing pure write actions
440                  * have no predicate expressions */
441                 if ( (*curr_pred)->is_entry_predicate() )
442                         new_pred->add_predicate_expr(NOPREDICATE, NULL, true);
443                 else if (next_inst->is_write()) {
444                         /* next_inst->is_write() <==> pure writes */
445                         new_pred->add_predicate_expr(NOPREDICATE, NULL, true);
446                 }
447
448                 return;
449         }
450
451         SnapVector<Predicate *> predicates;
452
453         struct half_pred_expr * half_expr = (*half_pred_expressions)[0];
454         predicates.push_back(new Predicate(next_inst));
455         predicates.push_back(new Predicate(next_inst));
456
457         predicates[0]->add_predicate_expr(half_expr->token, half_expr->func_inst, true);
458         predicates[1]->add_predicate_expr(half_expr->token, half_expr->func_inst, false);
459
460         for (uint i = 1; i < half_pred_expressions->size(); i++) {
461                 half_expr = (*half_pred_expressions)[i];
462
463                 uint old_size = predicates.size();
464                 for (uint j = 0; j < old_size; j++) {
465                         Predicate * pred = predicates[j];
466                         Predicate * new_pred = new Predicate(next_inst);
467                         new_pred->copy_predicate_expr(pred);
468
469                         pred->add_predicate_expr(half_expr->token, half_expr->func_inst, true);
470                         new_pred->add_predicate_expr(half_expr->token, half_expr->func_inst, false);
471
472                         predicates.push_back(new_pred);
473                 }
474         }
475
476         for (uint i = 0; i < predicates.size(); i++) {
477                 Predicate * pred= predicates[i];
478                 (*curr_pred)->add_child(pred);
479                 pred->set_parent(*curr_pred);
480         }
481
482         /* Free memories allocated by infer_predicate */
483         for (uint i = 0; i < half_pred_expressions->size(); i++) {
484                 struct half_pred_expr * tmp = (*half_pred_expressions)[i];
485                 snapshot_free(tmp);
486         }
487 }
488
489 /* Amend predicates that contain no predicate expressions. Currenlty only amend with NULLITY predicates */
490 bool FuncNode::amend_predicate_expr(Predicate ** curr_pred, FuncInst * next_inst, ModelAction * next_act)
491 {
492         // there should only be only child
493         Predicate * unset_pred = (*curr_pred)->get_children()->back();
494         uint64_t read_val = next_act->get_reads_from_value();
495
496         // only generate NULLITY predicate when it is actually NULL.
497         if ( !next_inst->is_single_location() && (void*)read_val == NULL ) {
498                 Predicate * new_pred = new Predicate(next_inst);
499
500                 (*curr_pred)->add_child(new_pred);
501                 new_pred->set_parent(*curr_pred);
502
503                 unset_pred->add_predicate_expr(NULLITY, NULL, false);
504                 new_pred->add_predicate_expr(NULLITY, NULL, true);
505
506                 return true;
507         }
508
509         return false;
510 }
511
512 void FuncNode::add_to_val_loc_map(uint64_t val, void * loc)
513 {
514         loc_set_t * locations = val_loc_map->get(val);
515
516         if (locations == NULL) {
517                 locations = new loc_set_t();
518                 val_loc_map->put(val, locations);
519         }
520
521         update_loc_may_equal_map(loc, locations);
522         locations->add(loc);
523         // values_may_read_from->add(val);
524 }
525
526 void FuncNode::add_to_val_loc_map(value_set_t * values, void * loc)
527 {
528         if (values == NULL)
529                 return;
530
531         value_set_iter * it = values->iterator();
532         while (it->hasNext()) {
533                 uint64_t val = it->next();
534                 add_to_val_loc_map(val, loc);
535         }
536 }
537
538 void FuncNode::update_loc_may_equal_map(void * new_loc, loc_set_t * old_locations)
539 {
540         if ( old_locations->contains(new_loc) )
541                 return;
542
543         loc_set_t * neighbors = loc_may_equal_map->get(new_loc);
544
545         if (neighbors == NULL) {
546                 neighbors = new loc_set_t();
547                 loc_may_equal_map->put(new_loc, neighbors);
548         }
549
550         loc_set_iter * loc_it = old_locations->iterator();
551         while (loc_it->hasNext()) {
552                 // new_loc: { old_locations, ... }
553                 void * member = loc_it->next();
554                 neighbors->add(member);
555
556                 // for each i in old_locations, i : { new_loc, ... }
557                 loc_set_t * _neighbors = loc_may_equal_map->get(member);
558                 if (_neighbors == NULL) {
559                         _neighbors = new loc_set_t();
560                         loc_may_equal_map->put(member, _neighbors);
561                 }
562                 _neighbors->add(new_loc);
563         }
564 }
565
566 /* Every time a thread enters a function, set its position to the predicate tree entry */
567 void FuncNode::init_predicate_tree_position(thread_id_t tid)
568 {
569         int thread_id = id_to_int(tid);
570         if (predicate_tree_position.size() <= (uint) thread_id)
571                 predicate_tree_position.resize(thread_id + 1);
572
573         predicate_tree_position[thread_id] = predicate_tree_entry;
574 }
575
576 void FuncNode::set_predicate_tree_position(thread_id_t tid, Predicate * pred)
577 {
578         int thread_id = id_to_int(tid);
579         predicate_tree_position[thread_id] = pred;
580 }
581
582 /* @return The position of a thread in a predicate tree */
583 Predicate * FuncNode::get_predicate_tree_position(thread_id_t tid)
584 {
585         int thread_id = id_to_int(tid);
586         return predicate_tree_position[thread_id];
587 }
588
589 /* Make sure elements of thrd_inst_act_map are initialized properly when threads enter functions */
590 void FuncNode::init_inst_act_map(thread_id_t tid)
591 {
592         int thread_id = id_to_int(tid);
593         SnapVector<inst_act_map_t *> * thrd_inst_act_map = history->getThrdInstActMap(func_id);
594         uint old_size = thrd_inst_act_map->size();
595
596         if (thrd_inst_act_map->size() <= (uint) thread_id) {
597                 uint new_size = thread_id + 1;
598                 thrd_inst_act_map->resize(new_size);
599
600                 for (uint i = old_size; i < new_size; i++)
601                         (*thrd_inst_act_map)[i] = new inst_act_map_t(128);
602         }
603 }
604
605 /* Reset elements of thrd_inst_act_map when threads exit functions */
606 void FuncNode::reset_inst_act_map(thread_id_t tid)
607 {
608         int thread_id = id_to_int(tid);
609         SnapVector<inst_act_map_t *> * thrd_inst_act_map = history->getThrdInstActMap(func_id);
610
611         inst_act_map_t * map = (*thrd_inst_act_map)[thread_id];
612         map->reset();
613 }
614
615 void FuncNode::update_inst_act_map(thread_id_t tid, ModelAction * read_act)
616 {
617         int thread_id = id_to_int(tid);
618         SnapVector<inst_act_map_t *> * thrd_inst_act_map = history->getThrdInstActMap(func_id);
619
620         inst_act_map_t * map = (*thrd_inst_act_map)[thread_id];
621         FuncInst * read_inst = get_inst(read_act);
622         map->put(read_inst, read_act);
623 }
624
625 inst_act_map_t * FuncNode::get_inst_act_map(thread_id_t tid)
626 {
627         int thread_id = id_to_int(tid);
628         SnapVector<inst_act_map_t *> * thrd_inst_act_map = history->getThrdInstActMap(func_id);
629
630         return (*thrd_inst_act_map)[thread_id];
631 }
632
633 /* Add FuncNodes that this node may follow */
634 void FuncNode::add_out_edge(FuncNode * other)
635 {
636         if ( !edge_table.contains(other) ) {
637                 edge_table.put(other, OUT_EDGE);
638                 out_edges.push_back(other);
639                 return;
640         }
641
642         edge_type_t edge = edge_table.get(other);
643         if (edge == IN_EDGE) {
644                 edge_table.put(other, BI_EDGE);
645                 out_edges.push_back(other);
646         }
647 }
648
649 /* Compute the distance between this FuncNode and the target node.
650  * Return -1 if the target node is unreachable or the actual distance
651  * is greater than max_step.
652  */
653 int FuncNode::compute_distance(FuncNode * target, int max_step)
654 {
655         if (target == NULL)
656                 return -1;
657         else if (target == this)
658                 return 0;
659
660         SnapList<FuncNode *> queue;
661         HashTable<FuncNode *, int, uintptr_t, 0> distances(128);
662
663         queue.push_back(this);
664         distances.put(this, 0);
665
666         while (!queue.empty()) {
667                 FuncNode * curr = queue.front();
668                 queue.pop_front();
669                 int dist = distances.get(curr);
670
671                 if (max_step <= dist)
672                         return -1;
673
674                 ModelList<FuncNode *> * outEdges = curr->get_out_edges();
675                 mllnode<FuncNode *> * it;
676                 for (it = outEdges->begin(); it != NULL; it = it->getNext()) {
677                         FuncNode * out_node = it->getVal();
678
679                         /* This node has not been visited before */
680                         if ( !distances.contains(out_node) ) {
681                                 if (out_node == target)
682                                         return dist + 1;
683
684                                 queue.push_back(out_node);
685                                 distances.put(out_node, dist + 1);
686                         }
687                 }
688         }
689
690         /* Target node is unreachable */
691         return -1;
692 }
693
694 void FuncNode::print_predicate_tree()
695 {
696         model_print("digraph function_%s {\n", func_name);
697         predicate_tree_entry->print_pred_subtree();
698         model_print("}\n");     // end of graph
699 }
700
701 void FuncNode::print_val_loc_map()
702 {
703 /*
704         value_set_iter * val_it = values_may_read_from->iterator();
705         while (val_it->hasNext()) {
706                 uint64_t value = val_it->next();
707                 model_print("val %llx: ", value);
708
709                 loc_set_t * locations = val_loc_map->get(value);
710                 loc_set_iter * loc_it = locations->iterator();
711                 while (loc_it->hasNext()) {
712                         void * location = loc_it->next();
713                         model_print("%p ", location);
714                 }
715                 model_print("\n");
716         }
717 */
718 }