cgraph callees availability
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
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
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
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
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
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
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
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
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
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
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
> 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
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
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!
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 phiÌ 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!