remove trailing whitespace

This commit is contained in:
Csaba Hruska 2018-11-27 12:25:29 +01:00
parent b0dd938d35
commit a743a3b4e8
63 changed files with 180 additions and 194 deletions

View File

@ -42,4 +42,3 @@ grinMain =
_prim_int_mul nasu kuri
36560 -> pure kuri
_prim_int_print meyu

View File

@ -239,7 +239,7 @@ test-suite grin-test
, DeadCodeElimination.Tests.DeadParam.MutuallyRecursive
, DeadCodeElimination.Tests.DeadParam.Spec
, DeadCodeElimination.Tests.DeadParam.Util
, DeadCodeElimination.Tests.DeadVariable.Simple
, DeadCodeElimination.Tests.DeadVariable.Heap
, DeadCodeElimination.Tests.DeadVariable.Update
@ -291,7 +291,7 @@ test-suite grin-test
, LiveVariable.Tests.UndefinedWithLocInfo
, LiveVariable.Tests.Util
, Parse.ParseSpec
, Parse.ParseSpec
, Parse.Tests.Interleaved
, Parse.Tests.PureUndefined
, Parse.Tests.StoreUndefined

View File

@ -8,4 +8,4 @@ grinMain =
f x =
case x of
(CNode c2 c3) -> pure c3
(CNode c2 c3) -> pure c3

View File

