public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Doubt about Pseudo register uses.
@ 2005-08-01  9:59 Chunjiang Li
  2005-08-01 11:56 ` Ian Lance Taylor
  0 siblings, 1 reply; 3+ messages in thread
From: Chunjiang Li @ 2005-08-01  9:59 UTC (permalink / raw)
  To: gcc

Hi, all,

When I read the GCC source code about register allocation,
I wonder is it true that one Pseudo  register is only corresponding to one basic block?
the reg_info struct is:

typedef struct reg_info_def
{				/* fields set by reg_scan */
  int first_uid;		/* UID of first insn to use (REG n) */
  int last_uid;			/* UID of last insn to use (REG n) */

				/* fields set by reg_scan & flow_analysis */
  int sets;			/* # of times (REG n) is set */

				/* fields set by flow_analysis */
  int refs;			/* # of times (REG n) is used or set */
  int freq;			/* # estimated frequency (REG n) is used or set */
  int deaths;			/* # of times (REG n) dies */
  int live_length;		/* # of instructions (REG n) is live */
  int calls_crossed;		/* # of calls (REG n) is live across */
  int basic_block;		/* # of basic blocks (REG n) is used in */
} reg_info;

It seems that one Pseudo register is only used in one basic block.
But I am not sure.
Please help me.


Creative Compiler Research Group,
National University of Defense Technology, China.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Doubt about Pseudo register uses.
  2005-08-01  9:59 Doubt about Pseudo register uses Chunjiang Li
@ 2005-08-01 11:56 ` Ian Lance Taylor
  2005-08-01 14:30   ` Chunjiang Li
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Lance Taylor @ 2005-08-01 11:56 UTC (permalink / raw)
  To: Chunjiang Li; +Cc: gcc

Chunjiang Li <chunjiang@nudt.edu.cn> writes:

> I wonder is it true that one Pseudo  register is only corresponding to one basic block?

No, it isn't.

> the reg_info struct is:
> 
> typedef struct reg_info_def
> {				/* fields set by reg_scan */
>   int first_uid;		/* UID of first insn to use (REG n) */
>   int last_uid;			/* UID of last insn to use (REG n) */
> 
> 				/* fields set by reg_scan & flow_analysis */
>   int sets;			/* # of times (REG n) is set */
> 
> 				/* fields set by flow_analysis */
>   int refs;			/* # of times (REG n) is used or set */
>   int freq;			/* # estimated frequency (REG n) is used or set */
>   int deaths;			/* # of times (REG n) dies */
>   int live_length;		/* # of instructions (REG n) is live */
>   int calls_crossed;		/* # of calls (REG n) is live across */
>   int basic_block;		/* # of basic blocks (REG n) is used in */
> } reg_info;
> 
> It seems that one Pseudo register is only used in one basic block.

If the register is used in more than one basic block, the basic_block
field is set to REG_BLOCK_GLOBAL.  See REG_BASIC_BLOCK in
basic-block.h and flow.c.

Ian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Doubt about Pseudo register uses.
  2005-08-01 11:56 ` Ian Lance Taylor
@ 2005-08-01 14:30   ` Chunjiang Li
  0 siblings, 0 replies; 3+ messages in thread
From: Chunjiang Li @ 2005-08-01 14:30 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc

Thx.
I also guessed that.
But, for I am a rookie in GCC, I know little about GCC, need advice.

 Ian Lance Taylor <ian@airs.com>:

> Chunjiang Li <chunjiang@nudt.edu.cn> writes:
>
> > I wonder is it true that one Pseudo  register is only corresponding to one
>  basic block?
>
> No, it isn't.
>
> > the reg_info struct is:
> >
> > typedef struct reg_info_def
> > {				/* fields set by reg_scan */
> >   int first_uid;		/* UID of first insn to use (REG n) */
> >   int last_uid;			/* UID of last insn to use (REG n) */
> >
> > 				/* fields set by reg_scan & flow_analysis */
> >   int sets;			/* # of times (REG n) is set */
> >
> > 				/* fields set by flow_analysis */
> >   int refs;			/* # of times (REG n) is used or set */
> >   int freq;			/* # estimated frequency (REG n) is used or set */
> >   int deaths;			/* # of times (REG n) dies */
> >   int live_length;		/* # of instructions (REG n) is live */
> >   int calls_crossed;		/* # of calls (REG n) is live across */
> >   int basic_block;		/* # of basic blocks (REG n) is used in */
> > } reg_info;
> >
> > It seems that one Pseudo register is only used in one basic block.
>
> If the register is used in more than one basic block, the basic_block
> field is set to REG_BLOCK_GLOBAL.  See REG_BASIC_BLOCK in
> basic-block.h and flow.c.
>
> Ian
> 



Creative Compiler Research Group,
National University of Defense Technology, China.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-08-01 14:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-01  9:59 Doubt about Pseudo register uses Chunjiang Li
2005-08-01 11:56 ` Ian Lance Taylor
2005-08-01 14:30   ` Chunjiang Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).