Re: How to find out register information at the beginning of a basic block?
On 05/31/2010 08:17 PM, H.J. Lu wrote: On Mon, May 31, 2010 at 12:31 PM, Vladimir Makarov wrote: H.J. Lu wrote: Hi, I am working on generating vzeroupper to avoid AVX->SSE transition penalty. I have generated vzeroupper on function return as well as function call. I am working on a backend pass to eliminate those vzeroupper instructions when I can prove that the upper 128bits of AVX registers are dead at the point where vzeroupper is added. To do that, I need to find out if a register is live at the beginning of a basic block as well as its size. I thought dataflow might give me such info. But I couldn't find a way to access such information. Does anyone have any pointers? DF_LR_IN (bb) returns bitmap of livings prseudo regnos. DF_LIVE_IN (bb) takes availability info into account. Size of hard registers is defined by hard_regno_nregs. My impression is hard_regno_nregs tells me that number of hard registers given machine mode occupy. It doesn't tell me the live size of a hard register at the beginning of a basic block. How do I get this information? If you mean what part of hard register lives, then as I know there is no such infrastructure code. As I remember Ken Zadeck tried to implement something analogous in the old RA. You could try to find this code in archives.
Re: How to find out register information at the beginning of a basic block?
On Mon, May 31, 2010 at 12:31 PM, Vladimir Makarov wrote: > H.J. Lu wrote: >> >> Hi, >> >> I am working on generating vzeroupper to avoid AVX->SSE transition >> penalty. >> >> I have generated vzeroupper on function return as well as function >> call. I am working on a backend pass to eliminate those vzeroupper >> instructions when I can prove that the upper 128bits of AVX registers >> are dead at the point where vzeroupper is added. To do that, I need >> to find out if a register is live at the beginning of a basic block as >> well >> as its size. I thought dataflow might give me such info. But I couldn't >> find a way to access such information. Does anyone have any pointers? >> >> > > DF_LR_IN (bb) returns bitmap of livings prseudo regnos. > DF_LIVE_IN (bb) takes availability info into account. > > Size of hard registers is defined by hard_regno_nregs. > My impression is hard_regno_nregs tells me that number of hard registers given machine mode occupy. It doesn't tell me the live size of a hard register at the beginning of a basic block. How do I get this information? Thanks. -- H.J.
Re: How to find out register information at the beginning of a basic block?
H.J. Lu wrote: On Mon, May 31, 2010 at 12:31 PM, Vladimir Makarov wrote: H.J. Lu wrote: Hi, I am working on generating vzeroupper to avoid AVX->SSE transition penalty. I have generated vzeroupper on function return as well as function call. I am working on a backend pass to eliminate those vzeroupper instructions when I can prove that the upper 128bits of AVX registers are dead at the point where vzeroupper is added. To do that, I need to find out if a register is live at the beginning of a basic block as well as its size. I thought dataflow might give me such info. But I couldn't find a way to access such information. Does anyone have any pointers? DF_LR_IN (bb) returns bitmap of livings prseudo regnos. DF_LIVE_IN (bb) takes availability info into account. Size of hard registers is defined by hard_regno_nregs. It is more complicated if you need the size of pseudo. The class of pseudo is necessary for this but even if you know this there are complicated situations, e.g. The new backend pass is run as the last pass and doesn't deal with pseudo registers. I have df_chain_add_problem (DF_UD_CHAIN + DF_DU_CHAIN); <<< Is this correct? I don't think you need all these chains (of course if you really need it). It is time consuming. I guess df_live_add_problem () will be enough.
Re: How to find out register information at the beginning of a basic block?
On Mon, May 31, 2010 at 12:31 PM, Vladimir Makarov wrote: > H.J. Lu wrote: >> >> Hi, >> >> I am working on generating vzeroupper to avoid AVX->SSE transition >> penalty. >> >> I have generated vzeroupper on function return as well as function >> call. I am working on a backend pass to eliminate those vzeroupper >> instructions when I can prove that the upper 128bits of AVX registers >> are dead at the point where vzeroupper is added. To do that, I need >> to find out if a register is live at the beginning of a basic block as >> well >> as its size. I thought dataflow might give me such info. But I couldn't >> find a way to access such information. Does anyone have any pointers? >> >> > > DF_LR_IN (bb) returns bitmap of livings prseudo regnos. > DF_LIVE_IN (bb) takes availability info into account. > > Size of hard registers is defined by hard_regno_nregs. > > It is more complicated if you need the size of pseudo. The class of pseudo > is necessary for this but even if you know this there are complicated > situations, e.g. The new backend pass is run as the last pass and doesn't deal with pseudo registers. I have df_chain_add_problem (DF_UD_CHAIN + DF_DU_CHAIN); <<< Is this correct? df_analyze (); FOR_EACH_BB (curr_block) { bool upper_128bits_live = false; bitmap live_in = DF_LIVE_IN (curr_block); ... } df_finish_pass (false); > on x86 pseudo of FLOAT_INT_REGS in DFmode cant take 2 general registers and > 1 float reg. > Thanks. -- H.J.
Re: How to find out register information at the beginning of a basic block?
H.J. Lu wrote: Hi, I am working on generating vzeroupper to avoid AVX->SSE transition penalty. I have generated vzeroupper on function return as well as function call. I am working on a backend pass to eliminate those vzeroupper instructions when I can prove that the upper 128bits of AVX registers are dead at the point where vzeroupper is added. To do that, I need to find out if a register is live at the beginning of a basic block as well as its size. I thought dataflow might give me such info. But I couldn't find a way to access such information. Does anyone have any pointers? DF_LR_IN (bb) returns bitmap of livings prseudo regnos. DF_LIVE_IN (bb) takes availability info into account. Size of hard registers is defined by hard_regno_nregs. It is more complicated if you need the size of pseudo. The class of pseudo is necessary for this but even if you know this there are complicated situations, e.g. on x86 pseudo of FLOAT_INT_REGS in DFmode cant take 2 general registers and 1 float reg. BTW, I have a PDF file to describe how vzeroupper is added. But the PDF attachment was rejected by the gcc mailing list. Please send me an email if you want it.