[modify Program to contain entry points as Ids rather than replicating tvrs.
John Meacham <john@repetae.net>**20080304103905] hunk ./E/Inline.hs 135
-programSubProgram prog rec ds = prog { progCombinators = ds, progType = SubProgram rec, progEntryPoints = map combHead ds }
+programSubProgram prog rec ds = progCombinators_s ds prog {  progType = SubProgram rec, progEntry = fromList (map combIdent ds) }
hunk ./E/LetFloat.hs 104
-        epoints = [ c | c@Comb { combHead = x } <- progCombinators prog, (x `elem` progEntryPoints prog) || forceNoinline x || getProperty prop_INSTANCE x || getProperty prop_SPECIALIZATION x ]
+        epoints = [ c | c@Comb { combHead = x } <- progCombinators prog, (tvrIdent x `member` progEntry prog) || forceNoinline x || getProperty prop_INSTANCE x || getProperty prop_SPECIALIZATION x ]
hunk ./E/Program.hs 24
+import Util.SetLike
hunk ./E/Program.hs 33
-    progExternalNames :: IdSet,
+    progExternalNames  :: IdSet,
hunk ./E/Program.hs 35
-    progCombinators :: [Comb],
-    progDataTable :: DataTable,
-    progEntryPoints :: [TVr],
-    progMainEntry :: TVr,
-    progModule :: Module,
-    progPasses :: [String],       -- ^ record of passes the program goes through
-    progUsedIds :: IdSet,         -- ^ filled in by occurance info collection
-    progFreeIds :: IdSet,         -- ^ filled in by occurance info collection
-    progSeasoning :: IdSet,       -- ^ these ids are depended on by external names via RULES
-    progType    :: ProgramType,
-    progStats :: !Stats.Stat
+    progCombinators    :: [Comb],
+    progDataTable      :: DataTable,
+    progEntry          :: IdSet,
+    progMain           :: Id,
+    progModule         :: Module,
+    progPasses         :: [String],    -- ^ record of passes the program goes through
+    progUsedIds        :: IdSet,       -- ^ filled in by occurance info collection
+    progFreeIds        :: IdSet,       -- ^ filled in by occurance info collection
+    progSeasoning      :: IdSet,       -- ^ these ids are depended on by external names via RULES
+    progType           :: ProgramType,
+    progCombMap        :: IdMap Comb,
+    progStats          :: !Stats.Stat
hunk ./E/Program.hs 51
-    progExternalNames = mempty,
+    progExternalNames  = mempty,
hunk ./E/Program.hs 53
-    progCombinators = mempty,
-    progDataTable = mempty,
-    progEntryPoints = mempty,
-    progMainEntry = tvr,
-    progModule = mainModule,
-    progPasses = [],
-    progUsedIds = mempty,
-    progFreeIds = mempty,
-    progSeasoning = mempty,
-    progType = MainProgram,
-    progStats = mempty
+    progCombinators    = mempty,
+    progDataTable      = mempty,
+    progEntry          = mempty,
+    progMain           = emptyId,
+    progModule         = mainModule,
+    progPasses         = [],
+    progUsedIds        = mempty,
+    progFreeIds        = mempty,
+    progSeasoning      = mempty,
+    progType           = MainProgram,
+    progCombMap        = mempty,
+    progStats          = mempty
hunk ./E/Program.hs 68
+progEntryPoints prog = map combHead $ concatMap (progComb prog) (toList $ progEntry prog)
+progMainEntry prog = combHead . runIdentity $ progComb prog (progMain prog)
+
+progComb :: Monad m => Program -> Id -> m Comb
+progComb prog x = case x `mlookup`  progCombMap prog of
+    Nothing -> fail $ "progComb: can't find '" ++ show (tvrShowName tvr { tvrIdent = x }) ++  "'"
+    Just c -> return c
+
hunk ./E/Program.hs 83
-programUpdate prog = check prog where
+programUpdate prog = check $ ucache prog where
hunk ./E/Program.hs 85
+    ucache prog = prog { progCombMap = fromList [ (combIdent c,c) | c <- ds ] }
hunk ./E/Program.hs 98
-programSetDs ds prog | flint && hasRepeatUnder (tvrIdent . fst) ds = error $ "programSetDs: program has redundant definitions: \n" ++ intercalate "\n"  (sort $ map (show . tvrShowName . fst) ds)
-programSetDs ds prog | flint && any (not . isValidAtom) (map (tvrIdent . fst) ds) = error $ "programSetDs: trying to set non unique top level name: \n" ++ intercalate "\n"  (sort $ map (show . tvrShowName . fst) ds)
-programSetDs ds prog = prog {
-    progMainEntry = f (progMainEntry prog),
-    progEntryPoints = map f (progEntryPoints prog),
-    progCombinators = [ emptyComb { combHead = t, combBody = e } | (t,e) <- ds ]
-    } where
-    f tvr | Just n <- Map.lookup (tvrIdent tvr) mp = n
-          | otherwise = tvr
-    mp = Map.fromList [ (tvrIdent t,t) | (t,_) <- ds ]
+programSetDs ds prog = progCombinators_s [ bindComb (t,e) | (t,e) <- ds ] prog
hunk ./E/Program.hs 126
-    when (progMainEntry prog /= tvr) $
+    when (progMain prog /= emptyId) $
hunk ./E/Program.hs 128
-    when (progEntryPoints prog /= [progMainEntry prog]) $
+    when (progEntry prog /= singleton (progMain prog)) $
hunk ./E/SSimplify.hs 81
-        (dsIn',(OMap fvs,uids)) = runReaderWriter (unOM $ collectDs dsIn mempty) (fromList $ map tvrIdent $ progEntryPoints prog)
+        (dsIn',(OMap fvs,uids)) = runReaderWriter (unOM $ collectDs dsIn mempty) (progEntry prog)
hunk ./E/SSimplify.hs 472
-    exportedSet = fromList $ map tvrIdent (progEntryPoints prog) :: IdSet
hunk ./Grin/FromE.hs 158
-compile prog@Program { progDataTable = dataTable, progMainEntry = mainEntry, progEntryPoints = entries } = do
+compile prog@Program { progDataTable = dataTable } = do
+    let entries = progEntryPoints prog
+        mainEntry = progMainEntry prog
hunk ./Main.hs 283
-    let entryPoints = execWriter $ programMapDs_ (\ (t,_) -> when (getProperty prop_EXPORTED t || getProperty prop_INSTANCE t)  (tell [t])) prog
-    prog <- return $ prog { progEntryPoints = entryPoints }
+    let entryPoints = fromList . execWriter $ programMapDs_ (\ (t,_) -> when (getProperty prop_EXPORTED t || getProperty prop_INSTANCE t)  (tell [tvrIdent t])) prog
+    prog <- return $ prog { progEntry = entryPoints }
hunk ./Main.hs 447
-    ds' = reachable (newGraph (progCombinators prog) combIdent freeVars) (map tvrIdent $ progEntryPoints prog)
+    ds' = reachable (newGraph (progCombinators prog) combIdent freeVars) (toList $ progEntry prog)
hunk ./Main.hs 515
-    prog <- return prog { progMainEntry   = main,
-                          progEntryPoints = (main:ffiExportNames),
+    prog <- return prog { progMain   = tvrIdent main,
+                          progEntry = fromList $ map tvrIdent (main:ffiExportNames),