Skip to content

Commit 86c676b

Browse files
committed
Avoid C and LLVM backends when using the SML backend
1 parent 1f6ceee commit 86c676b

File tree

1 file changed

+25
-20
lines changed

1 file changed

+25
-20
lines changed

gibbon-compiler/src/Gibbon/Compiler.hs

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -263,32 +263,37 @@ compile config@Config{mode,input,verbosity,backend,cfile} fp0 = do
263263
let stM = passes config' l0
264264
l4 <- evalStateT stM (CompileState {cnt=cnt0, result=initResult})
265265

266-
if mode == Interp2
267-
then do
268-
error "TODO: Interp2"
269-
-- l4res <- execProg l4
270-
-- mapM_ (\(IntVal v) -> liftIO $ print v) l4res
271-
-- exitSuccess
272-
else do
273-
str <- case backend of
274-
C -> codegenProg config' l4
266+
case mode of
267+
Interp2 -> do
268+
error "TODO: Interp2"
269+
-- l4res <- execProg l4
270+
-- mapM_ (\(IntVal v) -> liftIO $ print v) l4res
271+
-- exitSuccess
272+
273+
ToSML -> return ()
274+
ToMPLExe -> return ()
275+
RunMPL -> return ()
275276

277+
_ -> do
278+
str <- case backend of
279+
C -> codegenProg config' l4
276280

277281

278-
LLVM -> error $ "Cannot execute through the LLVM backend. To build Gibbon with LLVM: "
279-
++ "stack build --flag gibbon:llvm_enabled"
280282

281-
-- The C code is long, so put this at a higher verbosity level.
282-
dbgPrint passChatterLvl $ " [compiler] Final C codegen: " ++show (length str) ++" characters."
283-
dbgPrintLn 4 $ sepline ++ "\n" ++ str
283+
LLVM -> error $ "Cannot execute through the LLVM backend. To build Gibbon with LLVM: "
284+
++ "stack build --flag gibbon:llvm_enabled"
284285

285-
clearFile outfile
286-
writeFile outfile str
286+
-- The C code is long, so put this at a higher verbosity level.
287+
dbgPrint passChatterLvl $ " [compiler] Final C codegen: " ++show (length str) ++" characters."
288+
dbgPrintLn 4 $ sepline ++ "\n" ++ str
287289

288-
-- (Stage 3) Code written, now compile if warranted.
289-
when (mode == ToExe || mode == RunExe || isBench mode ) $ do
290-
compileAndRunExe config fp >>= putStr
291-
return ()
290+
clearFile outfile
291+
writeFile outfile str
292+
293+
-- (Stage 3) Code written, now compile if warranted.
294+
when (mode == ToExe || mode == RunExe || isBench mode ) $ do
295+
compileAndRunExe config fp >>= putStr
296+
return ()
292297

293298
runL0 :: L0.Prog0 -> IO ()
294299
runL0 l0 = do

0 commit comments

Comments
 (0)