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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/low-to-tree/low-to-tree.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/low-to-tree/low-to-tree.sml

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

revision 4036, Thu Jun 23 15:01:23 2016 UTC revision 4039, Fri Jun 24 15:35:09 2016 UTC
# Line 252  Line 252 
252            end            end
253    
254      fun trOp (env, srcRator, args) = let      fun trOp (env, srcRator, args) = let
255            fun bindOp rator = let            fun bindTREE rator = let
256                  val (args, stms) = simpleArgs (env, args)                  val (args, stms) = simpleArgs (env, args)
257                  in                  in
258                    (Env.TREE(T.E_Op(rator, args)), stms)                    (Env.TREE(T.E_Op(rator, args)), stms)
# Line 280  Line 280 
280                  end                  end
281            in            in
282              case srcRator              case srcRator
283               of Op.IAdd => bindOp TOp.IAdd               of Op.IAdd => bindTREE TOp.IAdd
284                | Op.ISub => bindOp TOp.ISub                | Op.ISub => bindTREE TOp.ISub
285                | Op.IMul => bindOp TOp.IMul                | Op.IMul => bindTREE TOp.IMul
286                | Op.IDiv => bindOp TOp.IDiv                | Op.IDiv => bindTREE TOp.IDiv
287                | Op.IMod => bindOp TOp.IMod                | Op.IMod => bindTREE TOp.IMod
288                | Op.INeg => bindOp TOp.INeg                | Op.INeg => bindTREE TOp.INeg
289  (* QUESTION: should we just use VAdd 1, etc ?*)  (* QUESTION: should we just use VAdd 1, etc ?*)
290                | Op.RAdd => bindOp TOp.RAdd                | Op.RAdd => bindTREE TOp.RAdd
291                | Op.RSub => bindOp TOp.RSub                | Op.RSub => bindTREE TOp.RSub
292                | Op.RMul => bindOp TOp.RMul                | Op.RMul => bindTREE TOp.RMul
293                | Op.RDiv => bindOp TOp.RDiv                | Op.RDiv => bindTREE TOp.RDiv
294                | Op.RNeg => bindOp TOp.RNeg                | Op.RNeg => bindTREE TOp.RNeg
295                | Op.LT ty => bindOp (TOp.LT (cvtScalarTy ty))                | Op.LT ty => bindTREE (TOp.LT (cvtScalarTy ty))
296                | Op.LTE ty => bindOp (TOp.LTE (cvtScalarTy ty))                | Op.LTE ty => bindTREE (TOp.LTE (cvtScalarTy ty))
297                | Op.EQ ty => bindOp (TOp.EQ (cvtScalarTy ty))                | Op.EQ ty => bindTREE (TOp.EQ (cvtScalarTy ty))
298                | Op.NEQ ty => bindOp (TOp.NEQ (cvtScalarTy ty))                | Op.NEQ ty => bindTREE (TOp.NEQ (cvtScalarTy ty))
299                | Op.GT ty => bindOp (TOp.GT (cvtScalarTy ty))                | Op.GT ty => bindTREE (TOp.GT (cvtScalarTy ty))
300                | Op.GTE ty => bindOp (TOp.GTE (cvtScalarTy ty))                | Op.GTE ty => bindTREE (TOp.GTE (cvtScalarTy ty))
301                | Op.Not => bindOp TOp.Not                | Op.Not => bindTREE TOp.Not
302                | Op.Abs ty => bindOp (TOp.Abs (cvtScalarTy ty))                | Op.Abs ty => bindTREE (TOp.Abs (cvtScalarTy ty))
303                | Op.Max ty => bindOp (TOp.Max (cvtScalarTy ty))                | Op.Max ty => bindTREE (TOp.Max (cvtScalarTy ty))
304                | Op.Min ty => bindOp (TOp.Min (cvtScalarTy ty))                | Op.Min ty => bindTREE (TOp.Min (cvtScalarTy ty))
305                | Op.RClamp => bindOp TOp.RClamp                | Op.RClamp => bindTREE TOp.RClamp
306                | Op.RLerp => bindOp TOp.RLerp                | Op.RLerp => bindTREE TOp.RLerp
307                | Op.VAdd _ => bindVOp TOp.VAdd                | Op.VAdd _ => bindVOp TOp.VAdd
308                | Op.VSub _ => bindVOp TOp.VSub                | Op.VSub _ => bindVOp TOp.VSub
309                | Op.VScale _ => let                | Op.VScale _ => let
# Line 360  Line 360 
360                    in                    in
361                      (Env.TREE(T.E_Op(TOp.ProjectLast(ty, idxs), [arg])), stms)                      (Env.TREE(T.E_Op(TOp.ProjectLast(ty, idxs), [arg])), stms)
362                    end                    end
363                | Op.Select(ty, i) => bindOp (TOp.Select(U.trType ty, i))                | Op.Select(ty, i) => bindTREE (TOp.Select(U.trType ty, i))
364                | Op.Subscript ty => bindOp (TOp.Subscript(U.trType ty))                | Op.Subscript ty => bindTREE (TOp.Subscript(U.trType ty))
365                | Op.MkDynamic(ty, n) => bindOp (TOp.MkDynamic(U.trType ty, n))                | Op.MkDynamic(ty, n) => bindTREE (TOp.MkDynamic(U.trType ty, n))
366                | Op.Append ty => bindOp (TOp.Append(U.trType ty))                | Op.Append ty => bindTREE (TOp.Append(U.trType ty))
367                | Op.Prepend ty => bindOp (TOp.Prepend(U.trType ty))                | Op.Prepend ty => bindTREE (TOp.Prepend(U.trType ty))
368                | Op.Concat ty => bindOp (TOp.Concat(U.trType ty))                | Op.Concat ty => bindTREE (TOp.Concat(U.trType ty))
369                | Op.Range => bindOp TOp.Range                | Op.Range => bindTREE TOp.Range
370                | Op.Length ty => bindOp (TOp.Length(U.trType ty))                | Op.Length ty => bindTREE (TOp.Length(U.trType ty))
371                | Op.SphereQuery(ty1, ty2) => bindOp (TOp.SphereQuery(U.trType ty1, U.trType ty2))                | Op.SphereQuery(ty1, ty2) => bindTREE (TOp.SphereQuery(U.trType ty1, U.trType ty2))
372                | Op.Sqrt => bindOp TOp.Sqrt                | Op.Sqrt => bindTREE TOp.Sqrt
373                | Op.Cos => bindOp TOp.Cos                | Op.Cos => bindTREE TOp.Cos
374                | Op.ArcCos => bindOp TOp.ArcCos                | Op.ArcCos => bindTREE TOp.ArcCos
375                | Op.Sin => bindOp TOp.Sin                | Op.Sin => bindTREE TOp.Sin
376                | Op.ArcSin => bindOp TOp.ArcSin                | Op.ArcSin => bindTREE TOp.ArcSin
377                | Op.Tan => bindOp TOp.Tan                | Op.Tan => bindTREE TOp.Tan
378                | Op.ArcTan => bindOp TOp.ArcTan                | Op.ArcTan => bindTREE TOp.ArcTan
379                | Op.Exp  => bindOp TOp.Exp                | Op.Exp  => bindTREE TOp.Exp
380                | Op.Ceiling 1 => bindOp TOp.RCeiling                | Op.Ceiling 1 => bindTREE TOp.RCeiling
381                | Op.Ceiling d => bindVOp TOp.VCeiling                | Op.Ceiling d => bindVOp TOp.VCeiling
382                | Op.Floor 1 => bindOp TOp.RFloor                | Op.Floor 1 => bindTREE TOp.RFloor
383                | Op.Floor d => bindVOp TOp.VFloor                | Op.Floor d => bindVOp TOp.VFloor
384                | Op.Round 1 => bindOp TOp.RRound                | Op.Round 1 => bindTREE TOp.RRound
385                | Op.Round d => bindVOp TOp.VRound                | Op.Round d => bindVOp TOp.VRound
386                | Op.Trunc 1 => bindOp TOp.RTrunc                | Op.Trunc 1 => bindTREE TOp.RTrunc
387                | Op.Trunc d => bindVOp TOp.VTrunc                | Op.Trunc d => bindVOp TOp.VTrunc
388                | Op.IntToReal => bindOp TOp.IntToReal                | Op.IntToReal => bindTREE TOp.IntToReal
389                | Op.RealToInt 1 => bindOp TOp.RealToInt                | Op.RealToInt 1 => bindTREE TOp.RealToInt
390                | Op.RealToInt d => let                | Op.RealToInt d => let
391                    val [v] = args                    val [v] = args
392                    val (layout, args, stms) = vectorArg (env, v)                    val (layout, args, stms) = vectorArg (env, v)
# Line 406  Line 406 
406                | Op.R_Mean ty => ??                | Op.R_Mean ty => ??
407                | Op.R_Variance ty => ??                | Op.R_Variance ty => ??
408  *)  *)
409                | Op.Transform info => bindOp (TOp.Transform info)                | Op.Transform info => bindTREE (TOp.Transform info)
410                | Op.Translate info => bindOp (TOp.Translate info)                | Op.Translate info => bindTREE (TOp.Translate info)
411                | Op.ControlIndex(info, ctl, d) => bindOp (TOp.ControlIndex(info, ctl, d))                | Op.ControlIndex(info, ctl, d) => bindTREE (TOp.ControlIndex(info, ctl, d))
412                | Op.LoadVoxel info => bindOp (TOp.LoadVoxel info)                | Op.LoadVoxel info => bindTREE (TOp.LoadVoxel info)
413                | Op.Inside(info, s) => bindOp (TOp.Inside(info, s))                | Op.Inside(info, s) => bindTREE (TOp.Inside(info, s))
414                | Op.ImageDim(info, d) => bindOp(TOp.ImageDim(info, d))                | Op.ImageDim(info, d) => bindTREE(TOp.ImageDim(info, d))
415                | Op.MathFn f => bindOp (TOp.MathFn f)                | Op.MathFn f => bindTREE (TOp.MathFn f)
416                | rator => raise Fail("bogus operator " ^ Op.toString srcRator)                | rator => raise Fail("bogus operator " ^ Op.toString srcRator)
417              (* end case *)              (* end case *)
418            end            end
# Line 437  Line 437 
437  *)  *)
438      fun trAssign (env, lhs, rhs) = let      fun trAssign (env, lhs, rhs) = let
439            fun getLHS () = (case UnifyVars.eqClassOf lhs of SOME x => x | _ => lhs)            fun getLHS () = (case UnifyVars.eqClassOf lhs of SOME x => x | _ => lhs)
440            fun bindRHS rhs = Env.bindVar (env, getLHS(), Env.RHS(U.trType(V.ty lhs), rhs))            fun bindRHS rhs = Env.bindVar (env, getLHS(), Env.RHS(U.trTempType(V.ty lhs), rhs))
441          (* binding for the lhs variable, where the rhs is a simple expression.  We check to          (* binding for the lhs variable, where the rhs is a simple expression.  We check to
442           * see if it is part of an merged equivalence class, in which case we need to generate           * see if it is part of an merged equivalence class, in which case we need to generate
443           * assigment(s)           * assigment(s)

Legend:
Removed from v.4036  
changed lines
  Added in v.4039

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