diff options
author | tomsmeding <tom.smeding@gmail.com> | 2017-01-30 08:44:30 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2017-01-30 08:44:30 +0100 |
commit | 462be93d0eb03e48b92e41a3e653c955f639bb0b (patch) | |
tree | d57d00183a101849ac3edd6de35e6c63ea68eeb7 | |
parent | 8f444b0c2a6d468a596949926eccf1edf932d4df (diff) |
Fix functions with no arguments
-rw-r--r-- | codegen.hs | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -284,7 +284,9 @@ genFunctionBlock bl args = do bodybb <- genBlock bl termbb changeBlock firstbb setTerminator $ A.Br (A.Name bodybb) [] - return firstbb + if length args > 0 + then return firstbb + else return bodybb genBlock :: Block -> LLName -- name of BasicBlock following this Block @@ -562,9 +564,7 @@ commonTypeM t1 t2 = maybe err return $ commonType t1 t2 cleanupTrampolines :: CGMonad () cleanupTrampolines = do - st <- get - let newblocks = go (allBlocks st) - put $ st {allBlocks = newblocks} + state $ \s -> ((), s {allBlocks = go (allBlocks s)}) where go :: Map.Map LLName A.BasicBlock -> Map.Map LLName A.BasicBlock go bbs = folder bbs (Map.toList bbs) |