on f0a67ff help sign in
Idris-dev/src/IRTS/CodegenCommon.hs
41 lines 1.2 kB history raw
1{-|
2Module : IRTS.CodegenCommon
3Description : Common data structures required for all code generators.
4Copyright :
5License : BSD3
6Maintainer : The Idris Community.
7-}
8module IRTS.CodegenCommon where
10import Idris.Core.TT
11import IRTS.Simplified
12import IRTS.Defunctionalise
14data DbgLevel = NONE | DEBUG | TRACE deriving Eq
15data OutputType = Raw | Object | Executable deriving (Eq, Show)
17-- | Everything which might be needed in a code generator.
18--
19-- A CG can choose which level of Decls to generate code from
20-- (simplified, defunctionalised or merely lambda lifted) and has
21-- access to the list of object files, libraries, etc.
23data CodegenInfo = CodegenInfo {
24 outputFile :: String
25 , outputType :: OutputType
26 , targetTriple :: String
27 , targetCPU :: String
28 , includes :: [FilePath]
29 , importDirs :: [FilePath]
30 , compileObjs :: [String]
31 , compileLibs :: [String]
32 , compilerFlags :: [String]
33 , debugLevel :: DbgLevel
34 , simpleDecls :: [(Name, SDecl)]
35 , defunDecls :: [(Name, DDecl)]
36 , liftDecls :: [(Name, LDecl)]
37 , interfaces :: Bool
38 , exportDecls :: [ExportIFace]
39 }
41type CodeGenerator = CodegenInfo -> IO ()