aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/compiler.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2010-12-24 12:51:46 -0500
committerGravatar Adam Chlipala <adam@chlipala.net>2010-12-24 12:51:46 -0500
commit64b7c504f9c1651a11f29a32a0c0ef5db6fdc982 (patch)
tree2290cc76b2c5aad02afa9fef6639f8176913368f /src/compiler.sml
parentf7fb87aa9fdff765a3b0c862a3d262968b2977f1 (diff)
Add an extra Especialize pass before Rpcify
Diffstat (limited to 'src/compiler.sml')
-rw-r--r--src/compiler.sml34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/compiler.sml b/src/compiler.sml
index 67c94d91..0c0a527f 100644
--- a/src/compiler.sml
+++ b/src/compiler.sml
@@ -133,6 +133,21 @@ fun runPrint (tr : ('src, 'dst) transform) input =
Print.print (#print tr v);
print "\n"))
+fun runPrintToFile (tr : ('src, 'dst) transform) input fname =
+ (ErrorMsg.resetErrors ();
+ case #func tr input of
+ NONE => print "Failure\n"
+ | SOME v =>
+ let
+ val outf = TextIO.openOut fname
+ val str = Print.openOut {dst = outf, wid = 80}
+ in
+ print "Success\n";
+ Print.fprint str (#print tr v);
+ Print.PD.PPS.closeStream str;
+ TextIO.closeOut outf
+ end)
+
fun time (tr : ('src, 'dst) transform) input =
let
val (_, pmap) = #time tr (input, [])
@@ -159,6 +174,18 @@ fun timePrint (tr : ('src, 'dst) transform) input =
print "\n")
end
+fun runPrintCoreFuncs (tr : ('src, Core.file) transform) input =
+ (ErrorMsg.resetErrors ();
+ case #func tr input of
+ NONE => print "Failure\n"
+ | SOME file =>
+ (print "Success\n";
+ app (fn (d, _) =>
+ case d of
+ Core.DVal (x, _, t, _, _) => Print.preface(x, CorePrint.p_con CoreEnv.empty t)
+ | Core.DValRec xts => app (fn (x, _, t, _, _) => Print.preface(x, CorePrint.p_con CoreEnv.empty t)) xts
+ | _ => ()) file))
+
val parseUrs =
{func = fn filename => let
val fname = OS.FileSys.tmpName ()
@@ -1060,12 +1087,15 @@ val shake = {
val toShake1 = transform shake "shake1" o toCore_untangle
+val toEspecialize1' = transform especialize "especialize1'" o toShake1
+val toShake1' = transform shake "shake1'" o toEspecialize1'
+
val rpcify = {
func = Rpcify.frob,
print = CorePrint.p_file CoreEnv.empty
}
-val toRpcify = transform rpcify "rpcify" o toShake1
+val toRpcify = transform rpcify "rpcify" o toShake1'
val toCore_untangle2 = transform core_untangle "core_untangle2" o toRpcify
val toShake2 = transform shake "shake2" o toCore_untangle2
@@ -1264,7 +1294,7 @@ fun compileC {cname, oname, ename, libs, profile, debug, link = link'} =
^ " " ^ #compile proto
^ " -c " ^ cname ^ " -o " ^ oname
- val link = "gcc -Werror -O3 -lm -pthread " ^ Config.gccArgs ^ " " ^ libs ^ " " ^ lib ^ " " ^ mhash ^ " " ^ oname
+ val link = "gcc -Werror -O3 -lm -lcrypt -pthread " ^ Config.gccArgs ^ " " ^ libs ^ " " ^ lib ^ " " ^ mhash ^ " " ^ oname
^ " -o " ^ ename
val (compile, link) =