OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [df.h] - Blame information for rev 154

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
/* Form lists of pseudo register references for autoinc optimization
2
   for GNU compiler.  This is part of flow optimization.
3
   Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2006
4
   Free Software Foundation, Inc.
5
   Originally contributed by Michael P. Hayes
6
             (m.hayes@elec.canterbury.ac.nz, mhayes@redhat.com)
7
   Major rewrite contributed by Danny Berlin (dberlin@dberlin.org)
8
             and Kenneth Zadeck (zadeck@naturalbridge.com).
9
 
10
This file is part of GCC.
11
 
12
GCC is free software; you can redistribute it and/or modify it under
13
the terms of the GNU General Public License as published by the Free
14
Software Foundation; either version 3, or (at your option) any later
15
version.
16
 
17
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
18
WARRANTY; without even the implied warranty of MERCHANTABILITY or
19
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20
for more details.
21
 
22
You should have received a copy of the GNU General Public License
23
along with GCC; see the file COPYING3.  If not see
24
<http://www.gnu.org/licenses/>.  */
25
 
26
#ifndef GCC_DF_H
27
#define GCC_DF_H
28
 
29
#include "bitmap.h"
30
#include "basic-block.h"
31
#include "alloc-pool.h"
32
 
33
struct dataflow;
34
struct df;
35
struct df_problem;
36
struct df_link;
37
 
38
/* Data flow problems.  All problems must have a unique here.  */
39
/* Scanning is not really a dataflow problem, but it is useful to have
40
   the basic block functions in the vector so that things get done in
41
   a uniform manner.  */
42
#define DF_SCAN  0 
43
#define DF_RU    1      /* Reaching Uses. */
44
#define DF_RD    2      /* Reaching Defs. */
45
#define DF_LR    3      /* Live Registers. */
46
#define DF_UR    4      /* Uninitialized Registers. */
47
#define DF_UREC  5      /* Uninitialized Registers with Early Clobber. */
48
#define DF_CHAIN 6      /* Def-Use and/or Use-Def Chains. */
49
#define DF_RI    7      /* Register Info. */
50
#define DF_LAST_PROBLEM_PLUS1 (DF_RI + 1)
51
 
52
 
53
/* Dataflow direction.  */
54
enum df_flow_dir
55
  {
56
    DF_NONE,
57
    DF_FORWARD,
58
    DF_BACKWARD
59
  };
60
 
61
 
62
/* The first of these is a set of a register.  The remaining three are
63
   all uses of a register (the mem_load and mem_store relate to how
64
   the register as an addressing operand).  */
65
enum df_ref_type {DF_REF_REG_DEF, DF_REF_REG_USE, DF_REF_REG_MEM_LOAD,
66
                  DF_REF_REG_MEM_STORE};
67
 
68
#define DF_REF_TYPE_NAMES {"def", "use", "mem load", "mem store"}
69
 
70
enum df_ref_flags
71
  {
72
    /* Read-modify-write refs generate both a use and a def and
73
       these are marked with this flag to show that they are not
74
       independent.  */
75
    DF_REF_READ_WRITE = 1,
76
 
77
    /* This flag is set, if we stripped the subreg from the reference.
78
       In this case we must make conservative guesses, at what the
79
       outer mode was.  */
80
    DF_REF_STRIPPED = 2,
81
 
82
    /* If this flag is set, this is not a real definition/use, but an
83
       artificial one created to model always live registers, eh uses, etc.  */
84
    DF_REF_ARTIFICIAL = 4,
85
 
86
 
87
    /* If this flag is set for an artificial use or def, that ref
88
       logically happens at the top of the block.  If it is not set
89
       for an artificial use or def, that ref logically happens at the
90
       bottom of the block.  This is never set for regular refs.  */
91
    DF_REF_AT_TOP = 8,
92
 
93
    /* This flag is set if the use is inside a REG_EQUAL note.  */
94
    DF_REF_IN_NOTE = 16,
95
 
96
    /* This flag is set if this ref, generally a def, may clobber the
97
       referenced register.  This is generally only set for hard
98
       registers that cross a call site.  With better information
99
       about calls, some of these could be changed in the future to
100
       DF_REF_MUST_CLOBBER.  */
101
    DF_REF_MAY_CLOBBER = 32,
102
 
103
    /* This flag is set if this ref, generally a def, is a real
104
       clobber. This is not currently set for registers live across a
105
       call because that clobbering may or may not happen.
106
 
107
       Most of the uses of this are with sets that have a
108
       GET_CODE(..)==CLOBBER.  Note that this is set even if the
109
       clobber is to a subreg.  So in order to tell if the clobber
110
       wipes out the entire register, it is necessary to also check
111
       the DF_REF_PARTIAL flag.  */
112
    DF_REF_MUST_CLOBBER = 64,
113
 
114
    /* This bit is true if this ref is part of a multiword hardreg.  */
115
    DF_REF_MW_HARDREG = 128,
116
 
117
    /* This flag is set if this ref is a partial use or def of the
118
       associated register.  */
119
    DF_REF_PARTIAL = 256
120
  };
121
 
122
 
123
/* Function prototypes added to df_problem instance.  */
124
 
125
/* Allocate the problem specific data.  */
126
typedef void (*df_alloc_function) (struct dataflow *, bitmap, bitmap);
127
 
128
/* This function is called if the problem has global data that needs
129
   to be cleared when ever the set of blocks changes.  The bitmap
130
   contains the set of blocks that may require special attention.
131
   This call is only made if some of the blocks are going to change.
132
   If everything is to be deleted, the wholesale deletion mechanisms
133
   apply. */
134
typedef void (*df_reset_function) (struct dataflow *, bitmap);
135
 
136
/* Free the basic block info.  Called from the block reordering code
137
   to get rid of the blocks that have been squished down.   */
138
typedef void (*df_free_bb_function) (struct dataflow *, basic_block, void *);
139
 
140
/* Local compute function.  */
141
typedef void (*df_local_compute_function) (struct dataflow *, bitmap, bitmap);
142
 
143
/* Init the solution specific data.  */
144
typedef void (*df_init_function) (struct dataflow *, bitmap);
145
 
146
/* Iterative dataflow function.  */
147
typedef void (*df_dataflow_function) (struct dataflow *, bitmap, bitmap,
148
                                   int *, int, bool);
149
 
150
/* Confluence operator for blocks with 0 out (or in) edges.  */
151
typedef void (*df_confluence_function_0) (struct dataflow *, basic_block);
152
 
153
/* Confluence operator for blocks with 1 or more out (or in) edges.  */
154
typedef void (*df_confluence_function_n) (struct dataflow *, edge);
155
 
156
/* Transfer function for blocks.  */
157
typedef bool (*df_transfer_function) (struct dataflow *, int);
158
 
159
/* Function to massage the information after the problem solving.  */
160
typedef void (*df_finalizer_function) (struct dataflow*, bitmap);
161
 
162
/* Function to free all of the problem specific datastructures.  */
163
typedef void (*df_free_function) (struct dataflow *);
164
 
165
/* Function to dump results to FILE.  */
166
typedef void (*df_dump_problem_function) (struct dataflow *, FILE *);
167
 
168
/* Function to add problem a dataflow problem that must be solved
169
   before this problem can be solved.  */
170
typedef struct dataflow * (*df_dependent_problem_function) (struct df *, int);
171
 
172
/* The static description of a dataflow problem to solve.  See above
173
   typedefs for doc for the function fields.  */
174
 
175
struct df_problem {
176
  /* The unique id of the problem.  This is used it index into
177
     df->defined_problems to make accessing the problem data easy.  */
178
  unsigned int id;
179
  enum df_flow_dir dir;                 /* Dataflow direction.  */
180
  df_alloc_function alloc_fun;
181
  df_reset_function reset_fun;
182
  df_free_bb_function free_bb_fun;
183
  df_local_compute_function local_compute_fun;
184
  df_init_function init_fun;
185
  df_dataflow_function dataflow_fun;
186
  df_confluence_function_0 con_fun_0;
187
  df_confluence_function_n con_fun_n;
188
  df_transfer_function trans_fun;
189
  df_finalizer_function finalize_fun;
190
  df_free_function free_fun;
191
  df_dump_problem_function dump_fun;
192
  df_dependent_problem_function dependent_problem_fun;
193
 
194
  /* Flags can be changed after analysis starts.  */
195
  int changeable_flags;
196
};
197
 
198
 
199
/* The specific instance of the problem to solve.  */
200
struct dataflow
201
{
202
  struct df *df;                        /* Instance of df we are working in.  */
203
  struct df_problem *problem;           /* The problem to be solved.  */
204
 
205
  /* Communication between iterative_dataflow and hybrid_search. */
206
  sbitmap visited, pending, considered;
207
 
208
  /* Array indexed by bb->index, that contains basic block problem and
209
     solution specific information.  */
210
  void **block_info;
211
  unsigned int block_info_size;
212
 
213
  /* The pool to allocate the block_info from. */
214
  alloc_pool block_pool;
215
 
216
  /* Problem specific control information.  */
217
 
218
  /* Scanning flags.  */
219
#define DF_HARD_REGS         1  /* Mark hard registers.  */
220
#define DF_EQUIV_NOTES       2  /* Mark uses present in EQUIV/EQUAL notes.  */
221
#define DF_SUBREGS           4  /* Return subregs rather than the inner reg.  */
222
  /* Flags that control the building of chains.  */
223
#define DF_DU_CHAIN          1    /* Build DU chains.  */  
224
#define DF_UD_CHAIN          2    /* Build UD chains.  */
225
  /* Flag to control the building of register info.  */
226
#define DF_RI_LIFE           1    /* Build register info.  */
227
 
228
  int flags;
229
 
230
  /* Other problem specific data that is not on a per basic block
231
     basis.  The structure is generally defined privately for the
232
     problem.  The exception being the scanning problem where it is
233
     fully public.  */
234
  void *problem_data;
235
};
236
 
237
 
238
/* The set of multiword hardregs used as operands to this
239
   instruction. These are factored into individual uses and defs but
240
   the aggregate is still needed to service the REG_DEAD and
241
   REG_UNUSED notes.  */
242
struct df_mw_hardreg
243
{
244
  rtx mw_reg;                   /* The multiword hardreg.  */
245
  enum df_ref_type type;        /* Used to see if the ref is read or write.  */
246
  enum df_ref_flags flags;      /* Various flags.  */
247
  struct df_link *regs;         /* The individual regs that make up
248
                                   this hardreg.  */
249
  struct df_mw_hardreg *next;   /* The next mw_hardreg in this insn.  */
250
};
251
 
252
 
253
/* One of these structures is allocated for every insn.  */
254
struct df_insn_info
255
{
256
  struct df_ref *defs;          /* Head of insn-def chain.  */
257
  struct df_ref *uses;          /* Head of insn-use chain.  */
258
  struct df_mw_hardreg *mw_hardregs;
259
  /* ???? The following luid field should be considered private so that
260
     we can change it on the fly to accommodate new insns?  */
261
  int luid;                     /* Logical UID.  */
262
  bool contains_asm;            /* Contains an asm instruction.  */
263
};
264
 
265
 
266
/* Two of these structures are allocated for every pseudo reg, one for
267
   the uses and one for the defs.  */
268
struct df_reg_info
269
{
270
  struct df_ref *reg_chain;     /* Head of reg-use or def chain.  */
271
  unsigned int begin;           /* First def_index for this pseudo.  */
272
  unsigned int n_refs;          /* Number of refs or defs for this pseudo.  */
273
};
274
 
275
/* Define a register reference structure.  One of these is allocated
276
   for every register reference (use or def).  Note some register
277
   references (e.g., post_inc, subreg) generate both a def and a use.  */
278
struct df_ref
279
{
280
  rtx reg;                      /* The register referenced.  */
281
  unsigned int regno;           /* The register number referenced.  */
282
  basic_block bb;               /* Basic block containing the instruction. */
283
 
284
  /* Insn containing ref. This will be null if this is an artificial
285
     reference.  */
286
  rtx insn;
287
  rtx *loc;                     /* The location of the reg.  */
288
  struct df_link *chain;        /* Head of def-use, use-def.  */
289
  unsigned int id;              /* Location in table.  */
290
  enum df_ref_type type;        /* Type of ref.  */
291
  enum df_ref_flags flags;      /* Various flags.  */
292
 
293
  /* For each regno, there are two chains of refs, one for the uses
294
     and one for the defs.  These chains go thru the refs themselves
295
     rather than using an external structure.  */
296
  struct df_ref *next_reg;     /* Next ref with same regno and type.  */
297
  struct df_ref *prev_reg;     /* Prev ref with same regno and type.  */
298
 
299
  /* Each insn has two lists, one for the uses and one for the
300
     defs. This is the next field in either of these chains. */
301
  struct df_ref *next_ref;
302
  void *data;                   /* The data assigned to it by user.  */
303
};
304
 
305
/* These links are used for two purposes:
306
   1) def-use or use-def chains.
307
   2) Multiword hard registers that underly a single hardware register.  */
308
struct df_link
309
{
310
  struct df_ref *ref;
311
  struct df_link *next;
312
};
313
 
314
/* Two of these structures are allocated, one for the uses and one for
315
   the defs.  */
316
struct df_ref_info
317
{
318
  struct df_reg_info **regs;    /* Array indexed by pseudo regno. */
319
  unsigned int regs_size;       /* Size of currently allocated regs table.  */
320
  unsigned int regs_inited;     /* Number of regs with reg_infos allocated.  */
321
  struct df_ref **refs;         /* Ref table, indexed by id.  */
322
  unsigned int refs_size;       /* Size of currently allocated refs table.  */
323
  unsigned int bitmap_size;     /* Number of refs seen.  */
324
 
325
  /* True if refs table is organized so that every reference for a
326
     pseudo is contiguous.  */
327
  bool refs_organized;
328
  /* True if the next refs should be added immediately or false to
329
     defer to later to reorganize the table.  */
330
  bool add_refs_inline;
331
};
332
 
333
 
334
/*----------------------------------------------------------------------------
335
   Problem data for the scanning dataflow problem.  Unlike the other
336
   dataflow problems, the problem data for scanning is fully exposed and
337
   used by owners of the problem.
338
----------------------------------------------------------------------------*/
339
 
340
struct df
341
{
342
 
343
  /* The set of problems to be solved is stored in two arrays.  In
344
     PROBLEMS_IN_ORDER, the problems are stored in the order that they
345
     are solved.  This is an internally dense array that may have
346
     nulls at the end of it.  In PROBLEMS_BY_INDEX, the problem is
347
     stored by the value in df_problem.id.  These are used to access
348
     the problem local data without having to search the first
349
     array.  */
350
 
351
  struct dataflow *problems_in_order [DF_LAST_PROBLEM_PLUS1];
352
  struct dataflow *problems_by_index [DF_LAST_PROBLEM_PLUS1];
353
  int num_problems_defined;
354
 
355
  /* Set after calls to df_scan_blocks, this contains all of the
356
     blocks that higher level problems must rescan before solving the
357
     dataflow equations.  If this is NULL, the blocks_to_analyze is
358
     used. */
359
  bitmap blocks_to_scan;
360
 
361
  /* If not NULL, the subset of blocks of the program to be considered
362
     for analysis.  */
363
  bitmap blocks_to_analyze;
364
 
365
  /* The following information is really the problem data for the
366
     scanning instance but it is used too often by the other problems
367
     to keep getting it from there.  */
368
  struct df_ref_info def_info;   /* Def info.  */
369
  struct df_ref_info use_info;   /* Use info.  */
370
  struct df_insn_info **insns;   /* Insn table, indexed by insn UID.  */
371
  unsigned int insns_size;       /* Size of insn table.  */
372
  bitmap hardware_regs_used;     /* The set of hardware registers used.  */
373
  bitmap entry_block_defs;       /* The set of hardware registers live on entry to the function.  */
374
  bitmap exit_block_uses;        /* The set of hardware registers used in exit block.  */
375
};
376
 
377
#define DF_SCAN_BB_INFO(DF, BB) (df_scan_get_bb_info((DF)->problems_by_index[DF_SCAN],(BB)->index))
378
#define DF_RU_BB_INFO(DF, BB) (df_ru_get_bb_info((DF)->problems_by_index[DF_RU],(BB)->index))
379
#define DF_RD_BB_INFO(DF, BB) (df_rd_get_bb_info((DF)->problems_by_index[DF_RD],(BB)->index))
380
#define DF_LR_BB_INFO(DF, BB) (df_lr_get_bb_info((DF)->problems_by_index[DF_LR],(BB)->index))
381
#define DF_UR_BB_INFO(DF, BB) (df_ur_get_bb_info((DF)->problems_by_index[DF_UR],(BB)->index))
382
#define DF_UREC_BB_INFO(DF, BB) (df_urec_get_bb_info((DF)->problems_by_index[DF_UREC],(BB)->index))
383
 
384
/* Most transformations that wish to use live register analysis will
385
   use these macros.  The DF_UPWARD_LIVE* macros are only half of the
386
   solution.  */
387
#define DF_LIVE_IN(DF, BB) (DF_UR_BB_INFO(DF, BB)->in) 
388
#define DF_LIVE_OUT(DF, BB) (DF_UR_BB_INFO(DF, BB)->out) 
389
 
390
 
391
/* Live in for register allocation also takes into account several other factors.  */
392
#define DF_RA_LIVE_IN(DF, BB) (DF_UREC_BB_INFO(DF, BB)->in) 
393
#define DF_RA_LIVE_OUT(DF, BB) (DF_UREC_BB_INFO(DF, BB)->out) 
394
 
395
/* These macros are currently used by only reg-stack since it is not
396
   tolerant of uninitialized variables.  This intolerance should be
397
   fixed because it causes other problems.  */
398
#define DF_UPWARD_LIVE_IN(DF, BB) (DF_LR_BB_INFO(DF, BB)->in) 
399
#define DF_UPWARD_LIVE_OUT(DF, BB) (DF_LR_BB_INFO(DF, BB)->out) 
400
 
401
 
402
/* Macros to access the elements within the ref structure.  */
403
 
404
 
405
#define DF_REF_REAL_REG(REF) (GET_CODE ((REF)->reg) == SUBREG \
406
                                ? SUBREG_REG ((REF)->reg) : ((REF)->reg))
407
#define DF_REF_REGNO(REF) ((REF)->regno)
408
#define DF_REF_REAL_LOC(REF) (GET_CODE ((REF)->reg) == SUBREG \
409
                                ? &SUBREG_REG ((REF)->reg) : ((REF)->loc))
410
#define DF_REF_REG(REF) ((REF)->reg)
411
#define DF_REF_LOC(REF) ((REF)->loc)
412
#define DF_REF_BB(REF) ((REF)->bb)
413
#define DF_REF_BBNO(REF) (DF_REF_BB (REF)->index)
414
#define DF_REF_INSN(REF) ((REF)->insn)
415
#define DF_REF_INSN_UID(REF) (INSN_UID ((REF)->insn))
416
#define DF_REF_TYPE(REF) ((REF)->type)
417
#define DF_REF_CHAIN(REF) ((REF)->chain)
418
#define DF_REF_ID(REF) ((REF)->id)
419
#define DF_REF_FLAGS(REF) ((REF)->flags)
420
#define DF_REF_NEXT_REG(REF) ((REF)->next_reg)
421
#define DF_REF_PREV_REG(REF) ((REF)->prev_reg)
422
#define DF_REF_NEXT_REF(REF) ((REF)->next_ref)
423
#define DF_REF_DATA(REF) ((REF)->data)
424
 
425
/* Macros to determine the reference type.  */
426
 
427
#define DF_REF_REG_DEF_P(REF) (DF_REF_TYPE (REF) == DF_REF_REG_DEF)
428
#define DF_REF_REG_USE_P(REF) ((REF) && !DF_REF_REG_DEF_P (REF))
429
#define DF_REF_REG_MEM_STORE_P(REF) (DF_REF_TYPE (REF) == DF_REF_REG_MEM_STORE)
430
#define DF_REF_REG_MEM_LOAD_P(REF) (DF_REF_TYPE (REF) == DF_REF_REG_MEM_LOAD)
431
#define DF_REF_REG_MEM_P(REF) (DF_REF_REG_MEM_STORE_P (REF) \
432
                               || DF_REF_REG_MEM_LOAD_P (REF))
433
 
434
/* Macros to get the refs out of def_info or use_info refs table.  */
435
#define DF_DEFS_SIZE(DF) ((DF)->def_info.bitmap_size)
436
#define DF_DEFS_GET(DF,ID) ((DF)->def_info.refs[(ID)])
437
#define DF_DEFS_SET(DF,ID,VAL) ((DF)->def_info.refs[(ID)]=(VAL))
438
#define DF_USES_SIZE(DF) ((DF)->use_info.bitmap_size)
439
#define DF_USES_GET(DF,ID) ((DF)->use_info.refs[(ID)])
440
#define DF_USES_SET(DF,ID,VAL) ((DF)->use_info.refs[(ID)]=(VAL))
441
 
442
/* Macros to access the register information from scan dataflow record.  */
443
 
444
#define DF_REG_SIZE(DF) ((DF)->def_info.regs_inited)
445
#define DF_REG_DEF_GET(DF, REG) ((DF)->def_info.regs[(REG)])
446
#define DF_REG_DEF_SET(DF, REG, VAL) ((DF)->def_info.regs[(REG)]=(VAL))
447
#define DF_REG_DEF_COUNT(DF, REG) ((DF)->def_info.regs[(REG)]->n_refs)
448
#define DF_REG_USE_GET(DF, REG) ((DF)->use_info.regs[(REG)])
449
#define DF_REG_USE_SET(DF, REG, VAL) ((DF)->use_info.regs[(REG)]=(VAL))
450
#define DF_REG_USE_COUNT(DF, REG) ((DF)->use_info.regs[(REG)]->n_refs)
451
 
452
/* Macros to access the elements within the reg_info structure table.  */
453
 
454
#define DF_REGNO_FIRST_DEF(DF, REGNUM) \
455
(DF_REG_DEF_GET(DF, REGNUM) ? DF_REG_DEF_GET(DF, REGNUM) : 0)
456
#define DF_REGNO_LAST_USE(DF, REGNUM) \
457
(DF_REG_USE_GET(DF, REGNUM) ? DF_REG_USE_GET(DF, REGNUM) : 0)
458
 
459
/* Macros to access the elements within the insn_info structure table.  */
460
 
461
#define DF_INSN_SIZE(DF) ((DF)->insns_size)
462
#define DF_INSN_GET(DF,INSN) ((DF)->insns[(INSN_UID(INSN))])
463
#define DF_INSN_SET(DF,INSN,VAL) ((DF)->insns[(INSN_UID (INSN))]=(VAL))
464
#define DF_INSN_CONTAINS_ASM(DF, INSN) (DF_INSN_GET(DF,INSN)->contains_asm)
465
#define DF_INSN_LUID(DF, INSN) (DF_INSN_GET(DF,INSN)->luid)
466
#define DF_INSN_DEFS(DF, INSN) (DF_INSN_GET(DF,INSN)->defs)
467
#define DF_INSN_USES(DF, INSN) (DF_INSN_GET(DF,INSN)->uses)
468
 
469
#define DF_INSN_UID_GET(DF,UID) ((DF)->insns[(UID)])
470
#define DF_INSN_UID_LUID(DF, INSN) (DF_INSN_UID_GET(DF,INSN)->luid)
471
#define DF_INSN_UID_DEFS(DF, INSN) (DF_INSN_UID_GET(DF,INSN)->defs)
472
#define DF_INSN_UID_USES(DF, INSN) (DF_INSN_UID_GET(DF,INSN)->uses)
473
#define DF_INSN_UID_MWS(DF, INSN) (DF_INSN_UID_GET(DF,INSN)->mw_hardregs)
474
 
475
/* This is a bitmap copy of regs_invalidated_by_call so that we can
476
   easily add it into bitmaps, etc. */
477
 
478
extern bitmap df_invalidated_by_call;
479
 
480
 
481
/* One of these structures is allocated for every basic block.  */
482
struct df_scan_bb_info
483
{
484
  /* Defs at the start of a basic block that is the target of an
485
     exception edge.  */
486
  struct df_ref *artificial_defs;
487
 
488
  /* Uses of hard registers that are live at every block.  */
489
  struct df_ref *artificial_uses;
490
};
491
 
492
 
493
/* Reaching uses.  All bitmaps are indexed by the id field of the ref
494
   except sparse_kill (see below).  */
495
struct df_ru_bb_info
496
{
497
  /* Local sets to describe the basic blocks.  */
498
  /* The kill set is the set of uses that are killed in this block.
499
     However, if the number of uses for this register is greater than
500
     DF_SPARSE_THRESHOLD, the sparse_kill is used instead. In
501
     sparse_kill, each register gets a slot and a 1 in this bitvector
502
     means that all of the uses of that register are killed.  This is
503
     a very useful efficiency hack in that it keeps from having push
504
     around big groups of 1s.  This is implemented by the
505
     bitmap_clear_range call.  */
506
 
507
  bitmap kill;
508
  bitmap sparse_kill;
509
  bitmap gen;   /* The set of uses generated in this block.  */
510
 
511
  /* The results of the dataflow problem.  */
512
  bitmap in;    /* At the top of the block.  */
513
  bitmap out;   /* At the bottom of the block.  */
514
};
515
 
516
 
517
/* Reaching definitions.  All bitmaps are indexed by the id field of
518
   the ref except sparse_kill (see above).  */
519
struct df_rd_bb_info
520
{
521
  /* Local sets to describe the basic blocks.  See the note in the RU
522
     datastructures for kill and sparse_kill.  */
523
  bitmap kill;
524
  bitmap sparse_kill;
525
  bitmap gen;   /* The set of defs generated in this block.  */
526
 
527
  /* The results of the dataflow problem.  */
528
  bitmap in;    /* At the top of the block.  */
529
  bitmap out;   /* At the bottom of the block.  */
530
};
531
 
532
 
533
/* Live registers.  All bitmaps are referenced by the register number.  */
534
struct df_lr_bb_info
535
{
536
  /* Local sets to describe the basic blocks.  */
537
  bitmap def;   /* The set of registers set in this block.  */
538
  bitmap use;   /* The set of registers used in this block.  */
539
 
540
  /* The results of the dataflow problem.  */
541
  bitmap in;    /* At the top of the block.  */
542
  bitmap out;   /* At the bottom of the block.  */
543
};
544
 
545
 
546
/* Uninitialized registers.  All bitmaps are referenced by the register number.  */
547
struct df_ur_bb_info
548
{
549
  /* Local sets to describe the basic blocks.  */
550
  bitmap kill;  /* The set of registers unset in this block.  Calls,
551
                   for instance, unset registers.  */
552
  bitmap gen;   /* The set of registers set in this block.  */
553
 
554
  /* The results of the dataflow problem.  */
555
  bitmap in;    /* At the top of the block.  */
556
  bitmap out;   /* At the bottom of the block.  */
557
};
558
 
559
/* Uninitialized registers.  All bitmaps are referenced by the register number.  */
560
struct df_urec_bb_info
561
{
562
  /* Local sets to describe the basic blocks.  */
563
  bitmap earlyclobber;  /* The set of registers that are referenced
564
                           with an an early clobber mode.  */
565
  /* Kill and gen are defined as in the UR problem.  */
566
  bitmap kill;
567
  bitmap gen;
568
 
569
  /* The results of the dataflow problem.  */
570
  bitmap in;    /* At the top of the block.  */
571
  bitmap out;   /* At the bottom of the block.  */
572
};
573
 
574
 
575
#define df_finish(df) {df_finish1(df); df=NULL;}
576
 
577
/* Functions defined in df-core.c.  */
578
 
579
extern struct df *df_init (int);
580
extern struct dataflow *df_add_problem (struct df *, struct df_problem *, int);
581
extern int df_set_flags (struct dataflow *, int);
582
extern int df_clear_flags (struct dataflow *, int);
583
extern void df_set_blocks (struct df*, bitmap);
584
extern void df_delete_basic_block (struct df *, int);
585
extern void df_finish1 (struct df *);
586
extern void df_analyze_problem (struct dataflow *, bitmap, bitmap, bitmap, int *, int, bool);
587
extern void df_analyze (struct df *);
588
extern void df_compact_blocks (struct df *);
589
extern void df_bb_replace (struct df *, int, basic_block);
590
extern struct df_ref *df_bb_regno_last_use_find (struct df *, basic_block, unsigned int);
591
extern struct df_ref *df_bb_regno_first_def_find (struct df *, basic_block, unsigned int);
592
extern struct df_ref *df_bb_regno_last_def_find (struct df *, basic_block, unsigned int);
593
extern bool df_insn_regno_def_p (struct df *, rtx, unsigned int);
594
extern struct df_ref *df_find_def (struct df *, rtx, rtx);
595
extern bool df_reg_defined (struct df *, rtx, rtx);
596
extern struct df_ref *df_find_use (struct df *, rtx, rtx);
597
extern bool df_reg_used (struct df *, rtx, rtx);
598
extern void df_iterative_dataflow (struct dataflow *, bitmap, bitmap, int *, int, bool);
599
extern void df_dump (struct df *, FILE *);
600
extern void df_refs_chain_dump (struct df_ref *, bool, FILE *);
601
extern void df_regs_chain_dump (struct df *, struct df_ref *,  FILE *);
602
extern void df_insn_debug (struct df *, rtx, bool, FILE *);
603
extern void df_insn_debug_regno (struct df *, rtx, FILE *);
604
extern void df_regno_debug (struct df *, unsigned int, FILE *);
605
extern void df_ref_debug (struct df_ref *, FILE *);
606
extern void debug_df_insn (rtx);
607
extern void debug_df_regno (unsigned int);
608
extern void debug_df_reg (rtx);
609
extern void debug_df_defno (unsigned int);
610
extern void debug_df_useno (unsigned int);
611
extern void debug_df_ref (struct df_ref *);
612
extern void debug_df_chain (struct df_link *);
613
/* An instance of df that can be shared between passes.  */
614
extern struct df *shared_df;
615
 
616
 
617
/* Functions defined in df-problems.c. */
618
 
619
extern struct df_link *df_chain_create (struct dataflow *, struct df_ref *, struct df_ref *);
620
extern void df_chain_unlink (struct dataflow *, struct df_ref *, struct df_link *);
621
extern void df_chain_copy (struct dataflow *, struct df_ref *, struct df_link *);
622
extern bitmap df_get_live_in (struct df *, basic_block);
623
extern bitmap df_get_live_out (struct df *, basic_block);
624
extern void df_grow_bb_info (struct dataflow *);
625
extern void df_chain_dump (struct df_link *, FILE *);
626
extern void df_print_bb_index (basic_block bb, FILE *file);
627
extern struct dataflow *df_ru_add_problem (struct df *, int);
628
extern struct df_ru_bb_info *df_ru_get_bb_info (struct dataflow *, unsigned int);
629
extern struct dataflow *df_rd_add_problem (struct df *, int);
630
extern struct df_rd_bb_info *df_rd_get_bb_info (struct dataflow *, unsigned int);
631
extern struct dataflow *df_lr_add_problem (struct df *, int);
632
extern struct df_lr_bb_info *df_lr_get_bb_info (struct dataflow *, unsigned int);
633
extern struct dataflow *df_ur_add_problem (struct df *, int);
634
extern struct df_ur_bb_info *df_ur_get_bb_info (struct dataflow *, unsigned int);
635
extern struct dataflow *df_urec_add_problem (struct df *, int);
636
extern struct df_urec_bb_info *df_urec_get_bb_info (struct dataflow *, unsigned int);
637
extern struct dataflow *df_chain_add_problem (struct df *, int);
638
extern struct dataflow *df_ri_add_problem (struct df *, int);
639
 
640
 
641
/* Functions defined in df-scan.c.  */
642
 
643
extern struct df_scan_bb_info *df_scan_get_bb_info (struct dataflow *, unsigned int);
644
extern struct dataflow *df_scan_add_problem (struct df *, int);
645
extern void df_rescan_blocks (struct df *, bitmap);
646
extern struct df_ref *df_ref_create (struct df *, rtx, rtx *, rtx,basic_block,enum df_ref_type, enum df_ref_flags);
647
extern struct df_ref *df_get_artificial_defs (struct df *, unsigned int);
648
extern struct df_ref *df_get_artificial_uses (struct df *, unsigned int);
649
extern void df_reg_chain_create (struct df_reg_info *, struct df_ref *);
650
extern struct df_ref *df_reg_chain_unlink (struct dataflow *, struct df_ref *);
651
extern void df_ref_remove (struct df *, struct df_ref *);
652
extern void df_insn_refs_delete (struct dataflow *, rtx);
653
extern void df_bb_refs_delete (struct dataflow *, int);
654
extern void df_refs_delete (struct dataflow *, bitmap);
655
extern void df_reorganize_refs (struct df_ref_info *);
656
extern void df_hard_reg_init (void);
657
extern bool df_read_modify_subreg_p (rtx);
658
 
659
 
660
/* web */
661
 
662
/* This entry is allocated for each reference in the insn stream.  */
663
struct web_entry
664
{
665
  /* Pointer to the parent in the union/find tree.  */
666
  struct web_entry *pred;
667
  /* Newly assigned register to the entry.  Set only for roots.  */
668
  rtx reg;
669
  void* extra_info;
670
};
671
 
672
extern struct web_entry *unionfind_root (struct web_entry *);
673
extern bool unionfind_union (struct web_entry *, struct web_entry *);
674
extern void union_defs (struct df *, struct df_ref *,
675
                        struct web_entry *, struct web_entry *,
676
                        bool (*fun) (struct web_entry *, struct web_entry *));
677
 
678
 
679
#endif /* GCC_DF_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.