Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/vis12/src/compiler/simplify/simplify.sml
ViewVC logotype

Diff of /branches/vis12/src/compiler/simplify/simplify.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2135, Mon Feb 11 12:33:24 2013 UTC revision 2140, Thu Feb 14 23:58:15 2013 UTC
# Line 66  Line 66 
66              (* end case *)              (* end case *)
67            end            end
68    
69      (* is the given statement's continuation the syntactically following statement? *)
70        fun contIsNext (AST.S_Block stms) = List.all contIsNext stms
71          | contIsNext AST.S_Die = false
72          | contIsNext AST.S_Stabilize = false
73          | contIsNext (AST.S_Return _) = false
74          | contIsNext _ = true
75    
76      fun simplifyProgram (AST.Program dcls) = let      fun simplifyProgram (AST.Program dcls) = let
77            val inputs = ref []            val inputs = ref []
78            val globals = ref []            val globals = ref []
# Line 205  Line 212 
212    
213      and simplifyStmt (stm, stms) = (case stm      and simplifyStmt (stm, stms) = (case stm
214             of AST.S_Block body => let             of AST.S_Block body => let
215    (* FIXME: we should probably prune unreachable code in the typechecker and issue a warning! *)
216                  fun simplify ([], stms) = stms                  fun simplify ([], stms) = stms
217                    | simplify (stm::r, stms) = simplify (r, simplifyStmt (stm, stms))                    | simplify (stm::r, stms) = if contIsNext stm
218                          then simplify (r, simplifyStmt (stm, stms))
219                          else simplify (r, [])  (* prune unreachable statements *)
220                  in                  in
221                    simplify (body, stms)                    simplify (body, stms)
222                  end                  end

Legend:
Removed from v.2135  
changed lines
  Added in v.2140

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0