cgraph callees availability

2011-07-01 Thread Paulo J. Matos

Hi,

In TARGET_FUNCTION_OK_FOR_SIBCALL I use the number of callees of the 
current_function_decl to decide if a sibcall should be done.


I have:
int aaa[9];

__attribute__ ((noinline))
int *foo(void) { return aaa; }

__attribute__ ((noinline))
void bar(int *a) { a[0] = 0x1234; }

void test(void)
{
int *x;
x = foo();
x[8] = 1;
bar(x);
}


I then use this code in TARGET_FUNCTION_OK_FOR_SIBCALL:

node = cgraph_get_node(current_function_decl);
if(node == NULL)
return false;

for(edge = node->callees; edge; edge = edge->next_callee)
if(++ncallees > 1)
return false;

return true;

In GCC4.4 function test presents 2 callees foo() and bar() and the 
sibcall is not done. In GCC4.5 the sibcall is done (but shouldn't) 
because callees in cgraph is 0x0. I wonder if this information is not 
available anymore at this point and if there's something I can do about it.


Cheers,
--
Paulo Matos



Re: cgraph callees availability

2011-07-01 Thread Paulo J. Matos



On 01/07/11 09:38, Paulo J. Matos wrote:


In GCC4.4 function test presents 2 callees foo() and bar() and the
sibcall is not done. In GCC4.5 the sibcall is done (but shouldn't)
because callees in cgraph is 0x0. I wonder if this information is not
available anymore at this point and if there's something I can do about it.



After some digging around I noticed GCC4.5 introduces:
NEXT_PASS (pass_remove_cgraph_callee_edges);

I am wondering why this is being done. Are we just freeing resources or 
is there any other reason? Is there any other way to find callees 
without this information?


Cheers,

--
PMatos



Re: cgraph callees availability

2011-07-01 Thread Richard Guenther
On Fri, Jul 1, 2011 at 11:10 AM, Paulo J. Matos  wrote:
>
>
> On 01/07/11 09:38, Paulo J. Matos wrote:
>
>> In GCC4.4 function test presents 2 callees foo() and bar() and the
>> sibcall is not done. In GCC4.5 the sibcall is done (but shouldn't)
>> because callees in cgraph is 0x0. I wonder if this information is not
>> available anymore at this point and if there's something I can do about
>> it.
>>
>
> After some digging around I noticed GCC4.5 introduces:
> NEXT_PASS (pass_remove_cgraph_callee_edges);
>
> I am wondering why this is being done. Are we just freeing resources or is
> there any other reason? Is there any other way to find callees without this
> information?

It is being done because the edges are not kept up-to-date.  There is
no other way to find callees but to walk all statements.  I also do not
see a good reason why you would want to use the number of callees
of a function to decide whether to emit sibcalls from it.

Richard.

> Cheers,
>
> --
> PMatos
>
>


Re: cgraph callees availability

2011-07-01 Thread Paulo J. Matos

On 01/07/11 10:31, Richard Guenther wrote:


It is being done because the edges are not kept up-to-date.  There is
no other way to find callees but to walk all statements.  I also do not
see a good reason why you would want to use the number of callees
of a function to decide whether to emit sibcalls from it.



Thanks for the input Richard. Makes sense. One way which seems to work 
is to obviously add a pass to rebuild the cgraph edges before 
pass_expand and remove them afterwards.


The reason why I need them is that I need know if a given register is 
live. I can check this when I expand_epilogue but not during expand 
(because RA has not been done). This special register is used for the 
return address of a function. So, if it is live it tells me that there 
was another function call besides the sibcall. If there was, it means I 
have to emit some extra instructions to do the sibcall. However, if I 
have to emit extra instructions then I don't actually want to do the 
sibcall cause I will be adding to the resulting size of the function 
which goes against our backend port policy.


By checking if there is more than 1 callee (an extra function called 
besides the sibcall) then I will know if I will need extra instructions 
or not and if I do, I say the function is _not_ ok for sibcall.


I guess if I don't want to add the extra passes before and after pass 
expand then I have to walk the statements. Sounds like it's the cleaner 
solution if I don't want to mess with the core.


Cheers,
--
PMatos



Re: cgraph callees availability

2011-07-01 Thread Richard Guenther
On Fri, Jul 1, 2011 at 11:41 AM, Paulo J. Matos  wrote:
> On 01/07/11 10:31, Richard Guenther wrote:
>>
>> It is being done because the edges are not kept up-to-date.  There is
>> no other way to find callees but to walk all statements.  I also do not
>> see a good reason why you would want to use the number of callees
>> of a function to decide whether to emit sibcalls from it.
>>
>
> Thanks for the input Richard. Makes sense. One way which seems to work is to
> obviously add a pass to rebuild the cgraph edges before pass_expand and
> remove them afterwards.
>
> The reason why I need them is that I need know if a given register is live.
> I can check this when I expand_epilogue but not during expand (because RA
> has not been done). This special register is used for the return address of
> a function. So, if it is live it tells me that there was another function
> call besides the sibcall. If there was, it means I have to emit some extra
> instructions to do the sibcall. However, if I have to emit extra
> instructions then I don't actually want to do the sibcall cause I will be
> adding to the resulting size of the function which goes against our backend
> port policy.
>
> By checking if there is more than 1 callee (an extra function called besides
> the sibcall) then I will know if I will need extra instructions or not and
> if I do, I say the function is _not_ ok for sibcall.
>
> I guess if I don't want to add the extra passes before and after pass expand
> then I have to walk the statements. Sounds like it's the cleaner solution if
> I don't want to mess with the core.

You could add this logic to the tree-tailcall.c pass.  I suppose what you
really want is no dominating call rather than only a single call in total.

Richard.

> Cheers,
> --
> PMatos
>
>


Re: cgraph callees availability

2011-07-01 Thread Paulo J. Matos

On 01/07/11 10:46, Richard Guenther wrote:


You could add this logic to the tree-tailcall.c pass.  I suppose what you
really want is no dominating call rather than only a single call in total.



Yes, that's true. I am currently porting the backend to 4.6.1 so I might 
do the changes in tree-tailcall on that version and leave the extra 
passes around expand in GCC 4.5.3 for now since our 4.5 is really just a 
bridge for our users to upgrade from our older 4.2/4.3 ports.




Re: RFC: [GUPC] UPC-related changes

2011-07-01 Thread Gary Funck
This email is a follow-up to an email with a similar title
(posted a year ago).  During that time period, we have worked
on making the changes suggested by Joseph Myers, Tom Tromey,
and other reviewers.  We have also implemented various bug fixes
and improvements.

Our goal with this RFC is to acquaint the reviewers with UPC and
the impact of UPC changes on the GCC front-end, and to gain consensus
that the changes are acceptable for incorporation into the GCC trunk.

Once we make further suggested changes, and have a consensus on this
batch of changes, I will send out RFC's for the "middle end"
(the lowering pass), "debugging" (UPC-specific DWARF extensions),
"runtime" (libupc) and "testing" RFC's.  Those additional RFC's
are likely to be more modular and will have less impact on
the GCC infrastructure.

The email describing the UPC-related front-end and
infrastructure changes was posted to the gcc-patches mailing list:
http://gcc.gnu.org/ml/gcc-patches/2011-07/msg00081.html

Thanks,
- Gary


Validity of __asm__ transformation with "m" reference

2011-07-01 Thread Martin Thuresson
In recent versions of GCC I have seen a transformation of inline
assembly that I'd like to confirm is valid.

The code in question can be found in mplayer/mp3lib/dct64_sse.c

  "movaps%0, %%xmm0\n\t"
  "shufps$27, %%xmm0, %%xmm0\n\t"
  "movaps%1, %%xmm5\n\t"
  "movaps%%xmm5, %%xmm6\n\t"
  :
  :"m"(*costab), "m"(*)

where  is
 static const int [4] __attribute__((aligned(16))) = { 1 << 31, 1
<< 31, 1 << 31, 1 << 31 };

GCC turns this into:
 "movaps%0, %%xmm0
  shufps$27, %%xmm0, %%xmm0
  movaps%1, %%xmm5
  movaps%%xmm5, %%xmm6
  " :  : "m" costab_mmx[24], *"m" -2147483648*);

The new constant might end up in an unaligned address causing the
program to segfault on Intel platforms.

Marking  volatile or changing the code to the following avoids the
transformation:

 __asm__(
"movaps%a0, %%xmm0\n\t"
"shufps$27, %%xmm0, %%xmm0\n\t"
"movaps%a1, %%xmm5\n\t"
"movaps%%xmm5, %%xmm6\n\t"
:
:"p"(costab), "p"()
   );

Thanks!
Martin


Re: viewcvs: Python error

2011-07-01 Thread Georg-Johann Lay

Ian Lance Taylor schrieb:

Vincent Legoll writes:


This may be the changeset that broke pygments running on older
pythons (< 2.4):

https://bitbucket.org/birkenfeld/pygments-main/changeset/8d3fbbf1ffdb


Thanks for identifying the patch.  I applied the reverse patch manually
to gcc.gnu.org, and the problem appears to be fixed, at least for now.

Ian


Hi, thanks for the fix, but it appears the revert changed bit too much. 
This issue has returned:


http://gcc.gnu.org/ml/gcc/2011-04/msg00336.html

Johann



Re: Validity of __asm__ transformation with "m" reference

2011-07-01 Thread Jakub Jelinek
On Fri, Jul 01, 2011 at 11:45:16AM -0700, Martin Thuresson wrote:
> In recent versions of GCC I have seen a transformation of inline
> assembly that I'd like to confirm is valid.
> 
> The code in question can be found in mplayer/mp3lib/dct64_sse.c
> 
>   "movaps%0, %%xmm0\n\t"
>   "shufps$27, %%xmm0, %%xmm0\n\t"
>   "movaps%1, %%xmm5\n\t"
>   "movaps%%xmm5, %%xmm6\n\t"
>   :
>   :"m"(*costab), "m"(*)
> 
> where  is
>  static const int [4] __attribute__((aligned(16))) = { 1 << 31, 1
> << 31, 1 << 31, 1 << 31 };
> 
> GCC turns this into:
>  "movaps%0, %%xmm0
>   shufps$27, %%xmm0, %%xmm0
>   movaps%1, %%xmm5
>   movaps%%xmm5, %%xmm6
>   " :  : "m" costab_mmx[24], *"m" -2147483648*);
> 
> The new constant might end up in an unaligned address causing the
> program to segfault on Intel platforms.

But you said the operand is an int sized memory, while you expect
4 times as big data with different alignment.
So you want "m"(*(__m128d *))  (or "m"(*(__m128i *)) ).

Your "fixed" version with "p" is not correct either, because
you don't say to gcc that it reads the value from that memory address, e.g.
if there is
int foo (void)
{
  int p, q;
  p = 5;
  asm ("movl %a1, %0" : "=r" (q) : "p" (&p));
  return q;
}
gcc might very well eliminate the p = 5; store.

Jakub


Re: Validity of __asm__ transformation with "m" reference

2011-07-01 Thread Martin Thuresson
Jacub,

On Fri, Jul 1, 2011 at 12:04 PM, Jakub Jelinek  wrote:
> On Fri, Jul 01, 2011 at 11:45:16AM -0700, Martin Thuresson wrote:
>> In recent versions of GCC I have seen a transformation of inline
>> assembly that I'd like to confirm is valid.
>>
>> The code in question can be found in mplayer/mp3lib/dct64_sse.c
>>
>>           "movaps    %0, %%xmm0\n\t"
>>           "shufps    $27, %%xmm0, %%xmm0\n\t"
>>           "movaps    %1, %%xmm5\n\t"
>>           "movaps    %%xmm5, %%xmm6\n\t"
>>           :
>>           :"m"(*costab), "m"(*)
>>
>> where  is
>>  static const int [4] __attribute__((aligned(16))) = { 1 << 31, 1
>> << 31, 1 << 31, 1 << 31 };
>>
>> GCC turns this into:
>>      "movaps    %0, %%xmm0
>>       shufps    $27, %%xmm0, %%xmm0
>>       movaps    %1, %%xmm5
>>       movaps    %%xmm5, %%xmm6
>>       " :  : "m" costab_mmx[24], *"m" -2147483648*);
>>
>> The new constant might end up in an unaligned address causing the
>> program to segfault on Intel platforms.
>
> But you said the operand is an int sized memory, while you expect
> 4 times as big data with different alignment.
> So you want "m"(*(__m128d *))  (or "m"(*(__m128i *)) ).

Ah, thanks. Glad to hear it was a source bug and not a compiler bug. I just
verified that the solution you proposed worked in my example.

>
> Your "fixed" version with "p" is not correct either, because
> you don't say to gcc that it reads the value from that memory address, e.g.
> if there is
> int foo (void)
> {
>  int p, q;
>  p = 5;
>  asm ("movl %a1, %0" : "=r" (q) : "p" (&p));
>  return q;
> }
> gcc might very well eliminate the p = 5; store.

OK, thanks for the example.

Thanks,
Martin

>
>        Jakub
>


Re: viewcvs: Python error

2011-07-01 Thread Ian Lance Taylor
> Ian Lance Taylor schrieb:
>
>> Thanks for identifying the patch.  I applied the reverse patch manually
>> to gcc.gnu.org, and the problem appears to be fixed, at least for now.
>>
>> Ian
>
> Hi, thanks for the fix, but it appears the revert changed bit too
> much. This issue has returned:
>
> http://gcc.gnu.org/ml/gcc/2011-04/msg00336.html

Thanks.  Fixed again.

(That happened when I updated the viewvc package, it wasn't due to the
change I made.)

Ian


gcc-4.6-20110701 is now available

2011-07-01 Thread gccadmin
Snapshot gcc-4.6-20110701 is now available on
  ftp://gcc.gnu.org/pub/gcc/snapshots/4.6-20110701/
and on various mirrors, see http://gcc.gnu.org/mirrors.html for details.

This snapshot has been generated from the GCC 4.6 SVN branch
with the following options: svn://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch 
revision 175771

You'll find:

 gcc-4.6-20110701.tar.bz2 Complete GCC

  MD5=6cdff36e33b3f8684830aa1f30130e51
  SHA1=6bb0ff2e1c4ec6a3d3d0380ebb1cecbbe70cbb63

Diffs from 4.6-20110624 are available in the diffs/ subdirectory.

When a particular snapshot is ready for public consumption the LATEST-4.6
link is updated and a message is sent to the gcc list.  Please do not use
a snapshot before it has been announced that way.


[rs6000] -mno-sched-prolog vs .debug_frame

2011-07-01 Thread Richard Henderson
The implementation of TARGET_SCHED_PROLOG is incompatible with
some coming changes to how dwarf2 cfi is to be generated.

Some suggested solutions are:

 (1) Remove the option.  Is it really that interesting
 beyond -mno-sched-insns2?

 (2) Emit blockage insns at the end of the prologue
 and the beginning of the epilogue.  That'll prevent
 the majority of the changes that scheduling could
 introduce.

 (3) Emit the prologue and epilogue somewhere after
 scheduling and before final.  E.g. md_reorg.

I'd be delighted if someone could actually implement one
of these changes at some point in the next week, but 
failing that please weigh in on the preferred solution.


r~


Du Toan G8, Phan mem du toan cong trinh uu viet nhat hien nay!

2011-07-01 Thread Du Toan G8
Công Ty Cổ phần Đầu Tư Tư Vấn Xây Dựng AN VIỆT xin trân 
trọng giới thiệu phần mềm Dự toán - Dự thầu G8 ,hiện là 
một trong những sản phẩm chiến lược của chúng tôi. 
Phần mềm Dự toán – Dự thầu G8 hiện nay đã được tin dùng 
ở hàng trăm Công ty, Các sở, ban ngành, cá nhân với số lượng 
người dùng lên tới hàng ngàn người, Không dừng lại hay tự 
thỏa mãn là tôn chỉ hành động của chúng tôi. Chính những chia 
sẻ, đóng góp vô cùng quý báu của quý vị là động lực để 
chúng tôi lao động sáng tạo không ngừng nghỉ sao cho phần mềm 
Dự toán – Dự thầu G8 trở nên thân thiện nhất, chính xác, 
mạnh mẽ nhất xứng đáng kỳ vọng của quý vị, quý khách hàng 
đã dành cho chúng tôi thời gian qua.
Với các tình năng nổi bật như:
Lập dự toán, thanh quyết toán, đấu thầu các công trình Xây 
dựng, Giao thông, Thuỷ lợi, Thủy điện, Viễn thông, Trạm biến 
áp, Đường dây tải điện, Chuyên ngành điện…. 
•  Cập nhật đơn giá năm 2008/2009, sử dụng định mức 
1776/1777/1778/1779 và tất cả các định mức ban hành trước đó. 
• Cập nhật đầy đủ quyết định 957/QĐ-BXD ngày 29/09/2009 
của Bộ Xây Dựng về định mức chi phí quản lý dự án và tư 
vấn đầu tư xây dựng công trình hay Nghị Định 99/2007/NĐ-CP 
về quản lý chi phí đầu  tư xây dựng công trình, theo Thông tư 
Số 05/2007/TT-BXD, thông tư 18/2008/TT-BXD và thông tư 04/2010/TT-BXD, 
tính Đơn giá Ca máy theo Thông tư 06/2010 Ngay 26-05-2010.
• Giao diện thân thiện giống phần mềm Microsoft Excel. 
• Có nhiều cách chiết tính, dự thầu phục vụ cho việc 
làm thầu của doanh nghiệp. 
• Có khả năng xuất sang Microsoft Excel với đầy đủ công 
thức, định dạng,v.v.. ( Khi xuất sang Excel vẫn giữ nguyên 
định dạng, công thức trong từng Sheet và công thức liên kết 
giữa các Sheet).
• Có khả năng lấy tiên lượng dự toán từ bất kỳ 1 dự 
toán nào như dự toán 97 năm 1997,..năm 2007 hoặc tiên lượng 
làm trên Excel. 
• Có khả năng thẩm định công trình để tìm ra sự sai 
lệch về khối lượng, đơn giá. 
• Có khả năng kết nối các tiên lượng lại thành 1 tiên 
lượng duy nhất. 
• Dùng đa đơn giá, đa hạng mục trong 1 công trình mà không 
cần tách 1 hạng mục thành 1 file như các phần mềm dự toán 
khác. 
• Cơ sở dữ liệu hiệu chỉnh dễ dàng, trực quan và đặc 
biệt là có đủ đơn giá, định mức của 64 Tỉnh, Thành phố. 
• Tính bù giá nhiên liệu, bù giá ca máy, cước vận chuyển, 
tự động vẽ biểu đồ tiến độ thi công ,ghi bản vẽ sang 
Autocad. 
• Hỗ trợ người dùng lập công tác Tạm tính có phân tích 
Vật tư/ Nhân công/ Máy đầy đủ, cho phép thêm vật tư mới vào 
cơ sở dữ liệu để dùng cho nhiều công trình…..
• Gửi quý khách báo giá phần  mềm dự toán G8.
 1.) Dự toán G8 Amateur - 2011
Số công tác  : 200
Số hạng mục : 01
Giá  : 1.000.000 (VND) ( Một triệu đồng )
2.) Dự toán G8 Beginner - 2011
Số công tác  : 300
Số hạng mục : 01
Giá  : 2.000.000 (VND) ( Hai triệu đồng )
3.) Dự toán G8 Professional - 2011
Số công tác  : 400
Số hạng mục : 01
Giá  : 3.000.000 (VND) ( Ba triệu đồng )
4.) Dự toán G8 Enterprise - 2011
Số công tác  : Vô hạn
Số hạng mục : Vô hạn
Giá  : 4.000.000 (VND) ( Bốn triệu đồng )
Quý khách có thể hoàn toàn yên tâm và tin tưởng khi sử dụng 
phần mềm Dự toán - Dự thầu G8 trong việc phân tích và đánh 
giá kết quả của các công trình.
Quý khách có thể tải  bộ cài phần mềm Dự toán G8 Express về 
dùng thử  ***MIỄN PHÍ*** tại:
http://www.dutoang8.com/DownloadSF.asp
Tải về hướng dẫn qua VIDEO:
http://www.dutoang8.com/Video.asp
Mọi đóng góp, yêu cầu hỗ trợ kỹ thuật của quý vị xin vui 
lòng gửi về địa chỉ:
Công Ty Cổ Phần Tư Vấn Đầu Tư Xây Dựng AN VIỆT
75 - Nguyễn Văn Lượng - Phường 17 - Gò Vấp - Tp.HCM.
Phòng Kinh Doanh
Lê Thanh Sơn
Hotline: 0168.314.8282 - 0822238663
Email : thanh...@anviet.edu.vn
Hãy gọi hoặc nhắn tin cho tôi dù quý khách ở bất cứ nơi 
đâu, vào bất cứ thời gian nào.
Trân trọng cám ơn quý khách hàng đã quan tâm!