Re: [tuples] gimple_assign_subcode for GIMPLE_SINGLE_RHS

2008-03-11 Thread Diego Novillo
On Tue, Mar 11, 2008 at 08:02, Zdenek Dvorak <[EMAIL PROTECTED]> wrote: > another possibility would be to represent a = b < c ? d : e as > > GIMPLE_ASSIGN (LT_EXPR, a, b, c, d, e) > > and a = (b < c) as > > GIMPLE_ASSIGN (LT_EXPR, a, b, c, true, false) Yeah, I think I like this one. We don't

Re: [tuples] gimple_assign_subcode for GIMPLE_SINGLE_RHS

2008-03-11 Thread Zdenek Dvorak
Hi, > On 03/10/08 08:24, Richard Guenther wrote: > > >You could either do > > > >GIMPLE_ASSIGN > > But 'cond' would be an unflattened tree expression. I'm trying to avoid > that. > > >or invent COND_GT_EXPR, COND_GE_EXPR, etc. (at least in GIMPLE > >we always have a comparison in COND_EXPR_C

Re: [tuples] gimple_assign_subcode for GIMPLE_SINGLE_RHS

2008-03-11 Thread Diego Novillo
On 03/10/08 08:24, Richard Guenther wrote: You could either do GIMPLE_ASSIGN But 'cond' would be an unflattened tree expression. I'm trying to avoid that. or invent COND_GT_EXPR, COND_GE_EXPR, etc. (at least in GIMPLE we always have a comparison in COND_EXPR_COND, never a plain boolean

Re: [tuples] gimple_assign_subcode for GIMPLE_SINGLE_RHS

2008-03-10 Thread Richard Guenther
On Mon, Mar 10, 2008 at 4:12 PM, Diego Novillo <[EMAIL PROTECTED]> wrote: > On Sun, Mar 9, 2008 at 14:22, Zdenek Dvorak <[EMAIL PROTECTED]> wrote: > > > extract_ops_from_tree would return GIMPLE_COPY as subcode and > > the whole expression as op1, where's the problem? > > Sorry, I misunderstoo

Re: [tuples] gimple_assign_subcode for GIMPLE_SINGLE_RHS

2008-03-10 Thread Diego Novillo
On Sun, Mar 9, 2008 at 14:22, Zdenek Dvorak <[EMAIL PROTECTED]> wrote: > extract_ops_from_tree would return GIMPLE_COPY as subcode and > the whole expression as op1, where's the problem? Sorry, I misunderstood you. I thought you were advocating *against* GIMPLE_COPY. > > I need to introduce

Re: [tuples] gimple_assign_subcode for GIMPLE_SINGLE_RHS

2008-03-09 Thread Zdenek Dvorak
Hi, > On 3/9/08 3:24 PM, Zdenek Dvorak wrote: > > >however, it would make things simpler. Now, we need to distiguish > >three cases -- SINGLE, UNARY and BINARY; if we pretended that > >GIMPLE_COPY is an unary operator, this would be reduced just > >to UNARY and BINARY. Of course, GIMPLE_COPY wo

Re: [tuples] gimple_assign_subcode for GIMPLE_SINGLE_RHS

2008-03-09 Thread Diego Novillo
On 3/9/08 3:24 PM, Zdenek Dvorak wrote: however, it would make things simpler. Now, we need to distiguish three cases -- SINGLE, UNARY and BINARY; if we pretended that GIMPLE_COPY is an unary operator, this would be reduced just to UNARY and BINARY. Of course, GIMPLE_COPY would never be used i

Re: [tuples] gimple_assign_subcode for GIMPLE_SINGLE_RHS

