From 512985277bf70e425ab6e96b3aea69ba91426afc Mon Sep 17 00:00:00 2001 From: Vladimir Azarov Date: Mon, 11 Aug 2025 01:58:25 +0200 Subject: Removal of register reassignment in allocator --- driver.fun | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'driver.fun') diff --git a/driver.fun b/driver.fun index 0f80f41..19adcaa 100644 --- a/driver.fun +++ b/driver.fun @@ -42,7 +42,19 @@ functor Driver(E: EMIT): DRIVER = struct parseFlag C arg tail else case file of - NONE => parseCmdArgs (updateC C s#file (SOME arg) %) tail + NONE => + let + val size = size arg + in + if String.extract (arg, size - 2, NONE) <> ".c" then + die `arg `": expected file with .c suffix" % + else + let + val file = String.substring (arg, 0, size - 2) + in + parseCmdArgs (updateC C s#file (SOME file) %) tail + end + end | SOME _ => die `arg `": file already specified" % fun exec () = @@ -53,7 +65,7 @@ functor Driver(E: EMIT): DRIVER = struct case (#mode config) of Normal => let - val parseCtx = P.createCtx file (#includeDirs config) + val parseCtx = P.createCtx file (#includeDirs config) true fun collect ctx = let @@ -67,9 +79,9 @@ functor Driver(E: EMIT): DRIVER = struct val parseCtx = collect parseCtx val progInfo = P.explode parseCtx - val ilCtx = I.createCtx progInfo + val ilCtx = I.createCtx progInfo (SOME $ file ^ ".i") in - E.emit "/tmp/prog.s" ilCtx + E.emit (file ^ ".s") ilCtx (SOME $ file ^ ".e") end | DebugT => P.P.T.debugPrint file | DebugE => P.P.debugPrint file (#includeDirs config) -- cgit v1.2.3