@ -1,6 +1,6 @@
grinMain =
grinMain =
n0 <- pure (CPair 5 (#undefined :: {}))
case n0 of
case n0 of
(CPair c0 c1) ->
x0 <- fetch c1
x0 <- fetch c1
pure c0

View File

@ -1,9 +1,9 @@
grinMain =
grinMain =
p0 <- store (CNil)
p1 <- store (CCons 0 p0)
x0 <- pure (#undefined :: T_Int64)
n0 <- pure (#undefined :: {CCons[T_Int64,{0,1}]})
p2 <- store n0
n1 <- pure (#undefined :: {CNil[],CCons[T_Int64,{2}]})
n2 <- pure (CCons (#undefined :: T_Int64) p0)
n2 <- pure (CCons (#undefined :: T_Int64) p0)
pure 5

View File

@ -1,7 +1,7 @@
grinMain =
grinMain =
n0 <- pure (CNil)
p0 <- case 0 of
0 -> store n0
0 -> store n0
1 -> pure (#undefined :: #ptr)
n1 <- fetch p0
pure 0

View File

@ -4,6 +4,6 @@ grinMain =
y1 <- fetch p0
pure y1
f p =
f p =
update p (CInt 1)
pure 0

View File

@ -1,22 +1,21 @@
grinMain =
grinMain =
x0 <- pure (CInt 5)
p0 <- store x0
a0 <- pure (Ffoo p0 p0 p0)
p1 <- store a0
a1 <- eval p1
pure a1
pure a1
-- functions cannot return pointers
foo x y z =
foo x y z =
y' <- eval y
pure y'
eval p =
v <- fetch p
case v of
case v of
(CInt n) -> pure v
(Ffoo x1 y1 z1) ->
(Ffoo x1 y1 z1) ->
w <- foo x1 y1 z1
update p w
update p w
pure w

View File

@ -1,7 +1,7 @@
{-
Heap locations have way too general type sets.
This is due to the fact that apply can produce
many differenct node types.
This is due to the fact that apply can produce
many differenct node types.
(All partial applications and return values of all functions).
apply is called by ap, which is called by eval.
This means that all pointers will have this overly general type information.
@ -12,7 +12,7 @@
Eval inlining + apply inlining should solve this issue.
-}
grinMain =
grinMain =
a0 <- pure (CInt 5)
a1 <- pure (CInt 5)
a2 <- pure (CInt 5)
@ -20,7 +20,7 @@ grinMain =
p1 <- store a1
p2 <- store a2
foo3 <- pure (P3foo)
foo3 <- pure (P3foo)
pfoo3 <- store foo3
foo3ap <- pure (Fap pfoo3 p0)
@ -36,49 +36,49 @@ grinMain =
foo1ap <- pure (Fap pfoo1 p2)
pfoo1ap <- store foo1ap
fooRet <- eval pfoo1ap
pure fooRet
foo x0 y0 z0 =
foo x0 y0 z0 =
y0' <- eval y0
pure y0'
-- apply always gets the function node in whnf
apply pf cur =
case pf of
(P3foo) ->
apply pf cur =
case pf of
(P3foo) ->
n0 <- pure (P2foo cur)
pure n0
(P2foo v0) ->
(P2foo v0) ->
n1 <- pure (P1foo v0 cur)
pure n1
(P1foo v1 v2) ->
(P1foo v1 v2) ->
n2 <- foo v1 v2 cur
pure n2
ap f x =
ap f x =
f' <- eval f
apply f' x
eval p =
eval p =
v <- fetch p
case v of
case v of
(CInt n) -> pure v
(P3foo) -> pure v
(P2foo v3) -> pure v
(P1foo v4 v5) -> pure v
(Ffoo b0 b1 b2) ->
(Ffoo b0 b1 b2) ->
w0 <- foo b0 b1 b2
update p w0
update p w0
pure w0
(Fapply g y) ->
(Fapply g y) ->
w1 <- apply g y
update p w1
pure w1
(Fap h z) ->
update p w1
pure w1
(Fap h z) ->
w2 <- ap h z
update p w2
update p w2
pure w2

View File

@ -1,4 +1,4 @@
grinMain =
grinMain =
a0 <- pure (CInt 5)
a1 <- pure (CInt 5)
a2 <- pure (CInt 5)
@ -16,11 +16,11 @@ grinMain =
(P1foo v1 v2) <- pure foo1
fooRet <- foo v1 v2 p2
pure fooRet
foo x0 y0 z0 =
foo x0 y0 z0 =
y0' <- fetch y0
(CInt n) <- y0'
pure y0'

View File

@ -1,10 +1,10 @@
grinMain =
grinMain =
x0 <- pure (CInt 5)
p0 <- store x0
a0 <- pure (Ffoo.0 p0)
p1 <- store a0
a1 <- eval p1
pure a1
pure a1
foo x y z =
y' <- eval y
@ -12,12 +12,11 @@ foo x y z =
eval p =
v <- fetch p
case v of
case v of
(CInt n) -> pure v
(Ffoo.0 y1) ->
(Ffoo.0 y1) ->
z1 <- pure (#undefined :: #ptr)
x1 <- pure (#undefined :: #ptr)
w <- foo x1 y1 z1
update p w
update p w
pure w

View File

@ -1,11 +1,11 @@
grinMain =
grinMain =
a0 <- pure 5
n0 <- pure (CInt.0)
r <- case n0 of
(CInt.0) ->
r <- case n0 of
(CInt.0) ->
c0 <- pure (#undefined :: T_Int64)
pure 0
(CBool.0) ->
(CBool.0) ->
c1 <- pure (#undefined :: T_Dead)
pure 0
pure r

View File

@ -4,7 +4,7 @@ grinMain = n1 <- pure (CInt 1)
t2 <- store n2
n3 <- pure (Fupto t1 t2)
t3 <- store n3
n4 <- pure (Flength t3)
n4 <- pure (Flength t3)
t4 <- store n4
n5 <- eval t4
(CInt r') <- pure n5
@ -29,10 +29,10 @@ upto m n = n6 <- eval m
length l = l2 <- eval l
case l2 of
(CNil) ->
(CNil) ->
n12 <- pure (CInt 0)
pure n12
(CCons.0 xs) ->
(CCons.0 xs) ->
x <- pure (#undefined :: #ptr)
n13 <- length xs
(CInt l') <- pure n13

View File

@ -1,4 +1,4 @@
grinMain =
grinMain =
a0 <- pure (CInt 5)
a1 <- pure (CInt 5)
a2 <- pure (CInt 5)
@ -6,7 +6,7 @@ grinMain =
p1 <- store a1
p2 <- store a2
foo3 <- pure (P3foo)
foo3 <- pure (P3foo)
pfoo3 <- store foo3
foo3ap <- pure (Fap pfoo3 p0)
@ -22,54 +22,54 @@ grinMain =
foo1ap <- pure (Fap pfoo1 p2)
pfoo1ap <- store foo1ap
fooRet <- eval pfoo1ap
pure fooRet
foo x0 y0 z0 =
foo x0 y0 z0 =
y0' <- eval y0
pure y0'
-- apply always gets the function node in whnf
apply pf cur =
case pf of
(P3foo) ->
apply pf cur =
case pf of
(P3foo) ->
n0 <- pure (P2foo cur)
pure n0
(P2foo v0) ->
(P2foo v0) ->
n1 <- pure (P1foo v0 cur)
pure n1
(P1foo v1 v2) ->
(P1foo v1 v2) ->
n2 <- foo v1 v2 cur
pure n2
ap f x =
ap f x =
f' <- eval f
apply f' x
eval p =
eval p =
v <- fetch p
case v of
case v of
(CInt n) -> pure v
(P3foo) -> pure v
(P2foo v3) -> pure v
(P1foo v4 v5) -> pure v
(Ffoo.0) ->
(Ffoo.0) ->
b2 <- pure (#undefined :: T_Dead)
b1 <- pure (#undefined :: T_Dead)
b0 <- pure (#undefined :: T_Dead)
w0 <- foo b0 b1 b2
update p w0
update p w0
pure w0
(Fapply.0) ->
(Fapply.0) ->
y <- pure (#undefined :: T_Dead)
g <- pure (#undefined :: T_Dead)
w1 <- apply g y
update p w1
pure w1
(Fap h z) ->
update p w1
pure w1
(Fap h z) ->
w2 <- ap h z
update p w2
update p w2
pure w2

View File

@ -1,9 +1,9 @@
{- NOTE:
P2foo is renamed to P2foo.1 because the name generation
takes the node name as base. So here foo will be the base,
takes the node name as base. So here foo will be the base,
for which a name was already generated: P1foo.0.
-}
grinMain =
grinMain =
a0 <- pure (CInt.0)
a1 <- pure (CInt 5)
a2 <- pure (CInt.0)
@ -23,11 +23,11 @@ grinMain =
(P1foo.0 v2) <- pure foo1
v1 <- pure (#undefined :: #ptr)
fooRet <- foo v1 v2 p2
pure fooRet
foo x0 y0 z0 =
foo x0 y0 z0 =
y0' <- fetch y0
(CInt n) <- y0'
pure y0'

View File

@ -11,7 +11,7 @@ grinMain =
n5 <- pure (CThree.2 a1 a2)
n6 <- pure (CThree.1 a0 a2)
n7 <- pure (CThree.0)
(CThree b0 b1 b2) <- pure n0
(CThree.6 c0) <- pure n1
@ -34,7 +34,7 @@ grinMain =
(CThree.1 h0 h2) <- pure n6
h1 <- pure (#undefined :: T_Int64)
(CThree.0) <- pure n7
i2 <- pure (#undefined :: T_Int64)
i1 <- pure (#undefined :: T_Int64)

View File

@ -1,7 +1,7 @@
grinMain =
grinMain =
a0 <- pure 5
n0 <- pure (CInt a0)
r <- case n0 of
r <- case n0 of
(CInt c0) -> pure 0
(CBool c1) -> pure 0
pure r

View File

@ -4,7 +4,7 @@ grinMain = n1 <- pure (CInt 1)
t2 <- store n2
n3 <- pure (Fupto t1 t2)
t3 <- store n3
n4 <- pure (Flength t3)
n4 <- pure (Flength t3)
t4 <- store n4
n5 <- eval t4
(CInt r') <- pure n5

View File

@ -4,6 +4,6 @@ grinMain =
y1 <- fetch p0
pure y1
f p =
f p =
update p (CInt 1)
pure 0

View File

@ -1,3 +1,3 @@
grinMain =
grinMain =
n0 <- pure (#undefined :: {CNode[#ptr]})
pure 0

View File

@ -1,3 +1,3 @@
grinMain =
grinMain =
y0 <- pure (#undefined :: T_Int64)
pure 0

View File

@ -1,7 +1,7 @@
grinMain =
grinMain =
n0 <- f 0
pure 0
f x =
f x =
p <- store (CInt 5)
pure (CNode p)

View File

@ -1,4 +1,4 @@
grinMain =
grinMain =
y0 <- f 0
pure 0

View File

@ -1,13 +1,13 @@
grinMain =
grinMain =
x0 <- pure (CInt 5)
p0 <- store x0
a0 <- pure (Ffoo p0 p0 p0)
p1 <- store a0
a1 <- eval p1
pure a1
pure a1
-- functions cannot return pointers
foo y =
foo y =
z <- pure (#undefined :: #ptr)
x <- pure (#undefined :: #ptr)
y' <- eval y
@ -15,10 +15,9 @@ foo y =
eval p =
v <- fetch p
case v of
case v of
(CInt n) -> pure v
(Ffoo x1 y1 z1) ->
(Ffoo x1 y1 z1) ->
w <- foo y1
update p w
update p w
pure w

View File

@ -1,6 +1,6 @@
grinMain = f
f =
f =
y <- pure (#undefined :: T_Int64)
x <- pure (#undefined :: T_Int64)
g

View File

@ -1,4 +1,4 @@
grinMain =
grinMain =
a0 <- pure (CInt 5)
a1 <- pure (CInt 5)
a2 <- pure (CInt 5)
@ -6,7 +6,7 @@ grinMain =
p1 <- store a1
p2 <- store a2
foo3 <- pure (P3foo)
foo3 <- pure (P3foo)
pfoo3 <- store foo3
foo3ap <- pure (Fap pfoo3 p0)
@ -22,51 +22,51 @@ grinMain =
foo1ap <- pure (Fap pfoo1 p2)
pfoo1ap <- store foo1ap
fooRet <- eval pfoo1ap
pure fooRet
foo y0 =
foo y0 =
z0 <- pure (#undefined :: #ptr)
x0 <- pure (#undefined :: #ptr)
y0' <- eval y0
pure y0'
-- apply always gets the function node in whnf
apply pf cur =
case pf of
(P3foo) ->
apply pf cur =
case pf of
(P3foo) ->
n0 <- pure (P2foo cur)
pure n0
(P2foo v0) ->
(P2foo v0) ->
n1 <- pure (P1foo v0 cur)
pure n1
(P1foo v1 v2) ->
(P1foo v1 v2) ->
n2 <- foo v2
pure n2
ap f x =
ap f x =
f' <- eval f
apply f' x
eval p =
eval p =
v <- fetch p
case v of
case v of
(CInt n) -> pure v
(P3foo) -> pure v
(P2foo v3) -> pure v
(P1foo v4 v5) -> pure v
(Ffoo b0 b1 b2) ->
(Ffoo b0 b1 b2) ->
w0 <- foo b1
update p w0
update p w0
pure w0
(Fapply g y) ->
(Fapply g y) ->
w1 <- apply g y
update p w1
pure w1
(Fap h z) ->
update p w1
pure w1
(Fap h z) ->
w2 <- ap h z
update p w2
update p w2
pure w2

View File

@ -1,4 +1,4 @@
grinMain =
grinMain =
a0 <- pure (CInt 5)
a1 <- pure (CInt 5)
a2 <- pure (CInt 5)
@ -16,7 +16,7 @@ grinMain =
(P1foo v1 v2) <- pure foo1
fooRet <- foo v2
pure fooRet

View File

@ -4,6 +4,6 @@ grinMain =
y1 <- fetch p0
pure y1
f p =
f p =
update p (CInt 1)
pure 0

View File

@ -4,5 +4,5 @@ grinMain =
y1 <- fetch p0
pure y1
f x p =
f x p =
pure 0

View File

@ -1,2 +1,2 @@
grinMain =
pure 0
grinMain =
pure 0

View File

@ -1,5 +1,4 @@
grinMain =
grinMain =
f (#undefined :: T_Int64) 5
f x y = pure y

View File

@ -1,3 +1,3 @@
grinMain =
grinMain =
case (CInt (#undefined :: T_Int64)) of
(CInt c0) -> pure 0

View File

@ -1,4 +1,4 @@
grinMain =
grinMain =
case (CInt (#undefined :: T_Int64)) of
(CInt c0) ->
n0 <- pure (CPair (#undefined :: T_Int64) 5)
@ -6,8 +6,8 @@ grinMain =
update p1 (CPair (#undefined :: T_Int64) 5)
y0 <- f (#undefined :: T_Int64)
(CPair c1 c2) <- pure n0
(CPair c1 c2) <- pure n0
(CPair x1 x2) <- fetch p1
pure (CLive c2 x2 y0)
pure (CLive c2 x2 y0)
f x = pure 0

View File

@ -1,5 +1,4 @@
grinMain =
grinMain =
n0 <- pure (CPair (#undefined :: T_Int64) 5)
case n0 of
case n0 of
(CPair c0 c1) -> pure c1

View File

@ -1,5 +1,4 @@
grinMain =
grinMain =
p0 <- store (CPair (#undefined :: T_Int64) 5)
(CPair c0 c1) <- fetch p0
(CPair c0 c1) <- fetch p0
pure c1

View File

@ -1,5 +1,4 @@
grinMain =
grinMain =
n0 <- pure (CPair (#undefined :: #ptr) 5)
case n0 of
case n0 of
(CPair c0 c1) -> pure c1

View File

@ -1,6 +1,5 @@
grinMain =
grinMain =
p0 <- store (CPair 0 0)
update p0 (CPair (#undefined :: T_Int64) 5)
(CPair c0 c1) <- fetch p0
(CPair c0 c1) <- fetch p0
pure c1

View File

@ -1,2 +1,2 @@
grinMain =
grinMain =
pure 0

View File

@ -1,2 +1,2 @@
grinMain =
grinMain =
pure 0

View File

@ -5,7 +5,7 @@ grinMain =
y1 <- fetch p0
pure y1
f x p =
f x p =
p' <- store x
x' <- fetch p
pure 0

View File

@ -1,7 +1,7 @@
grinMain =
grinMain =
p0 <- store (CInt 0)
n0 <- fetch p0
p1 <- store n0
y0 <- pure (CPtr p1)
update p1 y0
pure 0
pure 0

View File

@ -1,6 +1,5 @@
grinMain =
grinMain =
x0 <- pure 5
f x0 5
f x y = pure y

View File

@ -1,4 +1,4 @@
grinMain =
grinMain =
x0 <- pure 5
case (CInt x0) of
(CInt c0) -> pure 0

View File

@ -1,4 +1,4 @@
grinMain =
grinMain =
x0 <- pure 5
case (CInt x0) of
(CInt c0) ->
@ -7,8 +7,8 @@ grinMain =
update p1 (CPair x0 5)
y0 <- f x0
(CPair c1 c2) <- pure n0
(CPair c1 c2) <- pure n0
(CPair x1 x2) <- fetch p1
pure (CLive c2 x2 y0)
pure (CLive c2 x2 y0)
f x = pure 0

View File

@ -1,6 +1,5 @@
grinMain =
grinMain =
x0 <- pure 5
n0 <- pure (CPair x0 5)
case n0 of
case n0 of
(CPair c0 c1) -> pure c1

View File

@ -1,6 +1,5 @@
grinMain =
grinMain =
x0 <- pure 5
p0 <- store (CPair x0 5)
(CPair c0 c1) <- fetch p0
(CPair c0 c1) <- fetch p0
pure c1

View File

@ -1,6 +1,5 @@
grinMain =
grinMain =
x0 <- pure (#undefined :: #ptr)
n0 <- pure (CPair x0 5)
case n0 of
case n0 of
(CPair c0 c1) -> pure c1

View File

@ -1,7 +1,6 @@
grinMain =
grinMain =
x0 <- pure 5
p0 <- store (CPair 0 0)
update p0 (CPair x0 5)
(CPair c0 c1) <- fetch p0
(CPair c0 c1) <- fetch p0
pure c1

View File

@ -1,4 +1,4 @@
grinMain =
grinMain =
x0 <- pure 0
x1 <- pure (CInt 0)
x2 <- pure x0

View File

@ -1,4 +1,4 @@
grinMain =
grinMain =
p0 <- store (CInt 0)
update p0 (CInt 1)
pure 0

View File

@ -1,9 +1,9 @@
grinMain =
grinMain =
p0 <- store (CNil)
p1 <- store (CCons 0 p0)
x0 <- pure (#undefined :: T_Int64)
n0 <- pure (#undefined :: {CCons[T_Int64,{0,1}]})
p2 <- store n0
n1 <- pure (#undefined :: {CNil[],CCons[T_Int64,{2}]})
n2 <- pure (CCons (#undefined :: T_Int64) p0)
n2 <- pure (CCons (#undefined :: T_Int64) p0)
pure 5

View File

@ -1,8 +1,8 @@
grinMain =
grinMain =
p0 <- case 0 of
0 -> store (CInt 5)
1 -> pure (#undefined :: #ptr)
n0 <- fetch p0
n0 <- fetch p0
n1 <- pure (#undefined :: {CNode[#ptr]})
(CNode p1) <- pure n1
x0 <- fetch p1

View File

@ -1,4 +1,4 @@
grinMain =
grinMain =
n0 <- pure (CNil)
p0 <- store n0
n1 <- pure (CCons 0 p0)
@ -7,14 +7,14 @@ grinMain =
update p0 (CInt 5)
update p1 (CInt 5)
n4 <- case 0 of
0 ->
n4 <- case 0 of
0 ->
n2 <- fetch p0
pure n2
1 ->
1 ->
n3 <- fetch p1
pure n3
case n4 of
case n4 of
(CWord c0) -> pure 0
#default -> pure 1

View File

@ -8,4 +8,4 @@ grinMain =
f x =
case x of
(CNode c2 c3) -> pure c3
(CNode c2 c3) -> pure c3

View File

@ -8,7 +8,7 @@ grinMain =
case n1 of
(CWordH c3) -> pure 5
(CBoolH c4) -> pure c4
(CNopeH c5) -> pure c5
(CNopeH c5) -> pure c5
f x =
case x of

View File

@ -1,12 +1,12 @@
grinMain =
a0 <- pure 5
n0 <- pure (CNil)
p0 <- store n0
p0 <- store n0
n1 <- pure (CCons a0 p0)
r <- case n1 of
(CNil) ->
r <- case n1 of
(CNil) ->
pure (CNil)
(CCons x xs) ->
(CCons x xs) ->
xs' <- fetch xs
pure xs'
pure xs'
pure r

View File

@ -1,10 +1,10 @@
grinMain =
grinMain =
p0 <- store (CNil)
p1 <- store (CCons 0 p0)
x0 <- pure (#undefined :: T_Int64)
n0 <- pure (#undefined :: {CCons[T_Int64, #ptr]})
n1 <- pure (CCons (#undefined :: T_Int64) p0)
n2 <- pure (CCons (#undefined :: #ptr) p0)
(CCons c0 c1) <- pure n2
n1 <- pure (CCons (#undefined :: T_Int64) p0)
n2 <- pure (CCons (#undefined :: #ptr) p0)
(CCons c0 c1) <- pure n2
x1 <- fetch c0
pure x1

View File

@ -1,6 +1,6 @@
grinMain =
grinMain =
p0 <- store (CNil)
n0 <- pure (CCons (#undefined :: {0}) p0)
n0 <- pure (CCons (#undefined :: {0}) p0)
(CCons c0 c1) <- pure n0
x0 <- fetch c0
pure x0

View File

@ -1,5 +1,5 @@
% grinMain :: T_Int64
grinMain =
grinMain =
% a -> T_Int64
a <- pure 5
% n -> {CInt[T_Int64]}

View File

@ -1,4 +1,4 @@
grinMain =
grinMain =
x0 <- pure (#undefined :: T_Int64)
x1 <- pure (#undefined :: T_Word64)
x4 <- pure (#undefined :: T_Float)

View File

@ -1,4 +1,4 @@
grinMain =
grinMain =
p0 <- store (#undefined :: {CInt[T_Int64]})
p1 <- store (#undefined :: {CPair[T_Int64, T_Bool]})
p2 <- store (#undefined :: {CPair[T_Int64, {0}]})

View File

@ -1,4 +1,4 @@
grinMain p =
grinMain p =
update p (#undefined :: {CInt[T_Int64]})
update p (#undefined :: {CPair[T_Int64, T_Bool]})
update p (#undefined :: {CPair[T_Int64, {0}]})

View File

@ -17,7 +17,7 @@ extra-deps:
- QuickCheck-GenT-0.2.0
- megaparsec-6.5.0
- neat-interpolation-0.3.2.2
- set-extra-1.4.1
- set-extra-1.4.1
flags:
llvm-hs: