On Mon, Oct 14, 2013 at 2:20 PM, Andreas Krebbel <kreb...@linux.vnet.ibm.com> wrote: > On 14/10/13 13:30, Jakub Jelinek wrote: >> On Mon, Oct 14, 2013 at 01:26:25PM +0200, Richard Biener wrote: >>>> I somehow couldn't get it working with the add_builtin_function parameter. >>>> Perhaps because these >>>> attrs are supposed to be translated into the respective tree flags >>>> (DECL_IS_RETURNS_TWICE) at that >>>> point already?! >>> >>> Yes, via handle_..._attribute. >> >> ?? If add_builtin_function last argument is non-NULL, it will call >> decl_attributes with that argument and thus should set up evertyhing. >> So, IMHO: >> tree noreturn = tree_cons (get_identifier ("noreturn"), NULL, NULL); >> tree returns_twice = tree_cons (get_identifier ("returns_twice"), NULL, >> NULL); >> and passing either of those to add_builtin_function should IMHO work just >> fine. > > Yes that works - thanks. My first test was incomplete. I've tried with only > "returns_twice" first > and while this prevents the tree level ccp optimization it is not sufficient > to fix the testcase. On > rtl level the f = 88.0f assignment inside the transaction is still removed as > dead code. This only > stops when making tabort "noreturn" but this of course is no real fix since > an abort might occur > also without calling tabort explicitly. > > Having FPRs live accross an abort together with the incomplete CFG modelling > of transactions will > probably continue to cause all kinds of trouble until this is sorted out.
Yeah, similar to the setjmp/longjmp mess I've fixed on GIMPLE (but that is still broken on the RTL level). Richard. > Thanks for your help! > > Bye, > > -Andreas- > > --- > gcc/config/s390/s390.c | 13 +++!!!!!!!!!! > 1 file changed, 3 insertions(+), 10 modifications(!) > > Index: gcc/config/s390/s390.c > =================================================================== > *** gcc/config/s390/s390.c.orig > --- gcc/config/s390/s390.c > *************** static void > *** 9900,9905 **** > --- 9900,9908 ---- > s390_init_builtins (void) > { > tree ftype, uint64_type; > + tree returns_twice_attr = tree_cons (get_identifier ("returns_twice"), > + NULL, NULL); > + tree noreturn_attr = tree_cons (get_identifier ("noreturn"), NULL, NULL); > > /* void foo (void) */ > ftype = build_function_type_list (void_type_node, NULL_TREE); > *************** s390_init_builtins (void) > *** 9910,9926 **** > ftype = build_function_type_list (void_type_node, integer_type_node, > NULL_TREE); > add_builtin_function ("__builtin_tabort", ftype, > ! S390_BUILTIN_TABORT, BUILT_IN_MD, NULL, NULL_TREE); > add_builtin_function ("__builtin_tx_assist", ftype, > S390_BUILTIN_TX_ASSIST, BUILT_IN_MD, NULL, NULL_TREE); > > /* int foo (void *) */ > ftype = build_function_type_list (integer_type_node, ptr_type_node, > NULL_TREE); > add_builtin_function ("__builtin_tbegin", ftype, S390_BUILTIN_TBEGIN, > ! BUILT_IN_MD, NULL, NULL_TREE); > add_builtin_function ("__builtin_tbegin_nofloat", ftype, > S390_BUILTIN_TBEGIN_NOFLOAT, > ! BUILT_IN_MD, NULL, NULL_TREE); > > /* int foo (void *, int) */ > ftype = build_function_type_list (integer_type_node, ptr_type_node, > --- 9913,9929 ---- > ftype = build_function_type_list (void_type_node, integer_type_node, > NULL_TREE); > add_builtin_function ("__builtin_tabort", ftype, > ! S390_BUILTIN_TABORT, BUILT_IN_MD, NULL, > noreturn_attr); > add_builtin_function ("__builtin_tx_assist", ftype, > S390_BUILTIN_TX_ASSIST, BUILT_IN_MD, NULL, NULL_TREE); > > /* int foo (void *) */ > ftype = build_function_type_list (integer_type_node, ptr_type_node, > NULL_TREE); > add_builtin_function ("__builtin_tbegin", ftype, S390_BUILTIN_TBEGIN, > ! BUILT_IN_MD, NULL, returns_twice_attr); > add_builtin_function ("__builtin_tbegin_nofloat", ftype, > S390_BUILTIN_TBEGIN_NOFLOAT, > ! BUILT_IN_MD, NULL, returns_twice_attr); > > /* int foo (void *, int) */ > ftype = build_function_type_list (integer_type_node, ptr_type_node, > *************** s390_init_builtins (void) > *** 9928,9938 **** > add_builtin_function ("__builtin_tbegin_retry", ftype, > S390_BUILTIN_TBEGIN_RETRY, > BUILT_IN_MD, > ! NULL, NULL_TREE); > add_builtin_function ("__builtin_tbegin_retry_nofloat", ftype, > S390_BUILTIN_TBEGIN_RETRY_NOFLOAT, > BUILT_IN_MD, > ! NULL, NULL_TREE); > > /* int foo (void) */ > ftype = build_function_type_list (integer_type_node, NULL_TREE); > --- 9931,9941 ---- > add_builtin_function ("__builtin_tbegin_retry", ftype, > S390_BUILTIN_TBEGIN_RETRY, > BUILT_IN_MD, > ! NULL, returns_twice_attr); > add_builtin_function ("__builtin_tbegin_retry_nofloat", ftype, > S390_BUILTIN_TBEGIN_RETRY_NOFLOAT, > BUILT_IN_MD, > ! NULL, returns_twice_attr); > > /* int foo (void) */ > ftype = build_function_type_list (integer_type_node, NULL_TREE); >