00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #include "bb.h"
00044 #include "defs.h"
00045 #include "cg_flags.h"
00046 #include "cg.h"
00047 #include "cg_dep_graph.h"
00048 #include "cg_loop.h"
00049 #include "DaVinci.h"
00050 #include "glob.h"
00051 #include "mempool.h"
00052 #include "op.h"
00053 #include "region.h"
00054 #include "scheduler.h"
00055 #include "symtab.h"
00056 #include "symtab_idx.h"
00057 #include "tag.h"
00058 #include "tn.h"
00059 #include "topcode.h"
00060 #include "vt_dag.h"
00061 #include "vt_region.h"
00062 #include "whirl2ops.h"
00063 #include "wn_core.h"
00064 #include <ipfec_options.h>
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075 static char * Dependence_Color (CG_DEP_KIND kind)
00076 {
00077 switch (kind)
00078 {
00079 case CG_DEP_REGIN :
00080 case CG_DEP_REGOUT :
00081 case CG_DEP_REGANTI:
00082 return("black");
00083
00084 case CG_DEP_MEMIN :
00085 case CG_DEP_MEMOUT :
00086 case CG_DEP_MEMANTI:
00087 case CG_DEP_MEMVOL :
00088 case CG_DEP_MEMREAD:
00089 return("blue");
00090
00091 case CG_DEP_PREBR :
00092 case CG_DEP_POSTBR :
00093 return("red");
00094
00095 default :
00096 return("orange");
00097 }
00098 }
00099
00100
00101 typedef mempool_allocator<void *> VOID_ALLOC;
00102 typedef std::vector<void *, VOID_ALLOC> VOID_CONTAINER;
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120 class VOID_SET
00121 {
00122 private:
00123 VOID_CONTAINER _voids;
00124 public:
00125 VOID_SET() { _voids.clear(); }
00126 ~VOID_SET() {}
00127
00128 void Insert (void *p) { _voids.push_back (p); }
00129 void Clear () { _voids.clear(); }
00130 BOOL Is_In (void *p);
00131 };
00132
00133 BOOL
00134 VOID_SET::Is_In(void *p)
00135 {
00136 for (INT32 i=0; i< _voids.size() ; i++) {
00137 if ( p == _voids[i]) return TRUE;
00138 }
00139 return FALSE;
00140 }
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160 typedef struct dag_op_info {
00161 NODE_ID node_id;
00162 BOOL dep_dumped;
00163 INT32 dep_idx, dep_num;
00164 }DAG_OP_INFO;
00165
00166 typedef mempool_allocator<DAG_OP_INFO> DAG_OP_INFO_ALLOC;
00167 typedef std::vector<DAG_OP_INFO,DAG_OP_INFO_ALLOC> DAG_OP_INFO_VECTOR;
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184 typedef struct dag_dep_info {
00185 OP *dest_op;
00186 CG_DEP_KIND kind;
00187 BOOL dotted;
00188 }DAG_DEP_INFO;
00189
00190 typedef mempool_allocator<DAG_DEP_INFO> DAG_DEP_INFO_ALLOC;
00191 typedef std::vector<DAG_DEP_INFO,DAG_DEP_INFO_ALLOC> DAG_DEP_INFO_VECTOR;
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227 class DAG_OPS_INFO {
00228 private:
00229 DAG_OP_INFO_VECTOR _ops_info;
00230 DAG_DEP_INFO_VECTOR _deps_info;
00231 public:
00232 DAG_OPS_INFO() {
00233 _ops_info.clear();
00234 _deps_info.clear();
00235 }
00236 ~DAG_OPS_INFO() {}
00237
00238 void Insert_op_info( OP *op, BOOL dep_in_bb,
00239 BOOL dep_dumped,
00240 VOID_SET *bb_ops);
00241 DAG_DEP_INFO_VECTOR Dependencies (const NODE_ID op, BOOL& dumped);
00242 };
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265 void
00266 DAG_OPS_INFO::Insert_op_info ( OP *op, BOOL dep_in_bb, BOOL dep_dumped,
00267 VOID_SET *bb_ops )
00268 {
00269 DAG_OP_INFO tmp_op_info;
00270 DAG_DEP_INFO tmp_dep_info;
00271 INT32 idx, succ_counter, deps_info_size;
00272
00273
00274
00275
00276
00277 BOOL show_branch_edge;
00278 if (VT_Enable_DAG_BR) show_branch_edge = TRUE;
00279 else show_branch_edge = FALSE;
00280
00281 for (INT32 i=0; i< _ops_info.size() ; i++) {
00282 if ( ((NODE_ID)op) == _ops_info[i].node_id ) return;
00283 }
00284
00285
00286
00287
00288 _CG_DEP_OP_INFO* this_op_dep_info = _CG_DEP_op_info (op);
00289 ARC_LIST* this_op_succ_list = this_op_dep_info -> succs;
00290
00291 succ_counter = 0;
00292 deps_info_size = _deps_info.size();
00293
00294 for ( ARC* arc = ARC_LIST_first (this_op_succ_list) ;
00295 arc != NULL ; arc = ARC_LIST_first( arc -> next[1]) )
00296 {
00297 tmp_dep_info.dest_op = arc -> succ;
00298 tmp_dep_info.kind = ARC_kind(arc);
00299 tmp_dep_info.dotted = ARC_is_dotted(arc);
00300
00301 if (! show_branch_edge)
00302 if (CG_DEP_PREBR == tmp_dep_info.kind ||
00303 CG_DEP_POSTBR == tmp_dep_info.kind)
00304 continue;
00305
00306
00307
00308 if (dep_in_bb) {
00309 if ( ! (bb_ops -> Is_In(tmp_dep_info.dest_op)) ) continue;
00310 } else if ( bb_ops -> Is_In(tmp_dep_info.dest_op) ) continue;
00311
00312 _deps_info.push_back (tmp_dep_info);
00313 succ_counter ++;
00314 }
00315
00316 tmp_op_info.node_id = (NODE_ID) op;
00317 tmp_op_info.dep_dumped = dep_dumped;
00318 tmp_op_info.dep_idx = deps_info_size;
00319 tmp_op_info.dep_num = succ_counter;
00320
00321
00322 _ops_info.push_back (tmp_op_info);
00323 }
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338 DAG_DEP_INFO_VECTOR
00339 DAG_OPS_INFO::Dependencies (const NODE_ID op, BOOL& dumped)
00340 {
00341 DAG_DEP_INFO_VECTOR dep_vector;
00342 DAG_OP_INFO tmp_op_info;
00343 DAG_DEP_INFO tmp_dep_info;
00344 INT32 idx, succ_counter, deps_info_size;
00345
00346 dep_vector.clear();
00347
00348
00349
00350 for (INT32 i=0; i< _ops_info.size() ; i++) {
00351 if ( op == _ops_info[i].node_id ) {
00352 tmp_op_info = _ops_info[i];
00353 dumped = tmp_op_info.dep_dumped;
00354 idx = tmp_op_info.dep_idx;
00355 for (INT32 j = 0; j < tmp_op_info.dep_num; j ++ ) {
00356 dep_vector.push_back( _deps_info[idx + j] );
00357 }
00358 _ops_info[i].dep_dumped = ! _ops_info[i].dep_dumped;
00359 return dep_vector;
00360 }
00361 }
00362
00363
00364 Is_True(TRUE, ("Dependencies() must be afer Insert_op_info()."));
00365
00366 }
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387 class BB_DAG_Callback : public DaVinci_Callback {
00388 private:
00389 DaVinci *_dv;
00390 VOID_SET *_bb_ops;
00391 DAG_OPS_INFO _dag_ops_info;
00392 public:
00393 BB_DAG_Callback(DaVinci* dv, VOID_SET *bb_ops)
00394 {
00395 _dv = dv;
00396 _bb_ops = bb_ops;
00397 }
00398 ~BB_DAG_Callback (){}
00399
00400 void Insert_op_info( OP *op ) {
00401 _dag_ops_info.Insert_op_info ( op, TRUE, TRUE, _bb_ops );
00402 }
00403 virtual void Node_Select( const INT n_ids, const NODE_ID id_array[] );
00404 };
00405
00406 void
00407 BB_DAG_Callback::Node_Select(const INT n_ids, const NODE_ID id_array[])
00408 {
00409 NODE_ID node;
00410 DAG_DEP_INFO_VECTOR succ_nodes;
00411 DAG_DEP_INFO tmp_dep_info;
00412 BOOL dumped;
00413 EDGE_TYPE et,et_plain,et_dotted;
00414
00415 et_dotted.Pattern (EP_DOTTED);
00416
00417 _dv -> Update_Begin();
00418 for (INT32 i = 0; i < n_ids; ++i) {
00419 node = id_array[i];
00420
00421 succ_nodes = _dag_ops_info.Dependencies ( node, dumped );
00422 if (dumped) {
00423 for (INT32 i=0 ; i<succ_nodes.size() ; i++ ) {
00424 _dv -> Delete_Edge ( EDGE_ID ( node , (NODE_ID)(INTPTR)i ));
00425 }
00426 dumped = FALSE;
00427 }
00428 else {
00429 for (INT32 i=0 ; i<succ_nodes.size() ; i++ ) {
00430 tmp_dep_info = succ_nodes[i];
00431
00432 if (tmp_dep_info.dotted) et = et_dotted;
00433 else et = et_plain;
00434
00435
00436 if ( OP_bundled((OP*)node) &&
00437 OP_bundled(tmp_dep_info.dest_op) )
00438 et.Color("gray");
00439 else {
00440
00441 et.Color(Dependence_Color(tmp_dep_info.kind));
00442 }
00443 _dv -> New_Edge ( EDGE_ID ( node , (NODE_ID)(INTPTR) i ), et,
00444 node, (NODE_ID) tmp_dep_info.dest_op );
00445 }
00446 dumped = TRUE;
00447 }
00448 }
00449 _dv -> Update_End();
00450
00451 char buffer[1024];
00452 char *s = Print_OP ((OP*)node, buffer);
00453 Is_True(strlen(s) < 1024, ("Print_OP buffer overflowed"));
00454 _dv -> Show_Message (s);
00455 }
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481 class Regioanl_DAG_Callback : public DaVinci_Callback {
00482 private:
00483 DaVinci *_dv;
00484 VOID_SET *_regions, *_no_dep_bbs;
00485 DAG_OPS_INFO _dag_ops_info;
00486 public:
00487 Regioanl_DAG_Callback(DaVinci* dv,VOID_SET *regions,VOID_SET *no_dep_bbs)
00488 {
00489 _dv = dv;
00490 _regions = regions;
00491 _no_dep_bbs = no_dep_bbs;
00492 }
00493 ~Regioanl_DAG_Callback (){}
00494
00495 void Insert_op_info( OP *op, VOID_SET *bb_ops ) {
00496 _dag_ops_info.Insert_op_info ( op, FALSE, FALSE, bb_ops );
00497 }
00498 virtual void Node_Select( const INT n_ids, const NODE_ID id_array[] );
00499 };
00500
00501 void
00502 Regioanl_DAG_Callback::Node_Select(const INT n_ids, const NODE_ID id_array[])
00503 {
00504 NODE_ID node;
00505 DAG_DEP_INFO_VECTOR succ_nodes;
00506 DAG_DEP_INFO tmp_dep_info;
00507 BOOL dumped;
00508 EDGE_TYPE et,et_plain,et_dotted;
00509
00510 et_dotted.Pattern (EP_DOTTED);
00511
00512 for (INT32 i = 0; i < n_ids; ++i) {
00513 node = id_array[i];
00514 if ( _regions -> Is_In(node) )
00515 draw_regional_cfg( (REGION*) node);
00516 else if ( _no_dep_bbs -> Is_In(node) ) {}
00517 else
00518 {
00519
00520
00521 if ( ! OP_bundled((OP*)node) ) {
00522 _dv -> Update_Begin();
00523 succ_nodes = _dag_ops_info.Dependencies ( node, dumped );
00524
00525
00526
00527
00528 if (dumped) {
00529 for (INT32 i=0 ; i<succ_nodes.size() ; i++ ) {
00530 _dv -> Delete_Edge (EDGE_ID (node ,NODE_ID((INTPTR)(2*i+1))));
00531 }
00532 dumped = FALSE;
00533 }
00534 else {
00535 for (INT32 i=0 ; i<succ_nodes.size() ; i++ ) {
00536 tmp_dep_info = succ_nodes[i];
00537
00538 if (tmp_dep_info.dotted) et = et_dotted;
00539 else et = et_plain;
00540
00541
00542 if ( OP_bundled((OP*)node) &&
00543 OP_bundled(tmp_dep_info.dest_op) )
00544 et.Color("gray");
00545 else {
00546
00547 et.Color(Dependence_Color(tmp_dep_info.kind));
00548 }
00549 _dv -> New_Edge (EDGE_ID (node,NODE_ID((void*)INTPTR(2*i+1))), et,
00550 node,(NODE_ID)tmp_dep_info.dest_op);
00551 }
00552 dumped = TRUE;
00553 }
00554 _dv -> Update_End();
00555 }
00556
00557 char buffer[1024];
00558 char *s = Print_OP ((OP*)node, buffer);
00559 Is_True(strlen(s) < 1024, ("Print_OP buffer overflowed"));
00560 _dv -> Show_Message (s);
00561 }
00562 }
00563
00564 }
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588 void draw_bb_dependence_graph(BB *bb,const char *mes)
00589 {
00590 if (! DaVinci::enabled(TRUE)) return;
00591
00592 MEM_POOL dv_pool;
00593 dv_pool.magic_num = 0;
00594 MEM_POOL_Constructor pool( &dv_pool, "DaVinci", FALSE);
00595
00596 DaVinci dv (&dv_pool, NULL);
00597
00598 char window_title[128];
00599 if ( NULL == mes)
00600 sprintf(window_title,"DAG for BB %d - %s",
00601 BB_id(bb), Cur_PU_Name);
00602 else
00603 sprintf(window_title,"DAG for BB %d - %s - %s ",
00604 BB_id(bb), Cur_PU_Name, mes);
00605 Is_True(strlen(window_title) < 128, ("Window Title buf overflowed"));
00606 dv.Title(window_title);
00607
00608
00609 char nlabel[64];
00610 INT32 edge_id_number;
00611 VOID_SET bb_ops;
00612 NODE_TYPE nt, nt_plain, nt_cross_bb;
00613
00614 EDGE_TYPE et,et_dotted,et_plain;
00615 BOOL show_branch_edge;
00616 BOOL dep_cross_bb;
00617
00618 nt_cross_bb.Boarder (NB_DOUBLE);
00619 et_dotted.Pattern (EP_DOTTED);
00620
00621
00622
00623
00624
00625 if (VT_Enable_DAG_BR) show_branch_edge = TRUE;
00626 else show_branch_edge = FALSE;
00627
00628 OPS op_list = bb->ops;
00629
00630
00631 for (OP* op = op_list.first ; op != NULL ; op = op -> next) {
00632 bb_ops.Insert(op);
00633 }
00634
00635 BB_DAG_Callback bb_dag_callback (&dv, &bb_ops);
00636 for (OP* op = op_list.first ; op != NULL ; op = op -> next) {
00637 bb_dag_callback.Insert_op_info(op);
00638 }
00639
00640 dv.Graph_Begin();
00641 for (OP* op = op_list.first ; op != NULL ; op = op -> next)
00642 {
00643 _CG_DEP_OP_INFO* this_op_dep_info = _CG_DEP_op_info(op);
00644 ARC_LIST* this_op_succ_list = this_op_dep_info -> succs;
00645
00646
00647 dep_cross_bb = FALSE;
00648 for ( ARC* arc = ARC_LIST_first (this_op_succ_list) ;
00649 arc != NULL ; arc = ARC_LIST_first( arc -> next[1]) )
00650 if ( ! bb_ops.Is_In(arc->succ) ) dep_cross_bb = TRUE;
00651 if (dep_cross_bb) nt = nt_cross_bb;
00652 else nt = nt_plain;
00653
00654
00655 if (OP_bundled(op)) nt.Color("orange");
00656 else nt.Color("palegreen");
00657
00658 sprintf(nlabel,"[ %d ] %s",OP_map_idx(op),TOP_Name((TOP)(op->opr)));
00659 Is_True(strlen(nlabel) < 64, ("Node Label buf overflowed"));
00660
00661 dv.Node_Begin (NODE_ID (op), nlabel, nt);
00662
00663 edge_id_number = 0;
00664
00665
00666 for ( ARC* arc = ARC_LIST_first (this_op_succ_list) ;
00667 arc != NULL ; arc = ARC_LIST_first( arc -> next[1]) )
00668 {
00669
00670
00671 if (! bb_ops.Is_In(arc->succ)) continue;
00672
00673 CG_DEP_KIND kind = ARC_kind(arc);
00674 if (ARC_is_dotted(arc)) et = et_dotted;
00675 else et = et_plain;
00676
00677 if ( (OP_bundled(arc->pred)) && OP_bundled(arc->succ) )
00678 et.Color("gray");
00679 else {
00680
00681 et.Color(Dependence_Color(kind));
00682 }
00683
00684 if ( ((CG_DEP_PREBR != kind) && (CG_DEP_POSTBR != kind)) ||
00685 show_branch_edge ) {
00686 dv.Out_Edge ( EDGE_ID ( NODE_ID(op),
00687 NODE_ID(INTPTR(edge_id_number ++))),
00688 et, NODE_ID (arc->succ));
00689 };
00690 }
00691
00692 dv.Node_End();
00693 }
00694
00695 dv.Graph_End();
00696 dv.Event_Loop(&bb_dag_callback);
00697 }
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731 void draw_regional_dependence_graph(REGION *r,const char *mes)
00732 {
00733 if (! DaVinci::enabled(TRUE)) return;
00734
00735 MEM_POOL dv_pool;
00736 dv_pool.magic_num = 0;
00737 MEM_POOL_Constructor pool( &dv_pool, "DaVinci", FALSE);
00738
00739 DaVinci dv (&dv_pool, NULL);
00740
00741 char window_title[128];
00742 if ( NULL == mes)
00743 sprintf(window_title,"Reduced DAG for Region %d - %s",
00744 r -> Id(), Cur_PU_Name);
00745 else
00746 sprintf(window_title,"Reduced DAG for Region %d - %s - %s ",
00747 r -> Id(), Cur_PU_Name, mes);
00748 Is_True(strlen(window_title) < 128, ("Window Title buf overflowed"));
00749 dv.Title(window_title);
00750
00751
00752 REGIONAL_CFG_NODE *being_drawn_node;
00753 REGION *being_drawn_region;
00754 BB *being_drawn_bb;
00755 void *last_node;
00756 VOID_SET regions, no_dep_bbs, bb_ops;
00757 char nlabel[64];
00758 INT32 edge_id_number;
00759 BOOL show_branch_edge;
00760 NODE_TYPE nt,nt_region,nt_op_sched,nt_op_unsched,
00761 nt_empty_bb,nt_entry_bb,nt_exit_bb;
00762 EDGE_TYPE et,et_btwn_op,et_btwn_bb,et_dotted,et_plain;
00763
00764
00765 nt_region.Color ("orange");
00766 nt_region.Boarder (NB_DOUBLE);
00767 nt_region.Shape (NS_CIRCLE);
00768
00769 nt_op_sched.Color ("pink");
00770 nt_op_unsched.Color ("palegreen");
00771
00772
00773 nt_entry_bb.Color ("gray");
00774 nt_entry_bb.Boarder (NB_DOUBLE);
00775 nt_entry_bb.Shape (NS_RHOMBUS);
00776 nt_exit_bb.Color ("gray");
00777 nt_exit_bb.Boarder (NB_DOUBLE);
00778 nt_exit_bb.Shape (NS_ELLIPSE);
00779 nt_empty_bb.Color ("gray");
00780 nt_empty_bb.Boarder (NB_DOUBLE);
00781 nt_empty_bb.Shape (NS_BOX);
00782
00783
00784 et_btwn_op.Direction(ED_NONE);
00785 et_btwn_op.Color ("white");
00786
00787 et_btwn_bb.Pattern (EP_THICK);
00788 et_btwn_bb.Color ("pink");
00789
00790 et_dotted.Pattern (EP_DOTTED);
00791
00792
00793 if (VT_Enable_DAG_BR) show_branch_edge = TRUE;
00794 else show_branch_edge = FALSE;
00795
00796 Regioanl_DAG_Callback regional_dag_callback(&dv, ®ions, &no_dep_bbs);
00797
00798 dv.Graph_Begin();
00799
00800 REGIONAL_CFG *cfg = r -> Regional_Cfg();
00801
00802 for (SEQ_REGIONAL_CFG_ITER iter(cfg) ; iter != 0 ; ++ iter)
00803 {
00804 being_drawn_node = *iter;
00805 if ( being_drawn_node -> Is_Region() ) {
00806 being_drawn_region = being_drawn_node -> Region_Node();
00807 sprintf(nlabel, " %d ", being_drawn_region -> Id());
00808 Is_True(strlen(nlabel) < 64, ("Node Label buf overflowed"));
00809 dv.Node_Begin ( NODE_ID(being_drawn_region), nlabel, nt_region);
00810
00811
00812 regions.Insert( being_drawn_region );
00813 last_node = being_drawn_region;
00814 }
00815 else {
00816 being_drawn_bb = being_drawn_node -> BB_Node();
00817 if ( BB_entry(being_drawn_bb) || BB_exit(being_drawn_bb) ||
00818 0 == BB_length(being_drawn_bb) )
00819 {
00820
00821
00822 sprintf(nlabel, " %d ", being_drawn_bb -> id);
00823 Is_True(strlen(nlabel) < 64, ("Node Label buf overflowed"));
00824
00825 if (BB_entry(being_drawn_bb)) nt = nt_entry_bb;
00826 else if (BB_exit(being_drawn_bb)) nt = nt_exit_bb;
00827 else if (0 == BB_length(being_drawn_bb)) nt = nt_empty_bb;
00828 dv.Node_Begin(NODE_ID(being_drawn_bb), nlabel, nt);
00829
00830 no_dep_bbs.Insert( being_drawn_bb );
00831 last_node = being_drawn_bb;
00832 }
00833 else {
00834
00835
00836 OPS op_list = being_drawn_bb -> ops;
00837 OP *op;
00838
00839
00840 for (OP* op = op_list.first ; op != NULL ; op = op -> next) {
00841 bb_ops.Insert(op);
00842 }
00843
00844 for (OP* op = op_list.first ; op != NULL ; op = op -> next) {
00845 regional_dag_callback.Insert_op_info(op, &bb_ops);
00846 }
00847
00848 for ( op = op_list.first; op!= NULL; op = op -> next) {
00849
00850 if (OP_bundled(op)) nt=nt_op_sched;
00851 else nt = nt_op_unsched;
00852 sprintf(nlabel,"[ %d ] %s", OP_map_idx(op),
00853 TOP_Name((TOP)(op->opr)));
00854 Is_True(strlen(nlabel)<64,("Node Label buf overflowed"));
00855
00856 dv.Node_Begin (NODE_ID (op), nlabel, nt);
00857
00858 _CG_DEP_OP_INFO* this_op_dep_info = _CG_DEP_op_info(op);
00859 ARC_LIST* this_op_succ_list = this_op_dep_info -> succs;
00860
00861 edge_id_number = 0;
00862
00863
00864 for ( ARC* arc = ARC_LIST_first (this_op_succ_list) ;
00865 arc != NULL ; arc = ARC_LIST_first( arc -> next[1]) )
00866 {
00867
00868
00869 if (! bb_ops.Is_In(arc->succ)) continue;
00870
00871 CG_DEP_KIND kind = ARC_kind(arc);
00872 if (ARC_is_dotted(arc)) et = et_dotted;
00873 else et = et_plain;
00874
00875 if ((OP_bundled(arc->pred)) && OP_bundled(arc->succ))
00876 et.Color("gray");
00877 else {
00878
00879 et.Color(Dependence_Color(kind));
00880 }
00881
00882
00883
00884
00885 if (((CG_DEP_PREBR != kind)&&(CG_DEP_POSTBR != kind))
00886 || show_branch_edge ) {
00887 dv.Out_Edge ( EDGE_ID ( NODE_ID(op),
00888 NODE_ID(INTPTR(2* edge_id_number++))),
00889 et, NODE_ID (arc->succ));
00890 }
00891 }
00892
00893 if (op->next!= NULL) {
00894 dv.Out_Edge(EDGE_ID( NODE_ID(op),NODE_ID(op->next) ),
00895 et_btwn_op,
00896 NODE_ID (op -> next));
00897 dv.Node_End ();
00898 }
00899 last_node = op;
00900 }
00901 bb_ops.Clear();
00902 }
00903 }
00904
00905 for (CFG_SUCC_NODE_ITER kid_iter(being_drawn_node);
00906 kid_iter!=0; ++ kid_iter)
00907 {
00908 REGIONAL_CFG_NODE *kid_cfg_node = *kid_iter;
00909 void *kid_node;
00910 if ( kid_cfg_node -> Is_Region() )
00911 kid_node = kid_cfg_node -> Region_Node();
00912 else {
00913 being_drawn_bb = kid_cfg_node -> BB_Node();
00914 if ( BB_entry(being_drawn_bb) || BB_exit(being_drawn_bb) ||
00915 0 == BB_length(being_drawn_bb) )
00916 kid_node = being_drawn_bb;
00917 else kid_node = being_drawn_bb -> ops.first;
00918 }
00919
00920 dv.Out_Edge(EDGE_ID(last_node, kid_node), et_btwn_bb, kid_node);
00921 }
00922
00923 dv.Node_End();
00924 }
00925
00926 dv.Graph_End();
00927
00928 dv.Event_Loop( (DaVinci_Callback*) ®ional_dag_callback );
00929 }
00930
00931
00932
00933
00934
00935
00936
00937
00938
00939 char *
00940 Print_OP (OP *op, char *buf)
00941 {
00942 char *result = buf;
00943
00944 WN *wn;
00945 BOOL cg_loop_op = Is_CG_LOOP_Op(op);
00946 buf += sprintf(buf,"[ %d ] ", OP_map_idx(op) );
00947 if (OP_has_tag(op)) {
00948 LABEL_IDX tag = Get_OP_Tag(op);
00949 buf += sprintf (buf, "<tag %s>: ", LABEL_name(tag) );
00950 }
00951 for (INT32 i = 0; i < OP_results(op); i++) {
00952 char buffer[1024];
00953 char *s = sPrint_TN (OP_result(op,i), FALSE, buffer);
00954 Is_True(strlen(s) < 1024, ("Print_TN buffer overflowed"));
00955 buf += sprintf(buf, " %s", s);
00956 }
00957 buf += sprintf(buf," %s", TOP_Name((TOP)(op->opr)) );
00958 if ( OP_variant(op) != 0 )
00959 buf += sprintf (buf, " (%x)", OP_variant(op) );
00960 for (INT32 i=0; i<OP_opnds(op); i++) {
00961 TN *tn = OP_opnd(op,i);
00962 char buffer[1024];
00963 char *s = sPrint_TN (tn, FALSE, buffer);
00964 Is_True(strlen(s) < 1024, ("Print_TN buffer overflowed"));
00965 buf += sprintf(buf, " %s", s);
00966
00967 if ( cg_loop_op ) {
00968 INT omega = TN_is_symbol(tn) ? OP_restore_omega(op) :
00969 OP_omega(op,i);
00970 if (omega)
00971 buf += sprintf(buf, "[%d]", omega);
00972 }
00973 if (OP_Defs_TN(op, tn)) buf += sprintf(buf, "<defopnd>");
00974 buf += sprintf(buf, " ");
00975 }
00976 if (OP_glue(op)) buf += sprintf (buf, " glue");
00977 if (OP_no_alias(op)) buf += sprintf (buf, " noalias");
00978 if (OP_copy(op)) buf += sprintf (buf, " copy");
00979 if (OP_volatile(op)) buf += sprintf (buf, " volatile");
00980 if (OP_side_effects(op))buf += sprintf (buf, " side_effects");
00981 if (OP_hoisted(op)) buf += sprintf (buf, " hoisted");
00982 if (OP_cond_def(op)) buf += sprintf (buf, " cond_def");
00983 if (OP_end_group(op)) buf += sprintf (buf, " end_group");
00984 if (OP_tail_call(op)) buf += sprintf (buf, " tail_call");
00985 if (OP_no_move_before_gra(op)) buf += sprintf (buf, " no_move");
00986 if (OP_Scheduled(op)) buf += sprintf (buf, " scheduled");
00987
00988 if (wn = Get_WN_From_Memory_OP(op)) {
00989 char buffer[500];
00990 buffer[0] = '\0';
00991 if (Alias_Manager) Print_alias_info (buffer, Alias_Manager, wn);
00992 buf += sprintf(buf, " WN=%p %s", wn, buffer);
00993 }
00994 if (OP_unrolling(op)) {
00995 UINT16 unr = OP_unrolling(op);
00996 buf += sprintf(buf, " %d%s unrolling", unr,
00997 unr == 1 ? "st" : unr == 2 ? "nd" : unr == 3 ? "rd" : "th");
00998 }
00999 return result;
01000 }