2008-03-09 Thread Zdenek Dvorak
Hi, > >>So, what about adding a GIMPLE_COPY code? The code would have 0 > >>operands and used only for its numeric value. > > > >another possibility would be to make GIMPLE_COPY an unary operator, and > >get rid of the SINGLE_RHS case altogether (of course, unlike any other > >unary operator, it

Re: [tuples] gimple_assign_subcode for GIMPLE_SINGLE_RHS

2008-03-09 Thread Diego Novillo
On 3/9/08 11:31 AM, Richard Guenther wrote: On Sun, Mar 9, 2008 at 3:46 PM, Zdenek Dvorak <[EMAIL PROTECTED]> wrote: Hi, > So, what about adding a GIMPLE_COPY code? The code would have 0 > operands and used only for its numeric value. another possibility would be to make GIMPLE_COPY an un

Re: [tuples] gimple_assign_subcode for GIMPLE_SINGLE_RHS

2008-03-09 Thread Diego Novillo
On 3/9/08 10:46 AM, Zdenek Dvorak wrote: Hi, So, what about adding a GIMPLE_COPY code? The code would have 0 operands and used only for its numeric value. another possibility would be to make GIMPLE_COPY an unary operator, and get rid of the SINGLE_RHS case altogether (of course, unlike any

Re: [tuples] gimple_assign_subcode for GIMPLE_SINGLE_RHS

2008-03-09 Thread Richard Guenther
On Sun, Mar 9, 2008 at 3:46 PM, Zdenek Dvorak <[EMAIL PROTECTED]> wrote: > Hi, > > > > So, what about adding a GIMPLE_COPY code? The code would have 0 > > operands and used only for its numeric value. > > another possibility would be to make GIMPLE_COPY an unary operator, and > get rid of the

Re: [tuples] gimple_assign_subcode for GIMPLE_SINGLE_RHS

2008-03-09 Thread Zdenek Dvorak
Hi, > So, what about adding a GIMPLE_COPY code? The code would have 0 > operands and used only for its numeric value. another possibility would be to make GIMPLE_COPY an unary operator, and get rid of the SINGLE_RHS case altogether (of course, unlike any other unary operator, it would not requir

Re: [tuples] gimple_assign_subcode for GIMPLE_SINGLE_RHS

2008-03-09 Thread Zdenek Dvorak
Hi, > On Sun, Mar 9, 2008 at 2:17 PM, Diego Novillo <[EMAIL PROTECTED]> wrote: > > On Sun, Mar 9, 2008 at 08:15, Richard Guenther > > <[EMAIL PROTECTED]> wrote: > > > > > What is GIMPLE_SINGLE_RHS after all? > > > > Represents a "copy" operation, an operand with no operator (e.g., a = 3, b >

Re: [tuples] gimple_assign_subcode for GIMPLE_SINGLE_RHS

2008-03-09 Thread Diego Novillo
On 3/9/08 9:24 AM, Richard Guenther wrote: So as opposed to a unary operation which would look exactly the same apart from having a subcode? So what does gimple_assign_subcode () return for the GIMPLE_SINGLE_RHS case? Some random garbage? No. A unary operation is different. For instance, N

Re: [tuples] gimple_assign_subcode for GIMPLE_SINGLE_RHS

2008-03-09 Thread Richard Guenther
On Sun, Mar 9, 2008 at 2:17 PM, Diego Novillo <[EMAIL PROTECTED]> wrote: > On Sun, Mar 9, 2008 at 08:15, Richard Guenther > <[EMAIL PROTECTED]> wrote: > > > What is GIMPLE_SINGLE_RHS after all? > > Represents a "copy" operation, an operand with no operator (e.g., a = 3, b = > c) > > '3' and '

Re: [tuples] gimple_assign_subcode for GIMPLE_SINGLE_RHS

2008-03-09 Thread Diego Novillo
On Sun, Mar 9, 2008 at 08:15, Richard Guenther <[EMAIL PROTECTED]> wrote: > What is GIMPLE_SINGLE_RHS after all? Represents a "copy" operation, an operand with no operator (e.g., a = 3, b = c) '3' and 'c' are "single" operands. There is no operator involved in the assignment.

Re: [tuples] gimple_assign_subcode for GIMPLE_SINGLE_RHS

2008-03-09 Thread Diego Novillo
On Sat, Mar 8, 2008 at 19:29, Zdenek Dvorak <[EMAIL PROTECTED]> wrote: > The problem of course is that for GIMPLE_SINGLE_RHS, we do not maintain > the invariant that > > gimple_assign_subcode (stmt) == TREE_CODE (gimple_assign_rhs1 (stmt)), > > so gimple_assign_subcode typically will not be SS

Re: [tuples] gimple_assign_subcode for GIMPLE_SINGLE_RHS

2008-03-09 Thread Richard Guenther
On Sun, Mar 9, 2008 at 1:29 AM, Zdenek Dvorak <[EMAIL PROTECTED]> wrote: > Hi, > > I just noticed an error in a part of the code that I converted, that > looks this way: > > switch (gimple_assign_subcode (stmt)) > { > case SSA_NAME: > handle_ssa_name (); > break; > > case PLUS_EXPR:

[tuples] gimple_assign_subcode for GIMPLE_SINGLE_RHS

2008-03-08 Thread Zdenek Dvorak
Hi, I just noticed an error in a part of the code that I converted, that looks this way: switch (gimple_assign_subcode (stmt)) { case SSA_NAME: handle_ssa_name (); break; case PLUS_EXPR: handle_plus (); break; default: something (); } The problem of course is that for