Added a function to check the parameters passed to a proc call against each other for safe usage (CREW)
This commit is contained in:
parent
4bbb3f86d7
commit
48384746d0
|
@ -49,6 +49,7 @@ usageCheckPass t = do g' <- buildFlowGraph labelFunctions t
|
|||
Right g -> return g
|
||||
sequence_ $ checkPar (joinCheckParFunctions checkArrayUsage checkPlainVarUsage) g
|
||||
checkParAssignUsage t
|
||||
checkProcCallArgsUsage t
|
||||
-- TODO add checkInitVar here (need to find roots in the tree)
|
||||
return t
|
||||
|
||||
|
@ -189,3 +190,21 @@ checkParAssignUsage = mapM_ checkParAssign . listify isParAssign
|
|||
where
|
||||
mockedupParItems :: ParItems (Maybe Decl, Vars)
|
||||
mockedupParItems = ParItems [SeqItems [(Nothing, processVarW v)] | v <- vs]
|
||||
|
||||
|
||||
checkProcCallArgsUsage :: forall m t. (CSM m, Die m, Data t) => t -> m ()
|
||||
checkProcCallArgsUsage = mapM_ checkArgs . listify isProcCall
|
||||
where
|
||||
isProcCall :: A.Process -> Bool
|
||||
isProcCall (A.ProcCall {}) = True
|
||||
isProcCall _ = False
|
||||
|
||||
-- | Need to check that all the destinations in a parallel assignment
|
||||
-- are distinct. So we check plain variables, and array variables
|
||||
checkArgs :: A.Process -> m ()
|
||||
checkArgs (A.ProcCall m _ params)
|
||||
= do checkPlainVarUsage (m, mockedupParItems)
|
||||
checkArrayUsage (m, mockedupParItems)
|
||||
where
|
||||
mockedupParItems :: ParItems (Maybe Decl, Vars)
|
||||
mockedupParItems = ParItems [SeqItems [(Nothing, v)] | v <- map getVarActual params]
|
||||
|
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along
|
|||
with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-}
|
||||
|
||||
module UsageCheckUtils (customVarCompare, Decl(..), emptyVars, foldUnionVars, getVarProc, labelFunctions, mapUnionVars, ParItems(..), processVarW, transformParItems, Var(..), Vars(..), vars) where
|
||||
module UsageCheckUtils (customVarCompare, Decl(..), emptyVars, foldUnionVars, getVarActual, getVarProc, labelFunctions, mapUnionVars, ParItems(..), processVarW, transformParItems, Var(..), Vars(..), vars) where
|
||||
|
||||
import Data.Generics hiding (GT)
|
||||
import Data.List
|
||||
|
|
Loading…
Reference in New Issue
Block a user