SCM Repository
View of /branches/charisee/src/compiler/tree-il/tree-Cfn.sml
Parent Directory
|
Revision Log
Revision 2632 -
(download)
(annotate)
Fri May 23 18:57:58 2014 UTC (6 years, 8 months ago) by jhr
File size: 2247 byte(s)
Fri May 23 18:57:58 2014 UTC (6 years, 8 months ago) by jhr
File size: 2247 byte(s)
various changes
(* Exp to Function name *) structure TreetoCFN= struct structure Op = TreeOps structure Ty = TreeILTypes structure IL=TreeIL structure CE=clangEin structure Cfn = Cfn val default=[] val defaultExp="Exp-default" fun q n=Int.toString n (*Returns names for functions*) fun OptoCString rator = [](*(case rator of Op.prodScaV n => CE.applyfn(CE.rtnVec n,CE.scale n,CE. Sconcat [CE.argReal,CE.argVec n]) | Op.sumVec n => CE.applyfn(CE.rtnReal, CE.sum n,CE.argVec n) | Op.imgAddr _ => default | Op.imgLoad _ => default | _ => default (* end case *))*) fun flat [] = [] | flat (l::ls) = l @ flat ls; (*return:resultTy and fnName*) fun ExptoCString2 exp=(case exp of IL.E_Op(Op, exps) =>let val fnName = OptoCString Op val argName=flat(List.map ExptoCString2 exps) in fnName@argName end | IL.E_LoadVec(fullTy, origTy, exp, offset) => [] (*[Cfn.ldVec (fullTy, origTy, offset)] @(ExptoCString2 exp) *) | IL.E_mkVec(fullTy,origTy,Ty.vectorLength peices,exps) =>let val argName= flat(List.map ExptoCString2 exps) in [Cfn.mkVec(origTy)]@argName end | IL.E_Cons _ => [] | IL.E_Var _ => [] | IL.E_Lit _ => [] | _=>[] (*end case*)) (*IL.E_Cfn*) fun ExptoCfnPnt(IL.S_Assign (_,exp))= let val b= ExptoCString2 exp val a=String.concatWith "\n\t\t" (List.map Cfn.toString b) val _=print("\n \t C-Function names:\n \t\t ") val _=print a in b end (*Filter Types, Just one of each *) fun m([],rest)=rest | m (e1::es, rest)=(case (List.find(fn x=> (x=e1)) rest) of NONE=> m (es, rest@[e1]) | _ => m (es, rest) (*end case*)) fun gotFiltered []= (print(String.concat["\n \t No Function Name"]);1) | gotFiltered fnName= let val names=m (fnName,[]) val a=String.concatWith "\n\t\t" (List.map Cfn.toString names) val pnstr= print(String.concat[" Final C-function Calls:\n ","\n\n "]) in 1 end end
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |