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
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 #ifndef opt_transform_INCLUDED
00056 #define opt_transform_INCLUDED
00057
00058 #include "defs.h"
00059 #include "stab.h"
00060 #include "opt_defs.h"
00061 #include "opt_config.h"
00062 #include "opt_base.h"
00063 #include "opt_bb.h"
00064 #include "opt_sym.h"
00065 #include "opt_htable.h"
00066 #include "opt_cfg.h"
00067 #include "opt_mu_chi.h"
00068 #include "opt_ssa.h"
00069 #include "opt_main.h"
00070
00071
00072
00073 template <class Pred>
00074 BOOL find(CODEREP *cr, Pred pred)
00075 {
00076 if (pred(cr)) return TRUE;
00077
00078 switch ( cr->Kind() ) {
00079 case CK_IVAR:
00080 {
00081 CODEREP *base =
00082 (cr->Istr_base()) ? cr->Istr_base() : cr->Ilod_base();
00083 if (find(cr, pred))
00084 return TRUE;
00085 if (cr->Opr() == OPR_MLOAD &&
00086 find(cr->Mload_size(), pred))
00087 return TRUE;
00088 if (cr->Opr() == OPR_ILOADX &&
00089 find(cr->Index(), pred))
00090 return TRUE;
00091 MU_NODE *mnode = cr->Ivar_mu_node();
00092 if (mnode) {
00093 CODEREP *opnd = mnode->OPND();
00094 if (opnd && find(opnd, pred))
00095 return TRUE;
00096 }
00097 }
00098 return FALSE;
00099
00100 case CK_OP:
00101
00102 for (INT32 ikid = 0; ikid < cr->Kid_count(); ikid++ ) {
00103 if (find(cr->Opnd(ikid), pred))
00104 return TRUE;
00105 }
00106 return FALSE;
00107 }
00108 return FALSE;
00109 }
00110
00111
00112 struct DONT_TRACK_CUR_VERSION {
00113 void Enter_BB(BB_NODE *bb, CODEMAP *htable) { }
00114 void Enter_SR(STMTREP *stmt, BB_NODE *bb, CODEMAP *htable) { }
00115 void Exit_SR(STMTREP *stmt, BB_NODE *bb, CODEMAP *htable) { }
00116 void Exit_BB(BB_NODE *bb, CODEMAP *htable) { }
00117 DONT_TRACK_CUR_VERSION(COMP_UNIT *cu) {}
00118 };
00119
00120
00121
00122
00123 struct TRACK_CUR_VERSION {
00124 MEM_POOL _mem_pool;
00125 STACK<CODEREP*> **_vec_of_stack;
00126 OPT_STAB *_opt_stab;
00127
00128 OPT_STAB *Opt_stab() const { return _opt_stab; }
00129
00130 void Push(AUX_ID id, CODEREP *cr) { _vec_of_stack[id]->Push(cr); }
00131 void Pop(AUX_ID id) { _vec_of_stack[id]->Pop(); }
00132 int Size(AUX_ID id) const { return _vec_of_stack[id]->Elements(); }
00133 CODEREP *Top(AUX_ID id) const { return _vec_of_stack[id]->Top(); }
00134 CODEREP *Non_zero_top(AUX_ID id) {
00135 int n_elm = Size(id);
00136 for (int i = 0; i < n_elm; i++) {
00137 CODEREP *cr = _vec_of_stack[id]->Top_nth(i);
00138 if (!cr->Is_flag_set(CF_IS_ZERO_VERSION))
00139 return cr;
00140 }
00141 return NULL;
00142 }
00143 BOOL Is_volatile(AUX_ID id) { return _opt_stab->Is_volatile(id); }
00144
00145 void Print_stack(AUX_ID id, FILE *fp) {
00146 STACK<CODEREP*> *s = _vec_of_stack[id];
00147 for (int i = 0; i < s->Elements(); ++i) {
00148 CODEREP *top = s->Top_nth(i);
00149 if (top)
00150 fprintf(fp, "cr%d ", top->Coderep_id());
00151 else
00152 fprintf(fp, "null ");
00153 }
00154 fprintf(fp,"\n");
00155 }
00156
00157 void Enter_BB(BB_NODE *bb, CODEMAP *htable) {
00158 PHI_NODE *phi;
00159 PHI_LIST_ITER phi_iter;
00160
00161 FOR_ALL_ELEM (phi, phi_iter, Init(bb->Phi_list())) {
00162 if (phi->Live())
00163 Push(phi->Aux_id(), phi->RESULT());
00164 else
00165 Push(phi->Aux_id(),
00166 htable->Ssa()->Get_zero_version_CR(phi->Aux_id(), Opt_stab(), 0));
00167 }
00168 }
00169
00170 void Enter_SR(STMTREP *stmt, BB_NODE *bb, CODEMAP *htable) {
00171 if (OPERATOR_is_scalar_store (stmt->Opr())) {
00172 CODEREP *lhs = stmt->Lhs();
00173 Push(lhs->Aux_id(), lhs);
00174 }
00175 if (stmt->Has_chi()) {
00176 CHI_LIST_ITER chi_iter;
00177 CHI_NODE *cnode;
00178 CHI_LIST *chi_list = stmt->Chi_list();
00179
00180
00181 if (stmt->Opr() == OPR_OPT_CHI) {
00182 FOR_ALL_NODE( cnode, chi_iter, Init(chi_list)) {
00183 if (!cnode->Dse_dead())
00184 Push(cnode->Aux_id(), cnode->RESULT());
00185 else
00186 Push(cnode->Aux_id(),
00187 htable->Ssa()->Get_zero_version_CR(cnode->Aux_id(), Opt_stab(), 0));
00188 }
00189 } else {
00190 FOR_ALL_NODE( cnode, chi_iter, Init(chi_list)) {
00191 if (cnode->Live())
00192 Push(cnode->Aux_id(), cnode->RESULT());
00193 }
00194 }
00195 }
00196 }
00197
00198 void Exit_SR(STMTREP *stmt, BB_NODE *bb, CODEMAP *htable) {
00199 if (stmt->Has_chi()) {
00200 CHI_LIST_ITER chi_iter;
00201 CHI_NODE *cnode;
00202 CHI_LIST *chi_list = stmt->Chi_list();
00203 if (stmt->Opr() == OPR_OPT_CHI) {
00204 FOR_ALL_NODE( cnode, chi_iter, Init(chi_list)) {
00205 Pop(cnode->Aux_id());
00206 }
00207 }else {
00208 FOR_ALL_NODE( cnode, chi_iter, Init(chi_list)) {
00209 if (cnode->Live())
00210 Pop(cnode->Aux_id());
00211 }
00212 }
00213 }
00214 if (OPERATOR_is_scalar_store (stmt->Opr()))
00215 Pop(stmt->Lhs()->Aux_id());
00216 }
00217
00218 void Exit_BB(BB_NODE *bb, CODEMAP *htable) {
00219 PHI_LIST_ITER phi_iter;
00220 PHI_NODE *phi;
00221 FOR_ALL_ELEM (phi, phi_iter, Init(bb->Phi_list())) {
00222 Pop(phi->Aux_id());
00223 }
00224 }
00225
00226 TRACK_CUR_VERSION(COMP_UNIT *cu):
00227 _opt_stab(cu->Opt_stab())
00228 {
00229 OPT_POOL_Initialize(&_mem_pool, "Current version pool", FALSE, 0);
00230 OPT_POOL_Push(&_mem_pool, IVR_DUMP_FLAG);
00231 INT32 count = Opt_stab()->Lastidx()+1;
00232 _vec_of_stack = (STACK<CODEREP*> **)CXX_NEW_ARRAY( STACK<CODEREP*>*, count, &_mem_pool);
00233 for (INT32 i = 0; i < count; i++) {
00234 _vec_of_stack[i] = CXX_NEW(STACK<CODEREP*>(&_mem_pool), &_mem_pool);
00235 }
00236 }
00237 ~TRACK_CUR_VERSION() {
00238 OPT_POOL_Pop(&_mem_pool, 0);
00239 OPT_POOL_Delete(&_mem_pool, 0);
00240 }
00241 };
00242
00243 struct leaf_is_not_cur_ver_pred {
00244 TRACK_CUR_VERSION *cur_ver;
00245 BOOL operator()(CODEREP *cr) {
00246 if (cr->Kind() == CK_VAR && cur_ver->Top(cr->Aux_id()) != cr)
00247 return TRUE;
00248 else
00249 return FALSE;
00250 }
00251 leaf_is_not_cur_ver_pred(TRACK_CUR_VERSION *t):cur_ver(t) {}
00252 };
00253
00254
00255 inline BOOL is_current_version(TRACK_CUR_VERSION *cur_ver, CODEREP *cr) {
00256 return ! find(cr, leaf_is_not_cur_ver_pred(cur_ver));
00257 }
00258
00259
00260
00261 struct NO_CACHE {
00262 typedef COMP_UNIT* key_type;
00263 const char *_name;
00264 INT32 _count_unique;
00265 INT32 _count_total;
00266 INT32 _count_processed;
00267 BOOL _trace;
00268
00269 CODEREP *Lookup(CODEREP *, COMP_UNIT *) { return NULL; }
00270 void Update(CODEREP *, CODEREP *newcr, COMP_UNIT *) {
00271 if (newcr) {
00272 ++_count_unique;
00273 ++_count_total;
00274 }
00275 ++_count_processed;
00276 }
00277
00278 INT32 Count_unique() const { return _count_unique; }
00279 INT32 Count_total() const { return _count_total; }
00280 INT32 Count_processed() const { return _count_processed; }
00281 BOOL Trace() const { return _trace; }
00282
00283 NO_CACHE(const char *name, BOOL trace):
00284 _name(name),
00285 _count_unique(0),
00286 _count_total(0),
00287 _count_processed(0),
00288 _trace(trace)
00289 {}
00290 ~NO_CACHE() {
00291 if (Trace()) {
00292 fprintf(TFile, "CACHE<%s>: unique=%d, total=%d, processed=%d\n",
00293 _name,
00294 Count_unique(),
00295 Count_total(),
00296 Count_processed());
00297 }
00298 }
00299 };
00300
00301
00302 struct PER_PU_CACHE : public NO_CACHE {
00303 MEM_POOL _mem_pool;
00304 CODEMAP *_htable;
00305 CODEREP **_cached_result;
00306
00307 CODEREP *Lookup(CODEREP *cr, key_type key) {
00308 INT32 id = cr->Coderep_id();
00309 if (_cached_result[id] != NULL)
00310 ++_count_total;
00311 return _cached_result[id];
00312 }
00313
00314 void Update(CODEREP *cr, CODEREP *newcr, key_type key) {
00315 INT32 id = cr->Coderep_id();
00316 _cached_result[id] = newcr;
00317 if (newcr) {
00318 ++_count_unique;
00319 ++_count_total;
00320 }
00321 ++_count_processed;
00322 }
00323
00324 PER_PU_CACHE(COMP_UNIT *cu, const char *name, BOOL trace):
00325 NO_CACHE(name, trace),
00326 _htable(cu->Htable()) {
00327 OPT_POOL_Initialize(&_mem_pool, "SIMP BOOL pool", FALSE, 0);
00328 OPT_POOL_Push(&_mem_pool, IVR_DUMP_FLAG);
00329 _cached_result = (CODEREP **)
00330 CXX_NEW_ARRAY(CODEREP *, _htable->Coderep_id_cnt(), &_mem_pool);
00331 for (INT32 i = 0; i < _htable->Coderep_id_cnt(); i++)
00332 _cached_result[i] = NULL;
00333 }
00334 ~PER_PU_CACHE() {
00335 OPT_POOL_Pop(&_mem_pool, 0);
00336 OPT_POOL_Delete(&_mem_pool, 0);
00337 }
00338 };
00339
00340
00341 template <class CACHE_KEY>
00342 struct CACHE_TEMPLATE : public PER_PU_CACHE {
00343 typedef CACHE_KEY key_type;
00344 key_type *_visited;
00345
00346 CODEREP *Lookup(CODEREP *cr, key_type key) {
00347 INT32 id = cr->Coderep_id();
00348 if (_visited[id] == key) {
00349 if (_cached_result[id] != NULL)
00350 ++_count_total;
00351 return _cached_result[id];
00352 }
00353 return NULL;
00354 }
00355
00356 void Update(CODEREP *cr, CODEREP *newcr, key_type key) {
00357 INT32 id = cr->Coderep_id();
00358 _visited[id] = key;
00359 _cached_result[id] = newcr;
00360 if (newcr) {
00361 ++_count_unique;
00362 ++_count_total;
00363 }
00364 ++_count_processed;
00365 }
00366
00367 void Clear_visited() {
00368 for (INT32 i = 0; i < _htable->Coderep_id_cnt(); i++)
00369 _visited[i] = NULL;
00370 }
00371
00372 CACHE_TEMPLATE(COMP_UNIT *cu, const char *name, BOOL trace):
00373 PER_PU_CACHE(cu, name, trace) {
00374 _visited = (CACHE_KEY *)
00375 CXX_NEW_ARRAY(CACHE_KEY* , _htable->Coderep_id_cnt(), &_mem_pool);
00376 Clear_visited();
00377 }
00378 ~CACHE_TEMPLATE(void) { }
00379 };
00380
00381
00382 #if 0
00383 struct SHARED_CACHE : public CACHE_TEMPLATE<UINT32> {
00384 static UINT32 _next_key;
00385 UINT32 Alloc_key() {
00386 if (_next_key == 0) Clear_visited();
00387 return _next_key++;
00388 }
00389 };
00390
00391 SHARED_CACHE::_next_key = 1;
00392
00393 STMTREP *Get_cache_key(STMTREP *, STMTREP *stmt, BB_NODE *bb, INT32 temp_key) { return stmt; }
00394 BB_NODE *Get_cache_key(BB_NODE *, STMTREP *stmt, BB_NODE *bb, INT32 temp_key) { return bb; }
00395 COMP_UNIT *Get_cache_key(COMP_UNIT *, STMTREP *stmt, BB_NODE *bb, INT32 temp_key) { return NULL; }
00396 INT32 Get_cache_key(INT32, STMTREP *stmt, BB_NODE *bb, INT32 temp_key) { return temp_key; }
00397
00398 #else
00399
00400 inline STMTREP *Get_cache_key(STMTREP *, STMTREP *stmt, BB_NODE *bb) { return stmt; }
00401 inline BB_NODE *Get_cache_key(BB_NODE *, STMTREP *stmt, BB_NODE *bb) { return bb; }
00402 inline COMP_UNIT *Get_cache_key(COMP_UNIT *, STMTREP *stmt, BB_NODE *bb) { return NULL; }
00403
00404 #endif
00405
00406
00407 typedef CACHE_TEMPLATE<STMTREP*> PER_SR_CACHE;
00408 typedef CACHE_TEMPLATE<BB_NODE*> PER_BB_CACHE;
00409
00410
00411
00412
00413
00414 #ifdef Is_True_On
00415
00416 void set_transform_stop_at(int bb_id, int stmt_id);
00417 void transform_stopped();
00418 void check_transform_stop_at(int bb_id, int stmt_id);
00419 #endif
00420
00421 template <class TRANSFORM, class CACHE = PER_PU_CACHE, class VERSION = DONT_TRACK_CUR_VERSION>
00422 struct UPDATE {
00423 CODEMAP *_htable;
00424 CFG *_cfg;
00425 BOOL _trace;
00426 TRANSFORM *_trans;
00427 VERSION _version;
00428 CACHE _cache;
00429
00430 CODEMAP *Htable() const { return _htable; }
00431 CODEREP *Process_CR_no_repeat(CODEREP *cr, bool is_mu, STMTREP *stmt, BB_NODE *bb);
00432 void Process_PU(BB_NODE *bb);
00433
00434 public:
00435 UPDATE(COMP_UNIT *cu, TRANSFORM *trans, BOOL trace):
00436 _htable(cu->Htable()),
00437 _cfg(cu->Cfg()),
00438 _trace(trace),
00439 _trans(trans),
00440 _version(cu),
00441 _cache(cu, trans->Name(), trace) {
00442 trans->Setup(&_cache, &_version);
00443 }
00444 ~UPDATE() {
00445 }
00446
00447 void Process_PU() { Process_PU(_cfg->Entry_bb()); }
00448 void Process_BB(BB_NODE *bb);
00449 void Process_SR(STMTREP *stmt, BB_NODE *bb);
00450 CODEREP *Process_CR(CODEREP *cr, bool is_mu, STMTREP *stmt, BB_NODE *bb);
00451 };
00452
00453
00454
00455 template <class TRANSFORM, class CACHE, class VERSION>
00456 CODEREP *
00457 UPDATE<TRANSFORM, CACHE, VERSION>::Process_CR(CODEREP *cr, bool is_mu, STMTREP *stmt, BB_NODE *bb)
00458 {
00459 typename CACHE::key_type key = Get_cache_key((typename CACHE::key_type)NULL, stmt, bb);
00460 CODEREP *newcr = _cache.Lookup(cr, key);
00461 if (newcr == cr)
00462 return NULL;
00463 if (newcr)
00464 return newcr;
00465 newcr = Process_CR_no_repeat(cr, is_mu, stmt, bb);
00466 _cache.Update(cr, newcr != NULL ? newcr : cr, key);
00467 return newcr;
00468 }
00469
00470
00471 template <class TRANSFORM, class CACHE, class VERSION>
00472 CODEREP *
00473 UPDATE<TRANSFORM, CACHE, VERSION>::Process_CR_no_repeat(CODEREP *cr, bool is_mu, STMTREP *stmt, BB_NODE *bb)
00474 {
00475 CODEREP *simp = _trans->Apply_cr(cr, is_mu, stmt, bb, Htable());
00476 if (simp) {
00477 if (_trace) {
00478 fprintf(TFile, "UPDATE<%s>: BB%d\n", _trans->Name(), bb->Id());
00479 cr->Print(10, TFile);
00480 simp->Print(10, TFile);
00481 }
00482 return simp;
00483 }
00484
00485 switch (cr->Kind()) {
00486 case CK_LDA:
00487 case CK_CONST:
00488 case CK_RCONST:
00489 case CK_VAR:
00490 return NULL;
00491 case CK_IVAR:
00492 {
00493 CODEREP *ilod_base = Process_CR(cr->Ilod_base(), false, stmt, bb);
00494 CODEREP *mload_size = (cr->Opr() == OPR_MLOAD) ?
00495 Process_CR(cr->Mload_size(), false, stmt, bb) : NULL;
00496
00497 CODEREP *mu = NULL;
00498 if (cr->Ivar_mu_node())
00499 mu = Process_CR(cr->Ivar_mu_node()->OPND(), true, stmt, bb);
00500
00501 if (ilod_base || mload_size || mu) {
00502 CODEREP *newcr = Alloc_stack_cr(cr->Extra_ptrs_used());
00503 newcr->Copy(*cr);
00504 #ifdef KEY // bug 12390: without this, would do wrong ivar copy propagation
00505 newcr->Set_ivar_defstmt(NULL);
00506 #endif
00507 if (ilod_base)
00508 newcr->Set_ilod_base(ilod_base);
00509 newcr->Set_istr_base(NULL);
00510 if (mload_size)
00511 newcr->Set_mload_size(mload_size);
00512 if (mu) {
00513
00514
00515
00516 MU_NODE *mnode = (MU_NODE*) CXX_NEW(MU_NODE, Htable()->Mem_pool());
00517 mnode->Clone(cr->Ivar_mu_node());
00518 mnode->Set_OPND(mu);
00519 newcr->Set_ivar_mu_node(mnode);
00520 }
00521 newcr->Set_ivar_occ(cr->Ivar_occ());
00522
00523 CODEREP *ret = Htable()->Add_expr_and_fold(newcr);
00524
00525
00526
00527 ret->Reset_flag(CF_C_P_PROCESSED);
00528 ret->Reset_flag(CF_C_P_REHASHED);
00529 return ret;
00530 }
00531 break;
00532 }
00533 case CK_OP:
00534 {
00535 BOOL need_rehash = FALSE;
00536 CODEREP *newcr = Alloc_stack_cr(cr->Extra_ptrs_used());
00537 newcr->Copy(*cr);
00538 for (INT32 i = 0; i < cr->Kid_count(); i++) {
00539 CODEREP *opnd = Process_CR(cr->Opnd(i), false, stmt, bb);
00540 if (opnd) {
00541 need_rehash = TRUE;
00542 newcr->Set_opnd(i, opnd);
00543 }
00544 }
00545 if (need_rehash) {
00546 CODEREP *ret = Htable()->Add_expr_and_fold(newcr);
00547
00548 ret->Reset_flag(CF_C_P_PROCESSED);
00549
00550 #ifdef KEY
00551 if (ret->Kind() == CK_OP)
00552 #endif
00553 ret->Reset_flag(CF_C_P_REHASHED);
00554 return ret;
00555 }
00556 break;
00557 }
00558 }
00559 return NULL;
00560 }
00561
00562
00563 template <class TRANSFORM, class CACHE, class VERSION>
00564 void
00565 UPDATE<TRANSFORM, CACHE, VERSION>::Process_SR(STMTREP *stmt, BB_NODE *bb)
00566 {
00567 _trans->Apply_sr(stmt, bb, Htable());
00568
00569 CODEREP *cr;
00570 if (stmt->Rhs()) {
00571 if (cr = Process_CR(stmt->Rhs(), false, stmt, bb))
00572 stmt->Set_rhs(cr);
00573 }
00574 switch (stmt->Opr()) {
00575 case OPR_ISTORE:
00576 case OPR_ISTBITS:
00577 cr = Process_CR(stmt->Lhs()->Istr_base(), false, stmt, bb);
00578 if (cr)
00579 stmt->Lhs()->Set_istr_base(cr);
00580 break;
00581 case OPR_MSTORE:
00582 cr = Process_CR(stmt->Lhs()->Istr_base(), false, stmt, bb);
00583 if (cr)
00584 stmt->Lhs()->Set_istr_base(cr);
00585 CODEREP *num_bytes = (CODEREP *)stmt->Lhs()->Mstore_size();
00586 cr = Process_CR(num_bytes, false, stmt, bb);
00587 if (cr)
00588 stmt->Lhs()->Set_mstore_size(cr);
00589 break;
00590 }
00591 }
00592
00593
00594 template <class TRANSFORM, class CACHE, class VERSION>
00595 void
00596 UPDATE<TRANSFORM, CACHE, VERSION>::Process_BB(BB_NODE *bb)
00597 {
00598 _trans->Apply_bb(bb, Htable());
00599
00600 _version.Enter_BB(bb, Htable());
00601
00602 #ifdef Is_True_On
00603 int stmt_count = 0;
00604 #endif
00605
00606
00607 STMTREP_ITER stmt_iter(bb->Stmtlist());
00608 STMTREP *stmt;
00609 FOR_ALL_NODE(stmt, stmt_iter, Init()) {
00610 #ifdef Is_True_On
00611 check_transform_stop_at(bb->Id(), stmt_count++);
00612 #endif
00613 Process_SR(stmt, bb);
00614 _version.Enter_SR(stmt, bb, Htable());
00615 }
00616
00617 _trans->Apply_bb_post(bb, Htable());
00618 }
00619
00620
00621 template <class TRANSFORM, class CACHE, class VERSION>
00622 void
00623 UPDATE<TRANSFORM, CACHE, VERSION>::Process_PU(BB_NODE *bb)
00624 {
00625 Process_BB(bb);
00626
00627 BB_NODE *dom_bb;
00628 BB_LIST_ITER dom_bb_iter;
00629 FOR_ALL_ELEM(dom_bb, dom_bb_iter, Init(bb->Dom_bbs())) {
00630 Process_PU(dom_bb);
00631 }
00632
00633 STMTREP_ITER stmt_iter(bb->Stmtlist());
00634 STMTREP *stmt;
00635 FOR_ALL_NODE_REVERSE(stmt, stmt_iter, Init()) {
00636 _version.Exit_SR(stmt, bb, Htable());
00637 }
00638 _version.Exit_BB(bb, Htable());
00639 }
00640
00641
00642 struct NULL_TRANSFORM {
00643
00644 const char *Name() const { return "undefined"; }
00645 CODEREP *Apply_cr(CODEREP *cr, bool is_mu, STMTREP *stmt, BB_NODE *bb, CODEMAP *htable) const { return NULL; }
00646 void Apply_sr(STMTREP *stmt, BB_NODE *bb, CODEMAP *htable) const { }
00647 void Apply_sr_post(STMTREP *stmt, BB_NODE *bb, CODEMAP *htable) const { }
00648 void Apply_bb(BB_NODE *bb, CODEMAP *htable) const { }
00649 void Apply_bb_post(BB_NODE *bb, CODEMAP *htable) const { }
00650 };
00651
00652
00653
00654
00655 struct SUBSTITUE : public NULL_TRANSFORM {
00656 const char *Name() const { return "Substitute"; }
00657 CODEREP *_oldcr;
00658 CODEREP *_newcr;
00659 CODEREP *Apply_cr(CODEREP *cr, bool is_mu, STMTREP *stmt, BB_NODE *, CODEMAP *htable) const
00660 {
00661 if (cr == _oldcr)
00662 return _newcr;
00663 else
00664
00665 return NULL;
00666 }
00667
00668 void Init(CODEREP *o, CODEREP *n) { _oldcr = o; _newcr = n; }
00669
00670 void Setup(PER_SR_CACHE *, DONT_TRACK_CUR_VERSION *) {}
00671
00672 SUBSTITUE():
00673 _oldcr(NULL),
00674 _newcr(NULL) {}
00675 };
00676
00677
00678
00679 #endif // opt_transform_INCLUDED