public String SolveIteration(ForLoop L1)
 {
     String Result = "";
     return Result;
 }
    // $ANTLR start "kforStat"
    // Z:\\C2CUDATranslator\\C2CUDATranslator\\C2CUDATranslator.g:993:1: kforStat : 'for' '(' e1= kassignStat ';' e2= kexpr ';' e3= kincStat ')' kkblock ;
    public C2CUDATranslatorParser.kforStat_return kforStat() // throws RecognitionException [1]
    {   
        slist_stack.Push(new slist_scope());

        C2CUDATranslatorParser.kforStat_return retval = new C2CUDATranslatorParser.kforStat_return();
        retval.Start = input.LT(1);

        C2CUDATranslatorParser.kassignStat_return e1 = default(C2CUDATranslatorParser.kassignStat_return);

        C2CUDATranslatorParser.kexpr_return e2 = default(C2CUDATranslatorParser.kexpr_return);

        C2CUDATranslatorParser.kincStat_return e3 = default(C2CUDATranslatorParser.kincStat_return);



          ((slist_scope)slist_stack.Peek()).locals =  new ArrayList();
          ((slist_scope)slist_stack.Peek()).stats =  new ArrayList();
          String loopindex;
          

        try 
    	{
            // Z:\\C2CUDATranslator\\C2CUDATranslator\\C2CUDATranslator.g:1001:5: ( 'for' '(' e1= kassignStat ';' e2= kexpr ';' e3= kincStat ')' kkblock )
            // Z:\\C2CUDATranslator\\C2CUDATranslator\\C2CUDATranslator.g:1001:9: 'for' '(' e1= kassignStat ';' e2= kexpr ';' e3= kincStat ')' kkblock
            {
            	Match(input,44,FOLLOW_44_in_kforStat5305); 
            	Match(input,21,FOLLOW_21_in_kforStat5307); 
            	PushFollow(FOLLOW_kassignStat_in_kforStat5311);
            	e1 = kassignStat();
            	state.followingStackPointer--;

            	Match(input,19,FOLLOW_19_in_kforStat5313); 
            	PushFollow(FOLLOW_kexpr_in_kforStat5317);
            	e2 = kexpr();
            	state.followingStackPointer--;

            	Match(input,19,FOLLOW_19_in_kforStat5319); 
            	PushFollow(FOLLOW_kincStat_in_kforStat5323);
            	e3 = kincStat();
            	state.followingStackPointer--;

            	Match(input,27,FOLLOW_27_in_kforStat5325); 
            	PushFollow(FOLLOW_kkblock_in_kforStat5327);
            	kkblock();
            	state.followingStackPointer--;


            	     C2CUDATranslator.ForLoop Loop1 = new C2CUDATranslator.ForLoop();
            	     Loop1.Index = GetIndexofe1(e1);
            	     Loop1.Size = Getsizeofe2(e2);
            	    
            	     ((program_scope)program_stack.Peek()).kernelforloopindex = ((program_scope)program_stack.Peek()).kernelforloopindex+1;
            	     if(((program_scope)program_stack.Peek()).kernelforloopindex==1)
            	     {
            	     ((program_scope)program_stack.Peek()).size = Loop1.Size;
            	    // ((program_scope)program_stack.Peek()).size = ((program_scope)program_stack.Peek()).size+" * "+Loop1.Size;
            	     }
            	     else
            	     {
            	     Loop1.IsNestLoop=true;
            	      ((program_scope)program_stack.Peek()).size = Loop1.Size+" * "+((program_scope)program_stack.Peek()).size;
            	     }
            	     	 Boolean d=((program_scope)program_stack.Peek()).recursionflag;
            	     	
            	     if((((program_scope)program_stack.Peek()).iteraiveflag == false) && (((program_scope)program_stack.Peek()).recursionflag == false))
            	       {
            	       
            	       if(((program_scope)program_stack.Peek()).index=="2D")
            	  	{
            	  		if(Loop1.IsNestLoop)
            	  		{
            	  		 for(int myi=0;myi<((slist_scope)slist_stack.Peek()).stats.Count;myi++) 		
            	  		{
            	  			if(((slist_scope)slist_stack.Peek()).stats[myi].ToString().Contains("pitch"))
            	  			{
            	  				if(((slist_scope)slist_stack.Peek()).stats[myi].ToString().Contains(Loop1.Index))
            	  				{
            	 				//((slist_scope)slist_stack.Peek()).stats.RemoveAt(0);
            	  				}
            	  			}
            	  		}
            			retval.ST = templateLib.GetInstanceOf("RemoveforLoop",
            	            	new STAttrMap().Add("e1", ((e1 != null) ? e1.ST : null)).Add("e2", ((e2 != null) ? e2.ST : null)).Add("e3", ((e3 != null) ? e3.ST : null)).Add("locals", ((slist_scope)slist_stack.Peek()).locals).Add("stats", ((slist_scope)slist_stack.Peek()).stats).Add("index", Loop1.Index));
            	  		}
            	  		else
            	  		{
            	  		
            			retval.ST = templateLib.GetInstanceOf("kforLoop",
            	            	new STAttrMap().Add("e1", ((e1 != null) ? e1.ST : null)).Add("e2", ((e2 != null) ? e2.ST : null)).Add("e3", ((e3 != null) ? e3.ST : null)).Add("locals", ((slist_scope)slist_stack.Peek()).locals).Add("stats", ((slist_scope)slist_stack.Peek()).stats).Add("index", Loop1.Index));
            	            	}
            		}
            		else
            		{
            			if(((program_scope)program_stack.Peek()).index=="1D")
            		  	{
            			  retval.ST = templateLib.GetInstanceOf("RemoveChildforLoop",
            	            	  new STAttrMap().Add("e1", ((e1 != null) ? e1.ST : null)).Add("e2", ((e2 != null) ? e2.ST : null)).Add("e3", ((e3 != null) ? e3.ST : null)).Add("locals", ((slist_scope)slist_stack.Peek()).locals).Add("stats", ((slist_scope)slist_stack.Peek()).stats).Add("index", Loop1.Index));
            			}
            			else
            			{
            			 retval.ST = templateLib.GetInstanceOf("kforLoop",
            	            	  new STAttrMap().Add("e1", ((e1 != null) ? e1.ST : null)).Add("e2", ((e2 != null) ? e2.ST : null)).Add("e3", ((e3 != null) ? e3.ST : null)).Add("locals", ((slist_scope)slist_stack.Peek()).locals).Add("stats", ((slist_scope)slist_stack.Peek()).stats));
            			}
            		}
            	      // C2CUDATranslator.Transformation.Parallelize($kblock.ST);
            	     // retval.ST = templateLib.GetInstanceOf("RemoveforLoop",
            	       //     	  new STAttrMap().Add("e1", ((e1 != null) ? e1.ST : null)).Add("e2", ((e2 != null) ? e2.ST : null)).Add("e3", ((e3 != null) ? e3.ST : null)).Add("locals", ((slist_scope)slist_stack.Peek()).locals).Add("stats", ((slist_scope)slist_stack.Peek()).stats));
            		
            	       }
            	       else
            	       {
            	         retval.ST = templateLib.GetInstanceOf("kforLoop",
            	            	  new STAttrMap().Add("e1", ((e1 != null) ? e1.ST : null)).Add("e2", ((e2 != null) ? e2.ST : null)).Add("e3", ((e3 != null) ? e3.ST : null)).Add("locals", ((slist_scope)slist_stack.Peek()).locals).Add("stats", ((slist_scope)slist_stack.Peek()).stats));
            	       }
            	     

            }

            retval.Stop = input.LT(-1);

        }
        catch (RecognitionException re) 
    	{
            ReportError(re);
            Recover(input,re);
        }
        finally 
    	{
            slist_stack.Pop();

        }
        return retval;
    }
 public string ParallelizeLoop(ForLoop Loop)
 {
     return("");
 }
Esempio n. 4
0
 public string ParallelizeLoop(ForLoop Loop)
 {
     return "";
 }
Esempio n. 5
0
        public String SolveIteration(ForLoop L1)
        {
            String Result = "";

            return(Result);
        }