Commit a850e654 authored by Andreas Klebinger's avatar Andreas Klebinger Committed by Andreas Klebinger

Add core of the dom-lt package to nofib.

Of interest is in particular that the code uses -XStrict.
parent 9c2966dc
This diff is collapsed.
{-# OPTIONS_GHC -fno-full-laziness #-}
module Main where
import System.Environment
import Data.Bifunctor
import Dom
import Control.Monad
import Data.Traversable
-- Take a filename as input.
-- Each line is expected to be a graph of the form (root, [(vertex, [successors])])
-- Compute the dominators for each line.
main :: IO ()
main = do
[inputFile,repetitions] <- getArgs
let repetitions' = read repetitions
sgraphs <- map (second fromAdj . read) . lines <$> readFile inputFile :: IO [Rooted]
let s = flip map [0..repetitions'] $ (\i -> sum (map (\g -> i + doGraph g) sgraphs)) :: [Int]
print $ sum s
doGraph :: Rooted -> Int
doGraph g = length . idom $ g
\ No newline at end of file
TOP = ../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/target.mk
# The core (Dom.hs) is taken from the dom-lt package.
# Compute dominators over a graph
# Graphs are real examples for control flow graphs produced by GHC.
# First parameter controls input file, second parameter controls repetitions.
# We do more iterations here for stability over different GC parameterisations
# and to shift compute time away from read/graph creation.
FAST_OPTS = ghc-examples.in 50
NORM_OPTS = ghc-examples.in 400
SLOW_OPTS = ghc-examples.in 3000
# We require containers.
HC_OPTS += -package containers
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment