Commit 22240ca8 authored by Matthew Pickering's avatar Matthew Pickering Committed by Ben Gamari

Eliminate trailing whitespace

Reviewers: michalt, bgamari, O26 nofib, goldfire

Reviewed By: michalt, O26 nofib

Differential Revision: https://phabricator.haskell.org/D4045
parent cf032a22
......@@ -3,11 +3,11 @@
{--- Beginnings of X86 specific stuff Arch_X86.hs ---}
{------------------------------------------------------------------------}
{-
{-
This file is part of Cacheprof, a profiling tool for finding
sources of cache misses in programs.
Copyright (C) 1999 Julian Seward (jseward@acm.org)
Copyright (C) 1999 Julian Seward (jseward@acm.org)
Home page: http://www.cacheprof.org
This program is free software; you can redistribute it and/or
......@@ -38,11 +38,11 @@ module Arch_x86 (
where
data Opcode
data Opcode
= O_movl | O_movw | O_movb
| O_movzbw | O_movzbl | O_movzwl
| O_movsbw | O_movsbl | O_movswl
| O_pushl | O_popl
| O_movzbw | O_movzbl | O_movzwl
| O_movsbw | O_movsbl | O_movswl
| O_pushl | O_popl
| O_pushfl | O_popfl
| O_notl | O_notw | O_notb
| O_sall | O_salw | O_salb
......@@ -75,8 +75,8 @@ data Opcode
| O_stosl | O_stosw | O_stosb
| O_leave | O_ret | O_call | O_jmp
| O_je | O_jne
| O_jl | O_jle
| O_je | O_jne
| O_jl | O_jle
| O_jg | O_jge
| O_js | O_jns
| O_jz | O_jnz
......@@ -98,7 +98,7 @@ data Opcode
| O_cbtw
| O_rep | O_repz | O_repnz
| O_fild | O_fildl | O_fildll
| O_fsubp | O_fsubr | O_fsubrp | O_fsubrl | O_fsubrs
| O_fsubp | O_fsubr | O_fsubrp | O_fsubrl | O_fsubrs
| O_fsubs | O_fsubl | O_fsub
| O_faddp | O_fadds | O_faddl | O_fadd | O_fiaddl
| O_fmul | O_fmuls | O_fmull | O_fmulp
......@@ -130,7 +130,7 @@ data Opcode
x86info :: [(Opcode, OperandInfo)]
x86info
x86info
= [
(O_movl, OI [OE_RW 4 4]),
(O_movw, OI [OE_RW 2 2]),
......@@ -430,8 +430,8 @@ nonJumpyOpcodes
,O_shrl ,O_shrw ,O_shrb
,O_sarl
,O_leal
,O_movzbw ,O_movzbl ,O_movzwl
,O_movsbw ,O_movsbl ,O_movswl
,O_movzbw ,O_movzbl ,O_movzwl
,O_movsbw ,O_movsbl ,O_movswl
, O_seta , O_setae
, O_setb , O_setbe
......
......@@ -3,11 +3,11 @@
{--- Generic stuff for all architectures. Generics.hs ---}
{------------------------------------------------------------------------}
{-
{-
This file is part of Cacheprof, a profiling tool for finding
sources of cache misses in programs.
Copyright (C) 1999 Julian Seward (jseward@acm.org)
Copyright (C) 1999 Julian Seward (jseward@acm.org)
Home page: http://www.cacheprof.org
This program is free software; you can redistribute it and/or
......@@ -33,7 +33,7 @@ module Generics where
internal msg
= error ("\ncacheann: Internal error: " ++ msg ++ "\n")
incomplete msg
= error ("\ncacheann: Unhandled instruction set artefact:\n "
= error ("\ncacheann: Unhandled instruction set artefact:\n "
++ msg ++ "\n")
inputerr msg
= error ("\ncacheann: Bad input: " ++ msg ++ "\n")
......@@ -105,14 +105,14 @@ pApply f p ts
= case p ts of
PFail -> PFail
POk x uu -> POk (f x) uu
pName :: String -> a -> Parser a
pName w x ((LName w2):lxs)
= if w == w2 then POk x lxs else PFail
pName w x _ = PFail
p2 :: (a -> b -> c)
p2 :: (a -> b -> c)
-> Parser a -> Parser b -> Parser c
p2 f p1 p2 ts1
= case p1 ts1 of { PFail -> PFail ; POk x1 uu1 ->
......@@ -120,7 +120,7 @@ p2 f p1 p2 ts1
POk (f x1 x2) uu2
}}
p3 :: (a -> b -> c -> d)
p3 :: (a -> b -> c -> d)
-> Parser a -> Parser b -> Parser c -> Parser d
p3 f p1 p2 p3 ts1
= case p1 ts1 of { PFail -> PFail ; POk x1 uu1 ->
......
This diff is collapsed.
......@@ -140,10 +140,10 @@ Basic circuit components
> = None -- no component
> | Inp -- input to the entire circuit
> | Outp -- output from the entire circuit
> | Dff -- delay flip flop
> | Inv -- inverter
> | And2 -- 2-input and gate
> | Or2 -- 2-input or gate
> | Dff -- delay flip flop
> | Inv -- inverter
> | And2 -- 2-input and gate
> | Or2 -- 2-input or gate
> | Xor -- exclusive or gate
> deriving (Eq, Show)
......@@ -165,12 +165,12 @@ a is the type of a signal (the value on a wire)
> a) -- latch to hold the input signal value
> type OutPort a =
> (Int, -- output port number for the signal value
> a, -- latch to hold the signal value
> Bool, -- need to send it to the left?
> Int, -- distance to send to the left
> Bool, -- need to send it to the right?
> Int) -- distance to send to the right
> (Int, -- output port number for the signal value
> a, -- latch to hold the signal value
> Bool, -- need to send it to the left?
> Int, -- distance to send to the left
> Bool, -- need to send it to the right?
> Int) -- distance to send to the right
......@@ -235,9 +235,9 @@ a power of two
> emptyState :: Signal a => State a
> emptyState = PS { pid = -1,
> compType = None,
> pathDepth = -1,
> emptyState = PS { pid = -1,
> compType = None,
> pathDepth = -1,
> inports = [],
> outports = []}
......@@ -274,12 +274,12 @@ Packets are just OutPorts with a pid
> type Packet a =
> (Pid, -- id of this packet
> Int, -- output port number for the signal value
> a, -- latch to hold the signal value
> Bool, -- need to send it to the left?
> Int, -- distance to send to the left
> Bool, -- need to send it to the right?
> Int, -- distance to send to the right
> Int, -- output port number for the signal value
> a, -- latch to hold the signal value
> Bool, -- need to send it to the left?
> Int, -- distance to send to the left
> Bool, -- need to send it to the right?
> Int, -- distance to send to the right
> Int) -- extent
......@@ -388,7 +388,7 @@ need to restore them to there original values.
> restore_requests old_states new_states
> = zipWith restore old_states new_states
> where
> restore os ns = ns { outports = zipWith restore_outport (outports os)
> restore os ns = ns { outports = zipWith restore_outport (outports os)
> (outports ns) }
> restore_outport (p,_,ql,dl,qr,dq) (_,m,_,_,_,_) = (p,m,ql,dl,qr,dq)
......@@ -427,10 +427,10 @@ Update both the inports and outports of a state
> update_io :: Signal a => Int -> [(Packet a,Packet a)] -> State a -> State a
> update_io d lrps state = update_os (update_is state)
> where
> update_is state = state { inports = foldr update_i
> update_is state = state { inports = foldr update_i
> (inports state) lrps }
> update_os state = if pathDepth state == d
> then state { outports = zipWith update_o
> then state { outports = zipWith update_o
> lrps (outports state) }
> else state
......@@ -529,7 +529,7 @@ Place input values into circuit's input components
> store_inputs :: Signal a => [(Label,a)] -> State a -> State a
> store_inputs label_inputs state@(PS {compType=Inp})
> = head [ update_outports state value
> | ((label, input_pid), value) <- label_inputs,
> | ((label, input_pid), value) <- label_inputs,
> pid state == input_pid ]
> store_inputs label_inputs state = state
......@@ -593,7 +593,7 @@ Circuit example -- a register
> compType = Inp,
> pathDepth = 0,
> inports = [],
> outports = [(0, zeroS, False,
> outports = [(0, zeroS, False,
> 0, True, 8*(bits-1)+5)]
> }
......
......@@ -29,7 +29,7 @@ data Assign = Var := Value deriving (Eq, Ord, Show)
type Relation = Assign -> Assign -> Bool
data CSP = CSP { vars, vals :: Int, rel :: Relation }
data CSP = CSP { vars, vals :: Int, rel :: Relation }
type State = [Assign]
......@@ -111,18 +111,18 @@ data Maybe a = Just a | Nothing deriving Eq
earliestInconsistency :: CSP -> State -> Maybe (Var,Var)
earliestInconsistency CSP{rel=rel} [] = Nothing
earliestInconsistency CSP{rel=rel} (a:as) =
earliestInconsistency CSP{rel=rel} (a:as) =
case filter (not . rel a) (reverse as) of
[] -> Nothing
(b:_) -> Just (level a, level b)
labelInconsistencies :: CSP -> Transform State (State,Maybe (Var,Var))
labelInconsistencies csp = mapTree f
labelInconsistencies csp = mapTree f
where f s = (s,earliestInconsistency csp s)
btsolver0 :: CSP -> [State]
btsolver0 csp =
(filter (complete csp) . leaves . (mapTree fst) . prune ((/= Nothing) . snd)
(filter (complete csp) . leaves . (mapTree fst) . prune ((/= Nothing) . snd)
. (labelInconsistencies csp) . mkTree) csp
-----------------------------------------------
......@@ -150,7 +150,7 @@ search labeler csp =
bt :: Labeler
bt csp = mapTree f
where f s = (s,
where f s = (s,
case earliestInconsistency csp s of
Nothing -> checkComplete csp s
Just (a,b) -> Known [a,b])
......@@ -211,14 +211,14 @@ fillTable :: State -> CSP -> Table -> Table
fillTable [] csp tbl = tbl
fillTable ((var' := val'):as) CSP{vars=vars,vals=vals,rel=rel} tbl =
zipWith (zipWith f) tbl [[(var,val) | val <- [1..vals]] | var <- [var'+1..vars]]
where f cs (var,val) = if cs == Unknown && not (rel (var' := val') (var := val)) then
Known [var',var]
where f cs (var,val) = if cs == Unknown && not (rel (var' := val') (var := val)) then
Known [var',var]
else cs
lookupCache :: CSP -> Transform (State, Table) ((State, ConflictSet), Table)
lookupCache csp t = mapTree f t
where f ([], tbl) = (([], Unknown), tbl)
f (s@(a:_), tbl) = ((s, cs), tbl)
f (s@(a:_), tbl) = ((s, cs), tbl)
where cs = if tableEntry == Unknown then checkComplete csp s else tableEntry
tableEntry = (head tbl)!!(value a-1)
......@@ -233,18 +233,18 @@ bjbt' :: Labeler
bjbt' csp = bj' csp . bt csp
bj :: CSP -> Transform (State, ConflictSet) (State, ConflictSet)
bj csp = foldTree f
bj csp = foldTree f
where f (a, Known cs) chs = Node (a,Known cs) chs
f (a, Unknown) chs = Node (a,Known cs') chs
where cs' = combine (map label chs) []
combine :: [(State, ConflictSet)] -> [Var] -> [Var]
combine [] acc = acc
combine [] acc = acc
combine ((s, Known cs):css) acc =
if maxLevel s `notElem` cs then cs else combine css (cs `union` acc)
bj' :: CSP -> Transform (State, ConflictSet) (State, ConflictSet)
bj' csp = foldTree f
bj' csp = foldTree f
where f (a, Known cs) chs = Node (a,Known cs) chs
f (a, Unknown) chs = if knownConflict cs' then Node (a,cs') [] else Node (a,cs') chs
where cs' = Known (combine (map label chs) [])
......@@ -262,8 +262,8 @@ collect (Known cs:css) = cs `union` (collect css)
domainWipeOut :: CSP -> Transform ((State, ConflictSet), Table) (State, ConflictSet)
domainWipeOut CSP{vars=vars} t = mapTree f t
where f ((as, cs), tbl) = (as, cs')
where wipedDomains = ([vs | vs <- tbl, all (knownConflict) vs])
where f ((as, cs), tbl) = (as, cs')
where wipedDomains = ([vs | vs <- tbl, all (knownConflict) vs])
cs' = if null wipedDomains then cs else Known (collect (head wipedDomains))
......
......@@ -4,7 +4,7 @@ To: simonpj@dcs.gla.ac.uk
Subject: Fibonacci Heaps
As I promised at the Haskell Workshop, here is a sample program
using encapsulated state. I've translated this from SML, but
using encapsulated state. I've translated this from SML, but
in doing so, I noticed that in fact accumArray is all the
encapsulated state you really need for this application. In SML,
we are forced to use mutable arrays because we don't have such
......@@ -65,13 +65,13 @@ binomial trees.
>data Tree a = Node a [Tree a]
The degree of a binomial tree is equal to its number of children.
The degree of a binomial tree is equal to its number of children.
Every binomial tree of degree k has binomial trees of degrees
k-1...0 as children, in that order. It is easy to show that
a binomial tree of degree k has size 2^k.
The fundamental operation on binomial trees is linking, which compares
the roots of two binomial trees and makes the larger a child of the
the roots of two binomial trees and makes the larger a child of the
smaller (thus bumping its degree by one). It is essential that this
only be called on binomial trees of equal degree.
......@@ -135,10 +135,10 @@ with a forest of trees summing to the correct size.
>type Forest a = Bag (TaggedTree a)
In binomial queues, this forest must be maintained in strictly increasing
order of degree. For Fibonacci heaps, we adopt a more relaxed attitude:
order of degree. For Fibonacci heaps, we adopt a more relaxed attitude:
degrees may be repeated and order does not matter.
To be able to find the minimum element quickly, we keep the tree with the
To be able to find the minimum element quickly, we keep the tree with the
minimum root outside of the bag. In addition, at the top level of each heap,
we store the total size of the heap.
......@@ -182,7 +182,7 @@ the other using accumArray.
In the first implementation, there are three steps.
1. Allocate an array indexed by degrees.
2. Insert every tree into this array. If, when inserting a tree of
2. Insert every tree into this array. If, when inserting a tree of
degree k, there already exists a tree of degree k, link the
two trees and reinsert the new larger tree.
3. Transfer the trees into a bag, keeping track of the minimum tree.
......@@ -222,8 +222,8 @@ the highest slot of the array.
> getMin' a mini mint (ConsBag (i, t) b) (i+1)
> else
> getMin' a i t (ConsBag (mini, mint) b) (i+1)
>
> in
>
> in
> runST (newArray (0,d) Zero >>= \a ->
> applyToAll (ins a) f >>
> sequence (map (ins a) (getChildren tt)) >>
......@@ -233,7 +233,7 @@ the highest slot of the array.
--------------------
The second version of deleteMin uses accumArray to group trees of like
size. It then performs the linking and all remaining steps purely
size. It then performs the linking and all remaining steps purely
functionally.
>deleteMinFH' EmptyFH = error "deleteMinFH EmptyFH"
......
......@@ -3,16 +3,16 @@
-
- Copyright 1990,1991,1992,1993 Duncan Sinclair
-
- Permissiom to use, copy, modify, and distribute this software for any
- Permissiom to use, copy, modify, and distribute this software for any
- purpose and without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies, and
- that my name not be used in advertising or publicity pertaining to this
- software without specific, written prior permission. I makes no
- representations about the suitability of this software for any purpose.
- It is provided ``as is'' without express or implied warranty.
-
-
- Duncan Sinclair 1993.
-
-
- CSG evaluation engine.
-
-}
......
......@@ -3,16 +3,16 @@
-
- Copyright 1990,1991,1992,1993 Duncan Sinclair
-
- Permissiom to use, copy, modify, and distribute this software for any
- Permissiom to use, copy, modify, and distribute this software for any
- purpose and without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies, and
- that my name not be used in advertising or publicity pertaining to this
- software without specific, written prior permission. I makes no
- representations about the suitability of this software for any purpose.
- It is provided ``as is'' without express or implied warranty.
-
-
- Duncan Sinclair 1993.
-
-
- Interval arithmetic package.
-
-}
......
......@@ -3,16 +3,16 @@
-
- Copyright 1990,1991,1992,1993 Duncan Sinclair
-
- Permissiom to use, copy, modify, and distribute this software for any
- Permissiom to use, copy, modify, and distribute this software for any
- purpose and without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies, and
- that my name not be used in advertising or publicity pertaining to this
- software without specific, written prior permission. I makes no
- representations about the suitability of this software for any purpose.
- It is provided ``as is'' without express or implied warranty.
-
-
- Duncan Sinclair 1993.
-
-
- Colour definitions.
-
- (The information is this file is derived from the rgb database
......
......@@ -3,16 +3,16 @@
-
- Copyright 1990,1991,1992,1993 Duncan Sinclair
-
- Permission to use, copy, modify, and distribute this software for any
- Permission to use, copy, modify, and distribute this software for any
- purpose and without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies, and
- that my name not be used in advertising or publicity pertaining to this
- software without specific, written prior permission. I makes no
- representations about the suitability of this software for any purpose.
- It is provided ``as is'' without express or implied warranty.
-
-
- Duncan Sinclair 1993.
-
-
- Main program.
-
-}
......
......@@ -3,16 +3,16 @@
-
- Copyright 1990,1991,1992,1993 Duncan Sinclair
-
- Permissiom to use, copy, modify, and distribute this software for any
- Permissiom to use, copy, modify, and distribute this software for any
- purpose and without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies, and
- that my name not be used in advertising or publicity pertaining to this
- software without specific, written prior permission. I makes no
- representations about the suitability of this software for any purpose.
- It is provided ``as is'' without express or implied warranty.
-
-
- Duncan Sinclair 1993.
-
-
- Matrix arithmetic functions.
-
-}
......@@ -30,7 +30,7 @@ mat4x1 (r1,r2,r3) xyz = (x,y,z)
z = dorow r3 xyz
dorow :: (Fractional a) => Row -> R3 a -> a
dorow (m11,m12,m13,m14) (x,y,z)
dorow (m11,m12,m13,m14) (x,y,z)
= case (m1 * x) + (m2 * y) + (m3 * z) + m4 of n -> n
where
m1 = realToFrac m11
......@@ -46,7 +46,7 @@ mat4x1' (r1,r2,r3) xyz = (x,y,z)
z = dorow r3 xyz
dorow' :: (Fractional a) => Row -> R3 a -> a
dorow' (m11,m12,m13,m14) (x,y,z)
dorow' (m11,m12,m13,m14) (x,y,z)
= case (m1 * x) + (m2 * y) + (m3 * z) of n -> n
where
m1 = realToFrac m11
......
......@@ -3,16 +3,16 @@
-
- Copyright 1990,1991,1992,1993 Duncan Sinclair
-
- Permissiom to use, copy, modify, and distribute this software for any
- Permissiom to use, copy, modify, and distribute this software for any
- purpose and without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies, and
- that my name not be used in advertising or publicity pertaining to this
- software without specific, written prior permission. I makes no
- representations about the suitability of this software for any purpose.
- It is provided ``as is'' without express or implied warranty.
-
-
- Duncan Sinclair 1993.
-
-
- Csg to Oct-tree processing.
-
-}
......@@ -46,7 +46,7 @@ makeoct csg = octer 1 csg xyz
-- octer :: Int -> Csg -> (R3 BI) -> Oct
octer nn csg xyz
= case (calc csg white xyz) of
(res,newc',rgb,new) ->
(res,newc',rgb,new) ->
let
newc = if new then newc' else csg
c = light rgb (calcn newc xyz)
......
......@@ -3,16 +3,16 @@
-
- Copyright 1990,1991,1992,1993 Duncan Sinclair
-
- Permissiom to use, copy, modify, and distribute this software for any
- Permissiom to use, copy, modify, and distribute this software for any
- purpose and without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies, and
- that my name not be used in advertising or publicity pertaining to this
- software without specific, written prior permission. I makes no
- representations about the suitability of this software for any purpose.
- It is provided ``as is'' without express or implied warranty.
-
-
- Duncan Sinclair 1993.
-
-
- Version information.
-
-}
......
......@@ -3,16 +3,16 @@
-
- Copyright 1990,1991,1992,1993 Duncan Sinclair
-
- Permissiom to use, copy, modify, and distribute this software for any
- Permissiom to use, copy, modify, and distribute this software for any
- purpose and without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies, and
- that my name not be used in advertising or publicity pertaining to this
- software without specific, written prior permission. I makes no
- representations about the suitability of this software for any purpose.
- It is provided ``as is'' without express or implied warranty.
-
-
- Duncan Sinclair 1993.
-
-
- Oct-tree to Quad-tree processing.