Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/charisee/src/compiler/c-target/opr-to-clang.sml
ViewVC logotype

Diff of /branches/charisee/src/compiler/c-target/opr-to-clang.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2748, Wed Oct 1 21:16:56 2014 UTC revision 2749, Wed Oct 1 23:11:09 2014 UTC
# Line 221  Line 221 
221          val fnName=N.NameConsArray ty          val fnName=N.NameConsArray ty
222          val VarA= CL.E_Var varA          val VarA= CL.E_Var varA
223    
224            val _ =print ("found cons tensor to array"^Ty.toString (Ty.TensorTy ty))
225          fun mkTenToArr(size,paramTy,rhs,vars)=let          fun mkTenToArr(size,paramTy,rhs,vars)=let
226              val params=[mkParam ParamA]@ mkParamsSameType(paramTy, vars)              val params=[mkParam ParamA]@ mkParamsSameType(paramTy, vars)
227    
   
228              val lhs=indexDiderotType(VarA, size-1)              val lhs=indexDiderotType(VarA, size-1)
229              val stmts=setEq(lhs,rhs)              val stmts=setEq(lhs,rhs)
230          in          in
# Line 350  Line 349 
349    
350    
351    
352      fun mkVec0(tyR, ty,VarA,VarI,VarV)= let    (*storeVec Aligned*)
353      fun storeAligned(tyR, ty,VarA,VarI,VarV)= let
354          val e=   CL.E_Subscript(VarA,VarI)          val e=   CL.E_Subscript(VarA,VarI)
355          val lhs= CL.E_Ref(ty, e)          val lhs= CL.E_Ref(ty, e)
   
356      in      in
357         [CL.S_Eq (lhs ,VarV)]         [CL.S_Eq (lhs ,VarV)]
358      end      end
359    
360    
361   (*not aligned store Vec body *)   (*not aligned store Vec body *)
362   fun mkVec1(tyN,tyO, VarA,VarI,VarV)= let   fun store(tyN,tyI,VarA,VarI,VarV)= let
363      val (stmt, VarUR)= mkExtVar(tyN, varU,VarV)      val (stmt, VarUR)= mkExtVar(tyN, varU,VarV)
364      val x=tyO-1      val x=tyI-1
365      val rhs= indexDiderotType(VarUR,x)      val rhs= indexDiderotType(VarUR,x)
366      val lhs=indexDiderotTypeWithOffset(VarA, x, VarI)      val lhs=indexDiderotTypeWithOffset(VarA, x, VarI)
367      val e=setEq(lhs,rhs)      val e=setEq(lhs,rhs)
# Line 372  Line 371 
371      end      end
372    
373    
374     (*if tyN>tyO then store tyO indices
375       else store tyN indices  *)
376    
377    
378   (*General store function *)   (*General store function *)
379   fun generalmkVec(aligned,tyN,tyOrig)= let   fun generalmkVec(aligned,tyN,tyOrig)= let
380      val rtnType=voidTy      val rtnType=voidTy
# Line 381  Line 384 
384      val VarV= CL.E_Var varV      val VarV= CL.E_Var varV
385      val ty=vecTy tyN      val ty=vecTy tyN
386      val params=mkParams [ParamA,ParamI,([],ty, varV)]      val params=mkParams [ParamA,ParamI,([],ty, varV)]
     val stmts=(case false  
         of false => mkVec1(tyN,tyOrig,VarA,VarI,VarV)  
         | true =>   mkVec0(tyN, ty, VarA,VarI,VarV)  
         (*end case*))  
387    
388    
389        val stmts = (case (tyOrig>tyN,aligned)
390            of (true,true) =>   storeAligned(tyN, ty, VarA,VarI,VarV)
391            |  (true, _ )  => store(tyN,tyN,VarA,VarI,VarV)
392            |  (false, _ )  => store(tyN,tyOrig,VarA,VarI,VarV)
393            (*end case*))
394      in      in
395          createDec(rtnType, fnName, params,stmts@[ voidRtn])          createDec(rtnType, fnName, params,stmts@[ voidRtn])
396      end      end
# Line 399  Line 404 
404        | handleOpr( ILF.STORE (A,tyR,tyO))=generalmkVec(A,tyR,tyO)        | handleOpr( ILF.STORE (A,tyR,tyO))=generalmkVec(A,tyR,tyO)
405    
406        | handleOpr( ILF.CONSV n)= mkRealToVec n        | handleOpr( ILF.CONSV n)= mkRealToVec n
407        | handleOpr( ILF.CONS(Ty.TensorTy ty))=ConsTensorToArray  ty        | handleOpr( ILF.CONS(Ty.TensorTy ty))=(print "found consTY";ConsTensorToArray  ty)
408        | handleOpr( ILF.CONS _)=  default        | handleOpr( ILF.CONS ty)= (print ("found consTY but passed"^Ty.toString ty); default)
409    
410        | handleOpr( ILF.OP(Op.prodScaV d))=mkScaV d        | handleOpr( ILF.OP(Op.prodScaV d))=mkScaV d
411        | handleOpr( ILF.OP(Op.sumVec d))=mkSumV d        | handleOpr( ILF.OP(Op.sumVec d))=mkSumV d

Legend:
Removed from v.2748  
changed lines
  Added in v.2749

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0