Added a new csExtraSizes item to CompState and adjusted Main to work with that and the new AnalyseAsm
This commit is contained in:
parent
5f5dac41d1
commit
54175f1a08
10
Main.hs
10
Main.hs
|
@ -332,7 +332,7 @@ compileFull inputFile moutputFile
|
||||||
when (csHasMain optsPS) $ do
|
when (csHasMain optsPS) $ do
|
||||||
withOutputFile postCFile $ \h ->
|
withOutputFile postCFile $ \h ->
|
||||||
computeFinalStackSizes searchReadFile (csUnknownStackSize cs)
|
computeFinalStackSizes searchReadFile (csUnknownStackSize cs)
|
||||||
sizes >>= (liftIO . hPutStr h)
|
(Meta (Just sizesFile) 1 1) sizes >>= (liftIO . hPutStr h)
|
||||||
|
|
||||||
-- Compile this new "post" C file into an object file
|
-- Compile this new "post" C file into an object file
|
||||||
exec $ cCommand postCFile postOFile (csCompilerFlags optsPS)
|
exec $ cCommand postCFile postOFile (csCompilerFlags optsPS)
|
||||||
|
@ -387,8 +387,9 @@ compileFull inputFile moutputFile
|
||||||
ExitSuccess -> return ()
|
ExitSuccess -> return ()
|
||||||
ExitFailure n -> dieReport (Nothing, "Command \"" ++ cmd ++ "\" failed: exited with code: " ++ show n)
|
ExitFailure n -> dieReport (Nothing, "Command \"" ++ cmd ++ "\" failed: exited with code: " ++ show n)
|
||||||
|
|
||||||
searchReadFile :: String -> StateT [FilePath] PassM String
|
searchReadFile :: Meta -> String -> StateT [FilePath] PassM String
|
||||||
searchReadFile fn = do (h, _) <- lift $ searchFile emptyMeta (fn++".tock.sizes")
|
searchReadFile m fn
|
||||||
|
= do (h, _) <- lift $ searchFile m fn
|
||||||
liftIO $ hGetContents h
|
liftIO $ hGetContents h
|
||||||
-- Don't use hClose because hGetContents is lazy
|
-- Don't use hClose because hGetContents is lazy
|
||||||
|
|
||||||
|
@ -522,7 +523,8 @@ postCAnalyse fn ((outHandle, _), _)
|
||||||
cs <- getCompState
|
cs <- getCompState
|
||||||
|
|
||||||
progress "Analysing assembly"
|
progress "Analysing assembly"
|
||||||
output <- analyseAsm (Just $ map A.nameName names) (Set.toList $ csUsedFiles cs) asm
|
output <- analyseAsm (Just $ map A.nameName names)
|
||||||
|
(map (++ ".tock.sizes") $ csExtraSizes cs ++ Set.toList (csUsedFiles cs)) asm
|
||||||
|
|
||||||
liftIO $ hPutStr outHandle output
|
liftIO $ hPutStr outHandle output
|
||||||
|
|
||||||
|
|
|
@ -120,9 +120,12 @@ data CompState = CompState {
|
||||||
csUnknownStackSize :: Integer,
|
csUnknownStackSize :: Integer,
|
||||||
csSearchPath :: [String],
|
csSearchPath :: [String],
|
||||||
csImplicitModules :: [String],
|
csImplicitModules :: [String],
|
||||||
|
-- Extra sizes files to look up. These are stored without the tock suffix
|
||||||
|
csExtraSizes :: [String],
|
||||||
|
|
||||||
-- Set by preprocessor
|
-- Set by preprocessor
|
||||||
csCurrentFile :: String, -- Also used by some later passes!
|
csCurrentFile :: String, -- Also used by some later passes!
|
||||||
|
-- #USEd files. These are stored with any (known) extensions removed:
|
||||||
csUsedFiles :: Set String,
|
csUsedFiles :: Set String,
|
||||||
csDefinitions :: Map String PreprocDef,
|
csDefinitions :: Map String PreprocDef,
|
||||||
|
|
||||||
|
@ -183,6 +186,7 @@ emptyState = CompState {
|
||||||
csUnknownStackSize = 512,
|
csUnknownStackSize = 512,
|
||||||
csSearchPath = [".", tockIncludeDir],
|
csSearchPath = [".", tockIncludeDir],
|
||||||
csImplicitModules = [],
|
csImplicitModules = [],
|
||||||
|
csExtraSizes = [],
|
||||||
|
|
||||||
csCurrentFile = "none",
|
csCurrentFile = "none",
|
||||||
csUsedFiles = Set.empty,
|
csUsedFiles = Set.empty,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user