Documentation Archive Developer
Search

Next: , Previous: Statements, Up: GIMPLE


10.2.5 GIMPLE Example

     struct A { A(); ~A(); };
     
     int i;
     int g();
     void f()
     {
       A a;
       int j = (--i, i ? 0 : 1);
     
       for (int x = 42; x > 0; --x)
         {
           i += g()*4 + 32;
         }
     }

becomes

     void f()
     {
       int i.0;
       int T.1;
       int iftmp.2;
       int T.3;
       int T.4;
       int T.5;
       int T.6;
     
       {
         struct A a;
         int j;
     
         __comp_ctor (&a);
         try
           {
             i.0 = i;
             T.1 = i.0 - 1;
             i = T.1;
             i.0 = i;
             if (i.0 == 0)
               iftmp.2 = 1;
             else
               iftmp.2 = 0;
             j = iftmp.2;
             {
               int x;
     
               x = 42;
               goto test;
               loop:;
     
               T.3 = g ();
               T.4 = T.3 * 4;
               i.0 = i;
               T.5 = T.4 + i.0;
               T.6 = T.5 + 32;
               i = T.6;
               x = x - 1;
     
               test:;
               if (x > 0)
                 goto loop;
               else
                 goto break_;
               break_:;
             }
           }
         finally
           {
             __comp_dtor (&a);
           }
       }
     }