Skip to content

Commit

Permalink
Use new pass manager
Browse files Browse the repository at this point in the history
  • Loading branch information
ollef committed Sep 5, 2024
1 parent 45bbc9c commit 2c78e57
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Compiler.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ compile assemblyDir saveAssembly outputExecutableFile maybeOptimisationLevel pri
mainLLVMFile : builtinLLVMFile : moduleInitLLVMFile : moduleLLVMFiles
let optimisationArgs =
maybe [] (\o -> ["-O" <> o]) maybeOptimisationLevel
let optOptimisationArgs =
maybe [] (\o -> ["-passes=default<O" <> o <> ">"]) maybeOptimisationLevel

clang <- liftIO clangBinPath
liftIO
if saveAssembly
Expand All @@ -79,7 +82,7 @@ compile assemblyDir saveAssembly outputExecutableFile maybeOptimisationLevel pri
callProcess clang $ optimisationArgs <> ["-fPIC", "-Wno-override-module", "-S", "-emit-llvm", "-o", builtinCLLFile, builtinCFile]
callProcess clang $ optimisationArgs <> ["-fPIC", "-Wno-override-module", "-S", "-emit-llvm", "-o", memoryLLFile, memoryCFile]
callProcess (llvmBin </> "llvm-link") $ ["-S", "-o", linkedProgramName, builtinCLLFile, memoryLLFile] <> llvmFiles
callProcess (llvmBin </> "opt") $ optimisationArgs <> ["-S", "-o", optimisedProgramName, linkedProgramName]
callProcess (llvmBin </> "opt") $ optOptimisationArgs <> ["-S", "-o", optimisedProgramName, linkedProgramName]
callProcess clang $ optimisationArgs <> ["-fPIC", "-Wno-override-module", "-o", outputExecutableFile, linkedProgramName]
else callProcess clang $ optimisationArgs <> ["-fPIC", "-Wno-override-module", "-o", outputExecutableFile, builtinCFile, memoryCFile] <> llvmFiles

Expand Down

0 comments on commit 2c78e57

Please sign in to comment.