module Helium.CodeGeneration.CoreToLvm ( coreToLvm ) where
import Lvm.Core.Expr (CoreModule)
import Lvm.Common.Id (newNameSupply)
import Lvm.Core.ToAsm (coreToAsm)
import Lvm.Asm.ToLvm (asmToLvm)
import Lvm.Asm.Inline (asmInline)
import Lvm.Write (lvmWriteFile)
coreToLvm :: [Char] -> CoreModule -> IO ()
coreToLvm source coremod = do
nameSupply <- newNameSupply
let asmmod = coreToAsm nameSupply coremod
asmopt = asmInline asmmod
lvmmod = asmToLvm asmopt
target = source ++ ".lvm"
lvmWriteFile target lvmmod