comparison gcc/df.h @ 55:77e2b8dfacca gcc-4.4.5

update it from 4.4.3 to 4.5.0
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Fri, 12 Feb 2010 23:39:51 +0900
parents a06113de4d67
children b7f97abdc517
comparison
equal deleted inserted replaced
52:c156f1bd5cd9 55:77e2b8dfacca
1 /* Form lists of pseudo register references for autoinc optimization 1 /* Form lists of pseudo register references for autoinc optimization
2 for GNU compiler. This is part of flow optimization. 2 for GNU compiler. This is part of flow optimization.
3 Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009 3 Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009
4 Free Software Foundation, Inc. 4 Free Software Foundation, Inc.
5 Originally contributed by Michael P. Hayes 5 Originally contributed by Michael P. Hayes
6 (m.hayes@elec.canterbury.ac.nz, mhayes@redhat.com) 6 (m.hayes@elec.canterbury.ac.nz, mhayes@redhat.com)
7 Major rewrite contributed by Danny Berlin (dberlin@dberlin.org) 7 Major rewrite contributed by Danny Berlin (dberlin@dberlin.org)
8 and Kenneth Zadeck (zadeck@naturalbridge.com). 8 and Kenneth Zadeck (zadeck@naturalbridge.com).
9 9
10 This file is part of GCC. 10 This file is part of GCC.
27 #define GCC_DF_H 27 #define GCC_DF_H
28 28
29 #include "bitmap.h" 29 #include "bitmap.h"
30 #include "basic-block.h" 30 #include "basic-block.h"
31 #include "alloc-pool.h" 31 #include "alloc-pool.h"
32 #include "timevar.h"
32 33
33 struct dataflow; 34 struct dataflow;
34 struct df; 35 struct df;
35 struct df_problem; 36 struct df_problem;
36 struct df_link; 37 struct df_link;
37 struct df_insn_info; 38 struct df_insn_info;
38 union df_ref_d; 39 union df_ref_d;
39 40
40 /* Data flow problems. All problems must have a unique id here. */ 41 /* Data flow problems. All problems must have a unique id here. */
41 42
42 /* Scanning is not really a dataflow problem, but it is useful to have 43 /* Scanning is not really a dataflow problem, but it is useful to have
43 the basic block functions in the vector so that things get done in 44 the basic block functions in the vector so that things get done in
44 a uniform manner. The last four problems can be added or deleted 45 a uniform manner. The last four problems can be added or deleted
45 at any time are always defined (though LIVE is always there at -O2 46 at any time are always defined (though LIVE is always there at -O2
46 or higher); the others are always there. */ 47 or higher); the others are always there. */
47 #define DF_SCAN 0 48 #define DF_SCAN 0
48 #define DF_LR 1 /* Live Registers backward. */ 49 #define DF_LR 1 /* Live Registers backward. */
49 #define DF_LIVE 2 /* Live Registers & Uninitialized Registers */ 50 #define DF_LIVE 2 /* Live Registers & Uninitialized Registers */
50 #define DF_RD 3 /* Reaching Defs. */ 51 #define DF_RD 3 /* Reaching Defs. */
51 #define DF_CHAIN 4 /* Def-Use and/or Use-Def Chains. */ 52 #define DF_CHAIN 4 /* Def-Use and/or Use-Def Chains. */
52 #define DF_BYTE_LR 5 /* Subreg tracking lr. */ 53 #define DF_BYTE_LR 5 /* Subreg tracking lr. */
53 #define DF_NOTE 6 /* REG_DEF and REG_UNUSED notes. */ 54 #define DF_NOTE 6 /* REG_DEF and REG_UNUSED notes. */
54 55 #define DF_MD 7 /* Multiple Definitions. */
55 #define DF_LAST_PROBLEM_PLUS1 (DF_NOTE + 1) 56
57 #define DF_LAST_PROBLEM_PLUS1 (DF_MD + 1)
56 58
57 /* Dataflow direction. */ 59 /* Dataflow direction. */
58 enum df_flow_dir 60 enum df_flow_dir
59 { 61 {
60 DF_NONE, 62 DF_NONE,
101 103
102 104
103 /* This flag is set if this ref is a partial use or def of the 105 /* This flag is set if this ref is a partial use or def of the
104 associated register. */ 106 associated register. */
105 DF_REF_PARTIAL = 1 << 4, 107 DF_REF_PARTIAL = 1 << 4,
106 108
107 /* Read-modify-write refs generate both a use and a def and 109 /* Read-modify-write refs generate both a use and a def and
108 these are marked with this flag to show that they are not 110 these are marked with this flag to show that they are not
109 independent. */ 111 independent. */
110 DF_REF_READ_WRITE = 1 << 5, 112 DF_REF_READ_WRITE = 1 << 5,
111 113
116 DF_REF_MUST_CLOBBER. */ 118 DF_REF_MUST_CLOBBER. */
117 DF_REF_MAY_CLOBBER = 1 << 6, 119 DF_REF_MAY_CLOBBER = 1 << 6,
118 120
119 /* This flag is set if this ref, generally a def, is a real 121 /* This flag is set if this ref, generally a def, is a real
120 clobber. This is not currently set for registers live across a 122 clobber. This is not currently set for registers live across a
121 call because that clobbering may or may not happen. 123 call because that clobbering may or may not happen.
122 124
123 Most of the uses of this are with sets that have a 125 Most of the uses of this are with sets that have a
124 GET_CODE(..)==CLOBBER. Note that this is set even if the 126 GET_CODE(..)==CLOBBER. Note that this is set even if the
125 clobber is to a subreg. So in order to tell if the clobber 127 clobber is to a subreg. So in order to tell if the clobber
126 wipes out the entire register, it is necessary to also check 128 wipes out the entire register, it is necessary to also check
129 131
130 132
131 /* If the ref has one of the following two flags set, then the 133 /* If the ref has one of the following two flags set, then the
132 struct df_ref can be cast to struct df_ref_extract to access 134 struct df_ref can be cast to struct df_ref_extract to access
133 the width and offset fields. */ 135 the width and offset fields. */
134 136
135 /* This flag is set if the ref contains a SIGN_EXTRACT. */ 137 /* This flag is set if the ref contains a SIGN_EXTRACT. */
136 DF_REF_SIGN_EXTRACT = 1 << 8, 138 DF_REF_SIGN_EXTRACT = 1 << 8,
137 139
138 /* This flag is set if the ref contains a ZERO_EXTRACT. */ 140 /* This flag is set if the ref contains a ZERO_EXTRACT. */
139 DF_REF_ZERO_EXTRACT = 1 << 9, 141 DF_REF_ZERO_EXTRACT = 1 << 9,
161 }; 163 };
162 164
163 /* The possible ordering of refs within the df_ref_info. */ 165 /* The possible ordering of refs within the df_ref_info. */
164 enum df_ref_order 166 enum df_ref_order
165 { 167 {
166 /* There is not table. */ 168 /* There is not table. */
167 DF_REF_ORDER_NO_TABLE, 169 DF_REF_ORDER_NO_TABLE,
168 170
169 /* There is a table of refs but it is not (or no longer) organized 171 /* There is a table of refs but it is not (or no longer) organized
170 by one of the following methods. */ 172 by one of the following methods. */
171 DF_REF_ORDER_UNORDERED, 173 DF_REF_ORDER_UNORDERED,
172 DF_REF_ORDER_UNORDERED_WITH_NOTES, 174 DF_REF_ORDER_UNORDERED_WITH_NOTES,
173 175
174 /* Organize the table by reg order, all of the refs with regno 0 176 /* Organize the table by reg order, all of the refs with regno 0
175 followed by all of the refs with regno 1 ... . Within all of 177 followed by all of the refs with regno 1 ... . Within all of
176 the regs for a particular regno, the refs are unordered. */ 178 the regs for a particular regno, the refs are unordered. */
177 DF_REF_ORDER_BY_REG, 179 DF_REF_ORDER_BY_REG,
178 180
179 /* For uses, the refs within eq notes may be added for 181 /* For uses, the refs within eq notes may be added for
180 DF_REF_ORDER_BY_REG. */ 182 DF_REF_ORDER_BY_REG. */
181 DF_REF_ORDER_BY_REG_WITH_NOTES, 183 DF_REF_ORDER_BY_REG_WITH_NOTES,
182 184
183 /* Organize the refs in insn order. The insns are ordered within a 185 /* Organize the refs in insn order. The insns are ordered within a
184 block, and the blocks are ordered by FOR_ALL_BB. */ 186 block, and the blocks are ordered by FOR_ALL_BB. */
185 DF_REF_ORDER_BY_INSN, 187 DF_REF_ORDER_BY_INSN,
186 188
187 /* For uses, the refs within eq notes may be added for 189 /* For uses, the refs within eq notes may be added for
188 DF_REF_ORDER_BY_INSN. */ 190 DF_REF_ORDER_BY_INSN. */
189 DF_REF_ORDER_BY_INSN_WITH_NOTES 191 DF_REF_ORDER_BY_INSN_WITH_NOTES
251 typedefs for doc for the function fields. */ 253 typedefs for doc for the function fields. */
252 254
253 struct df_problem { 255 struct df_problem {
254 /* The unique id of the problem. This is used it index into 256 /* The unique id of the problem. This is used it index into
255 df->defined_problems to make accessing the problem data easy. */ 257 df->defined_problems to make accessing the problem data easy. */
256 unsigned int id; 258 unsigned int id;
257 enum df_flow_dir dir; /* Dataflow direction. */ 259 enum df_flow_dir dir; /* Dataflow direction. */
258 df_alloc_function alloc_fun; 260 df_alloc_function alloc_fun;
259 df_reset_function reset_fun; 261 df_reset_function reset_fun;
260 df_free_bb_function free_bb_fun; 262 df_free_bb_function free_bb_fun;
261 df_local_compute_function local_compute_fun; 263 df_local_compute_function local_compute_fun;
273 df_verify_solution_start verify_start_fun; 275 df_verify_solution_start verify_start_fun;
274 df_verify_solution_end verify_end_fun; 276 df_verify_solution_end verify_end_fun;
275 struct df_problem *dependent_problem; 277 struct df_problem *dependent_problem;
276 278
277 /* The timevar id associated with this pass. */ 279 /* The timevar id associated with this pass. */
278 unsigned int tv_id; 280 timevar_id_t tv_id;
279 281
280 /* True if the df_set_blocks should null out the basic block info if 282 /* True if the df_set_blocks should null out the basic block info if
281 this block drops out of df->blocks_to_analyze. */ 283 this block drops out of df->blocks_to_analyze. */
282 bool free_blocks_on_set_blocks; 284 bool free_blocks_on_set_blocks;
283 }; 285 };
292 solution specific information. */ 294 solution specific information. */
293 void **block_info; 295 void **block_info;
294 unsigned int block_info_size; 296 unsigned int block_info_size;
295 297
296 /* The pool to allocate the block_info from. */ 298 /* The pool to allocate the block_info from. */
297 alloc_pool block_pool; 299 alloc_pool block_pool;
298 300
299 /* The lr and live problems have their transfer functions recomputed 301 /* The lr and live problems have their transfer functions recomputed
300 only if necessary. This is possible for them because, the 302 only if necessary. This is possible for them because, the
301 problems are kept active for the entire backend and their 303 problems are kept active for the entire backend and their
302 transfer functions are indexed by the REGNO. These are not 304 transfer functions are indexed by the REGNO. These are not
309 fully public. */ 311 fully public. */
310 void *problem_data; 312 void *problem_data;
311 313
312 /* Local flags for some of the problems. */ 314 /* Local flags for some of the problems. */
313 unsigned int local_flags; 315 unsigned int local_flags;
314 316
315 /* True if this problem of this instance has been initialized. This 317 /* True if this problem of this instance has been initialized. This
316 is used by the dumpers to keep garbage out of the dumps if, for 318 is used by the dumpers to keep garbage out of the dumps if, for
317 debugging a dump is produced before the first call to 319 debugging a dump is produced before the first call to
318 df_analyze after a new problem is added. */ 320 df_analyze after a new problem is added. */
319 bool computed; 321 bool computed;
320 322
321 /* True if the something has changed which invalidates the dataflow 323 /* True if the something has changed which invalidates the dataflow
322 solutions. Note that this bit is always true for all problems except 324 solutions. Note that this bit is always true for all problems except
323 lr and live. */ 325 lr and live. */
324 bool solutions_dirty; 326 bool solutions_dirty;
325 327
326 /* If true, this pass is deleted by df_finish_pass. This is never 328 /* If true, this pass is deleted by df_finish_pass. This is never
327 true for DF_SCAN and DF_LR. It is true for DF_LIVE if optimize > 329 true for DF_SCAN and DF_LR. It is true for DF_LIVE if optimize >
334 instruction. These are factored into individual uses and defs but 336 instruction. These are factored into individual uses and defs but
335 the aggregate is still needed to service the REG_DEAD and 337 the aggregate is still needed to service the REG_DEAD and
336 REG_UNUSED notes. */ 338 REG_UNUSED notes. */
337 struct df_mw_hardreg 339 struct df_mw_hardreg
338 { 340 {
339 rtx mw_reg; /* The multiword hardreg. */ 341 rtx mw_reg; /* The multiword hardreg. */
340 /* These two bitfields are intentionally oversized, in the hope that 342 /* These two bitfields are intentionally oversized, in the hope that
341 accesses to 16-bit fields will usually be quicker. */ 343 accesses to 16-bit fields will usually be quicker. */
342 ENUM_BITFIELD(df_ref_type) type : 16; 344 ENUM_BITFIELD(df_ref_type) type : 16;
343 /* Used to see if the ref is read or write. */ 345 /* Used to see if the ref is read or write. */
344 ENUM_BITFIELD(df_ref_flags) flags : 16; 346 int flags : 16; /* Various df_ref_flags. */
345 /* Various flags. */
346 unsigned int start_regno; /* First word of the multi word subreg. */ 347 unsigned int start_regno; /* First word of the multi word subreg. */
347 unsigned int end_regno; /* Last word of the multi word subreg. */ 348 unsigned int end_regno; /* Last word of the multi word subreg. */
348 unsigned int mw_order; /* Same as df_ref.ref_order. */ 349 unsigned int mw_order; /* Same as df_ref.ref_order. */
349 }; 350 };
350 351
351 352
352 /* Define a register reference structure. One of these is allocated 353 /* Define a register reference structure. One of these is allocated
353 for every register reference (use or def). Note some register 354 for every register reference (use or def). Note some register
354 references (e.g., post_inc, subreg) generate both a def and a use. */ 355 references (e.g., post_inc, subreg) generate both a def and a use. */
355 struct df_base_ref 356 struct df_base_ref
358 accesses to 8 and 16-bit fields will usually be quicker. */ 359 accesses to 8 and 16-bit fields will usually be quicker. */
359 ENUM_BITFIELD(df_ref_class) cl : 8; 360 ENUM_BITFIELD(df_ref_class) cl : 8;
360 361
361 ENUM_BITFIELD(df_ref_type) type : 8; 362 ENUM_BITFIELD(df_ref_type) type : 8;
362 /* Type of ref. */ 363 /* Type of ref. */
363 ENUM_BITFIELD(df_ref_flags) flags : 16; 364 int flags : 16; /* Various df_ref_flags. */
364 /* Various flags. */
365 rtx reg; /* The register referenced. */ 365 rtx reg; /* The register referenced. */
366 struct df_link *chain; /* Head of def-use, use-def. */ 366 struct df_link *chain; /* Head of def-use, use-def. */
367 /* Pointer to the insn info of the containing instruction. FIXME! 367 /* Pointer to the insn info of the containing instruction. FIXME!
368 Currently this is NULL for artificial refs but this will be used 368 Currently this is NULL for artificial refs but this will be used
369 when FUDs are added. */ 369 when FUDs are added. */
370 struct df_insn_info *insn_info; 370 struct df_insn_info *insn_info;
371 /* For each regno, there are three chains of refs, one for the uses, 371 /* For each regno, there are three chains of refs, one for the uses,
372 the eq_uses and the defs. These chains go thru the refs 372 the eq_uses and the defs. These chains go thru the refs
373 themselves rather than using an external structure. */ 373 themselves rather than using an external structure. */
374 union df_ref_d *next_reg; /* Next ref with same regno and type. */ 374 union df_ref_d *next_reg; /* Next ref with same regno and type. */
375 union df_ref_d *prev_reg; /* Prev ref with same regno and type. */ 375 union df_ref_d *prev_reg; /* Prev ref with same regno and type. */
376 unsigned int regno; /* The register number referenced. */ 376 unsigned int regno; /* The register number referenced. */
377 /* Location in the ref table. This is only valid after a call to 377 /* Location in the ref table. This is only valid after a call to
378 df_maybe_reorganize_[use,def]_refs which is an expensive operation. */ 378 df_maybe_reorganize_[use,def]_refs which is an expensive operation. */
379 int id; 379 int id;
380 /* The index at which the operand was scanned in the insn. This is 380 /* The index at which the operand was scanned in the insn. This is
381 used to totally order the refs in an insn. */ 381 used to totally order the refs in an insn. */
382 unsigned int ref_order; 382 unsigned int ref_order;
383 }; 383 };
384 384
385 385
386 /* The three types of df_refs. Note that the df_ref_extract is an 386 /* The three types of df_refs. Note that the df_ref_extract is an
387 extension of the df_regular_ref, not the df_base_ref. */ 387 extension of the df_regular_ref, not the df_base_ref. */
388 struct df_artificial_ref 388 struct df_artificial_ref
389 { 389 {
390 struct df_base_ref base; 390 struct df_base_ref base;
391 391
392 /* Artificial refs do not have an insn, so to get the basic block, 392 /* Artificial refs do not have an insn, so to get the basic block,
434 { 434 {
435 rtx insn; /* The insn this info comes from. */ 435 rtx insn; /* The insn this info comes from. */
436 df_ref *defs; /* Head of insn-def chain. */ 436 df_ref *defs; /* Head of insn-def chain. */
437 df_ref *uses; /* Head of insn-use chain. */ 437 df_ref *uses; /* Head of insn-use chain. */
438 /* Head of insn-use chain for uses in REG_EQUAL/EQUIV notes. */ 438 /* Head of insn-use chain for uses in REG_EQUAL/EQUIV notes. */
439 df_ref *eq_uses; 439 df_ref *eq_uses;
440 struct df_mw_hardreg **mw_hardregs; 440 struct df_mw_hardreg **mw_hardregs;
441 /* The logical uid of the insn in the basic block. This is valid 441 /* The logical uid of the insn in the basic block. This is valid
442 after any call to df_analyze but may rot after insns are added, 442 after any call to df_analyze but may rot after insns are added,
443 deleted or moved. */ 443 deleted or moved. */
444 int luid; 444 int luid;
445 }; 445 };
446 446
447 /* These links are used for ref-ref chains. Currently only DEF-USE and 447 /* These links are used for ref-ref chains. Currently only DEF-USE and
448 USE-DEF chains can be built by DF. */ 448 USE-DEF chains can be built by DF. */
449 struct df_link 449 struct df_link
450 { 450 {
451 df_ref ref; 451 df_ref ref;
454 454
455 455
456 enum df_chain_flags 456 enum df_chain_flags
457 { 457 {
458 /* Flags that control the building of chains. */ 458 /* Flags that control the building of chains. */
459 DF_DU_CHAIN = 1, /* Build DU chains. */ 459 DF_DU_CHAIN = 1, /* Build DU chains. */
460 DF_UD_CHAIN = 2 /* Build UD chains. */ 460 DF_UD_CHAIN = 2 /* Build UD chains. */
461 }; 461 };
462 462
463 enum df_changeable_flags 463 enum df_changeable_flags
464 { 464 {
465 /* Scanning flags. */ 465 /* Scanning flags. */
466 /* Flag to control the running of dce as a side effect of building LR. */ 466 /* Flag to control the running of dce as a side effect of building LR. */
467 DF_LR_RUN_DCE = 1 << 0, /* Run DCE. */ 467 DF_LR_RUN_DCE = 1 << 0, /* Run DCE. */
468 DF_NO_HARD_REGS = 1 << 1, /* Skip hard registers in RD and CHAIN Building. */ 468 DF_NO_HARD_REGS = 1 << 1, /* Skip hard registers in RD and CHAIN Building. */
531 nulls at the end of it. In PROBLEMS_BY_INDEX, the problem is 531 nulls at the end of it. In PROBLEMS_BY_INDEX, the problem is
532 stored by the value in df_problem.id. These are used to access 532 stored by the value in df_problem.id. These are used to access
533 the problem local data without having to search the first 533 the problem local data without having to search the first
534 array. */ 534 array. */
535 535
536 struct dataflow *problems_in_order[DF_LAST_PROBLEM_PLUS1]; 536 struct dataflow *problems_in_order[DF_LAST_PROBLEM_PLUS1];
537 struct dataflow *problems_by_index[DF_LAST_PROBLEM_PLUS1]; 537 struct dataflow *problems_by_index[DF_LAST_PROBLEM_PLUS1];
538 538
539 /* If not NULL, this subset of blocks of the program to be 539 /* If not NULL, this subset of blocks of the program to be
540 considered for analysis. At certain times, this will contain all 540 considered for analysis. At certain times, this will contain all
541 the blocks in the function so it cannot be used as an indicator 541 the blocks in the function so it cannot be used as an indicator
542 of if we are analyzing a subset. See analyze_subset. */ 542 of if we are analyzing a subset. See analyze_subset. */
543 bitmap blocks_to_analyze; 543 bitmap blocks_to_analyze;
544 544
545 /* The following information is really the problem data for the 545 /* The following information is really the problem data for the
546 scanning instance but it is used too often by the other problems 546 scanning instance but it is used too often by the other problems
547 to keep getting it from there. */ 547 to keep getting it from there. */
576 /* Insns to delete, rescan or reprocess the notes at next 576 /* Insns to delete, rescan or reprocess the notes at next
577 df_rescan_all or df_process_deferred_rescans. */ 577 df_rescan_all or df_process_deferred_rescans. */
578 bitmap insns_to_delete; 578 bitmap insns_to_delete;
579 bitmap insns_to_rescan; 579 bitmap insns_to_rescan;
580 bitmap insns_to_notes_rescan; 580 bitmap insns_to_notes_rescan;
581 int *postorder; /* The current set of basic blocks 581 int *postorder; /* The current set of basic blocks
582 in reverse postorder. */ 582 in reverse postorder. */
583 int *postorder_inverted; /* The current set of basic blocks 583 int *postorder_inverted; /* The current set of basic blocks
584 in reverse postorder of inverted CFG. */ 584 in reverse postorder of inverted CFG. */
585 int n_blocks; /* The number of blocks in reverse postorder. */ 585 int n_blocks; /* The number of blocks in reverse postorder. */
586 int n_blocks_inverted; /* The number of blocks 586 int n_blocks_inverted; /* The number of blocks
587 in reverse postorder of inverted CFG. */ 587 in reverse postorder of inverted CFG. */
588 588
589 /* An array [FIRST_PSEUDO_REGISTER], indexed by regno, of the number 589 /* An array [FIRST_PSEUDO_REGISTER], indexed by regno, of the number
590 of refs that qualify as being real hard regs uses. Artificial 590 of refs that qualify as being real hard regs uses. Artificial
591 uses and defs as well as refs in eq notes are ignored. If the 591 uses and defs as well as refs in eq notes are ignored. If the
600 600
601 /* This counter provides a way to totally order refs without using 601 /* This counter provides a way to totally order refs without using
602 addresses. It is incremented whenever a ref is created. */ 602 addresses. It is incremented whenever a ref is created. */
603 unsigned int ref_order; 603 unsigned int ref_order;
604 604
605 /* Problem specific control information. */ 605 /* Problem specific control information. This is a combination of
606 ENUM_BITFIELD (df_changeable_flags) changeable_flags : 8; 606 enum df_changeable_flags values. */
607 int changeable_flags : 8;
607 608
608 /* If this is true, then only a subset of the blocks of the program 609 /* If this is true, then only a subset of the blocks of the program
609 is considered to compute the solutions of dataflow problems. */ 610 is considered to compute the solutions of dataflow problems. */
610 bool analyze_subset; 611 bool analyze_subset;
611 612
617 #define DF_SCAN_BB_INFO(BB) (df_scan_get_bb_info((BB)->index)) 618 #define DF_SCAN_BB_INFO(BB) (df_scan_get_bb_info((BB)->index))
618 #define DF_RD_BB_INFO(BB) (df_rd_get_bb_info((BB)->index)) 619 #define DF_RD_BB_INFO(BB) (df_rd_get_bb_info((BB)->index))
619 #define DF_LR_BB_INFO(BB) (df_lr_get_bb_info((BB)->index)) 620 #define DF_LR_BB_INFO(BB) (df_lr_get_bb_info((BB)->index))
620 #define DF_LIVE_BB_INFO(BB) (df_live_get_bb_info((BB)->index)) 621 #define DF_LIVE_BB_INFO(BB) (df_live_get_bb_info((BB)->index))
621 #define DF_BYTE_LR_BB_INFO(BB) (df_byte_lr_get_bb_info((BB)->index)) 622 #define DF_BYTE_LR_BB_INFO(BB) (df_byte_lr_get_bb_info((BB)->index))
623 #define DF_MD_BB_INFO(BB) (df_md_get_bb_info((BB)->index))
622 624
623 /* Most transformations that wish to use live register analysis will 625 /* Most transformations that wish to use live register analysis will
624 use these macros. This info is the and of the lr and live sets. */ 626 use these macros. This info is the and of the lr and live sets. */
625 #define DF_LIVE_IN(BB) (DF_LIVE_BB_INFO(BB)->in) 627 #define DF_LIVE_IN(BB) (DF_LIVE_BB_INFO(BB)->in)
626 #define DF_LIVE_OUT(BB) (DF_LIVE_BB_INFO(BB)->out) 628 #define DF_LIVE_OUT(BB) (DF_LIVE_BB_INFO(BB)->out)
627 629
628 /* These macros are used by passes that are not tolerant of 630 /* These macros are used by passes that are not tolerant of
629 uninitialized variables. This intolerance should eventually 631 uninitialized variables. This intolerance should eventually
630 be fixed. */ 632 be fixed. */
631 #define DF_LR_IN(BB) (DF_LR_BB_INFO(BB)->in) 633 #define DF_LR_IN(BB) (DF_LR_BB_INFO(BB)->in)
632 #define DF_LR_OUT(BB) (DF_LR_BB_INFO(BB)->out) 634 #define DF_LR_OUT(BB) (DF_LR_BB_INFO(BB)->out)
633 635
634 /* These macros are used by passes that are not tolerant of 636 /* These macros are used by passes that are not tolerant of
635 uninitialized variables. This intolerance should eventually 637 uninitialized variables. This intolerance should eventually
636 be fixed. */ 638 be fixed. */
637 #define DF_BYTE_LR_IN(BB) (DF_BYTE_LR_BB_INFO(BB)->in) 639 #define DF_BYTE_LR_IN(BB) (DF_BYTE_LR_BB_INFO(BB)->in)
638 #define DF_BYTE_LR_OUT(BB) (DF_BYTE_LR_BB_INFO(BB)->out) 640 #define DF_BYTE_LR_OUT(BB) (DF_BYTE_LR_BB_INFO(BB)->out)
639 641
640 /* Macros to access the elements within the ref structure. */ 642 /* Macros to access the elements within the ref structure. */
641 643
642 644
643 #define DF_REF_REAL_REG(REF) (GET_CODE ((REF)->base.reg) == SUBREG \ 645 #define DF_REF_REAL_REG(REF) (GET_CODE ((REF)->base.reg) == SUBREG \
670 #define DF_REF_REG_MARK(REF) (DF_REF_FLAGS_SET ((REF),DF_REF_REG_MARKER)) 672 #define DF_REF_REG_MARK(REF) (DF_REF_FLAGS_SET ((REF),DF_REF_REG_MARKER))
671 #define DF_REF_REG_UNMARK(REF) (DF_REF_FLAGS_CLEAR ((REF),DF_REF_REG_MARKER)) 673 #define DF_REF_REG_UNMARK(REF) (DF_REF_FLAGS_CLEAR ((REF),DF_REF_REG_MARKER))
672 #define DF_REF_IS_REG_MARKED(REF) (DF_REF_FLAGS_IS_SET ((REF),DF_REF_REG_MARKER)) 674 #define DF_REF_IS_REG_MARKED(REF) (DF_REF_FLAGS_IS_SET ((REF),DF_REF_REG_MARKER))
673 #define DF_REF_NEXT_REG(REF) ((REF)->base.next_reg) 675 #define DF_REF_NEXT_REG(REF) ((REF)->base.next_reg)
674 #define DF_REF_PREV_REG(REF) ((REF)->base.prev_reg) 676 #define DF_REF_PREV_REG(REF) ((REF)->base.prev_reg)
675 /* The following two macros may only be applied if one of 677 /* The following two macros may only be applied if one of
676 DF_REF_SIGN_EXTRACT | DF_REF_ZERO_EXTRACT is true. */ 678 DF_REF_SIGN_EXTRACT | DF_REF_ZERO_EXTRACT is true. */
677 #define DF_REF_EXTRACT_WIDTH(REF) ((REF)->extract_ref.width) 679 #define DF_REF_EXTRACT_WIDTH(REF) ((REF)->extract_ref.width)
678 #define DF_REF_EXTRACT_OFFSET(REF) ((REF)->extract_ref.offset) 680 #define DF_REF_EXTRACT_OFFSET(REF) ((REF)->extract_ref.offset)
679 #define DF_REF_EXTRACT_MODE(REF) ((REF)->extract_ref.mode) 681 #define DF_REF_EXTRACT_MODE(REF) ((REF)->extract_ref.mode)
680 682
681 /* Macros to determine the reference type. */ 683 /* Macros to determine the reference type. */
691 #define DF_MWS_TYPE(MREF) ((MREF)->type) 693 #define DF_MWS_TYPE(MREF) ((MREF)->type)
692 694
693 /* Macros to get the refs out of def_info or use_info refs table. If 695 /* Macros to get the refs out of def_info or use_info refs table. If
694 the focus of the dataflow has been set to some subset of blocks 696 the focus of the dataflow has been set to some subset of blocks
695 with df_set_blocks, these macros will only find the uses and defs 697 with df_set_blocks, these macros will only find the uses and defs
696 in that subset of blocks. 698 in that subset of blocks.
697 699
698 These macros should be used with care. The def macros are only 700 These macros should be used with care. The def macros are only
699 usable after a call to df_maybe_reorganize_def_refs and the use 701 usable after a call to df_maybe_reorganize_def_refs and the use
700 macros are only usable after a call to 702 macros are only usable after a call to
701 df_maybe_reorganize_use_refs. HOWEVER, BUILDING AND USING THESE 703 df_maybe_reorganize_use_refs. HOWEVER, BUILDING AND USING THESE
787 }; 789 };
788 790
789 791
790 /* Reaching definitions. All bitmaps are indexed by the id field of 792 /* Reaching definitions. All bitmaps are indexed by the id field of
791 the ref except sparse_kill which is indexed by regno. */ 793 the ref except sparse_kill which is indexed by regno. */
792 struct df_rd_bb_info 794 struct df_rd_bb_info
793 { 795 {
794 /* Local sets to describe the basic blocks. */ 796 /* Local sets to describe the basic blocks. */
795 bitmap kill; 797 bitmap kill;
796 bitmap sparse_kill; 798 bitmap sparse_kill;
797 bitmap gen; /* The set of defs generated in this block. */ 799 bitmap gen; /* The set of defs generated in this block. */
798 800
799 /* The results of the dataflow problem. */ 801 /* The results of the dataflow problem. */
800 bitmap in; /* At the top of the block. */ 802 bitmap in; /* At the top of the block. */
801 bitmap out; /* At the bottom of the block. */ 803 bitmap out; /* At the bottom of the block. */
802 }; 804 };
803 805
804 806
807 /* Multiple reaching definitions. All bitmaps are referenced by the
808 register number. */
809
810 struct df_md_bb_info
811 {
812 /* Local sets to describe the basic blocks. */
813 bitmap gen; /* Partial/conditional definitions live at BB out. */
814 bitmap kill; /* Other definitions that are live at BB out. */
815 bitmap init; /* Definitions coming from dominance frontier edges. */
816
817 /* The results of the dataflow problem. */
818 bitmap in; /* Just before the block itself. */
819 bitmap out; /* At the bottom of the block. */
820 };
821
822
805 /* Live registers, a backwards dataflow problem. All bitmaps are 823 /* Live registers, a backwards dataflow problem. All bitmaps are
806 referenced by the register number. */ 824 referenced by the register number. */
807 825
808 struct df_lr_bb_info 826 struct df_lr_bb_info
809 { 827 {
810 /* Local sets to describe the basic blocks. */ 828 /* Local sets to describe the basic blocks. */
811 bitmap def; /* The set of registers set in this block 829 bitmap def; /* The set of registers set in this block
812 - except artificial defs at the top. */ 830 - except artificial defs at the top. */
813 bitmap use; /* The set of registers used in this block. */ 831 bitmap use; /* The set of registers used in this block. */
814 832
815 /* The results of the dataflow problem. */ 833 /* The results of the dataflow problem. */
816 bitmap in; /* Just before the block itself. */ 834 bitmap in; /* Just before the block itself. */
820 838
821 /* Uninitialized registers. All bitmaps are referenced by the 839 /* Uninitialized registers. All bitmaps are referenced by the
822 register number. Anded results of the forwards and backward live 840 register number. Anded results of the forwards and backward live
823 info. Note that the forwards live information is not available 841 info. Note that the forwards live information is not available
824 separately. */ 842 separately. */
825 struct df_live_bb_info 843 struct df_live_bb_info
826 { 844 {
827 /* Local sets to describe the basic blocks. */ 845 /* Local sets to describe the basic blocks. */
828 bitmap kill; /* The set of registers unset in this block. Calls, 846 bitmap kill; /* The set of registers unset in this block. Calls,
829 for instance, unset registers. */ 847 for instance, unset registers. */
830 bitmap gen; /* The set of registers set in this block. */ 848 bitmap gen; /* The set of registers set in this block. */
836 854
837 855
838 /* Live registers, a backwards dataflow problem. These bitmaps are 856 /* Live registers, a backwards dataflow problem. These bitmaps are
839 indexed by the df_byte_lr_offset array which is indexed by pseudo. */ 857 indexed by the df_byte_lr_offset array which is indexed by pseudo. */
840 858
841 struct df_byte_lr_bb_info 859 struct df_byte_lr_bb_info
842 { 860 {
843 /* Local sets to describe the basic blocks. */ 861 /* Local sets to describe the basic blocks. */
844 bitmap def; /* The set of registers set in this block 862 bitmap def; /* The set of registers set in this block
845 - except artificial defs at the top. */ 863 - except artificial defs at the top. */
846 bitmap use; /* The set of registers used in this block. */ 864 bitmap use; /* The set of registers used in this block. */
847 865
848 /* The results of the dataflow problem. */ 866 /* The results of the dataflow problem. */
849 bitmap in; /* Just before the block itself. */ 867 bitmap in; /* Just before the block itself. */
851 }; 869 };
852 870
853 871
854 /* This is used for debugging and for the dumpers to find the latest 872 /* This is used for debugging and for the dumpers to find the latest
855 instance so that the df info can be added to the dumps. This 873 instance so that the df info can be added to the dumps. This
856 should not be used by regular code. */ 874 should not be used by regular code. */
857 extern struct df *df; 875 extern struct df *df;
858 #define df_scan (df->problems_by_index[DF_SCAN]) 876 #define df_scan (df->problems_by_index[DF_SCAN])
859 #define df_rd (df->problems_by_index[DF_RD]) 877 #define df_rd (df->problems_by_index[DF_RD])
860 #define df_lr (df->problems_by_index[DF_LR]) 878 #define df_lr (df->problems_by_index[DF_LR])
861 #define df_live (df->problems_by_index[DF_LIVE]) 879 #define df_live (df->problems_by_index[DF_LIVE])
862 #define df_chain (df->problems_by_index[DF_CHAIN]) 880 #define df_chain (df->problems_by_index[DF_CHAIN])
863 #define df_byte_lr (df->problems_by_index[DF_BYTE_LR]) 881 #define df_byte_lr (df->problems_by_index[DF_BYTE_LR])
864 #define df_note (df->problems_by_index[DF_NOTE]) 882 #define df_note (df->problems_by_index[DF_NOTE])
883 #define df_md (df->problems_by_index[DF_MD])
865 884
866 /* This symbol turns on checking that each modification of the cfg has 885 /* This symbol turns on checking that each modification of the cfg has
867 been identified to the appropriate df routines. It is not part of 886 been identified to the appropriate df routines. It is not part of
868 verification per se because the check that the final solution has 887 verification per se because the check that the final solution has
869 not changed covers this. However, if the solution is not being 888 not changed covers this. However, if the solution is not being
876 895
877 896
878 /* Functions defined in df-core.c. */ 897 /* Functions defined in df-core.c. */
879 898
880 extern void df_add_problem (struct df_problem *); 899 extern void df_add_problem (struct df_problem *);
881 extern enum df_changeable_flags df_set_flags (enum df_changeable_flags); 900 extern int df_set_flags (int);
882 extern enum df_changeable_flags df_clear_flags (enum df_changeable_flags); 901 extern int df_clear_flags (int);
883 extern void df_set_blocks (bitmap); 902 extern void df_set_blocks (bitmap);
884 extern void df_remove_problem (struct dataflow *); 903 extern void df_remove_problem (struct dataflow *);
885 extern void df_finish_pass (bool); 904 extern void df_finish_pass (bool);
886 extern void df_analyze_problem (struct dataflow *, bitmap, int *, int); 905 extern void df_analyze_problem (struct dataflow *, bitmap, int *, int);
887 extern void df_analyze (void); 906 extern void df_analyze (void);
937 extern bitmap df_get_live_out (basic_block); 956 extern bitmap df_get_live_out (basic_block);
938 extern void df_grow_bb_info (struct dataflow *); 957 extern void df_grow_bb_info (struct dataflow *);
939 extern void df_chain_dump (struct df_link *, FILE *); 958 extern void df_chain_dump (struct df_link *, FILE *);
940 extern void df_print_bb_index (basic_block bb, FILE *file); 959 extern void df_print_bb_index (basic_block bb, FILE *file);
941 extern void df_rd_add_problem (void); 960 extern void df_rd_add_problem (void);
961 extern void df_rd_simulate_artificial_defs_at_top (basic_block, bitmap);
962 extern void df_rd_simulate_one_insn (basic_block, rtx, bitmap);
942 extern void df_lr_add_problem (void); 963 extern void df_lr_add_problem (void);
943 extern void df_lr_verify_transfer_functions (void); 964 extern void df_lr_verify_transfer_functions (void);
944 extern void df_live_verify_transfer_functions (void); 965 extern void df_live_verify_transfer_functions (void);
945 extern void df_live_add_problem (void); 966 extern void df_live_add_problem (void);
946 extern void df_live_set_all_dirty (void); 967 extern void df_live_set_all_dirty (void);
947 extern void df_chain_add_problem (enum df_chain_flags); 968 extern void df_chain_add_problem (unsigned int);
948 extern void df_byte_lr_add_problem (void); 969 extern void df_byte_lr_add_problem (void);
949 extern int df_byte_lr_get_regno_start (unsigned int); 970 extern int df_byte_lr_get_regno_start (unsigned int);
950 extern int df_byte_lr_get_regno_len (unsigned int); 971 extern int df_byte_lr_get_regno_len (unsigned int);
951 extern void df_byte_lr_simulate_defs (rtx, bitmap); 972 extern void df_byte_lr_simulate_defs (rtx, bitmap);
952 extern void df_byte_lr_simulate_uses (rtx, bitmap); 973 extern void df_byte_lr_simulate_uses (rtx, bitmap);
953 extern void df_byte_lr_simulate_artificial_refs_at_top (basic_block, bitmap); 974 extern void df_byte_lr_simulate_artificial_refs_at_top (basic_block, bitmap);
954 extern void df_byte_lr_simulate_artificial_refs_at_end (basic_block, bitmap); 975 extern void df_byte_lr_simulate_artificial_refs_at_end (basic_block, bitmap);
955 extern void df_note_add_problem (void); 976 extern void df_note_add_problem (void);
977 extern void df_md_add_problem (void);
978 extern void df_md_simulate_artificial_defs_at_top (basic_block, bitmap);
979 extern void df_md_simulate_one_insn (basic_block, rtx, bitmap);
956 extern void df_simulate_find_defs (rtx, bitmap); 980 extern void df_simulate_find_defs (rtx, bitmap);
957 extern void df_simulate_defs (rtx, bitmap); 981 extern void df_simulate_defs (rtx, bitmap);
958 extern void df_simulate_uses (rtx, bitmap); 982 extern void df_simulate_uses (rtx, bitmap);
959 extern void df_simulate_initialize_backwards (basic_block, bitmap); 983 extern void df_simulate_initialize_backwards (basic_block, bitmap);
960 extern void df_simulate_one_insn_backwards (basic_block, rtx, bitmap); 984 extern void df_simulate_one_insn_backwards (basic_block, rtx, bitmap);
961 extern void df_simulate_finalize_backwards (basic_block, bitmap); 985 extern void df_simulate_finalize_backwards (basic_block, bitmap);
962 extern void df_simulate_initialize_forwards (basic_block, bitmap); 986 extern void df_simulate_initialize_forwards (basic_block, bitmap);
963 extern void df_simulate_one_insn_forwards (basic_block, rtx, bitmap); 987 extern void df_simulate_one_insn_forwards (basic_block, rtx, bitmap);
964 extern void df_simulate_finalize_forwards (basic_block, bitmap);
965 988
966 /* Functions defined in df-scan.c. */ 989 /* Functions defined in df-scan.c. */
967 990
968 extern void df_scan_alloc (bitmap); 991 extern void df_scan_alloc (bitmap);
969 extern void df_scan_add_problem (void); 992 extern void df_scan_add_problem (void);
970 extern void df_grow_reg_info (void); 993 extern void df_grow_reg_info (void);
971 extern void df_grow_insn_info (void); 994 extern void df_grow_insn_info (void);
972 extern void df_scan_blocks (void); 995 extern void df_scan_blocks (void);
973 extern df_ref df_ref_create (rtx, rtx *, rtx,basic_block, 996 extern df_ref df_ref_create (rtx, rtx *, rtx,basic_block,
974 enum df_ref_type, enum df_ref_flags, 997 enum df_ref_type, int ref_flags,
975 int, int, enum machine_mode); 998 int, int, enum machine_mode);
976 extern void df_ref_remove (df_ref); 999 extern void df_ref_remove (df_ref);
977 extern struct df_insn_info * df_insn_create_insn_record (rtx); 1000 extern struct df_insn_info * df_insn_create_insn_record (rtx);
978 extern void df_insn_delete (basic_block, unsigned int); 1001 extern void df_insn_delete (basic_block, unsigned int);
979 extern void df_bb_refs_record (int, bool); 1002 extern void df_bb_refs_record (int, bool);
980 extern bool df_insn_rescan (rtx); 1003 extern bool df_insn_rescan (rtx);
1004 extern bool df_insn_rescan_debug_internal (rtx);
981 extern void df_insn_rescan_all (void); 1005 extern void df_insn_rescan_all (void);
982 extern void df_process_deferred_rescans (void); 1006 extern void df_process_deferred_rescans (void);
983 extern void df_recompute_luids (basic_block); 1007 extern void df_recompute_luids (basic_block);
984 extern void df_insn_change_bb (rtx, basic_block); 1008 extern void df_insn_change_bb (rtx, basic_block);
985 extern void df_maybe_reorganize_use_refs (enum df_ref_order); 1009 extern void df_maybe_reorganize_use_refs (enum df_ref_order);
997 extern void df_compute_regs_ever_live (bool); 1021 extern void df_compute_regs_ever_live (bool);
998 extern bool df_read_modify_subreg_p (rtx); 1022 extern bool df_read_modify_subreg_p (rtx);
999 extern void df_scan_verify (void); 1023 extern void df_scan_verify (void);
1000 1024
1001 /* Functions defined in df-byte-scan.c. */ 1025 /* Functions defined in df-byte-scan.c. */
1002 extern bool df_compute_accessed_bytes (df_ref, enum df_mm, 1026 extern bool df_compute_accessed_bytes (df_ref, enum df_mm,
1003 unsigned int *, unsigned int *); 1027 unsigned int *, unsigned int *);
1004 1028
1005 1029
1006 /* Get basic block info. */ 1030 /* Get basic block info. */
1007 1031
1030 return (struct df_lr_bb_info *) df_lr->block_info[index]; 1054 return (struct df_lr_bb_info *) df_lr->block_info[index];
1031 else 1055 else
1032 return NULL; 1056 return NULL;
1033 } 1057 }
1034 1058
1059 static inline struct df_md_bb_info *
1060 df_md_get_bb_info (unsigned int index)
1061 {
1062 if (index < df_md->block_info_size)
1063 return (struct df_md_bb_info *) df_md->block_info[index];
1064 else
1065 return NULL;
1066 }
1067
1035 static inline struct df_live_bb_info * 1068 static inline struct df_live_bb_info *
1036 df_live_get_bb_info (unsigned int index) 1069 df_live_get_bb_info (unsigned int index)
1037 { 1070 {
1038 if (index < df_live->block_info_size) 1071 if (index < df_live->block_info_size)
1039 return (struct df_live_bb_info *) df_live->block_info[index]; 1072 return (struct df_live_bb_info *) df_live->block_info[index];