Mercurial > hg > CbC > CbC_gcc
comparison gcc/df-problems.c @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 /* Standard problems for dataflow support routines. | 1 /* Standard problems for dataflow support routines. |
2 Copyright (C) 1999-2018 Free Software Foundation, Inc. | 2 Copyright (C) 1999-2020 Free Software Foundation, Inc. |
3 Originally contributed by Michael P. Hayes | 3 Originally contributed by Michael P. Hayes |
4 (m.hayes@elec.canterbury.ac.nz, mhayes@redhat.com) | 4 (m.hayes@elec.canterbury.ac.nz, mhayes@redhat.com) |
5 Major rewrite contributed by Danny Berlin (dberlin@dberlin.org) | 5 Major rewrite contributed by Danny Berlin (dberlin@dberlin.org) |
6 and Kenneth Zadeck (zadeck@naturalbridge.com). | 6 and Kenneth Zadeck (zadeck@naturalbridge.com). |
7 | 7 |
34 #include "cfganal.h" | 34 #include "cfganal.h" |
35 #include "dce.h" | 35 #include "dce.h" |
36 #include "valtrack.h" | 36 #include "valtrack.h" |
37 #include "dumpfile.h" | 37 #include "dumpfile.h" |
38 #include "rtl-iter.h" | 38 #include "rtl-iter.h" |
39 #include "regs.h" | |
40 #include "function-abi.h" | |
39 | 41 |
40 /* Note that turning REG_DEAD_DEBUGGING on will cause | 42 /* Note that turning REG_DEAD_DEBUGGING on will cause |
41 gcc.c-torture/unsorted/dump-noaddr.c to fail because it prints | 43 gcc.c-torture/unsorted/dump-noaddr.c to fail because it prints |
42 addresses in the dumps. */ | 44 addresses in the dumps. */ |
43 #define REG_DEAD_DEBUGGING 0 | 45 #define REG_DEAD_DEBUGGING 0 |
137 by the regnum are used to represent that there is a killing def | 139 by the regnum are used to represent that there is a killing def |
138 for the register. The confluence and transfer functions use | 140 for the register. The confluence and transfer functions use |
139 these along with the bitmap_clear_range call to remove ranges of | 141 these along with the bitmap_clear_range call to remove ranges of |
140 bits without actually generating a knockout vector. | 142 bits without actually generating a knockout vector. |
141 | 143 |
142 The kill and sparse_kill and the dense_invalidated_by_call and | 144 The kill and sparse_kill and the dense_invalidated_by_eh and |
143 sparse_invalidated_by_call both play this game. */ | 145 sparse_invalidated_by_eh both play this game. */ |
144 | 146 |
145 /* Private data used to compute the solution for this problem. These | 147 /* Private data used to compute the solution for this problem. These |
146 data structures are not accessible outside of this module. */ | 148 data structures are not accessible outside of this module. */ |
147 struct df_rd_problem_data | 149 class df_rd_problem_data |
148 { | 150 { |
149 /* The set of defs to regs invalidated by call. */ | 151 public: |
150 bitmap_head sparse_invalidated_by_call; | 152 /* The set of defs to regs invalidated by EH edges. */ |
151 /* The set of defs to regs invalidate by call for rd. */ | 153 bitmap_head sparse_invalidated_by_eh; |
152 bitmap_head dense_invalidated_by_call; | 154 bitmap_head dense_invalidated_by_eh; |
153 /* An obstack for the bitmaps we need for this problem. */ | 155 /* An obstack for the bitmaps we need for this problem. */ |
154 bitmap_obstack rd_bitmaps; | 156 bitmap_obstack rd_bitmaps; |
155 }; | 157 }; |
156 | 158 |
157 | 159 |
159 | 161 |
160 static void | 162 static void |
161 df_rd_free_bb_info (basic_block bb ATTRIBUTE_UNUSED, | 163 df_rd_free_bb_info (basic_block bb ATTRIBUTE_UNUSED, |
162 void *vbb_info) | 164 void *vbb_info) |
163 { | 165 { |
164 struct df_rd_bb_info *bb_info = (struct df_rd_bb_info *) vbb_info; | 166 class df_rd_bb_info *bb_info = (class df_rd_bb_info *) vbb_info; |
165 if (bb_info) | 167 if (bb_info) |
166 { | 168 { |
167 bitmap_clear (&bb_info->kill); | 169 bitmap_clear (&bb_info->kill); |
168 bitmap_clear (&bb_info->sparse_kill); | 170 bitmap_clear (&bb_info->sparse_kill); |
169 bitmap_clear (&bb_info->gen); | 171 bitmap_clear (&bb_info->gen); |
179 static void | 181 static void |
180 df_rd_alloc (bitmap all_blocks) | 182 df_rd_alloc (bitmap all_blocks) |
181 { | 183 { |
182 unsigned int bb_index; | 184 unsigned int bb_index; |
183 bitmap_iterator bi; | 185 bitmap_iterator bi; |
184 struct df_rd_problem_data *problem_data; | 186 class df_rd_problem_data *problem_data; |
185 | 187 |
186 if (df_rd->problem_data) | 188 if (df_rd->problem_data) |
187 { | 189 { |
188 problem_data = (struct df_rd_problem_data *) df_rd->problem_data; | 190 problem_data = (class df_rd_problem_data *) df_rd->problem_data; |
189 bitmap_clear (&problem_data->sparse_invalidated_by_call); | 191 bitmap_clear (&problem_data->sparse_invalidated_by_eh); |
190 bitmap_clear (&problem_data->dense_invalidated_by_call); | 192 bitmap_clear (&problem_data->dense_invalidated_by_eh); |
191 } | 193 } |
192 else | 194 else |
193 { | 195 { |
194 problem_data = XNEW (struct df_rd_problem_data); | 196 problem_data = XNEW (class df_rd_problem_data); |
195 df_rd->problem_data = problem_data; | 197 df_rd->problem_data = problem_data; |
196 | 198 |
197 bitmap_obstack_initialize (&problem_data->rd_bitmaps); | 199 bitmap_obstack_initialize (&problem_data->rd_bitmaps); |
198 bitmap_initialize (&problem_data->sparse_invalidated_by_call, | 200 bitmap_initialize (&problem_data->sparse_invalidated_by_eh, |
199 &problem_data->rd_bitmaps); | 201 &problem_data->rd_bitmaps); |
200 bitmap_initialize (&problem_data->dense_invalidated_by_call, | 202 bitmap_initialize (&problem_data->dense_invalidated_by_eh, |
201 &problem_data->rd_bitmaps); | 203 &problem_data->rd_bitmaps); |
202 } | 204 } |
203 | 205 |
204 df_grow_bb_info (df_rd); | 206 df_grow_bb_info (df_rd); |
205 | 207 |
206 /* Because of the clustering of all use sites for the same pseudo, | 208 /* Because of the clustering of all use sites for the same pseudo, |
207 we have to process all of the blocks before doing the analysis. */ | 209 we have to process all of the blocks before doing the analysis. */ |
208 | 210 |
209 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) | 211 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) |
210 { | 212 { |
211 struct df_rd_bb_info *bb_info = df_rd_get_bb_info (bb_index); | 213 class df_rd_bb_info *bb_info = df_rd_get_bb_info (bb_index); |
212 | 214 |
213 /* When bitmaps are already initialized, just clear them. */ | 215 /* When bitmaps are already initialized, just clear them. */ |
214 if (bb_info->kill.obstack) | 216 if (bb_info->kill.obstack) |
215 { | 217 { |
216 bitmap_clear (&bb_info->kill); | 218 bitmap_clear (&bb_info->kill); |
280 more complicated than just simulating, because we must produce the | 282 more complicated than just simulating, because we must produce the |
281 gen and kill sets and hence deal with the two possible representations | 283 gen and kill sets and hence deal with the two possible representations |
282 of kill sets. */ | 284 of kill sets. */ |
283 | 285 |
284 static void | 286 static void |
285 df_rd_bb_local_compute_process_def (struct df_rd_bb_info *bb_info, | 287 df_rd_bb_local_compute_process_def (class df_rd_bb_info *bb_info, |
286 df_ref def, | 288 df_ref def, |
287 int top_flag) | 289 int top_flag) |
288 { | 290 { |
289 for (; def; def = DF_REF_NEXT_LOC (def)) | 291 for (; def; def = DF_REF_NEXT_LOC (def)) |
290 { | 292 { |
337 | 339 |
338 static void | 340 static void |
339 df_rd_bb_local_compute (unsigned int bb_index) | 341 df_rd_bb_local_compute (unsigned int bb_index) |
340 { | 342 { |
341 basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index); | 343 basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index); |
342 struct df_rd_bb_info *bb_info = df_rd_get_bb_info (bb_index); | 344 class df_rd_bb_info *bb_info = df_rd_get_bb_info (bb_index); |
343 rtx_insn *insn; | 345 rtx_insn *insn; |
344 | 346 |
345 bitmap_clear (&seen_in_block); | 347 bitmap_clear (&seen_in_block); |
346 bitmap_clear (&seen_in_insn); | 348 bitmap_clear (&seen_in_insn); |
347 | 349 |
386 static void | 388 static void |
387 df_rd_local_compute (bitmap all_blocks) | 389 df_rd_local_compute (bitmap all_blocks) |
388 { | 390 { |
389 unsigned int bb_index; | 391 unsigned int bb_index; |
390 bitmap_iterator bi; | 392 bitmap_iterator bi; |
391 unsigned int regno; | 393 class df_rd_problem_data *problem_data |
392 struct df_rd_problem_data *problem_data | 394 = (class df_rd_problem_data *) df_rd->problem_data; |
393 = (struct df_rd_problem_data *) df_rd->problem_data; | 395 bitmap sparse_invalidated = &problem_data->sparse_invalidated_by_eh; |
394 bitmap sparse_invalidated = &problem_data->sparse_invalidated_by_call; | 396 bitmap dense_invalidated = &problem_data->dense_invalidated_by_eh; |
395 bitmap dense_invalidated = &problem_data->dense_invalidated_by_call; | |
396 | 397 |
397 bitmap_initialize (&seen_in_block, &df_bitmap_obstack); | 398 bitmap_initialize (&seen_in_block, &df_bitmap_obstack); |
398 bitmap_initialize (&seen_in_insn, &df_bitmap_obstack); | 399 bitmap_initialize (&seen_in_insn, &df_bitmap_obstack); |
399 | 400 |
400 df_maybe_reorganize_def_refs (DF_REF_ORDER_BY_REG); | 401 df_maybe_reorganize_def_refs (DF_REF_ORDER_BY_REG); |
402 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) | 403 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) |
403 { | 404 { |
404 df_rd_bb_local_compute (bb_index); | 405 df_rd_bb_local_compute (bb_index); |
405 } | 406 } |
406 | 407 |
407 /* Set up the knockout bit vectors to be applied across EH_EDGES. */ | 408 /* Set up the knockout bit vectors to be applied across EH_EDGES. |
408 EXECUTE_IF_SET_IN_BITMAP (regs_invalidated_by_call_regset, 0, regno, bi) | 409 Conservatively treat partially-clobbered registers as surviving |
409 { | 410 across the EH edge, i.e. assume that definitions before the edge |
410 if (! HARD_REGISTER_NUM_P (regno) | 411 is taken *might* reach uses after it has been taken. */ |
411 || !(df->changeable_flags & DF_NO_HARD_REGS)) | 412 if (!(df->changeable_flags & DF_NO_HARD_REGS)) |
413 for (unsigned int regno = 0; regno < FIRST_PSEUDO_REGISTER; ++regno) | |
414 if (eh_edge_abi.clobbers_full_reg_p (regno)) | |
412 { | 415 { |
413 if (DF_DEFS_COUNT (regno) > DF_SPARSE_THRESHOLD) | 416 if (DF_DEFS_COUNT (regno) > DF_SPARSE_THRESHOLD) |
414 bitmap_set_bit (sparse_invalidated, regno); | 417 bitmap_set_bit (sparse_invalidated, regno); |
415 else | 418 else |
416 bitmap_set_range (dense_invalidated, | 419 bitmap_set_range (dense_invalidated, |
417 DF_DEFS_BEGIN (regno), | 420 DF_DEFS_BEGIN (regno), |
418 DF_DEFS_COUNT (regno)); | 421 DF_DEFS_COUNT (regno)); |
419 } | 422 } |
420 } | 423 |
421 | 424 bitmap_release (&seen_in_block); |
422 bitmap_clear (&seen_in_block); | 425 bitmap_release (&seen_in_insn); |
423 bitmap_clear (&seen_in_insn); | |
424 } | 426 } |
425 | 427 |
426 | 428 |
427 /* Initialize the solution bit vectors for problem. */ | 429 /* Initialize the solution bit vectors for problem. */ |
428 | 430 |
432 unsigned int bb_index; | 434 unsigned int bb_index; |
433 bitmap_iterator bi; | 435 bitmap_iterator bi; |
434 | 436 |
435 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) | 437 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) |
436 { | 438 { |
437 struct df_rd_bb_info *bb_info = df_rd_get_bb_info (bb_index); | 439 class df_rd_bb_info *bb_info = df_rd_get_bb_info (bb_index); |
438 | 440 |
439 bitmap_copy (&bb_info->out, &bb_info->gen); | 441 bitmap_copy (&bb_info->out, &bb_info->gen); |
440 bitmap_clear (&bb_info->in); | 442 bitmap_clear (&bb_info->in); |
441 } | 443 } |
442 } | 444 } |
453 if (e->flags & EDGE_FAKE) | 455 if (e->flags & EDGE_FAKE) |
454 return false; | 456 return false; |
455 | 457 |
456 if (e->flags & EDGE_EH) | 458 if (e->flags & EDGE_EH) |
457 { | 459 { |
458 struct df_rd_problem_data *problem_data | 460 class df_rd_problem_data *problem_data |
459 = (struct df_rd_problem_data *) df_rd->problem_data; | 461 = (class df_rd_problem_data *) df_rd->problem_data; |
460 bitmap sparse_invalidated = &problem_data->sparse_invalidated_by_call; | 462 bitmap sparse_invalidated = &problem_data->sparse_invalidated_by_eh; |
461 bitmap dense_invalidated = &problem_data->dense_invalidated_by_call; | 463 bitmap dense_invalidated = &problem_data->dense_invalidated_by_eh; |
462 bitmap_iterator bi; | 464 bitmap_iterator bi; |
463 unsigned int regno; | 465 unsigned int regno; |
464 | 466 |
465 auto_bitmap tmp (&df_bitmap_obstack); | 467 auto_bitmap tmp (&df_bitmap_obstack); |
466 bitmap_and_compl (tmp, op2, dense_invalidated); | 468 bitmap_and_compl (tmp, op2, dense_invalidated); |
482 /* Transfer function. */ | 484 /* Transfer function. */ |
483 | 485 |
484 static bool | 486 static bool |
485 df_rd_transfer_function (int bb_index) | 487 df_rd_transfer_function (int bb_index) |
486 { | 488 { |
487 struct df_rd_bb_info *bb_info = df_rd_get_bb_info (bb_index); | 489 class df_rd_bb_info *bb_info = df_rd_get_bb_info (bb_index); |
488 unsigned int regno; | 490 unsigned int regno; |
489 bitmap_iterator bi; | 491 bitmap_iterator bi; |
490 bitmap in = &bb_info->in; | 492 bitmap in = &bb_info->in; |
491 bitmap out = &bb_info->out; | 493 bitmap out = &bb_info->out; |
492 bitmap gen = &bb_info->gen; | 494 bitmap gen = &bb_info->gen; |
496 | 498 |
497 if (bitmap_empty_p (sparse_kill)) | 499 if (bitmap_empty_p (sparse_kill)) |
498 changed = bitmap_ior_and_compl (out, gen, in, kill); | 500 changed = bitmap_ior_and_compl (out, gen, in, kill); |
499 else | 501 else |
500 { | 502 { |
501 struct df_rd_problem_data *problem_data; | 503 class df_rd_problem_data *problem_data; |
502 bitmap_head tmp; | 504 bitmap_head tmp; |
503 | 505 |
504 /* Note that TMP is _not_ a temporary bitmap if we end up replacing | 506 /* Note that TMP is _not_ a temporary bitmap if we end up replacing |
505 OUT with TMP. Therefore, allocate TMP in the RD bitmaps obstack. */ | 507 OUT with TMP. Therefore, allocate TMP in the RD bitmaps obstack. */ |
506 problem_data = (struct df_rd_problem_data *) df_rd->problem_data; | 508 problem_data = (class df_rd_problem_data *) df_rd->problem_data; |
507 bitmap_initialize (&tmp, &problem_data->rd_bitmaps); | 509 bitmap_initialize (&tmp, &problem_data->rd_bitmaps); |
508 | 510 |
509 bitmap_and_compl (&tmp, in, kill); | 511 bitmap_and_compl (&tmp, in, kill); |
510 EXECUTE_IF_SET_IN_BITMAP (sparse_kill, 0, regno, bi) | 512 EXECUTE_IF_SET_IN_BITMAP (sparse_kill, 0, regno, bi) |
511 { | 513 { |
525 { | 527 { |
526 /* Create a mask of DEFs for all registers live at the end of this | 528 /* Create a mask of DEFs for all registers live at the end of this |
527 basic block, and mask out DEFs of registers that are not live. | 529 basic block, and mask out DEFs of registers that are not live. |
528 Computing the mask looks costly, but the benefit of the pruning | 530 Computing the mask looks costly, but the benefit of the pruning |
529 outweighs the cost. */ | 531 outweighs the cost. */ |
530 struct df_rd_bb_info *bb_info = df_rd_get_bb_info (bb_index); | 532 class df_rd_bb_info *bb_info = df_rd_get_bb_info (bb_index); |
531 bitmap regs_live_out = &df_lr_get_bb_info (bb_index)->out; | 533 bitmap regs_live_out = &df_lr_get_bb_info (bb_index)->out; |
532 bitmap live_defs = BITMAP_ALLOC (&df_bitmap_obstack); | 534 bitmap live_defs = BITMAP_ALLOC (&df_bitmap_obstack); |
533 unsigned int regno; | 535 unsigned int regno; |
534 bitmap_iterator bi; | 536 bitmap_iterator bi; |
535 | 537 |
547 /* Free all storage associated with the problem. */ | 549 /* Free all storage associated with the problem. */ |
548 | 550 |
549 static void | 551 static void |
550 df_rd_free (void) | 552 df_rd_free (void) |
551 { | 553 { |
552 struct df_rd_problem_data *problem_data | 554 class df_rd_problem_data *problem_data |
553 = (struct df_rd_problem_data *) df_rd->problem_data; | 555 = (class df_rd_problem_data *) df_rd->problem_data; |
554 | 556 |
555 if (problem_data) | 557 if (problem_data) |
556 { | 558 { |
557 bitmap_obstack_release (&problem_data->rd_bitmaps); | 559 bitmap_obstack_release (&problem_data->rd_bitmaps); |
558 | 560 |
568 /* Debugging info. */ | 570 /* Debugging info. */ |
569 | 571 |
570 static void | 572 static void |
571 df_rd_start_dump (FILE *file) | 573 df_rd_start_dump (FILE *file) |
572 { | 574 { |
573 struct df_rd_problem_data *problem_data | 575 class df_rd_problem_data *problem_data |
574 = (struct df_rd_problem_data *) df_rd->problem_data; | 576 = (class df_rd_problem_data *) df_rd->problem_data; |
575 unsigned int m = DF_REG_SIZE (df); | 577 unsigned int m = DF_REG_SIZE (df); |
576 unsigned int regno; | 578 unsigned int regno; |
577 | 579 |
578 if (!df_rd->block_info) | 580 if (!df_rd->block_info) |
579 return; | 581 return; |
580 | 582 |
581 fprintf (file, ";; Reaching defs:\n"); | 583 fprintf (file, ";; Reaching defs:\n"); |
582 | 584 |
583 fprintf (file, ";; sparse invalidated \t"); | 585 fprintf (file, ";; sparse invalidated \t"); |
584 dump_bitmap (file, &problem_data->sparse_invalidated_by_call); | 586 dump_bitmap (file, &problem_data->sparse_invalidated_by_eh); |
585 fprintf (file, ";; dense invalidated \t"); | 587 fprintf (file, ";; dense invalidated \t"); |
586 dump_bitmap (file, &problem_data->dense_invalidated_by_call); | 588 dump_bitmap (file, &problem_data->dense_invalidated_by_eh); |
587 | 589 |
588 fprintf (file, ";; reg->defs[] map:\t"); | 590 fprintf (file, ";; reg->defs[] map:\t"); |
589 for (regno = 0; regno < m; regno++) | 591 for (regno = 0; regno < m; regno++) |
590 if (DF_DEFS_COUNT (regno)) | 592 if (DF_DEFS_COUNT (regno)) |
591 fprintf (file, "%d[%d,%d] ", regno, | 593 fprintf (file, "%d[%d,%d] ", regno, |
641 /* Debugging info at top of bb. */ | 643 /* Debugging info at top of bb. */ |
642 | 644 |
643 static void | 645 static void |
644 df_rd_top_dump (basic_block bb, FILE *file) | 646 df_rd_top_dump (basic_block bb, FILE *file) |
645 { | 647 { |
646 struct df_rd_bb_info *bb_info = df_rd_get_bb_info (bb->index); | 648 class df_rd_bb_info *bb_info = df_rd_get_bb_info (bb->index); |
647 if (!bb_info) | 649 if (!bb_info) |
648 return; | 650 return; |
649 | 651 |
650 df_rd_dump_defs_set (&bb_info->in, ";; rd in ", file); | 652 df_rd_dump_defs_set (&bb_info->in, ";; rd in ", file); |
651 df_rd_dump_defs_set (&bb_info->gen, ";; rd gen ", file); | 653 df_rd_dump_defs_set (&bb_info->gen, ";; rd gen ", file); |
656 /* Debugging info at bottom of bb. */ | 658 /* Debugging info at bottom of bb. */ |
657 | 659 |
658 static void | 660 static void |
659 df_rd_bottom_dump (basic_block bb, FILE *file) | 661 df_rd_bottom_dump (basic_block bb, FILE *file) |
660 { | 662 { |
661 struct df_rd_bb_info *bb_info = df_rd_get_bb_info (bb->index); | 663 class df_rd_bb_info *bb_info = df_rd_get_bb_info (bb->index); |
662 if (!bb_info) | 664 if (!bb_info) |
663 return; | 665 return; |
664 | 666 |
665 df_rd_dump_defs_set (&bb_info->out, ";; rd out ", file); | 667 df_rd_dump_defs_set (&bb_info->out, ";; rd out ", file); |
666 } | 668 } |
689 NULL, /* Debugging start insn. */ | 691 NULL, /* Debugging start insn. */ |
690 NULL, /* Debugging end insn. */ | 692 NULL, /* Debugging end insn. */ |
691 NULL, /* Incremental solution verify start. */ | 693 NULL, /* Incremental solution verify start. */ |
692 NULL, /* Incremental solution verify end. */ | 694 NULL, /* Incremental solution verify end. */ |
693 NULL, /* Dependent problem. */ | 695 NULL, /* Dependent problem. */ |
694 sizeof (struct df_rd_bb_info),/* Size of entry of block_info array. */ | 696 sizeof (class df_rd_bb_info),/* Size of entry of block_info array. */ |
695 TV_DF_RD, /* Timing variable. */ | 697 TV_DF_RD, /* Timing variable. */ |
696 true /* Reset blocks on dropping out of blocks_to_analyze. */ | 698 true /* Reset blocks on dropping out of blocks_to_analyze. */ |
697 }; | 699 }; |
698 | 700 |
699 | 701 |
731 | 733 |
732 static void | 734 static void |
733 df_lr_free_bb_info (basic_block bb ATTRIBUTE_UNUSED, | 735 df_lr_free_bb_info (basic_block bb ATTRIBUTE_UNUSED, |
734 void *vbb_info) | 736 void *vbb_info) |
735 { | 737 { |
736 struct df_lr_bb_info *bb_info = (struct df_lr_bb_info *) vbb_info; | 738 class df_lr_bb_info *bb_info = (class df_lr_bb_info *) vbb_info; |
737 if (bb_info) | 739 if (bb_info) |
738 { | 740 { |
739 bitmap_clear (&bb_info->use); | 741 bitmap_clear (&bb_info->use); |
740 bitmap_clear (&bb_info->def); | 742 bitmap_clear (&bb_info->def); |
741 bitmap_clear (&bb_info->in); | 743 bitmap_clear (&bb_info->in); |
767 bitmap_obstack_initialize (&problem_data->lr_bitmaps); | 769 bitmap_obstack_initialize (&problem_data->lr_bitmaps); |
768 } | 770 } |
769 | 771 |
770 EXECUTE_IF_SET_IN_BITMAP (df_lr->out_of_date_transfer_functions, 0, bb_index, bi) | 772 EXECUTE_IF_SET_IN_BITMAP (df_lr->out_of_date_transfer_functions, 0, bb_index, bi) |
771 { | 773 { |
772 struct df_lr_bb_info *bb_info = df_lr_get_bb_info (bb_index); | 774 class df_lr_bb_info *bb_info = df_lr_get_bb_info (bb_index); |
773 | 775 |
774 /* When bitmaps are already initialized, just clear them. */ | 776 /* When bitmaps are already initialized, just clear them. */ |
775 if (bb_info->use.obstack) | 777 if (bb_info->use.obstack) |
776 { | 778 { |
777 bitmap_clear (&bb_info->def); | 779 bitmap_clear (&bb_info->def); |
798 unsigned int bb_index; | 800 unsigned int bb_index; |
799 bitmap_iterator bi; | 801 bitmap_iterator bi; |
800 | 802 |
801 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) | 803 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) |
802 { | 804 { |
803 struct df_lr_bb_info *bb_info = df_lr_get_bb_info (bb_index); | 805 class df_lr_bb_info *bb_info = df_lr_get_bb_info (bb_index); |
804 gcc_assert (bb_info); | 806 gcc_assert (bb_info); |
805 bitmap_clear (&bb_info->in); | 807 bitmap_clear (&bb_info->in); |
806 bitmap_clear (&bb_info->out); | 808 bitmap_clear (&bb_info->out); |
807 } | 809 } |
808 } | 810 } |
812 | 814 |
813 static void | 815 static void |
814 df_lr_bb_local_compute (unsigned int bb_index) | 816 df_lr_bb_local_compute (unsigned int bb_index) |
815 { | 817 { |
816 basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index); | 818 basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index); |
817 struct df_lr_bb_info *bb_info = df_lr_get_bb_info (bb_index); | 819 class df_lr_bb_info *bb_info = df_lr_get_bb_info (bb_index); |
818 rtx_insn *insn; | 820 rtx_insn *insn; |
819 df_ref def, use; | 821 df_ref def, use; |
820 | 822 |
821 /* Process the registers set in an exception handler. */ | 823 /* Process the registers set in an exception handler. */ |
822 FOR_EACH_ARTIFICIAL_DEF (def, bb_index) | 824 FOR_EACH_ARTIFICIAL_DEF (def, bb_index) |
927 { | 929 { |
928 if (bb_index == EXIT_BLOCK) | 930 if (bb_index == EXIT_BLOCK) |
929 { | 931 { |
930 /* The exit block is special for this problem and its bits are | 932 /* The exit block is special for this problem and its bits are |
931 computed from thin air. */ | 933 computed from thin air. */ |
932 struct df_lr_bb_info *bb_info = df_lr_get_bb_info (EXIT_BLOCK); | 934 class df_lr_bb_info *bb_info = df_lr_get_bb_info (EXIT_BLOCK); |
933 bitmap_copy (&bb_info->use, df->exit_block_uses); | 935 bitmap_copy (&bb_info->use, df->exit_block_uses); |
934 } | 936 } |
935 else | 937 else |
936 df_lr_bb_local_compute (bb_index); | 938 df_lr_bb_local_compute (bb_index); |
937 } | 939 } |
948 unsigned int bb_index; | 950 unsigned int bb_index; |
949 bitmap_iterator bi; | 951 bitmap_iterator bi; |
950 | 952 |
951 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) | 953 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) |
952 { | 954 { |
953 struct df_lr_bb_info *bb_info = df_lr_get_bb_info (bb_index); | 955 class df_lr_bb_info *bb_info = df_lr_get_bb_info (bb_index); |
954 bitmap_copy (&bb_info->in, &bb_info->use); | 956 bitmap_copy (&bb_info->in, &bb_info->use); |
955 bitmap_clear (&bb_info->out); | 957 bitmap_clear (&bb_info->out); |
956 } | 958 } |
957 } | 959 } |
958 | 960 |
976 { | 978 { |
977 bitmap op1 = &df_lr_get_bb_info (e->src->index)->out; | 979 bitmap op1 = &df_lr_get_bb_info (e->src->index)->out; |
978 bitmap op2 = &df_lr_get_bb_info (e->dest->index)->in; | 980 bitmap op2 = &df_lr_get_bb_info (e->dest->index)->in; |
979 bool changed = false; | 981 bool changed = false; |
980 | 982 |
981 /* Call-clobbered registers die across exception and call edges. */ | 983 /* Call-clobbered registers die across exception and call edges. |
984 Conservatively treat partially-clobbered registers as surviving | |
985 across the edges; they might or might not, depending on what | |
986 mode they have. */ | |
982 /* ??? Abnormal call edges ignored for the moment, as this gets | 987 /* ??? Abnormal call edges ignored for the moment, as this gets |
983 confused by sibling call edges, which crashes reg-stack. */ | 988 confused by sibling call edges, which crashes reg-stack. */ |
984 if (e->flags & EDGE_EH) | 989 if (e->flags & EDGE_EH) |
985 changed = bitmap_ior_and_compl_into (op1, op2, regs_invalidated_by_call_regset); | 990 { |
991 bitmap_view<HARD_REG_SET> eh_kills (eh_edge_abi.full_reg_clobbers ()); | |
992 changed = bitmap_ior_and_compl_into (op1, op2, eh_kills); | |
993 } | |
986 else | 994 else |
987 changed = bitmap_ior_into (op1, op2); | 995 changed = bitmap_ior_into (op1, op2); |
988 | 996 |
989 changed |= bitmap_ior_into (op1, &df->hardware_regs_used); | 997 changed |= bitmap_ior_into (op1, &df->hardware_regs_used); |
990 return changed; | 998 return changed; |
994 /* Transfer function. */ | 1002 /* Transfer function. */ |
995 | 1003 |
996 static bool | 1004 static bool |
997 df_lr_transfer_function (int bb_index) | 1005 df_lr_transfer_function (int bb_index) |
998 { | 1006 { |
999 struct df_lr_bb_info *bb_info = df_lr_get_bb_info (bb_index); | 1007 class df_lr_bb_info *bb_info = df_lr_get_bb_info (bb_index); |
1000 bitmap in = &bb_info->in; | 1008 bitmap in = &bb_info->in; |
1001 bitmap out = &bb_info->out; | 1009 bitmap out = &bb_info->out; |
1002 bitmap use = &bb_info->use; | 1010 bitmap use = &bb_info->use; |
1003 bitmap def = &bb_info->def; | 1011 bitmap def = &bb_info->def; |
1004 | 1012 |
1066 /* Debugging info at top of bb. */ | 1074 /* Debugging info at top of bb. */ |
1067 | 1075 |
1068 static void | 1076 static void |
1069 df_lr_top_dump (basic_block bb, FILE *file) | 1077 df_lr_top_dump (basic_block bb, FILE *file) |
1070 { | 1078 { |
1071 struct df_lr_bb_info *bb_info = df_lr_get_bb_info (bb->index); | 1079 class df_lr_bb_info *bb_info = df_lr_get_bb_info (bb->index); |
1072 struct df_lr_problem_data *problem_data; | 1080 struct df_lr_problem_data *problem_data; |
1073 if (!bb_info) | 1081 if (!bb_info) |
1074 return; | 1082 return; |
1075 | 1083 |
1076 fprintf (file, ";; lr in \t"); | 1084 fprintf (file, ";; lr in \t"); |
1094 /* Debugging info at bottom of bb. */ | 1102 /* Debugging info at bottom of bb. */ |
1095 | 1103 |
1096 static void | 1104 static void |
1097 df_lr_bottom_dump (basic_block bb, FILE *file) | 1105 df_lr_bottom_dump (basic_block bb, FILE *file) |
1098 { | 1106 { |
1099 struct df_lr_bb_info *bb_info = df_lr_get_bb_info (bb->index); | 1107 class df_lr_bb_info *bb_info = df_lr_get_bb_info (bb->index); |
1100 struct df_lr_problem_data *problem_data; | 1108 struct df_lr_problem_data *problem_data; |
1101 if (!bb_info) | 1109 if (!bb_info) |
1102 return; | 1110 return; |
1103 | 1111 |
1104 fprintf (file, ";; lr out \t"); | 1112 fprintf (file, ";; lr out \t"); |
1211 NULL, /* Debugging start insn. */ | 1219 NULL, /* Debugging start insn. */ |
1212 NULL, /* Debugging end insn. */ | 1220 NULL, /* Debugging end insn. */ |
1213 df_lr_verify_solution_start,/* Incremental solution verify start. */ | 1221 df_lr_verify_solution_start,/* Incremental solution verify start. */ |
1214 df_lr_verify_solution_end, /* Incremental solution verify end. */ | 1222 df_lr_verify_solution_end, /* Incremental solution verify end. */ |
1215 NULL, /* Dependent problem. */ | 1223 NULL, /* Dependent problem. */ |
1216 sizeof (struct df_lr_bb_info),/* Size of entry of block_info array. */ | 1224 sizeof (class df_lr_bb_info),/* Size of entry of block_info array. */ |
1217 TV_DF_LR, /* Timing variable. */ | 1225 TV_DF_LR, /* Timing variable. */ |
1218 false /* Reset blocks on dropping out of blocks_to_analyze. */ | 1226 false /* Reset blocks on dropping out of blocks_to_analyze. */ |
1219 }; | 1227 }; |
1220 | 1228 |
1221 | 1229 |
1251 bitmap_initialize (&saved_use, &bitmap_default_obstack); | 1259 bitmap_initialize (&saved_use, &bitmap_default_obstack); |
1252 bitmap_initialize (&all_blocks, &bitmap_default_obstack); | 1260 bitmap_initialize (&all_blocks, &bitmap_default_obstack); |
1253 | 1261 |
1254 FOR_ALL_BB_FN (bb, cfun) | 1262 FOR_ALL_BB_FN (bb, cfun) |
1255 { | 1263 { |
1256 struct df_lr_bb_info *bb_info = df_lr_get_bb_info (bb->index); | 1264 class df_lr_bb_info *bb_info = df_lr_get_bb_info (bb->index); |
1257 bitmap_set_bit (&all_blocks, bb->index); | 1265 bitmap_set_bit (&all_blocks, bb->index); |
1258 | 1266 |
1259 if (bb_info) | 1267 if (bb_info) |
1260 { | 1268 { |
1261 /* Make a copy of the transfer functions and then compute | 1269 /* Make a copy of the transfer functions and then compute |
1337 | 1345 |
1338 static void | 1346 static void |
1339 df_live_free_bb_info (basic_block bb ATTRIBUTE_UNUSED, | 1347 df_live_free_bb_info (basic_block bb ATTRIBUTE_UNUSED, |
1340 void *vbb_info) | 1348 void *vbb_info) |
1341 { | 1349 { |
1342 struct df_live_bb_info *bb_info = (struct df_live_bb_info *) vbb_info; | 1350 class df_live_bb_info *bb_info = (class df_live_bb_info *) vbb_info; |
1343 if (bb_info) | 1351 if (bb_info) |
1344 { | 1352 { |
1345 bitmap_clear (&bb_info->gen); | 1353 bitmap_clear (&bb_info->gen); |
1346 bitmap_clear (&bb_info->kill); | 1354 bitmap_clear (&bb_info->kill); |
1347 bitmap_clear (&bb_info->in); | 1355 bitmap_clear (&bb_info->in); |
1375 | 1383 |
1376 df_grow_bb_info (df_live); | 1384 df_grow_bb_info (df_live); |
1377 | 1385 |
1378 EXECUTE_IF_SET_IN_BITMAP (df_live->out_of_date_transfer_functions, 0, bb_index, bi) | 1386 EXECUTE_IF_SET_IN_BITMAP (df_live->out_of_date_transfer_functions, 0, bb_index, bi) |
1379 { | 1387 { |
1380 struct df_live_bb_info *bb_info = df_live_get_bb_info (bb_index); | 1388 class df_live_bb_info *bb_info = df_live_get_bb_info (bb_index); |
1381 | 1389 |
1382 /* When bitmaps are already initialized, just clear them. */ | 1390 /* When bitmaps are already initialized, just clear them. */ |
1383 if (bb_info->kill.obstack) | 1391 if (bb_info->kill.obstack) |
1384 { | 1392 { |
1385 bitmap_clear (&bb_info->kill); | 1393 bitmap_clear (&bb_info->kill); |
1405 unsigned int bb_index; | 1413 unsigned int bb_index; |
1406 bitmap_iterator bi; | 1414 bitmap_iterator bi; |
1407 | 1415 |
1408 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) | 1416 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) |
1409 { | 1417 { |
1410 struct df_live_bb_info *bb_info = df_live_get_bb_info (bb_index); | 1418 class df_live_bb_info *bb_info = df_live_get_bb_info (bb_index); |
1411 gcc_assert (bb_info); | 1419 gcc_assert (bb_info); |
1412 bitmap_clear (&bb_info->in); | 1420 bitmap_clear (&bb_info->in); |
1413 bitmap_clear (&bb_info->out); | 1421 bitmap_clear (&bb_info->out); |
1414 } | 1422 } |
1415 } | 1423 } |
1419 | 1427 |
1420 static void | 1428 static void |
1421 df_live_bb_local_compute (unsigned int bb_index) | 1429 df_live_bb_local_compute (unsigned int bb_index) |
1422 { | 1430 { |
1423 basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index); | 1431 basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index); |
1424 struct df_live_bb_info *bb_info = df_live_get_bb_info (bb_index); | 1432 class df_live_bb_info *bb_info = df_live_get_bb_info (bb_index); |
1425 rtx_insn *insn; | 1433 rtx_insn *insn; |
1426 df_ref def; | 1434 df_ref def; |
1427 int luid = 0; | 1435 int luid = 0; |
1428 | 1436 |
1429 FOR_BB_INSNS (bb, insn) | 1437 FOR_BB_INSNS (bb, insn) |
1495 unsigned int bb_index; | 1503 unsigned int bb_index; |
1496 bitmap_iterator bi; | 1504 bitmap_iterator bi; |
1497 | 1505 |
1498 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) | 1506 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) |
1499 { | 1507 { |
1500 struct df_live_bb_info *bb_info = df_live_get_bb_info (bb_index); | 1508 class df_live_bb_info *bb_info = df_live_get_bb_info (bb_index); |
1501 struct df_lr_bb_info *bb_lr_info = df_lr_get_bb_info (bb_index); | 1509 class df_lr_bb_info *bb_lr_info = df_lr_get_bb_info (bb_index); |
1502 | 1510 |
1503 /* No register may reach a location where it is not used. Thus | 1511 /* No register may reach a location where it is not used. Thus |
1504 we trim the rr result to the places where it is used. */ | 1512 we trim the rr result to the places where it is used. */ |
1505 bitmap_and (&bb_info->out, &bb_info->gen, &bb_lr_info->out); | 1513 bitmap_and (&bb_info->out, &bb_info->gen, &bb_lr_info->out); |
1506 bitmap_clear (&bb_info->in); | 1514 bitmap_clear (&bb_info->in); |
1525 /* Transfer function for the forwards may-initialized problem. */ | 1533 /* Transfer function for the forwards may-initialized problem. */ |
1526 | 1534 |
1527 static bool | 1535 static bool |
1528 df_live_transfer_function (int bb_index) | 1536 df_live_transfer_function (int bb_index) |
1529 { | 1537 { |
1530 struct df_live_bb_info *bb_info = df_live_get_bb_info (bb_index); | 1538 class df_live_bb_info *bb_info = df_live_get_bb_info (bb_index); |
1531 struct df_lr_bb_info *bb_lr_info = df_lr_get_bb_info (bb_index); | 1539 class df_lr_bb_info *bb_lr_info = df_lr_get_bb_info (bb_index); |
1532 bitmap in = &bb_info->in; | 1540 bitmap in = &bb_info->in; |
1533 bitmap out = &bb_info->out; | 1541 bitmap out = &bb_info->out; |
1534 bitmap gen = &bb_info->gen; | 1542 bitmap gen = &bb_info->gen; |
1535 bitmap kill = &bb_info->kill; | 1543 bitmap kill = &bb_info->kill; |
1536 | 1544 |
1557 bitmap_iterator bi; | 1565 bitmap_iterator bi; |
1558 unsigned int bb_index; | 1566 unsigned int bb_index; |
1559 | 1567 |
1560 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) | 1568 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) |
1561 { | 1569 { |
1562 struct df_lr_bb_info *bb_lr_info = df_lr_get_bb_info (bb_index); | 1570 class df_lr_bb_info *bb_lr_info = df_lr_get_bb_info (bb_index); |
1563 struct df_live_bb_info *bb_live_info = df_live_get_bb_info (bb_index); | 1571 class df_live_bb_info *bb_live_info = df_live_get_bb_info (bb_index); |
1564 | 1572 |
1565 /* No register may reach a location where it is not used. Thus | 1573 /* No register may reach a location where it is not used. Thus |
1566 we trim the rr result to the places where it is used. */ | 1574 we trim the rr result to the places where it is used. */ |
1567 bitmap_and_into (&bb_live_info->in, &bb_lr_info->in); | 1575 bitmap_and_into (&bb_live_info->in, &bb_lr_info->in); |
1568 bitmap_and_into (&bb_live_info->out, &bb_lr_info->out); | 1576 bitmap_and_into (&bb_live_info->out, &bb_lr_info->out); |
1583 if (df_live->block_info) | 1591 if (df_live->block_info) |
1584 { | 1592 { |
1585 df_live->block_info_size = 0; | 1593 df_live->block_info_size = 0; |
1586 free (df_live->block_info); | 1594 free (df_live->block_info); |
1587 df_live->block_info = NULL; | 1595 df_live->block_info = NULL; |
1588 bitmap_clear (&df_live_scratch); | 1596 bitmap_release (&df_live_scratch); |
1589 bitmap_obstack_release (&problem_data->live_bitmaps); | 1597 bitmap_obstack_release (&problem_data->live_bitmaps); |
1590 free (problem_data); | 1598 free (problem_data); |
1591 df_live->problem_data = NULL; | 1599 df_live->problem_data = NULL; |
1592 } | 1600 } |
1593 BITMAP_FREE (df_live->out_of_date_transfer_functions); | 1601 BITMAP_FREE (df_live->out_of_date_transfer_functions); |
1598 /* Debugging info at top of bb. */ | 1606 /* Debugging info at top of bb. */ |
1599 | 1607 |
1600 static void | 1608 static void |
1601 df_live_top_dump (basic_block bb, FILE *file) | 1609 df_live_top_dump (basic_block bb, FILE *file) |
1602 { | 1610 { |
1603 struct df_live_bb_info *bb_info = df_live_get_bb_info (bb->index); | 1611 class df_live_bb_info *bb_info = df_live_get_bb_info (bb->index); |
1604 struct df_live_problem_data *problem_data; | 1612 struct df_live_problem_data *problem_data; |
1605 | 1613 |
1606 if (!bb_info) | 1614 if (!bb_info) |
1607 return; | 1615 return; |
1608 | 1616 |
1627 /* Debugging info at bottom of bb. */ | 1635 /* Debugging info at bottom of bb. */ |
1628 | 1636 |
1629 static void | 1637 static void |
1630 df_live_bottom_dump (basic_block bb, FILE *file) | 1638 df_live_bottom_dump (basic_block bb, FILE *file) |
1631 { | 1639 { |
1632 struct df_live_bb_info *bb_info = df_live_get_bb_info (bb->index); | 1640 class df_live_bb_info *bb_info = df_live_get_bb_info (bb->index); |
1633 struct df_live_problem_data *problem_data; | 1641 struct df_live_problem_data *problem_data; |
1634 | 1642 |
1635 if (!bb_info) | 1643 if (!bb_info) |
1636 return; | 1644 return; |
1637 | 1645 |
1739 NULL, /* Debugging start insn. */ | 1747 NULL, /* Debugging start insn. */ |
1740 NULL, /* Debugging end insn. */ | 1748 NULL, /* Debugging end insn. */ |
1741 df_live_verify_solution_start,/* Incremental solution verify start. */ | 1749 df_live_verify_solution_start,/* Incremental solution verify start. */ |
1742 df_live_verify_solution_end, /* Incremental solution verify end. */ | 1750 df_live_verify_solution_end, /* Incremental solution verify end. */ |
1743 &problem_LR, /* Dependent problem. */ | 1751 &problem_LR, /* Dependent problem. */ |
1744 sizeof (struct df_live_bb_info),/* Size of entry of block_info array. */ | 1752 sizeof (class df_live_bb_info),/* Size of entry of block_info array. */ |
1745 TV_DF_LIVE, /* Timing variable. */ | 1753 TV_DF_LIVE, /* Timing variable. */ |
1746 false /* Reset blocks on dropping out of blocks_to_analyze. */ | 1754 false /* Reset blocks on dropping out of blocks_to_analyze. */ |
1747 }; | 1755 }; |
1748 | 1756 |
1749 | 1757 |
1794 | 1802 |
1795 df_grow_insn_info (); | 1803 df_grow_insn_info (); |
1796 | 1804 |
1797 FOR_ALL_BB_FN (bb, cfun) | 1805 FOR_ALL_BB_FN (bb, cfun) |
1798 { | 1806 { |
1799 struct df_live_bb_info *bb_info = df_live_get_bb_info (bb->index); | 1807 class df_live_bb_info *bb_info = df_live_get_bb_info (bb->index); |
1800 bitmap_set_bit (&all_blocks, bb->index); | 1808 bitmap_set_bit (&all_blocks, bb->index); |
1801 | 1809 |
1802 if (bb_info) | 1810 if (bb_info) |
1803 { | 1811 { |
1804 /* Make a copy of the transfer functions and then compute | 1812 /* Make a copy of the transfer functions and then compute |
1856 | 1864 |
1857 static void | 1865 static void |
1858 df_mir_free_bb_info (basic_block bb ATTRIBUTE_UNUSED, | 1866 df_mir_free_bb_info (basic_block bb ATTRIBUTE_UNUSED, |
1859 void *vbb_info) | 1867 void *vbb_info) |
1860 { | 1868 { |
1861 struct df_mir_bb_info *bb_info = (struct df_mir_bb_info *) vbb_info; | 1869 class df_mir_bb_info *bb_info = (class df_mir_bb_info *) vbb_info; |
1862 if (bb_info) | 1870 if (bb_info) |
1863 { | 1871 { |
1864 bitmap_clear (&bb_info->gen); | 1872 bitmap_clear (&bb_info->gen); |
1865 bitmap_clear (&bb_info->kill); | 1873 bitmap_clear (&bb_info->kill); |
1866 bitmap_clear (&bb_info->in); | 1874 bitmap_clear (&bb_info->in); |
1893 | 1901 |
1894 df_grow_bb_info (df_mir); | 1902 df_grow_bb_info (df_mir); |
1895 | 1903 |
1896 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) | 1904 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) |
1897 { | 1905 { |
1898 struct df_mir_bb_info *bb_info = df_mir_get_bb_info (bb_index); | 1906 class df_mir_bb_info *bb_info = df_mir_get_bb_info (bb_index); |
1899 | 1907 |
1900 /* When bitmaps are already initialized, just clear them. */ | 1908 /* When bitmaps are already initialized, just clear them. */ |
1901 if (bb_info->kill.obstack) | 1909 if (bb_info->kill.obstack) |
1902 { | 1910 { |
1903 bitmap_clear (&bb_info->kill); | 1911 bitmap_clear (&bb_info->kill); |
1926 unsigned int bb_index; | 1934 unsigned int bb_index; |
1927 bitmap_iterator bi; | 1935 bitmap_iterator bi; |
1928 | 1936 |
1929 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) | 1937 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) |
1930 { | 1938 { |
1931 struct df_mir_bb_info *bb_info = df_mir_get_bb_info (bb_index); | 1939 class df_mir_bb_info *bb_info = df_mir_get_bb_info (bb_index); |
1932 | 1940 |
1933 gcc_assert (bb_info); | 1941 gcc_assert (bb_info); |
1934 | 1942 |
1935 bitmap_clear (&bb_info->in); | 1943 bitmap_clear (&bb_info->in); |
1936 bitmap_set_range (&bb_info->in, 0, DF_REG_SIZE (df)); | 1944 bitmap_set_range (&bb_info->in, 0, DF_REG_SIZE (df)); |
1944 | 1952 |
1945 static void | 1953 static void |
1946 df_mir_bb_local_compute (unsigned int bb_index) | 1954 df_mir_bb_local_compute (unsigned int bb_index) |
1947 { | 1955 { |
1948 basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index); | 1956 basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index); |
1949 struct df_mir_bb_info *bb_info = df_mir_get_bb_info (bb_index); | 1957 class df_mir_bb_info *bb_info = df_mir_get_bb_info (bb_index); |
1950 rtx_insn *insn; | 1958 rtx_insn *insn; |
1951 int luid = 0; | 1959 int luid = 0; |
1952 | 1960 |
1953 /* Ignoring artificial defs is intentional: these often pretend that some | 1961 /* Ignoring artificial defs is intentional: these often pretend that some |
1954 registers carry incoming arguments (when they are FUNCTION_ARG_REGNO) even | 1962 registers carry incoming arguments (when they are FUNCTION_ARG_REGNO) even |
2008 blocks, assume all registers are uninitialized. */ | 2016 blocks, assume all registers are uninitialized. */ |
2009 | 2017 |
2010 static void | 2018 static void |
2011 df_mir_confluence_0 (basic_block bb) | 2019 df_mir_confluence_0 (basic_block bb) |
2012 { | 2020 { |
2013 struct df_mir_bb_info *bb_info = df_mir_get_bb_info (bb->index); | 2021 class df_mir_bb_info *bb_info = df_mir_get_bb_info (bb->index); |
2014 | 2022 |
2015 bitmap_clear (&bb_info->in); | 2023 bitmap_clear (&bb_info->in); |
2016 } | 2024 } |
2017 | 2025 |
2018 | 2026 |
2036 /* Transfer function for the forwards must-initialized problem. */ | 2044 /* Transfer function for the forwards must-initialized problem. */ |
2037 | 2045 |
2038 static bool | 2046 static bool |
2039 df_mir_transfer_function (int bb_index) | 2047 df_mir_transfer_function (int bb_index) |
2040 { | 2048 { |
2041 struct df_mir_bb_info *bb_info = df_mir_get_bb_info (bb_index); | 2049 class df_mir_bb_info *bb_info = df_mir_get_bb_info (bb_index); |
2042 bitmap in = &bb_info->in; | 2050 bitmap in = &bb_info->in; |
2043 bitmap out = &bb_info->out; | 2051 bitmap out = &bb_info->out; |
2044 bitmap gen = &bb_info->gen; | 2052 bitmap gen = &bb_info->gen; |
2045 bitmap kill = &bb_info->kill; | 2053 bitmap kill = &bb_info->kill; |
2046 | 2054 |
2071 /* Debugging info at top of bb. */ | 2079 /* Debugging info at top of bb. */ |
2072 | 2080 |
2073 static void | 2081 static void |
2074 df_mir_top_dump (basic_block bb, FILE *file) | 2082 df_mir_top_dump (basic_block bb, FILE *file) |
2075 { | 2083 { |
2076 struct df_mir_bb_info *bb_info = df_mir_get_bb_info (bb->index); | 2084 class df_mir_bb_info *bb_info = df_mir_get_bb_info (bb->index); |
2077 | 2085 |
2078 if (!bb_info) | 2086 if (!bb_info) |
2079 return; | 2087 return; |
2080 | 2088 |
2081 fprintf (file, ";; mir in \t"); | 2089 fprintf (file, ";; mir in \t"); |
2089 /* Debugging info at bottom of bb. */ | 2097 /* Debugging info at bottom of bb. */ |
2090 | 2098 |
2091 static void | 2099 static void |
2092 df_mir_bottom_dump (basic_block bb, FILE *file) | 2100 df_mir_bottom_dump (basic_block bb, FILE *file) |
2093 { | 2101 { |
2094 struct df_mir_bb_info *bb_info = df_mir_get_bb_info (bb->index); | 2102 class df_mir_bb_info *bb_info = df_mir_get_bb_info (bb->index); |
2095 | 2103 |
2096 if (!bb_info) | 2104 if (!bb_info) |
2097 return; | 2105 return; |
2098 | 2106 |
2099 fprintf (file, ";; mir out \t"); | 2107 fprintf (file, ";; mir out \t"); |
2190 NULL, /* Debugging start insn. */ | 2198 NULL, /* Debugging start insn. */ |
2191 NULL, /* Debugging end insn. */ | 2199 NULL, /* Debugging end insn. */ |
2192 df_mir_verify_solution_start, /* Incremental solution verify start. */ | 2200 df_mir_verify_solution_start, /* Incremental solution verify start. */ |
2193 df_mir_verify_solution_end, /* Incremental solution verify end. */ | 2201 df_mir_verify_solution_end, /* Incremental solution verify end. */ |
2194 NULL, /* Dependent problem. */ | 2202 NULL, /* Dependent problem. */ |
2195 sizeof (struct df_mir_bb_info),/* Size of entry of block_info array. */ | 2203 sizeof (class df_mir_bb_info),/* Size of entry of block_info array. */ |
2196 TV_DF_MIR, /* Timing variable. */ | 2204 TV_DF_MIR, /* Timing variable. */ |
2197 false /* Reset blocks on dropping out of blocks_to_analyze. */ | 2205 false /* Reset blocks on dropping out of blocks_to_analyze. */ |
2198 }; | 2206 }; |
2199 | 2207 |
2200 | 2208 |
2453 | 2461 |
2454 static void | 2462 static void |
2455 df_chain_create_bb (unsigned int bb_index) | 2463 df_chain_create_bb (unsigned int bb_index) |
2456 { | 2464 { |
2457 basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index); | 2465 basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index); |
2458 struct df_rd_bb_info *bb_info = df_rd_get_bb_info (bb_index); | 2466 class df_rd_bb_info *bb_info = df_rd_get_bb_info (bb_index); |
2459 rtx_insn *insn; | 2467 rtx_insn *insn; |
2460 bitmap_head cpy; | 2468 bitmap_head cpy; |
2461 | 2469 |
2462 bitmap_initialize (&cpy, &bitmap_default_obstack); | 2470 bitmap_initialize (&cpy, &bitmap_default_obstack); |
2463 bitmap_copy (&cpy, &bb_info->in); | 2471 bitmap_copy (&cpy, &bb_info->in); |
2708 | 2716 |
2709 static void | 2717 static void |
2710 df_word_lr_free_bb_info (basic_block bb ATTRIBUTE_UNUSED, | 2718 df_word_lr_free_bb_info (basic_block bb ATTRIBUTE_UNUSED, |
2711 void *vbb_info) | 2719 void *vbb_info) |
2712 { | 2720 { |
2713 struct df_word_lr_bb_info *bb_info = (struct df_word_lr_bb_info *) vbb_info; | 2721 class df_word_lr_bb_info *bb_info = (class df_word_lr_bb_info *) vbb_info; |
2714 if (bb_info) | 2722 if (bb_info) |
2715 { | 2723 { |
2716 bitmap_clear (&bb_info->use); | 2724 bitmap_clear (&bb_info->use); |
2717 bitmap_clear (&bb_info->def); | 2725 bitmap_clear (&bb_info->def); |
2718 bitmap_clear (&bb_info->in); | 2726 bitmap_clear (&bb_info->in); |
2751 bitmap_set_bit (df_word_lr->out_of_date_transfer_functions, ENTRY_BLOCK); | 2759 bitmap_set_bit (df_word_lr->out_of_date_transfer_functions, ENTRY_BLOCK); |
2752 bitmap_set_bit (df_word_lr->out_of_date_transfer_functions, EXIT_BLOCK); | 2760 bitmap_set_bit (df_word_lr->out_of_date_transfer_functions, EXIT_BLOCK); |
2753 | 2761 |
2754 EXECUTE_IF_SET_IN_BITMAP (df_word_lr->out_of_date_transfer_functions, 0, bb_index, bi) | 2762 EXECUTE_IF_SET_IN_BITMAP (df_word_lr->out_of_date_transfer_functions, 0, bb_index, bi) |
2755 { | 2763 { |
2756 struct df_word_lr_bb_info *bb_info = df_word_lr_get_bb_info (bb_index); | 2764 class df_word_lr_bb_info *bb_info = df_word_lr_get_bb_info (bb_index); |
2757 | 2765 |
2758 /* When bitmaps are already initialized, just clear them. */ | 2766 /* When bitmaps are already initialized, just clear them. */ |
2759 if (bb_info->use.obstack) | 2767 if (bb_info->use.obstack) |
2760 { | 2768 { |
2761 bitmap_clear (&bb_info->def); | 2769 bitmap_clear (&bb_info->def); |
2782 unsigned int bb_index; | 2790 unsigned int bb_index; |
2783 bitmap_iterator bi; | 2791 bitmap_iterator bi; |
2784 | 2792 |
2785 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) | 2793 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) |
2786 { | 2794 { |
2787 struct df_word_lr_bb_info *bb_info = df_word_lr_get_bb_info (bb_index); | 2795 class df_word_lr_bb_info *bb_info = df_word_lr_get_bb_info (bb_index); |
2788 gcc_assert (bb_info); | 2796 gcc_assert (bb_info); |
2789 bitmap_clear (&bb_info->in); | 2797 bitmap_clear (&bb_info->in); |
2790 bitmap_clear (&bb_info->out); | 2798 bitmap_clear (&bb_info->out); |
2791 } | 2799 } |
2792 } | 2800 } |
2848 | 2856 |
2849 static void | 2857 static void |
2850 df_word_lr_bb_local_compute (unsigned int bb_index) | 2858 df_word_lr_bb_local_compute (unsigned int bb_index) |
2851 { | 2859 { |
2852 basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index); | 2860 basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index); |
2853 struct df_word_lr_bb_info *bb_info = df_word_lr_get_bb_info (bb_index); | 2861 class df_word_lr_bb_info *bb_info = df_word_lr_get_bb_info (bb_index); |
2854 rtx_insn *insn; | 2862 rtx_insn *insn; |
2855 df_ref def, use; | 2863 df_ref def, use; |
2856 | 2864 |
2857 /* Ensure that artificial refs don't contain references to pseudos. */ | 2865 /* Ensure that artificial refs don't contain references to pseudos. */ |
2858 FOR_EACH_ARTIFICIAL_DEF (def, bb_index) | 2866 FOR_EACH_ARTIFICIAL_DEF (def, bb_index) |
2915 unsigned int bb_index; | 2923 unsigned int bb_index; |
2916 bitmap_iterator bi; | 2924 bitmap_iterator bi; |
2917 | 2925 |
2918 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) | 2926 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) |
2919 { | 2927 { |
2920 struct df_word_lr_bb_info *bb_info = df_word_lr_get_bb_info (bb_index); | 2928 class df_word_lr_bb_info *bb_info = df_word_lr_get_bb_info (bb_index); |
2921 bitmap_copy (&bb_info->in, &bb_info->use); | 2929 bitmap_copy (&bb_info->in, &bb_info->use); |
2922 bitmap_clear (&bb_info->out); | 2930 bitmap_clear (&bb_info->out); |
2923 } | 2931 } |
2924 } | 2932 } |
2925 | 2933 |
2939 /* Transfer function. */ | 2947 /* Transfer function. */ |
2940 | 2948 |
2941 static bool | 2949 static bool |
2942 df_word_lr_transfer_function (int bb_index) | 2950 df_word_lr_transfer_function (int bb_index) |
2943 { | 2951 { |
2944 struct df_word_lr_bb_info *bb_info = df_word_lr_get_bb_info (bb_index); | 2952 class df_word_lr_bb_info *bb_info = df_word_lr_get_bb_info (bb_index); |
2945 bitmap in = &bb_info->in; | 2953 bitmap in = &bb_info->in; |
2946 bitmap out = &bb_info->out; | 2954 bitmap out = &bb_info->out; |
2947 bitmap use = &bb_info->use; | 2955 bitmap use = &bb_info->use; |
2948 bitmap def = &bb_info->def; | 2956 bitmap def = &bb_info->def; |
2949 | 2957 |
2976 /* Debugging info at top of bb. */ | 2984 /* Debugging info at top of bb. */ |
2977 | 2985 |
2978 static void | 2986 static void |
2979 df_word_lr_top_dump (basic_block bb, FILE *file) | 2987 df_word_lr_top_dump (basic_block bb, FILE *file) |
2980 { | 2988 { |
2981 struct df_word_lr_bb_info *bb_info = df_word_lr_get_bb_info (bb->index); | 2989 class df_word_lr_bb_info *bb_info = df_word_lr_get_bb_info (bb->index); |
2982 if (!bb_info) | 2990 if (!bb_info) |
2983 return; | 2991 return; |
2984 | 2992 |
2985 fprintf (file, ";; blr in \t"); | 2993 fprintf (file, ";; blr in \t"); |
2986 df_print_word_regset (file, &bb_info->in); | 2994 df_print_word_regset (file, &bb_info->in); |
2994 /* Debugging info at bottom of bb. */ | 3002 /* Debugging info at bottom of bb. */ |
2995 | 3003 |
2996 static void | 3004 static void |
2997 df_word_lr_bottom_dump (basic_block bb, FILE *file) | 3005 df_word_lr_bottom_dump (basic_block bb, FILE *file) |
2998 { | 3006 { |
2999 struct df_word_lr_bb_info *bb_info = df_word_lr_get_bb_info (bb->index); | 3007 class df_word_lr_bb_info *bb_info = df_word_lr_get_bb_info (bb->index); |
3000 if (!bb_info) | 3008 if (!bb_info) |
3001 return; | 3009 return; |
3002 | 3010 |
3003 fprintf (file, ";; blr out \t"); | 3011 fprintf (file, ";; blr out \t"); |
3004 df_print_word_regset (file, &bb_info->out); | 3012 df_print_word_regset (file, &bb_info->out); |
3029 NULL, /* Debugging start insn. */ | 3037 NULL, /* Debugging start insn. */ |
3030 NULL, /* Debugging end insn. */ | 3038 NULL, /* Debugging end insn. */ |
3031 NULL, /* Incremental solution verify start. */ | 3039 NULL, /* Incremental solution verify start. */ |
3032 NULL, /* Incremental solution verify end. */ | 3040 NULL, /* Incremental solution verify end. */ |
3033 NULL, /* Dependent problem. */ | 3041 NULL, /* Dependent problem. */ |
3034 sizeof (struct df_word_lr_bb_info),/* Size of entry of block_info array. */ | 3042 sizeof (class df_word_lr_bb_info),/* Size of entry of block_info array. */ |
3035 TV_DF_WORD_LR, /* Timing variable. */ | 3043 TV_DF_WORD_LR, /* Timing variable. */ |
3036 false /* Reset blocks on dropping out of blocks_to_analyze. */ | 3044 false /* Reset blocks on dropping out of blocks_to_analyze. */ |
3037 }; | 3045 }; |
3038 | 3046 |
3039 | 3047 |
4091 if (NONDEBUG_INSN_P (insn)) | 4099 if (NONDEBUG_INSN_P (insn)) |
4092 { | 4100 { |
4093 if (volatile_insn_p (PATTERN (insn))) | 4101 if (volatile_insn_p (PATTERN (insn))) |
4094 return false; | 4102 return false; |
4095 memrefs_in_across |= find_memory (insn); | 4103 memrefs_in_across |= find_memory (insn); |
4096 note_stores (PATTERN (insn), find_memory_stores, | 4104 note_stores (insn, find_memory_stores, &mem_sets_in_across); |
4097 &mem_sets_in_across); | |
4098 /* This is used just to find sets of the stack pointer. */ | 4105 /* This is used just to find sets of the stack pointer. */ |
4099 memrefs_in_across |= mem_sets_in_across; | 4106 memrefs_in_across |= mem_sets_in_across; |
4100 trapping_insns_in_across |= may_trap_p (PATTERN (insn)); | 4107 trapping_insns_in_across |= may_trap_p (PATTERN (insn)); |
4101 } | 4108 } |
4102 next = PREV_INSN (insn); | 4109 next = PREV_INSN (insn); |
4171 dealt with elsewhere. */ | 4178 dealt with elsewhere. */ |
4172 if (other_branch_live != NULL || memrefs_in_across != 0) | 4179 if (other_branch_live != NULL || memrefs_in_across != 0) |
4173 { | 4180 { |
4174 int mem_ref_flags = 0; | 4181 int mem_ref_flags = 0; |
4175 int mem_set_flags = 0; | 4182 int mem_set_flags = 0; |
4176 note_stores (PATTERN (insn), find_memory_stores, &mem_set_flags); | 4183 note_stores (insn, find_memory_stores, &mem_set_flags); |
4177 mem_ref_flags = find_memory (insn); | 4184 mem_ref_flags = find_memory (insn); |
4178 /* Catch sets of the stack pointer. */ | 4185 /* Catch sets of the stack pointer. */ |
4179 mem_ref_flags |= mem_set_flags; | 4186 mem_ref_flags |= mem_set_flags; |
4180 | 4187 |
4181 if ((mem_ref_flags | mem_set_flags) & MEMREF_VOLATILE) | 4188 if ((mem_ref_flags | mem_set_flags) & MEMREF_VOLATILE) |
4345 | 4352 |
4346 static void | 4353 static void |
4347 df_md_free_bb_info (basic_block bb ATTRIBUTE_UNUSED, | 4354 df_md_free_bb_info (basic_block bb ATTRIBUTE_UNUSED, |
4348 void *vbb_info) | 4355 void *vbb_info) |
4349 { | 4356 { |
4350 struct df_md_bb_info *bb_info = (struct df_md_bb_info *) vbb_info; | 4357 class df_md_bb_info *bb_info = (class df_md_bb_info *) vbb_info; |
4351 if (bb_info) | 4358 if (bb_info) |
4352 { | 4359 { |
4353 bitmap_clear (&bb_info->kill); | 4360 bitmap_clear (&bb_info->kill); |
4354 bitmap_clear (&bb_info->gen); | 4361 bitmap_clear (&bb_info->gen); |
4355 bitmap_clear (&bb_info->init); | 4362 bitmap_clear (&bb_info->init); |
4380 } | 4387 } |
4381 bitmap_initialize (&df_md_scratch, &problem_data->md_bitmaps); | 4388 bitmap_initialize (&df_md_scratch, &problem_data->md_bitmaps); |
4382 | 4389 |
4383 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) | 4390 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) |
4384 { | 4391 { |
4385 struct df_md_bb_info *bb_info = df_md_get_bb_info (bb_index); | 4392 class df_md_bb_info *bb_info = df_md_get_bb_info (bb_index); |
4386 /* When bitmaps are already initialized, just clear them. */ | 4393 /* When bitmaps are already initialized, just clear them. */ |
4387 if (bb_info->init.obstack) | 4394 if (bb_info->init.obstack) |
4388 { | 4395 { |
4389 bitmap_clear (&bb_info->init); | 4396 bitmap_clear (&bb_info->init); |
4390 bitmap_clear (&bb_info->gen); | 4397 bitmap_clear (&bb_info->gen); |
4449 } | 4456 } |
4450 } | 4457 } |
4451 } | 4458 } |
4452 | 4459 |
4453 static void | 4460 static void |
4454 df_md_bb_local_compute_process_def (struct df_md_bb_info *bb_info, | 4461 df_md_bb_local_compute_process_def (class df_md_bb_info *bb_info, |
4455 df_ref def, | 4462 df_ref def, |
4456 int top_flag) | 4463 int top_flag) |
4457 { | 4464 { |
4458 bitmap_clear (&seen_in_insn); | 4465 bitmap_clear (&seen_in_insn); |
4459 | 4466 |
4490 | 4497 |
4491 static void | 4498 static void |
4492 df_md_bb_local_compute (unsigned int bb_index) | 4499 df_md_bb_local_compute (unsigned int bb_index) |
4493 { | 4500 { |
4494 basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index); | 4501 basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index); |
4495 struct df_md_bb_info *bb_info = df_md_get_bb_info (bb_index); | 4502 class df_md_bb_info *bb_info = df_md_get_bb_info (bb_index); |
4496 rtx_insn *insn; | 4503 rtx_insn *insn; |
4497 | 4504 |
4498 /* Artificials are only hard regs. */ | 4505 /* Artificials are only hard regs. */ |
4499 if (!(df->changeable_flags & DF_NO_HARD_REGS)) | 4506 if (!(df->changeable_flags & DF_NO_HARD_REGS)) |
4500 df_md_bb_local_compute_process_def (bb_info, | 4507 df_md_bb_local_compute_process_def (bb_info, |
4531 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi1) | 4538 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi1) |
4532 { | 4539 { |
4533 df_md_bb_local_compute (bb_index); | 4540 df_md_bb_local_compute (bb_index); |
4534 } | 4541 } |
4535 | 4542 |
4536 bitmap_clear (&seen_in_insn); | 4543 bitmap_release (&seen_in_insn); |
4537 | 4544 |
4538 frontiers = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun)); | 4545 frontiers = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun)); |
4539 FOR_ALL_BB_FN (bb, cfun) | 4546 FOR_ALL_BB_FN (bb, cfun) |
4540 bitmap_initialize (&frontiers[bb->index], &bitmap_default_obstack); | 4547 bitmap_initialize (&frontiers[bb->index], &bitmap_default_obstack); |
4541 | 4548 |
4568 unsigned int bb_index; | 4575 unsigned int bb_index; |
4569 bitmap_iterator bi; | 4576 bitmap_iterator bi; |
4570 | 4577 |
4571 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) | 4578 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) |
4572 { | 4579 { |
4573 struct df_md_bb_info *bb_info = df_md_get_bb_info (bb_index); | 4580 class df_md_bb_info *bb_info = df_md_get_bb_info (bb_index); |
4574 gcc_assert (bb_info); | 4581 gcc_assert (bb_info); |
4575 bitmap_clear (&bb_info->in); | 4582 bitmap_clear (&bb_info->in); |
4576 bitmap_clear (&bb_info->out); | 4583 bitmap_clear (&bb_info->out); |
4577 } | 4584 } |
4578 } | 4585 } |
4579 | 4586 |
4580 static bool | 4587 static bool |
4581 df_md_transfer_function (int bb_index) | 4588 df_md_transfer_function (int bb_index) |
4582 { | 4589 { |
4583 basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index); | 4590 basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index); |
4584 struct df_md_bb_info *bb_info = df_md_get_bb_info (bb_index); | 4591 class df_md_bb_info *bb_info = df_md_get_bb_info (bb_index); |
4585 bitmap in = &bb_info->in; | 4592 bitmap in = &bb_info->in; |
4586 bitmap out = &bb_info->out; | 4593 bitmap out = &bb_info->out; |
4587 bitmap gen = &bb_info->gen; | 4594 bitmap gen = &bb_info->gen; |
4588 bitmap kill = &bb_info->kill; | 4595 bitmap kill = &bb_info->kill; |
4589 | 4596 |
4607 unsigned int bb_index; | 4614 unsigned int bb_index; |
4608 bitmap_iterator bi; | 4615 bitmap_iterator bi; |
4609 | 4616 |
4610 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) | 4617 EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi) |
4611 { | 4618 { |
4612 struct df_md_bb_info *bb_info = df_md_get_bb_info (bb_index); | 4619 class df_md_bb_info *bb_info = df_md_get_bb_info (bb_index); |
4613 | 4620 |
4614 bitmap_copy (&bb_info->in, &bb_info->init); | 4621 bitmap_copy (&bb_info->in, &bb_info->init); |
4615 df_md_transfer_function (bb_index); | 4622 df_md_transfer_function (bb_index); |
4616 } | 4623 } |
4617 } | 4624 } |
4618 | 4625 |
4619 static void | 4626 static void |
4620 df_md_confluence_0 (basic_block bb) | 4627 df_md_confluence_0 (basic_block bb) |
4621 { | 4628 { |
4622 struct df_md_bb_info *bb_info = df_md_get_bb_info (bb->index); | 4629 class df_md_bb_info *bb_info = df_md_get_bb_info (bb->index); |
4623 bitmap_copy (&bb_info->in, &bb_info->init); | 4630 bitmap_copy (&bb_info->in, &bb_info->init); |
4624 } | 4631 } |
4625 | 4632 |
4626 /* In of target gets or of out of source. */ | 4633 /* In of target gets or of out of source. */ |
4627 | 4634 |
4633 | 4640 |
4634 if (e->flags & EDGE_FAKE) | 4641 if (e->flags & EDGE_FAKE) |
4635 return false; | 4642 return false; |
4636 | 4643 |
4637 if (e->flags & EDGE_EH) | 4644 if (e->flags & EDGE_EH) |
4638 return bitmap_ior_and_compl_into (op1, op2, | 4645 { |
4639 regs_invalidated_by_call_regset); | 4646 /* Conservatively treat partially-clobbered registers as surviving |
4647 across the edge; they might or might not, depending on what mode | |
4648 they have. */ | |
4649 bitmap_view<HARD_REG_SET> eh_kills (eh_edge_abi.full_reg_clobbers ()); | |
4650 return bitmap_ior_and_compl_into (op1, op2, eh_kills); | |
4651 } | |
4640 else | 4652 else |
4641 return bitmap_ior_into (op1, op2); | 4653 return bitmap_ior_into (op1, op2); |
4642 } | 4654 } |
4643 | 4655 |
4644 /* Free all storage associated with the problem. */ | 4656 /* Free all storage associated with the problem. */ |
4647 df_md_free (void) | 4659 df_md_free (void) |
4648 { | 4660 { |
4649 struct df_md_problem_data *problem_data | 4661 struct df_md_problem_data *problem_data |
4650 = (struct df_md_problem_data *) df_md->problem_data; | 4662 = (struct df_md_problem_data *) df_md->problem_data; |
4651 | 4663 |
4664 bitmap_release (&df_md_scratch); | |
4652 bitmap_obstack_release (&problem_data->md_bitmaps); | 4665 bitmap_obstack_release (&problem_data->md_bitmaps); |
4653 free (problem_data); | 4666 free (problem_data); |
4654 df_md->problem_data = NULL; | 4667 df_md->problem_data = NULL; |
4655 | 4668 |
4656 df_md->block_info_size = 0; | 4669 df_md->block_info_size = 0; |
4663 /* Debugging info at top of bb. */ | 4676 /* Debugging info at top of bb. */ |
4664 | 4677 |
4665 static void | 4678 static void |
4666 df_md_top_dump (basic_block bb, FILE *file) | 4679 df_md_top_dump (basic_block bb, FILE *file) |
4667 { | 4680 { |
4668 struct df_md_bb_info *bb_info = df_md_get_bb_info (bb->index); | 4681 class df_md_bb_info *bb_info = df_md_get_bb_info (bb->index); |
4669 if (!bb_info) | 4682 if (!bb_info) |
4670 return; | 4683 return; |
4671 | 4684 |
4672 fprintf (file, ";; md in \t"); | 4685 fprintf (file, ";; md in \t"); |
4673 df_print_regset (file, &bb_info->in); | 4686 df_print_regset (file, &bb_info->in); |
4682 /* Debugging info at bottom of bb. */ | 4695 /* Debugging info at bottom of bb. */ |
4683 | 4696 |
4684 static void | 4697 static void |
4685 df_md_bottom_dump (basic_block bb, FILE *file) | 4698 df_md_bottom_dump (basic_block bb, FILE *file) |
4686 { | 4699 { |
4687 struct df_md_bb_info *bb_info = df_md_get_bb_info (bb->index); | 4700 class df_md_bb_info *bb_info = df_md_get_bb_info (bb->index); |
4688 if (!bb_info) | 4701 if (!bb_info) |
4689 return; | 4702 return; |
4690 | 4703 |
4691 fprintf (file, ";; md out \t"); | 4704 fprintf (file, ";; md out \t"); |
4692 df_print_regset (file, &bb_info->out); | 4705 df_print_regset (file, &bb_info->out); |
4714 NULL, /* Debugging start insn. */ | 4727 NULL, /* Debugging start insn. */ |
4715 NULL, /* Debugging end insn. */ | 4728 NULL, /* Debugging end insn. */ |
4716 NULL, /* Incremental solution verify start. */ | 4729 NULL, /* Incremental solution verify start. */ |
4717 NULL, /* Incremental solution verify end. */ | 4730 NULL, /* Incremental solution verify end. */ |
4718 NULL, /* Dependent problem. */ | 4731 NULL, /* Dependent problem. */ |
4719 sizeof (struct df_md_bb_info),/* Size of entry of block_info array. */ | 4732 sizeof (class df_md_bb_info),/* Size of entry of block_info array. */ |
4720 TV_DF_MD, /* Timing variable. */ | 4733 TV_DF_MD, /* Timing variable. */ |
4721 false /* Reset blocks on dropping out of blocks_to_analyze. */ | 4734 false /* Reset blocks on dropping out of blocks_to_analyze. */ |
4722 }; | 4735 }; |
4723 | 4736 |
4724 /* Create a new MD instance and add it to the existing instance | 4737 /* Create a new MD instance and add it to the existing instance |