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