Commit a5701d5d authored by Julian Kranz's avatar Julian Kranz

Merge branch 'master' of bitbucket.org:simona/gdsl-toolkit into experimental

parents 20121c82 792b9871
......@@ -600,11 +600,23 @@ structure Simplify = struct
BASICblock (decls,stmts)
end
and visitExp s (PRIexp (SLICEprim,t,[e,LITexp (INTvtype, INTlit ofs1), LITexp (INTvtype, INTlit size1)])) =
and visitExp s (PRIexp (SLICEprim,t,[e,LITexp (INTvtype, INTlit ofs), LITexp (INTvtype, INTlit size)])) =
(case visitExp s e of
VEC2INTexp (_,PRIexp (SLICEprim,t,[e,LITexp (INTvtype, INTlit ofs2), LITexp (INTvtype, INTlit size2)])) =>
PRIexp (SLICEprim,t,[e,LITexp (INTvtype, INTlit (ofs1+ofs2)), LITexp (INTvtype, INTlit size1)])
| e => PRIexp (SLICEprim,t,[e,LITexp (INTvtype, INTlit ofs1), LITexp (INTvtype, INTlit size1)])
VEC2INTexp (_,PRIexp (SLICEprim,_,[e,LITexp (INTvtype, INTlit ofs2), LITexp (INTvtype, INTlit size2)])) =>
PRIexp (SLICEprim,t,[e,LITexp (INTvtype, INTlit (ofs+ofs2)), LITexp (INTvtype, INTlit size)])
| e as VEC2INTexp (_,PRIexp (CONCAT_VECprim,_,[
vec1 as PRIexp (SLICEprim,t1,[e1,LITexp (INTvtype, INTlit ofs1), LITexp (INTvtype, INTlit size1)]),
vec2 as PRIexp (SLICEprim,t2,[e2,LITexp (INTvtype, INTlit ofs2), LITexp (INTvtype, INTlit size2)])
])) => if ofs>=size2 then visitExp s (
PRIexp (SLICEprim,t,[
VEC2INTexp (SOME (IntInf.toInt size1), vec1),
LITexp (INTvtype, INTlit (ofs-size2)), LITexp (INTvtype, INTlit size)]))
else if ofs+size<=size2 then visitExp s (
PRIexp (SLICEprim,t,[
VEC2INTexp (SOME (IntInf.toInt size2), vec2),
LITexp (INTvtype, INTlit ofs), LITexp (INTvtype, INTlit size)]))
else PRIexp (SLICEprim,t,[e,LITexp (INTvtype, INTlit ofs), LITexp (INTvtype, INTlit size)])
| e => PRIexp (SLICEprim,t,[e,LITexp (INTvtype, INTlit ofs), LITexp (INTvtype, INTlit size)])
)
| visitExp s (PRIexp (SETSTATEprim,_,[PRIexp (GETSTATEprim,_,[])])) = PRIexp (VOIDprim,VOIDvtype,[])
| visitExp s (PRIexp (f,t,es)) = PRIexp (f,t,map (visitExp s) es)
......@@ -646,14 +658,17 @@ structure Simplify = struct
| e => BOXexp (t, e)
)
| visitExp s (UNBOXexp (t,e)) = (case visitExp s e of
BOXexp (t2,e) => e
BOXexp (t,e) => e
| e => UNBOXexp (t, e)
)
| visitExp s (VEC2INTexp (sz,e)) = (case visitExp s e of
INT2VECexp (sz,e) => e
| e => VEC2INTexp (sz, e)
)
| visitExp s (INT2VECexp (sz,e)) = INT2VECexp (sz, visitExp s e)
| visitExp s (INT2VECexp (sz,e)) = (case visitExp s e of
VEC2INTexp (sz,e) => e
| e => INT2VECexp (sz, e)
)
| visitExp s (CLOSUREexp (t,sym,es)) = CLOSUREexp (t,sym,map (visitExp s) es)
| visitExp s (STATEexp (b,t,e)) =
let
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment