packages feed

linearscan-hoopl 0.9.2 → 0.10.0

raw patch · 4 files changed

+84/−81 lines, 4 filesdep ~linearscandep ~linearscan-hoopl

Dependency ranges changed: linearscan, linearscan-hoopl

Files

linearscan-hoopl.cabal view
@@ -1,5 +1,5 @@ name:          linearscan-hoopl-version:       0.9.2+version:       0.10.0 synopsis:      Makes it easy to use the linearscan register allocator with Hoopl homepage:      http://github.com/jwiegley/linearscan-hoopl license:       BSD3@@ -27,7 +27,7 @@   build-depends:           base       >=4.7 && <5     , hoopl      >= 3.10.0.1-    , linearscan >= 0.9.0+    , linearscan >= 0.10.0     , containers     , transformers     , free@@ -53,8 +53,8 @@     , hspec              >= 1.4.4     , hspec-expectations >= 0.3     , hoopl              >= 3.10.0.1 && < 3.11-    , linearscan         >= 0.9.0-    , linearscan-hoopl   >= 0.9.0+    , linearscan         >= 0.10.0+    , linearscan-hoopl   >= 0.10.0     , containers         >= 0.5.5     , transformers       >= 0.3.0.0     , lens-family-core
test/Assembly.hs view
@@ -122,20 +122,14 @@                         (v1, Either PhysReg VarId -> [VarInfo]) v2 instrVars f = go   where-    go Nop = pure Nop-    go (Add s1 s2 d1) =-        Add <$> f (s1, vinfos Input)-            <*> f (s2, vinfos Input)-            <*> f (d1, vinfos Output)-    go (Offp x1 x2 x3) =-        Offp <$> f (x1, vinfos Input)-             <*> f (x2, vinfos Input)-             <*> f (x3, vinfos Output)-    -- jww (2015-08-25): I need to deal with the possibility that different-    -- registers are allocated for the input and output sides.-    go (Offlpi x) =-        Offlpi <$> f (x, vinfos Input -- <> vinfos Output-                     )+    go Nop             = pure Nop+    go (Add s1 s2 d1)  = Add <$> f (s1, vinfos Input)+                             <*> f (s2, vinfos Input)+                             <*> f (d1, vinfos Output)+    go (Offp x1 x2 x3) = Offp <$> f (x1, vinfos Input)+                              <*> f (x2, vinfos Input)+                              <*> f (x3, vinfos Output)+    go (Offlpi x)      = Offlpi <$> f (x, vinfos InputOutput)  -- Traverse the input and temp/output variables of each instruction. variables :: Applicative f@@ -149,7 +143,7 @@       where         blockRegs2to16 = [ vinfo Output (Left n) | n <- [2..16] ] -    go (Reclaim src)          = Reclaim <$> f (src, vinfos Output)+    go (Reclaim src)          = Reclaim <$> f (src, vinfos InputOutput)     go (Instr i)              = Instr <$> sequenceA (over instrVars f i)     go (LoadConst c dst)      = LoadConst c <$> f (dst, vinfos Output)     go (Move src dst)         = Move <$> f (src, vinfos Input)@@ -261,8 +255,6 @@         go (VirtualIV  n, k) = case k (Right n) of             [] -> error "No kind assigned to variable"             v : _ ->-                -- jww (2015-08-25): Must handle multiple roles by-                -- introducing move instructions.                 Assign n (fromMaybe (-1) (Data.List.lookup (n, varKind v) m))      mkMoveOps sreg svar dreg =
test/Generated.hs view
@@ -97,7 +97,7 @@  generatedTests :: SpecWith () generatedTests = it "Handles generated tests" $ do-  res <- quickCheckWithResult stdArgs { maxSuccess = 1000 } $+  res <- quickCheckWithResult stdArgs { maxSuccess = 1000000000 } $       forAll arbitrary testGraph   isSuccess res `shouldBe` True 
test/Main.hs view
@@ -8,25 +8,28 @@ import Generated import LinearScan (UseVerifier(..)) import LinearScan.Hoopl.DSL--- import Programs.Blocked+import Programs.Allocation+import Programs.Allocation2+import Programs.Allocation3+import Programs.Allocation4+import Programs.Allocation5+import Programs.Allocation6+import Programs.Assignment+import Programs.Blocked+import Programs.BranchAlloc import Programs.Exhaustion+import Programs.Incoming import Programs.Ordered import Programs.Overcommit-import Programs.Incoming+import Programs.Overlapped+import Programs.Reservation import Programs.Residency import Programs.Residency2 import Programs.Residency3-import Programs.BranchAlloc-import Programs.Returned import Programs.Restoration-import Programs.Allocation-import Programs.Allocation2-import Programs.Allocation3-import Programs.Allocation4-import Programs.Allocation5-import Programs.UponEntry-import Programs.Overlapped import Programs.ReturnAssign+import Programs.Returned+import Programs.UponEntry import Test.Hspec  -- | The objective of these tests is to present a program to the register@@ -42,26 +45,34 @@   describe "Loop tests" loopTests    describe "Edge-case tests" $ do-    let runTest k = asmTestLiteral VerifyEnabled 32 k Nothing+    -- These tests use the strict verifier     it "Near exhaustion program" $ asmTest_ 32 exhaustion1-    -- it "Blocked register program"                  $ runTest regBlocked-    it "Orders reservations"                       $ runTest regOrdered-    it "Guards against over-committing"            $ runTest overCommitted-    it "Properly reserves incoming registers"      $ runTest regsIncoming-    it "Handles edge-case 1 residency scenario"    $ runTest residency-    it "Handles edge-case 2 residency scenario"    $ runTest residency2-    it "Handles edge-case 3 residency scenario"    $ runTest residency3++    -- These were copied from the generated test output when failures were+    -- found, so in general they are too loose to work under the strict+    -- verifier.+    let runTest k = asmTestLiteral VerifyEnabled 32 k Nothing     it "A case of residency involving branches"    $ runTest branchAlloc-    it "Frees registers properly before returning" $ runTest freeBeforeReturn-    it "Restoration after a graph edge split"      $ runTest restoration-    it "Handles edge-case 1 allocation scenario"   $ runTest allocation-    it "Handles edge-case 2 allocation scenario"   $ runTest allocation2-    it "Handles edge-case 3 allocation scenario"   $ runTest allocation3-    it "Handles edge-case 4 allocation scenario"   $ runTest allocation4-    it "Handles edge-case 5 allocation scenario"   $ runTest allocation5     it "Allocates correctly on block entry"        $ runTest uponEntry-    it "Register over-allocation edge-case"        $ runTest overlapped+    it "Blocked register program"                  $ runTest regBlocked     it "Does not assign after a return_"             $ runTest returnAssign+    it "Frees registers properly before returning" $ runTest freeBeforeReturn+    it "Guards against over-committing"            $ runTest overCommitted+    it "Handles edge-case allocation scenario 1"   $ runTest allocation+    it "Handles edge-case allocation scenario 2"   $ runTest allocation2+    it "Handles edge-case allocation scenario 3"   $ runTest allocation3+    it "Handles edge-case allocation scenario 4"   $ runTest allocation4+    it "Handles edge-case allocation scenario 5"   $ runTest allocation5+    it "Handles edge-case allocation scenario 6"   $ runTest allocation6+    it "Handles edge-case assignment scenario 1"   $ runTest assignment+    it "Handles edge-case reservation scenario 1"  $ runTest reservation+    it "Handles edge-case residency scenario 1"    $ runTest residency+    it "Handles edge-case residency scenario 2"    $ runTest residency2+    it "Handles edge-case residency scenario 3"    $ runTest residency3+    it "Orders reservations"                       $ runTest regOrdered+    it "Properly reserves incoming registers"      $ runTest regsIncoming+    it "Register over-allocation edge-case"        $ runTest overlapped+    it "Restoration after a graph edge split"      $ runTest restoration    describe "Generated tests" generatedTests @@ -892,27 +903,27 @@         return_) $      label "entry" $ do-        lc (r0 v0)-        lc (r3 v1)-        add (r0 v0) (r3 v1) (r2 v2)-        add (r2 v2) (r3 v1) (r1 v3)-        save (r3 v1) 0-        add (r1 v3) (r2 v2) (r3 v4)-        save (r3 v4) 8-        add (r3 v4) (r1 v3) (r3 v5)-        save (r2 v2) 16-        save (r1 v3) 24+        lc (r3 v0)+        lc (r2 v1)+        add (r3 v0) (r2 v1) (r3 v2)+        add (r3 v2) (r2 v1) (r1 v3)+        add (r1 v3) (r3 v2) (r0 v4)+        save (r3 v2) 0+        add (r0 v4) (r1 v3) (r3 v5)+        save (r2 v1) 8+        save (r1 v3) 16+        save (r0 v4) 24         save (r3 v5) 32         call 1000-        restore 16 (r1 v2)-        restore 24 (r2 v3)-        add (r1 v2) (r2 v3) (r1 v6)-        restore 8 (r2 v4)-        restore 32 (r3 v5)-        add (r2 v4) (r3 v5) (r2 v7)-        add (r1 v6) (r2 v7) (r1 v8)-        restore 0 (r2 v1)-        add (r1 v8) (r2 v1) (r0 v0)+        restore 0 (r0 v2)+        restore 16 (r1 v3)+        add (r0 v2) (r1 v3) (r0 v6)+        restore 24 (r1 v4)+        restore 32 (r2 v5)+        add (r1 v4) (r2 v5) (r1 v7)+        add (r0 v6) (r1 v7) (r0 v8)+        restore 8 (r1 v1)+        add (r0 v8) (r1 v1) (r0 v0)         return_    it "Allocates between call instructions" $ asmTest 32@@ -1000,18 +1011,18 @@      label "L2" $ do         lc (r30 v95)-        restore 80 (r1 v90)-        move (r1 v90) (r29 v43)+        restore 80 (r0 v90)+        move (r0 v90) (r29 v43)         save (r29 v43) 104         save (r30 v95) 112         save (r31 v98) 120         call 95         call 64-        restore 72 (r1 v53)-        move (r1 v53) (r1 v58)-        restore 24 (r2 v16)-        restore 120 (r3 v98)-        add (r3 v98) (r2 v16) (r0 v100)+        restore 72 (r0 v53)+        move (r0 v53) (r0 v58)+        restore 24 (r1 v16)+        restore 120 (r2 v98)+        add (r2 v98) (r1 v16) (r1 v100)         restore 8 (r3 v3)         restore 40 (r2 v35)         add (r2 v35) (r3 v3) (r2 v67)@@ -1028,18 +1039,18 @@      label "L4" $ do         nop-        restore 88 (r0 v100)-        move (r0 v100) (r30 v44)-        save (r30 v44) 96+        restore 88 (r31 v100)+        move (r31 v100) (r31 v44)+        save (r31 v44) 96         call 30         call 32         jump "L5"      label "L5" $ do-        lc (r30 v3)-        save (r30 v3) 8+        lc (r31 v3)+        save (r31 v3) 8         call 35-        lc (r1 v73)+        lc (r0 v73)         return_  loopTests :: SpecWith ()