summaryrefslogtreecommitdiff
path: root/driver.fun
diff options
context:
space:
mode:
authorVladimir Azarov <avm@intermediate-node.net>2025-08-11 01:58:25 +0200
committerVladimir Azarov <avm@intermediate-node.net>2025-08-11 01:58:25 +0200
commit512985277bf70e425ab6e96b3aea69ba91426afc (patch)
tree01c2326749caa9616947e995d87686fc86223713 /driver.fun
parent66665caf9da212c121c99de95a18e6ae3470cdbc (diff)
Removal of register reassignment in allocator
Diffstat (limited to 'driver.fun')
-rw-r--r--driver.fun20
1 files changed, 16 insertions, 4 deletions
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)