From f1b0775be806685521b162673c5a4051eb95439e Mon Sep 17 00:00:00 2001 From: Tristan Ravitch Date: Wed, 13 Dec 2017 21:56:29 -0800 Subject: [PATCH] Update to the new parameterized-utils List This replaces the old ShapedList from dismantle-tablegen --- cabal.project.dist | 2 ++ macaw-ppc/src/Data/Macaw/PPC/Arch.hs | 16 ++++++++-------- macaw-semmc/src/Data/Macaw/SemMC/TH.hs | 16 ++++++++-------- submodules/crucible | 2 +- submodules/dismantle | 2 +- submodules/parameterized-utils | 2 +- submodules/semmc | 2 +- 7 files changed, 22 insertions(+), 20 deletions(-) diff --git a/cabal.project.dist b/cabal.project.dist index 5241a608..151c8c06 100644 --- a/cabal.project.dist +++ b/cabal.project.dist @@ -5,6 +5,8 @@ packages: macaw-ppc/ submodules/semmc/semmc-ppc/ submodules/dismantle/dismantle-tablegen/ submodules/dismantle/dismantle-ppc/ + submodules/dismantle/dismantle-arm/ + submodules/dismantle/dismantle-thumb/ submodules/parameterized-utils/ submodules/crucible/crucible/ submodules/crucible/galois-matlab/ diff --git a/macaw-ppc/src/Data/Macaw/PPC/Arch.hs b/macaw-ppc/src/Data/Macaw/PPC/Arch.hs index b84bd920..f18e4369 100644 --- a/macaw-ppc/src/Data/Macaw/PPC/Arch.hs +++ b/macaw-ppc/src/Data/Macaw/PPC/Arch.hs @@ -237,43 +237,43 @@ ppcInstructionMatcher (D.Instruction opc operands) = D.ISYNC -> Just (G.addStmt (MC.ExecArchStmt Isync)) D.DCBA -> case operands of - D.Memrr memrr D.:> D.Nil -> Just $ do + D.Memrr memrr D.:< D.Nil -> Just $ do ea <- memrrToEffectiveAddress memrr G.addStmt (MC.ExecArchStmt (Dcba ea)) D.DCBF -> case operands of - D.Memrr memrr D.:> D.Nil -> Just $ do + D.Memrr memrr D.:< D.Nil -> Just $ do ea <- memrrToEffectiveAddress memrr G.addStmt (MC.ExecArchStmt (Dcbf ea)) D.DCBI -> case operands of - D.Memrr memrr D.:> D.Nil -> Just $ do + D.Memrr memrr D.:< D.Nil -> Just $ do ea <- memrrToEffectiveAddress memrr G.addStmt (MC.ExecArchStmt (Dcbi ea)) D.DCBST -> case operands of - D.Memrr memrr D.:> D.Nil -> Just $ do + D.Memrr memrr D.:< D.Nil -> Just $ do ea <- memrrToEffectiveAddress memrr G.addStmt (MC.ExecArchStmt (Dcbst ea)) D.DCBZ -> case operands of - D.Memrr memrr D.:> D.Nil -> Just $ do + D.Memrr memrr D.:< D.Nil -> Just $ do ea <- memrrToEffectiveAddress memrr G.addStmt (MC.ExecArchStmt (Dcbz ea)) D.DCBZL -> case operands of - D.Memrr memrr D.:> D.Nil -> Just $ do + D.Memrr memrr D.:< D.Nil -> Just $ do ea <- memrrToEffectiveAddress memrr G.addStmt (MC.ExecArchStmt (Dcbzl ea)) D.DCBT -> case operands of - D.Memrr memrr D.:> D.U5imm imm D.:> D.Nil -> Just $ do + D.Memrr memrr D.:< D.U5imm imm D.:< D.Nil -> Just $ do ea <- memrrToEffectiveAddress memrr th <- O.extractValue imm G.addStmt (MC.ExecArchStmt (Dcbt ea th)) D.DCBTST -> case operands of - D.Memrr memrr D.:> D.U5imm imm D.:> D.Nil -> Just $ do + D.Memrr memrr D.:< D.U5imm imm D.:< D.Nil -> Just $ do ea <- memrrToEffectiveAddress memrr th <- O.extractValue imm G.addStmt (MC.ExecArchStmt (Dcbtst ea th)) diff --git a/macaw-semmc/src/Data/Macaw/SemMC/TH.hs b/macaw-semmc/src/Data/Macaw/SemMC/TH.hs index 23f82cee..3b224763 100644 --- a/macaw-semmc/src/Data/Macaw/SemMC/TH.hs +++ b/macaw-semmc/src/Data/Macaw/SemMC/TH.hs @@ -42,7 +42,7 @@ import qualified Data.Parameterized.Lift as LF import qualified Data.Parameterized.Map as Map import qualified Data.Parameterized.NatRepr as NR import qualified Data.Parameterized.Nonce as PN -import qualified Data.Parameterized.ShapedList as SL +import qualified Data.Parameterized.List as SL import Data.Parameterized.Some ( Some(..) ) import qualified Data.Parameterized.TraversableFC as FC import Data.Parameterized.Witness ( Witness(..) ) @@ -184,7 +184,7 @@ genCaseBody :: forall a sh t arch -> Name -> a sh -> ParameterizedFormula (Sym t) arch sh - -> SL.ShapedList (FreeParamF Name) sh + -> SL.List (FreeParamF Name) sh -> Q Exp genCaseBody ltr ena ae ipVarName _opc semantics varNames = do regsName <- newName "_regs" @@ -194,7 +194,7 @@ genCaseBody ltr ena ae ipVarName _opc semantics varNames = do locVarsMap = Map.foldrWithKey (collectVarForLocation (Proxy @arch)) Map.empty (pfLiteralVars semantics) opVarsMap :: Map.MapF (SI.BoundVar (Sym t)) (FreeParamF Name) - opVarsMap = SL.foldrFCIndexed (collectOperandVars varNames) Map.empty (pfOperandVars semantics) + opVarsMap = SL.ifoldr (collectOperandVars varNames) Map.empty (pfOperandVars semantics) collectVarForLocation :: forall tp arch proxy t . proxy arch @@ -215,13 +215,13 @@ collectVarForLocation _ loc bv = Map.insert bv loc -- SemMC.BoundVar module for information about the nature of that change -- (basically, from 'Symbol' to BaseType). collectOperandVars :: forall sh tp arch t - . SL.ShapedList (FreeParamF Name) sh + . SL.List (FreeParamF Name) sh -> SL.Index sh tp -> BV.BoundVar (Sym t) arch tp -> Map.MapF (SI.BoundVar (Sym t)) (FreeParamF Name) -> Map.MapF (SI.BoundVar (Sym t)) (FreeParamF Name) collectOperandVars varNames ix (BV.BoundVar bv) m = - case SL.indexShapedList varNames ix of + case varNames SL.!! ix of FreeParamF name -> Map.insert bv (FreeParamF name) m -- | Generate an implementation of 'execInstruction' that runs in the @@ -300,7 +300,7 @@ translateFormula :: forall arch t sh . -> Name -> ParameterizedFormula (Sym t) arch sh -> BoundVarInterpretations arch t - -> SL.ShapedList (FreeParamF Name) sh + -> SL.List (FreeParamF Name) sh -> Q Exp translateFormula ltr ena ae ipVarName semantics interps varNames = do let preamble = [ bindS (varP (regsValName interps)) [| G.getRegs |] ] @@ -311,7 +311,7 @@ translateFormula ltr ena ae ipVarName semantics interps varNames = do translateDefinition (Map.Pair param expr) = do case param of OperandParameter _w idx -> do - let FreeParamF name = varNames `SL.indexShapedList` idx + let FreeParamF name = varNames SL.!! idx newVal <- addEltTH interps expr appendStmt [| G.setRegVal (O.toRegister $(varE name)) $(return newVal) |] LiteralParameter loc @@ -320,7 +320,7 @@ translateFormula ltr ena ae ipVarName semantics interps varNames = do valExp <- addEltTH interps expr appendStmt [| G.setRegVal $(ltr loc) $(return valExp) |] FunctionParameter str (WrappedOperand _ opIx) _w -> do - let FreeParamF boundOperandName = SL.indexShapedList varNames opIx + let FreeParamF boundOperandName = varNames SL.!! opIx case lookup str (A.locationFuncInterpretation (Proxy @arch)) of Nothing -> fail ("Function has no definition: " ++ str) Just fi -> do diff --git a/submodules/crucible b/submodules/crucible index 410f4ceb..d91a6299 160000 --- a/submodules/crucible +++ b/submodules/crucible @@ -1 +1 @@ -Subproject commit 410f4ceb253f4d908fb1e8104418e0c1fce686f0 +Subproject commit d91a62996c5d4b5fd597f381c89488aa6e6f6319 diff --git a/submodules/dismantle b/submodules/dismantle index e14f7398..b101733e 160000 --- a/submodules/dismantle +++ b/submodules/dismantle @@ -1 +1 @@ -Subproject commit e14f73980ff6a3de326d404402f1cbda63f98555 +Subproject commit b101733e2e5ceb04f16cdf0e5b1a80983c94a976 diff --git a/submodules/parameterized-utils b/submodules/parameterized-utils index 3e91cb7e..e1b2c3f6 160000 --- a/submodules/parameterized-utils +++ b/submodules/parameterized-utils @@ -1 +1 @@ -Subproject commit 3e91cb7efffe13b08fea7e81b5aebb81a9cd625f +Subproject commit e1b2c3f6b1f86b38336777fafa01e0dccd444616 diff --git a/submodules/semmc b/submodules/semmc index 7d6e4b93..70a066a2 160000 --- a/submodules/semmc +++ b/submodules/semmc @@ -1 +1 @@ -Subproject commit 7d6e4b93028153ec10459e7b3bf0aa7635bb3e54 +Subproject commit 70a066a282a91b56dd96031c31bf66db788b1b88