Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extended Syntax: LVA fix #97

Merged
merged 5 commits into from
Apr 26, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
ES: fixed external liveness handling in LVA
  • Loading branch information
Anabra committed Jan 28, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit d095ce329654c9aeed07696a6fe15ab1182c9517
Original file line number Diff line number Diff line change
@@ -23,8 +23,6 @@ import qualified AbstractInterpretation.ExtendedSyntax.IR as IR
import AbstractInterpretation.ExtendedSyntax.IR (Instruction(..), AbstractProgram(..), AbstractMapping(..))
import AbstractInterpretation.ExtendedSyntax.LiveVariable.CodeGenBase

import AbstractInterpretation.ExtendedSyntax.EffectTracking.Result

-- NOTE: For a live variable, we could store its type information.

-- Live variable analysis program.
@@ -400,17 +398,20 @@ codeGenM e = (cata folder >=> const setMainLive) e
argRegs <- mapM getReg args

mExt <- getExternal name
(funResultReg, funArgRegs) <- getOrAddFunRegs name $ length args
varPatternDataFlow appReg funResultReg

case mExt of
Nothing -> do -- regular function
(funResultReg, funArgRegs) <- getOrAddFunRegs name $ length args
-- no effect data-flow between formal and actual arguments
zipWithM_ livenessDataFlow funArgRegs argRegs
zipWithM_ (\src dst -> emit $ copyStructureWithPtrInfo src dst) argRegs funArgRegs

varPatternDataFlow appReg funResultReg
Just ext | eEffectful ext -> do mapM_ setBasicValLive argRegs
mapM_ setBasicValLive funArgRegs
setBasicValSideEffecting appReg
| otherwise -> do allArgsLive <- codeGenBlock_ $ mapM_ setBasicValLive argRegs
| otherwise -> do allArgsLive <- codeGenBlock_ $ do
mapM_ setBasicValLive argRegs
mapM_ setBasicValLive funArgRegs
emit $ appReg `isLiveThen` allArgsLive

pure $ R appReg