Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /sml/trunk/src/MLRISC/mltree/mltree-simplify.sml
ViewVC logotype

View of /sml/trunk/src/MLRISC/mltree/mltree-simplify.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 933 - (download) (annotate)
Wed Sep 19 19:31:19 2001 UTC (18 years ago) by george
File size: 67714 byte(s)
  cleanup
(* WARNING: this is generated by running 'nowhere mltree-simplify.in'.
 * Do not edit this file directly.
 * Version 1.2
 *)

(*#line 15.1 "mltree-simplify.in"*)
functor MLTreeSimplifier(
(*#line 16.4 "mltree-simplify.in"*)
                         structure T : MLTREE

(*#line 17.4 "mltree-simplify.in"*)
                         structure Size : MLTREE_SIZE

(*#line 18.7 "mltree-simplify.in"*)
                         where T = T

(*#line 20.4 "mltree-simplify.in"*)
                         val sext : T.rewriter -> (T.sext -> T.sext)

(*#line 21.4 "mltree-simplify.in"*)
                         val rext : T.rewriter -> (T.rext -> T.rext)

(*#line 22.4 "mltree-simplify.in"*)
                         val fext : T.rewriter -> (T.fext -> T.fext)

(*#line 23.4 "mltree-simplify.in"*)
                         val ccext : T.rewriter -> (T.ccext -> T.ccext)
                        ): MLTREE_SIMPLIFIER =
struct

(*#line 27.4 "mltree-simplify.in"*)
   structure T = T

(*#line 28.4 "mltree-simplify.in"*)
   structure I = T.I

(*#line 29.4 "mltree-simplify.in"*)
   structure R = MLTreeRewrite
      (
(*#line 30.7 "mltree-simplify.in"*)
       structure T = T

(*#line 31.7 "mltree-simplify.in"*)
       val sext = sext
       and rext = rext
       and fext = fext
       and ccext = ccext
      )


(*#line 34.4 "mltree-simplify.in"*)
   type simplifier = T.rewriter

(*#line 36.4 "mltree-simplify.in"*)
   val lit_11 = (IntInf.fromInt 0)
   and lit_16 = (IntInf.fromInt 1)

(*#line 37.4 "mltree-simplify.in"*)
   val zero = (IntInf.fromInt 0)

(*#line 38.4 "mltree-simplify.in"*)
   val zeroT = T.LI zero

(*#line 40.4 "mltree-simplify.in"*)
   fun simplify {addressWidth, signedAddress} = 
       let 
(*#line 43.4 "mltree-simplify.in"*)
           fun sim ==> exp = 
                  let val v_3 = exp
                      fun state_180 e = e
                      fun state_164 () = zeroT
                      fun state_173 () = zeroT
                      fun state_195 v_3 = 
                          let val exp = v_3
                          in exp
                          end
                      fun state_133 (v_1, v_4) = 
                          let val b = v_4
                              and ty = v_1
                          in b
                          end
                      fun state_15 (v_1, v_0) = 
                          let val a = v_0
                              and ty = v_1
                          in a
                          end
                      fun state_163 v_1 = 
                          let val ty = v_1
                          in zeroT
                          end
                      fun state_155 v_1 = 
                          let val ty = v_1
                          in zeroT
                          end
                      fun state_172 v_1 = 
                          let val ty = v_1
                          in zeroT
                          end
                      fun state_124 v_4 = 
                          let val b = v_4
                          in b
                          end
                      fun state_50 (v_1, v_4) = 
                          let val ty = v_1
                              and x = v_4
                          in x
                          end
                      fun state_48 v_1 = 
                          let val ty = v_1
                          in zeroT
                          end
                      fun state_52 (v_1, v_0) = 
                          let val ty = v_1
                              and x = v_0
                          in x
                          end
                      fun state_90 (v_1, v_4) = 
                          let val ty = v_1
                              and x = v_4
                          in x
                          end
                      fun state_88 v_1 = 
                          let val ty = v_1
                          in zeroT
                          end
                      fun state_92 (v_1, v_0) = 
                          let val ty = v_1
                              and x = v_0
                          in x
                          end
                      fun state_23 (v_1, v_4) = 
                          let val ty = v_1
                              and x = v_4
                          in x
                          end
                      fun state_21 v_1 = 
                          let val ty = v_1
                          in zeroT
                          end
                      fun state_25 (v_1, v_0) = 
                          let val ty = v_1
                              and x = v_0
                          in x
                          end
                      fun state_142 (v_1, v_4) = 
                          let val b = v_4
                              and ty = v_1
                          in zeroT
                          end
                      fun state_115 v_0 = 
                          let val a = v_0
                          in a
                          end
                      fun state_74 (v_1, v_0) = 
                          let val ty = v_1
                              and x = v_0
                          in x
                          end
                      fun state_5 (v_1, v_0) = 
                          let val ty = v_1
                              and x = v_0
                          in x
                          end
                      fun state_1855 (v_3, v_1, v_10, v_4) = (if ((IntInf.compare (v_10, lit_11)) = EQUAL)
                             then (state_133 (v_1, v_4))
                             else (state_195 v_3))
                      fun state_1570 (v_3, v_1, v_0, v_2) = (if ((IntInf.compare (v_2, lit_11)) = EQUAL)
                             then (state_15 (v_1, v_0))
                             else (state_195 v_3))
                      fun state_1387 (v_3, v_1, v_10) = (if ((IntInf.compare (v_10, lit_11)) = EQUAL)
                             then (state_163 v_1)
                             else (state_195 v_3))
                      fun state_1294 (v_3, v_1, v_10) = (if ((IntInf.compare (v_10, lit_11)) = EQUAL)
                             then (state_155 v_1)
                             else (state_195 v_3))
                      fun state_1111 (v_3, v_1, v_10) = (if ((IntInf.compare (v_10, lit_11)) = EQUAL)
                             then (state_172 v_1)
                             else (state_195 v_3))
                      fun state_979 (v_3, v_10, v_4) = (if ((IntInf.compare (v_10, lit_11)) = EQUAL)
                             then (state_124 v_4)
                             else (state_195 v_3))
                      fun state_877 (v_3, v_1, v_0, v_2) = (if ((IntInf.compare (v_2, lit_11)) = EQUAL)
                             then (state_48 v_1)
                             else (if ((IntInf.compare (v_2, lit_16)) = EQUAL)
                                then (state_52 (v_1, v_0))
                                else (state_195 v_3)))
                      fun state_782 (v_3, v_1, v_0, v_2) = (if ((IntInf.compare (v_2, lit_11)) = EQUAL)
                             then (state_88 v_1)
                             else (if ((IntInf.compare (v_2, lit_16)) = EQUAL)
                                then (state_92 (v_1, v_0))
                                else (state_195 v_3)))
                      fun state_687 (v_3, v_1, v_0, v_2) = (if ((IntInf.compare (v_2, lit_11)) = EQUAL)
                             then (state_21 v_1)
                             else (if ((IntInf.compare (v_2, lit_16)) = EQUAL)
                                then (state_25 (v_1, v_0))
                                else (state_195 v_3)))
                      fun state_594 (v_3, v_1, v_10, v_4) = (if ((IntInf.compare (v_10, lit_11)) = EQUAL)
                             then (state_142 (v_1, v_4))
                             else (state_195 v_3))
                      fun state_474 (v_3, v_0, v_10) = (if ((IntInf.compare (v_10, lit_11)) = EQUAL)
                             then (state_115 v_0)
                             else (state_195 v_3))
                      fun state_381 (v_3, v_1, v_0, v_2) = (if ((IntInf.compare (v_2, lit_11)) = EQUAL)
                             then (state_74 (v_1, v_0))
                             else (state_195 v_3))
                      fun state_196 (v_3, v_1, v_0, v_2) = (if ((IntInf.compare (v_2, lit_11)) = EQUAL)
                             then (state_5 (v_1, v_0))
                             else (state_195 v_3))
                      fun state_1571 (v_3, v_1, v_0, v_4) = 
                          (case v_4 of
                            T.LI v_2 => state_1570 (v_3, v_1, v_0, v_2)
                          | _ => state_195 v_3
                          )
                      fun state_197 (v_3, v_1, v_0, v_4) = 
                          (case v_4 of
                            T.LI v_2 => state_196 (v_3, v_1, v_0, v_2)
                          | _ => state_195 v_3
                          )
                  in 
                     (case v_3 of
                       T.ADD v_5 => 
                       let val (v_1, v_0, v_4) = v_5
                       in 
                          (case v_0 of
                            T.ADD v_10 => 
                            let val (v_7, v_9, v_13) = v_10
                            in 
                               (case v_13 of
                                 T.LI v_12 => 
                                 (case v_4 of
                                   T.LI v_2 => 
                                   let val a = v_9
                                       and ty = v_1
                                       and ty' = v_7
                                       and x = v_12
                                       and y = v_2
                                   in (if (ty = ty')
                                         then (T.ADD (ty, a, T.LI (I.ADD (ty, x, y))))
                                         else (state_196 (v_3, v_1, v_0, v_2)))
                                   end
                                 | _ => state_195 v_3
                                 )
                               | _ => state_197 (v_3, v_1, v_0, v_4)
                               )
                            end
                          | T.LABEXP v_10 => 
                            (case v_4 of
                              T.LABEXP v_2 => 
                              let val ty = v_1
                                  and x = v_10
                                  and y = v_2
                              in T.LABEXP (T.ADD (ty, x, y))
                              end
                            | T.LI v_2 => state_196 (v_3, v_1, v_0, v_2)
                            | _ => state_195 v_3
                            )
                          | T.LI v_10 => (if ((IntInf.compare (v_10, lit_11)) = EQUAL)
                               then 
                               let val ty = v_1
                                   and x = v_4
                               in x
                               end
                               else 
                               (case v_4 of
                                 T.LI v_2 => (if ((IntInf.compare (v_2, lit_11)) = EQUAL)
                                    then (state_5 (v_1, v_0))
                                    else 
                                    let val ty = v_1
                                        and x = v_10
                                        and y = v_2
                                    in T.LI (I.ADD (ty, x, y))
                                    end)
                               | _ => state_195 v_3
                               ))
                          | _ => state_197 (v_3, v_1, v_0, v_4)
                          )
                       end
                     | T.ADDT v_5 => 
                       let val (v_1, v_0, v_4) = v_5
                       in 
                          (case v_0 of
                            T.LABEXP v_10 => 
                            (case v_4 of
                              T.LABEXP v_2 => 
                              let val ty = v_1
                                  and x = v_10
                                  and y = v_2
                              in T.LABEXP (T.ADDT (ty, x, y))
                              end
                            | T.LI v_2 => state_381 (v_3, v_1, v_0, v_2)
                            | _ => state_195 v_3
                            )
                          | T.LI v_10 => (if ((IntInf.compare (v_10, lit_11)) = EQUAL)
                               then 
                               let val ty = v_1
                                   and x = v_4
                               in x
                               end
                               else 
                               (case v_4 of
                                 T.LI v_2 => (if ((IntInf.compare (v_2, lit_11)) = EQUAL)
                                    then (state_74 (v_1, v_0))
                                    else 
                                    let val ty = v_1
                                        and x = v_10
                                        and y = v_2
                                    in (T.LI (I.ADDT (ty, x, y)))handle Overflow => exp

                                    end)
                               | _ => state_195 v_3
                               ))
                          | _ => 
                            (case v_4 of
                              T.LI v_2 => state_381 (v_3, v_1, v_0, v_2)
                            | _ => state_195 v_3
                            )
                          )
                       end
                     | T.ANDB v_5 => 
                       let val (v_1, v_0, v_4) = v_5
                       in 
                          (case v_4 of
                            T.LABEXP v_2 => 
                            (case v_0 of
                              T.LABEXP v_10 => 
                              let val ty = v_1
                                  and x = v_10
                                  and y = v_2
                              in T.LABEXP (T.ANDB (ty, x, y))
                              end
                            | T.LI v_10 => state_474 (v_3, v_0, v_10)
                            | _ => state_195 v_3
                            )
                          | T.LI v_2 => (if ((IntInf.compare (v_2, lit_11)) = EQUAL)
                               then 
                               let val b = v_4
                               in b
                               end
                               else 
                               (case v_0 of
                                 T.LI v_10 => (if ((IntInf.compare (v_10, lit_11)) = EQUAL)
                                    then (state_115 v_0)
                                    else 
                                    let val ty = v_1
                                        and x = v_10
                                        and y = v_2
                                    in T.LI (I.ANDB (ty, x, y))
                                    end)
                               | _ => state_195 v_3
                               ))
                          | T.NOTB v_2 => 
                            (case v_0 of
                              T.LI v_10 => state_474 (v_3, v_0, v_10)
                            | T.NOTB v_10 => 
                              let val (v_7, v_9) = v_10
                              in 
                                 let val (v_6, v_8) = v_2
                                 in 
                                    let val a = v_9
                                        and b = v_8
                                        and ty = v_1
                                        and ty' = v_7
                                        and ty'' = v_6
                                    in (if ((ty = ty') andalso (ty' = ty''))
                                          then (T.NOTB (ty, T.ORB (ty, a, b)))
                                          else (state_195 v_3))
                                    end
                                 end
                              end
                            | _ => state_195 v_3
                            )
                          | _ => 
                            (case v_0 of
                              T.LI v_10 => state_474 (v_3, v_0, v_10)
                            | _ => state_195 v_3
                            )
                          )
                       end
                     | T.COND v_5 => 
                       let val (v_1, v_0, v_4, v_17) = v_5
                       in 
                          (case v_0 of
                            T.FALSE => 
                            let val a = v_4
                                and b = v_17
                                and ty = v_1
                            in b
                            end
                          | T.TRUE => 
                            let val a = v_4
                                and b = v_17
                                and ty = v_1
                            in a
                            end
                          | _ => state_195 v_3
                          )
                       end
                     | T.DIVS v_5 => 
                       let val (v_1, v_0, v_4) = v_5
                       in 
                          (case v_4 of
                            T.LABEXP v_2 => 
                            (case v_0 of
                              T.LABEXP v_10 => 
                              let val ty = v_1
                                  and x = v_10
                                  and y = v_2
                              in T.LABEXP (T.DIVS (ty, x, y))
                              end
                            | _ => state_195 v_3
                            )
                          | T.LI v_2 => (if ((IntInf.compare (v_2, lit_16)) = EQUAL)
                               then 
                               let val a = v_0
                                   and ty = v_1
                               in a
                               end
                               else 
                               (case v_0 of
                                 T.LI v_10 => 
                                 let val ty = v_1
                                     and x = v_10
                                     and y = v_2
                                 in (if (y <> zero)
                                       then (T.LI (I.DIVS (ty, x, y)))
                                       else (state_195 v_3))
                                 end
                               | _ => state_195 v_3
                               ))
                          | _ => state_195 v_3
                          )
                       end
                     | T.DIVT v_5 => 
                       let val (v_1, v_0, v_4) = v_5
                       in 
                          (case v_4 of
                            T.LABEXP v_2 => 
                            (case v_0 of
                              T.LABEXP v_10 => 
                              let val ty = v_1
                                  and x = v_10
                                  and y = v_2
                              in T.LABEXP (T.DIVT (ty, x, y))
                              end
                            | _ => state_195 v_3
                            )
                          | T.LI v_2 => (if ((IntInf.compare (v_2, lit_16)) = EQUAL)
                               then 
                               let val a = v_0
                                   and ty = v_1
                               in a
                               end
                               else 
                               (case v_0 of
                                 T.LI v_10 => 
                                 let val ty = v_1
                                     and x = v_10
                                     and y = v_2
                                 in (if (y <> zero)
                                       then (T.LI (I.DIVT (ty, x, y)))
                                       else (state_195 v_3))
                                 end
                               | _ => state_195 v_3
                               ))
                          | _ => state_195 v_3
                          )
                       end
                     | T.DIVU v_5 => 
                       let val (v_1, v_0, v_4) = v_5
                       in 
                          (case v_4 of
                            T.LABEXP v_2 => 
                            (case v_0 of
                              T.LABEXP v_10 => 
                              let val ty = v_1
                                  and x = v_10
                                  and y = v_2
                              in T.LABEXP (T.DIVU (ty, x, y))
                              end
                            | _ => state_195 v_3
                            )
                          | T.LI v_2 => (if ((IntInf.compare (v_2, lit_16)) = EQUAL)
                               then 
                               let val a = v_0
                                   and ty = v_1
                               in a
                               end
                               else 
                               (case v_0 of
                                 T.LI v_10 => 
                                 let val ty = v_1
                                     and x = v_10
                                     and y = v_2
                                 in (if (y <> zero)
                                       then (T.LI (I.DIVU (ty, x, y)))
                                       else (state_195 v_3))
                                 end
                               | _ => state_195 v_3
                               ))
                          | _ => state_195 v_3
                          )
                       end
                     | T.EQVB v_5 => 
                       let val (v_1, v_0, v_4) = v_5
                       in 
                          (case v_4 of
                            T.LABEXP v_2 => 
                            (case v_0 of
                              T.LABEXP v_10 => 
                              let val ty = v_1
                                  and x = v_10
                                  and y = v_2
                              in T.LABEXP (T.EQVB (ty, x, y))
                              end
                            | T.LI v_10 => state_594 (v_3, v_1, v_10, v_4)
                            | _ => state_195 v_3
                            )
                          | T.LI v_2 => (if ((IntInf.compare (v_2, lit_11)) = EQUAL)
                               then 
                               let val a = v_0
                                   and ty = v_1
                               in zeroT
                               end
                               else 
                               (case v_0 of
                                 T.LI v_10 => (if ((IntInf.compare (v_10, lit_11)) = EQUAL)
                                    then (state_142 (v_1, v_4))
                                    else 
                                    let val ty = v_1
                                        and x = v_10
                                        and y = v_2
                                    in T.LI (I.EQVB (ty, x, y))
                                    end)
                               | _ => state_195 v_3
                               ))
                          | _ => 
                            (case v_0 of
                              T.LI v_10 => state_594 (v_3, v_1, v_10, v_4)
                            | _ => state_195 v_3
                            )
                          )
                       end
                     | T.MULS v_5 => 
                       let val (v_1, v_0, v_4) = v_5
                       in 
                          (case v_0 of
                            T.LABEXP v_10 => 
                            (case v_4 of
                              T.LABEXP v_2 => 
                              let val ty = v_1
                                  and x = v_10
                                  and y = v_2
                              in T.LABEXP (T.MULS (ty, x, y))
                              end
                            | T.LI v_2 => state_687 (v_3, v_1, v_0, v_2)
                            | _ => state_195 v_3
                            )
                          | T.LI v_10 => (if ((IntInf.compare (v_10, lit_11)) = EQUAL)
                               then 
                               let val ty = v_1
                               in zeroT
                               end
                               else (if ((IntInf.compare (v_10, lit_16)) = EQUAL)
                                  then 
                                  (case v_4 of
                                    T.LI v_2 => (if ((IntInf.compare (v_2, lit_11)) = EQUAL)
                                       then (state_21 v_1)
                                       else (if ((IntInf.compare (v_2, lit_16)) = EQUAL)
                                          then (state_23 (v_1, v_4))
                                          else (state_23 (v_1, v_4))))
                                  | _ => state_23 (v_1, v_4)
                                  )
                                  else 
                                  (case v_4 of
                                    T.LI v_2 => (if ((IntInf.compare (v_2, lit_11)) = EQUAL)
                                       then (state_21 v_1)
                                       else (if ((IntInf.compare (v_2, lit_16)) = EQUAL)
                                          then (state_25 (v_1, v_0))
                                          else 
                                          let val ty = v_1
                                              and x = v_10
                                              and y = v_2
                                          in T.LI (I.MULS (ty, x, y))
                                          end))
                                  | _ => state_195 v_3
                                  )))
                          | _ => 
                            (case v_4 of
                              T.LI v_2 => state_687 (v_3, v_1, v_0, v_2)
                            | _ => state_195 v_3
                            )
                          )
                       end
                     | T.MULT v_5 => 
                       let val (v_1, v_0, v_4) = v_5
                       in 
                          (case v_0 of
                            T.LABEXP v_10 => 
                            (case v_4 of
                              T.LABEXP v_2 => 
                              let val ty = v_1
                                  and x = v_10
                                  and y = v_2
                              in T.LABEXP (T.MULT (ty, x, y))
                              end
                            | T.LI v_2 => state_782 (v_3, v_1, v_0, v_2)
                            | _ => state_195 v_3
                            )
                          | T.LI v_10 => (if ((IntInf.compare (v_10, lit_11)) = EQUAL)
                               then 
                               let val ty = v_1
                               in zeroT
                               end
                               else (if ((IntInf.compare (v_10, lit_16)) = EQUAL)
                                  then 
                                  (case v_4 of
                                    T.LI v_2 => (if ((IntInf.compare (v_2, lit_11)) = EQUAL)
                                       then (state_88 v_1)
                                       else (if ((IntInf.compare (v_2, lit_16)) = EQUAL)
                                          then (state_90 (v_1, v_4))
                                          else (state_90 (v_1, v_4))))
                                  | _ => state_90 (v_1, v_4)
                                  )
                                  else 
                                  (case v_4 of
                                    T.LI v_2 => (if ((IntInf.compare (v_2, lit_11)) = EQUAL)
                                       then (state_88 v_1)
                                       else (if ((IntInf.compare (v_2, lit_16)) = EQUAL)
                                          then (state_92 (v_1, v_0))
                                          else 
                                          let val ty = v_1
                                              and x = v_10
                                              and y = v_2
                                          in (T.LI (I.MULT (ty, x, y)))handle Overflow => exp

                                          end))
                                  | _ => state_195 v_3
                                  )))
                          | _ => 
                            (case v_4 of
                              T.LI v_2 => state_782 (v_3, v_1, v_0, v_2)
                            | _ => state_195 v_3
                            )
                          )
                       end
                     | T.MULU v_5 => 
                       let val (v_1, v_0, v_4) = v_5
                       in 
                          (case v_0 of
                            T.LABEXP v_10 => 
                            (case v_4 of
                              T.LABEXP v_2 => 
                              let val ty = v_1
                                  and x = v_10
                                  and y = v_2
                              in T.LABEXP (T.MULU (ty, x, y))
                              end
                            | T.LI v_2 => state_877 (v_3, v_1, v_0, v_2)
                            | _ => state_195 v_3
                            )
                          | T.LI v_10 => (if ((IntInf.compare (v_10, lit_11)) = EQUAL)
                               then 
                               let val ty = v_1
                               in zeroT
                               end
                               else (if ((IntInf.compare (v_10, lit_16)) = EQUAL)
                                  then 
                                  (case v_4 of
                                    T.LI v_2 => (if ((IntInf.compare (v_2, lit_11)) = EQUAL)
                                       then (state_48 v_1)
                                       else (if ((IntInf.compare (v_2, lit_16)) = EQUAL)
                                          then (state_50 (v_1, v_4))
                                          else (state_50 (v_1, v_4))))
                                  | _ => state_50 (v_1, v_4)
                                  )
                                  else 
                                  (case v_4 of
                                    T.LI v_2 => (if ((IntInf.compare (v_2, lit_11)) = EQUAL)
                                       then (state_48 v_1)
                                       else (if ((IntInf.compare (v_2, lit_16)) = EQUAL)
                                          then (state_52 (v_1, v_0))
                                          else 
                                          let val ty = v_1
                                              and x = v_10
                                              and y = v_2
                                          in T.LI (I.MULU (ty, x, y))
                                          end))
                                  | _ => state_195 v_3
                                  )))
                          | _ => 
                            (case v_4 of
                              T.LI v_2 => state_877 (v_3, v_1, v_0, v_2)
                            | _ => state_195 v_3
                            )
                          )
                       end
                     | T.NEGT v_5 => 
                       let val (v_1, v_0) = v_5
                       in 
                          (case v_0 of
                            T.LABEXP v_10 => 
                            let val ty = v_1
                                and x = v_10
                            in T.LABEXP (T.NEGT (ty, x))
                            end
                          | T.LI v_10 => 
                            let val ty = v_1
                                and x = v_10
                            in (T.LI (I.NEGT (ty, x)))handle Overflow => exp

                            end
                          | _ => state_195 v_3
                          )
                       end
                     | T.NOTB v_5 => 
                       let val (v_1, v_0) = v_5
                       in 
                          (case v_0 of
                            T.LABEXP v_10 => 
                            let val ty = v_1
                                and x = v_10
                            in T.LABEXP (T.NOTB (ty, x))
                            end
                          | T.LI v_10 => 
                            let val n = v_10
                                and ty = v_1
                            in T.LI (I.NOTB (ty, n))
                            end
                          | T.NOTB v_10 => 
                            let val (v_7, v_9) = v_10
                            in 
                               let val a = v_9
                                   and ty = v_1
                                   and ty' = v_7
                               in (if (ty = ty')
                                     then a
                                     else (state_195 v_3))
                               end
                            end
                          | _ => state_195 v_3
                          )
                       end
                     | T.ORB v_5 => 
                       let val (v_1, v_0, v_4) = v_5
                       in 
                          (case v_4 of
                            T.LABEXP v_2 => 
                            (case v_0 of
                              T.LABEXP v_10 => 
                              let val ty = v_1
                                  and x = v_10
                                  and y = v_2
                              in T.LABEXP (T.ORB (ty, x, y))
                              end
                            | T.LI v_10 => state_979 (v_3, v_10, v_4)
                            | _ => state_195 v_3
                            )
                          | T.LI v_2 => (if ((IntInf.compare (v_2, lit_11)) = EQUAL)
                               then 
                               let val a = v_0
                               in a
                               end
                               else 
                               (case v_0 of
                                 T.LI v_10 => (if ((IntInf.compare (v_10, lit_11)) = EQUAL)
                                    then (state_124 v_4)
                                    else 
                                    let val ty = v_1
                                        and x = v_10
                                        and y = v_2
                                    in T.LI (I.ORB (ty, x, y))
                                    end)
                               | _ => state_195 v_3
                               ))
                          | T.NOTB v_2 => 
                            (case v_0 of
                              T.LI v_10 => state_979 (v_3, v_10, v_4)
                            | T.NOTB v_10 => 
                              let val (v_7, v_9) = v_10
                              in 
                                 let val (v_6, v_8) = v_2
                                 in 
                                    let val a = v_9
                                        and b = v_8
                                        and ty = v_1
                                        and ty' = v_7
                                        and ty'' = v_6
                                    in (if ((ty = ty') andalso (ty' = ty''))
                                          then (T.NOTB (ty, T.ANDB (ty, a, b)))
                                          else (state_195 v_3))
                                    end
                                 end
                              end
                            | _ => state_195 v_3
                            )
                          | _ => 
                            (case v_0 of
                              T.LI v_10 => state_979 (v_3, v_10, v_4)
                            | _ => state_195 v_3
                            )
                          )
                       end
                     | T.QUOTS v_5 => 
                       let val (v_1, v_0, v_4) = v_5
                       in 
                          (case v_4 of
                            T.LABEXP v_2 => 
                            (case v_0 of
                              T.LABEXP v_10 => 
                              let val ty = v_1
                                  and x = v_10
                                  and y = v_2
                              in T.LABEXP (T.QUOTS (ty, x, y))
                              end
                            | _ => state_195 v_3
                            )
                          | T.LI v_2 => (if ((IntInf.compare (v_2, lit_16)) = EQUAL)
                               then 
                               let val a = v_0
                                   and ty = v_1
                               in a
                               end
                               else 
                               (case v_0 of
                                 T.LI v_10 => 
                                 let val ty = v_1
                                     and x = v_10
                                     and y = v_2
                                 in (if (y <> zero)
                                       then (T.LI (I.QUOTS (ty, x, y)))
                                       else (state_195 v_3))
                                 end
                               | _ => state_195 v_3
                               ))
                          | _ => state_195 v_3
                          )
                       end
                     | T.QUOTT v_5 => 
                       let val (v_1, v_0, v_4) = v_5
                       in 
                          (case v_4 of
                            T.LABEXP v_2 => 
                            (case v_0 of
                              T.LABEXP v_10 => 
                              let val ty = v_1
                                  and x = v_10
                                  and y = v_2
                              in T.LABEXP (T.QUOTT (ty, x, y))
                              end
                            | _ => state_195 v_3
                            )
                          | T.LI v_2 => (if ((IntInf.compare (v_2, lit_16)) = EQUAL)
                               then 
                               let val a = v_0
                                   and ty = v_1
                               in a
                               end
                               else 
                               (case v_0 of
                                 T.LI v_10 => 
                                 let val ty = v_1
                                     and x = v_10
                                     and y = v_2
                                 in (if (y <> zero)
                                       then (T.LI (I.QUOTT (ty, x, y)))
                                       else (state_195 v_3))
                                 end
                               | _ => state_195 v_3
                               ))
                          | _ => state_195 v_3
                          )
                       end
                     | T.REMS v_5 => 
                       let val (v_1, v_0, v_4) = v_5
                       in 
                          (case v_4 of
                            T.LABEXP v_2 => 
                            (case v_0 of
                              T.LABEXP v_10 => 
                              let val ty = v_1
                                  and x = v_10
                                  and y = v_2
                              in T.LABEXP (T.REMS (ty, x, y))
                              end
                            | _ => state_195 v_3
                            )
                          | T.LI v_2 => (if ((IntInf.compare (v_2, lit_16)) = EQUAL)
                               then 
                               let val a = v_0
                                   and ty = v_1
                               in zeroT
                               end
                               else 
                               (case v_0 of
                                 T.LI v_10 => 
                                 let val ty = v_1
                                     and x = v_10
                                     and y = v_2
                                 in (if (y <> zero)
                                       then (T.LI (I.REMS (ty, x, y)))
                                       else (state_195 v_3))
                                 end
                               | _ => state_195 v_3
                               ))
                          | _ => state_195 v_3
                          )
                       end
                     | T.REMT v_5 => 
                       let val (v_1, v_0, v_4) = v_5
                       in 
                          (case v_4 of
                            T.LABEXP v_2 => 
                            (case v_0 of
                              T.LABEXP v_10 => 
                              let val ty = v_1
                                  and x = v_10
                                  and y = v_2
                              in T.LABEXP (T.REMT (ty, x, y))
                              end
                            | _ => state_195 v_3
                            )
                          | T.LI v_2 => (if ((IntInf.compare (v_2, lit_16)) = EQUAL)
                               then 
                               let val a = v_0
                                   and ty = v_1
                               in zeroT
                               end
                               else 
                               (case v_0 of
                                 T.LI v_10 => 
                                 let val ty = v_1
                                     and x = v_10
                                     and y = v_2
                                 in (if (y <> zero)
                                       then (T.LI (I.REMT (ty, x, y)))
                                       else (state_195 v_3))
                                 end
                               | _ => state_195 v_3
                               ))
                          | _ => state_195 v_3
                          )
                       end
                     | T.REMU v_5 => 
                       let val (v_1, v_0, v_4) = v_5
                       in 
                          (case v_4 of
                            T.LABEXP v_2 => 
                            (case v_0 of
                              T.LABEXP v_10 => 
                              let val ty = v_1
                                  and x = v_10
                                  and y = v_2
                              in T.LABEXP (T.REMU (ty, x, y))
                              end
                            | _ => state_195 v_3
                            )
                          | T.LI v_2 => (if ((IntInf.compare (v_2, lit_16)) = EQUAL)
                               then 
                               let val a = v_0
                                   and ty = v_1
                               in zeroT
                               end
                               else 
                               (case v_0 of
                                 T.LI v_10 => 
                                 let val ty = v_1
                                     and x = v_10
                                     and y = v_2
                                 in (if (y <> zero)
                                       then (T.LI (I.REMU (ty, x, y)))
                                       else (state_195 v_3))
                                 end
                               | _ => state_195 v_3
                               ))
                          | _ => state_195 v_3
                          )
                       end
                     | T.SLL v_5 => 
                       let val (v_1, v_0, v_4) = v_5
                       in 
                          (case v_4 of
                            T.LABEXP v_2 => 
                            (case v_0 of
                              T.LABEXP v_10 => 
                              let val ty = v_1
                                  and x = v_10
                                  and y = v_2
                              in T.LABEXP (T.SLL (ty, x, y))
                              end
                            | T.LI v_10 => state_1111 (v_3, v_1, v_10)
                            | _ => state_195 v_3
                            )
                          | T.LI v_2 => (if ((IntInf.compare (v_2, lit_11)) = EQUAL)
                               then 
                               let val a = v_0
                                   and ty = v_1
                               in a
                               end
                               else 
                               (case v_0 of
                                 T.LI v_10 => (if ((IntInf.compare (v_10, lit_11)) = EQUAL)
                                    then (state_172 v_1)
                                    else 
                                    let val n = v_2
                                        and ty = v_1
                                    in (if (IntInf.<= (IntInf.fromInt ty, n))
                                          then (state_173 ())
                                          else 
                                          let val ty = v_1
                                              and x = v_10
                                              and y = v_2
                                          in T.LI (I.SLL (ty, x, y))
                                          end)
                                    end)
                               | _ => 
                                 let val n = v_2
                                     and ty = v_1
                                 in (if (IntInf.<= (IntInf.fromInt ty, n))
                                       then (state_173 ())
                                       else (state_195 v_3))
                                 end
                               ))
                          | _ => 
                            (case v_0 of
                              T.LI v_10 => state_1111 (v_3, v_1, v_10)
                            | _ => state_195 v_3
                            )
                          )
                       end
                     | T.SRA v_5 => 
                       let val (v_1, v_0, v_4) = v_5
                       in 
                          (case v_4 of
                            T.LABEXP v_2 => 
                            (case v_0 of
                              T.LABEXP v_10 => 
                              let val ty = v_1
                                  and x = v_10
                                  and y = v_2
                              in T.LABEXP (T.SRA (ty, x, y))
                              end
                            | T.LI v_10 => state_1294 (v_3, v_1, v_10)
                            | _ => state_195 v_3
                            )
                          | T.LI v_2 => (if ((IntInf.compare (v_2, lit_11)) = EQUAL)
                               then 
                               let val a = v_0
                                   and ty = v_1
                               in a
                               end
                               else 
                               (case v_0 of
                                 T.LI v_10 => (if ((IntInf.compare (v_10, lit_11)) = EQUAL)
                                    then (state_155 v_1)
                                    else 
                                    let val ty = v_1
                                        and x = v_10
                                        and y = v_2
                                    in T.LI (I.SRA (ty, x, y))
                                    end)
                               | _ => state_195 v_3
                               ))
                          | _ => 
                            (case v_0 of
                              T.LI v_10 => state_1294 (v_3, v_1, v_10)
                            | _ => state_195 v_3
                            )
                          )
                       end
                     | T.SRL v_5 => 
                       let val (v_1, v_0, v_4) = v_5
                       in 
                          (case v_4 of
                            T.LABEXP v_2 => 
                            (case v_0 of
                              T.LABEXP v_10 => 
                              let val ty = v_1
                                  and x = v_10
                                  and y = v_2
                              in T.LABEXP (T.SRL (ty, x, y))
                              end
                            | T.LI v_10 => state_1387 (v_3, v_1, v_10)
                            | _ => state_195 v_3
                            )
                          | T.LI v_2 => (if ((IntInf.compare (v_2, lit_11)) = EQUAL)
                               then 
                               let val a = v_0
                                   and ty = v_1
                               in a
                               end
                               else 
                               (case v_0 of
                                 T.LI v_10 => (if ((IntInf.compare (v_10, lit_11)) = EQUAL)
                                    then (state_163 v_1)
                                    else 
                                    let val n = v_2
                                        and ty = v_1
                                    in (if (IntInf.<= (IntInf.fromInt ty, n))
                                          then (state_164 ())
                                          else 
                                          let val ty = v_1
                                              and x = v_10
                                              and y = v_2
                                          in T.LI (I.SRL (ty, x, y))
                                          end)
                                    end)
                               | _ => 
                                 let val n = v_2
                                     and ty = v_1
                                 in (if (IntInf.<= (IntInf.fromInt ty, n))
                                       then (state_164 ())
                                       else (state_195 v_3))
                                 end
                               ))
                          | _ => 
                            (case v_0 of
                              T.LI v_10 => state_1387 (v_3, v_1, v_10)
                            | _ => state_195 v_3
                            )
                          )
                       end
                     | T.SUB v_5 => 
                       let val (v_1, v_0, v_4) = v_5
                       in 
                          (case v_0 of
                            T.LABEXP v_10 => 
                            (case v_4 of
                              T.LABEXP v_2 => 
                              let val ty = v_1
                                  and x = v_10
                                  and y = v_2
                              in T.LABEXP (T.SUB (ty, x, y))
                              end
                            | T.LI v_2 => state_1570 (v_3, v_1, v_0, v_2)
                            | _ => state_195 v_3
                            )
                          | T.LI v_10 => 
                            (case v_4 of
                              T.LI v_2 => (if ((IntInf.compare (v_2, lit_11)) = EQUAL)
                                 then (state_15 (v_1, v_0))
                                 else 
                                 let val ty = v_1
                                     and x = v_10
                                     and y = v_2
                                 in T.LI (I.SUB (ty, x, y))
                                 end)
                            | T.SUB v_2 => 
                              let val (v_6, v_8, v_14) = v_2
                              in (if ((IntInf.compare (v_10, lit_11)) = EQUAL)
                                    then 
                                    (case v_8 of
                                      T.LI v_15 => (if ((IntInf.compare (v_15, lit_11)) = EQUAL)
                                         then 
                                         let val a = v_14
                                             and ty = v_1
                                             and ty' = v_6
                                         in (if (ty = ty')
                                               then a
                                               else (state_195 v_3))
                                         end
                                         else (state_195 v_3))
                                    | _ => state_195 v_3
                                    )
                                    else (state_195 v_3))
                              end
                            | _ => state_195 v_3
                            )
                          | T.SUB v_10 => 
                            let val (v_7, v_9, v_13) = v_10
                            in 
                               (case v_13 of
                                 T.LI v_12 => 
                                 (case v_4 of
                                   T.LI v_2 => 
                                   let val a = v_9
                                       and ty = v_1
                                       and ty' = v_7
                                       and x = v_12
                                       and y = v_2
                                   in (if (ty = ty')
                                         then (T.SUB (ty, a, T.LI (I.ADD (ty, x, y))))
                                         else (state_1570 (v_3, v_1, v_0, v_2)))
                                   end
                                 | _ => state_195 v_3
                                 )
                               | _ => state_1571 (v_3, v_1, v_0, v_4)
                               )
                            end
                          | _ => state_1571 (v_3, v_1, v_0, v_4)
                          )
                       end
                     | T.SUBT v_5 => 
                       let val (v_1, v_0, v_4) = v_5
                       in 
                          (case v_4 of
                            T.LABEXP v_2 => 
                            (case v_0 of
                              T.LABEXP v_10 => 
                              let val ty = v_1
                                  and x = v_10
                                  and y = v_2
                              in T.LABEXP (T.SUBT (ty, x, y))
                              end
                            | _ => state_195 v_3
                            )
                          | T.LI v_2 => (if ((IntInf.compare (v_2, lit_11)) = EQUAL)
                               then 
                               let val a = v_0
                                   and ty = v_1
                               in a
                               end
                               else 
                               (case v_0 of
                                 T.LI v_10 => 
                                 let val ty = v_1
                                     and x = v_10
                                     and y = v_2
                                 in (T.LI (I.SUBT (ty, x, y)))handle Overflow => exp

                                 end
                               | _ => state_195 v_3
                               ))
                          | _ => state_195 v_3
                          )
                       end
                     | T.SX v_5 => 
                       let val (v_1, v_0, v_4) = v_5
                       in 
                          (case v_4 of
                            T.LABEXP v_2 => 
                            let val e = v_4
                                and ty = v_1
                                and ty' = v_0
                            in (if (ty = ty')
                                  then (state_180 e)
                                  else 
                                  let val ty = v_1
                                      and ty' = v_0
                                      and x = v_2
                                  in T.LABEXP (T.SX (ty, ty', x))
                                  end)
                            end
                          | T.LI v_2 => 
                            let val e = v_4
                                and ty = v_1
                                and ty' = v_0
                            in (if (ty = ty')
                                  then (state_180 e)
                                  else 
                                  let val n = v_2
                                      and ty = v_1
                                      and ty' = v_0
                                  in T.LI (I.SX (ty, ty', n))
                                  end)
                            end
                          | T.LOAD v_2 => 
                            let val ty = v_1
                                and ty' = v_0
                            in exp
                            end
                          | _ => 
                            let val e = v_4
                                and ty = v_1
                                and ty' = v_0
                            in (if (ty = ty')
                                  then (state_180 e)
                                  else (state_195 v_3))
                            end
                          )
                       end
                     | T.XORB v_5 => 
                       let val (v_1, v_0, v_4) = v_5
                       in 
                          (case v_4 of
                            T.LABEXP v_2 => 
                            (case v_0 of
                              T.LABEXP v_10 => 
                              let val ty = v_1
                                  and x = v_10
                                  and y = v_2
                              in T.LABEXP (T.XORB (ty, x, y))
                              end
                            | T.LI v_10 => state_1855 (v_3, v_1, v_10, v_4)
                            | _ => state_195 v_3
                            )
                          | T.LI v_2 => (if ((IntInf.compare (v_2, lit_11)) = EQUAL)
                               then 
                               let val a = v_0
                                   and ty = v_1
                               in a
                               end
                               else 
                               (case v_0 of
                                 T.LI v_10 => (if ((IntInf.compare (v_10, lit_11)) = EQUAL)
                                    then (state_133 (v_1, v_4))
                                    else 
                                    let val ty = v_1
                                        and x = v_10
                                        and y = v_2
                                    in T.LI (I.XORB (ty, x, y))
                                    end)
                               | _ => state_195 v_3
                               ))
                          | T.NOTB v_2 => 
                            (case v_0 of
                              T.LI v_10 => state_1855 (v_3, v_1, v_10, v_4)
                            | T.NOTB v_10 => 
                              let val (v_7, v_9) = v_10
                              in 
                                 let val (v_6, v_8) = v_2
                                 in 
                                    let val a = v_9
                                        and b = v_8
                                        and ty = v_1
                                        and ty' = v_7
                                        and ty'' = v_6
                                    in (if ((ty = ty') andalso (ty' = ty''))
                                          then (T.NOTB (ty, T.XORB (ty, a, b)))
                                          else (state_195 v_3))
                                    end
                                 end
                              end
                            | _ => state_195 v_3
                            )
                          | _ => 
                            (case v_0 of
                              T.LI v_10 => state_1855 (v_3, v_1, v_10, v_4)
                            | _ => state_195 v_3
                            )
                          )
                       end
                     | T.ZX v_5 => 
                       let val (v_1, v_0, v_4) = v_5
                       in 
                          let val e = v_4
                              and ty = v_1
                              and ty' = v_0
                          in (if (ty = ty')
                                then e
                                else 
                                (case v_4 of
                                  T.LABEXP v_2 => 
                                  let val ty = v_1
                                      and ty' = v_0
                                      and x = v_2
                                  in T.LABEXP (T.ZX (ty, ty', x))
                                  end
                                | T.LI v_2 => 
                                  let val n = v_2
                                      and ty = v_1
                                      and ty' = v_0
                                  in T.LI (I.ZX (ty, ty', n))
                                  end
                                | _ => state_195 v_3
                                ))
                          end
                       end
                     | _ => state_195 v_3
                     )
                  end
           and simStm ==> (T.IF(T.TRUE, yes, no)) = yes
             | simStm ==> (T.IF(T.FALSE, yes, no)) = no
             | simStm ==> (T.SEQ[x]) = x
             | simStm ==> s = s
           and simF p_0 p_1 = 
               let val v_10 = (p_0, p_1)
                   fun state_8 (v_0, v_1) = 
                       let val ==> = v_0
                           and exp = v_1
                       in exp
                       end
               in 
                  let val (v_0, v_1) = v_10
                  in 
                     (case v_1 of
                       T.CVTF2F v_7 => 
                       let val (v_3, v_6, v_8) = v_7
                       in 
                          let val ==> = v_0
                              and e = v_8
                              and ty = v_3
                              and ty' = v_6
                          in (if (ty = ty')
                                then e
                                else (state_8 (v_0, v_1)))
                          end
                       end
                     | T.FCOND v_7 => 
                       let val (v_3, v_6, v_8, v_9) = v_7
                       in 
                          (case v_6 of
                            T.FALSE => 
                            let val ==> = v_0
                                and no = v_9
                                and ty = v_3
                                and yes = v_8
                            in no
                            end
                          | T.TRUE => 
                            let val ==> = v_0
                                and no = v_9
                                and ty = v_3
                                and yes = v_8
                            in yes
                            end
                          | _ => state_8 (v_0, v_1)
                          )
                       end
                     | T.FNEG v_7 => 
                       let val (v_3, v_6) = v_7
                       in 
                          (case v_6 of
                            T.FNEG v_5 => 
                            let val (v_2, v_4) = v_5
                            in 
                               let val ==> = v_0
                                   and e = v_4
                                   and ty = v_3
                                   and ty' = v_2
                               in (if (ty = ty')
                                     then e
                                     else (state_8 (v_0, v_1)))
                               end
                            end
                          | _ => state_8 (v_0, v_1)
                          )
                       end
                     | _ => state_8 (v_0, v_1)
                     )
                  end
               end
           and cc false = T.FALSE
             | cc true = T.TRUE
           and simCC ==> (T.CMP(ty, T.EQ, T.LI x, T.LI y)) = cc (I.EQ (ty, x, y))
             | simCC ==> (T.CMP(ty, T.NE, T.LI x, T.LI y)) = cc (I.NE (ty, x, y))
             | simCC ==> (T.CMP(ty, T.GT, T.LI x, T.LI y)) = cc (I.GT (ty, x, y))
             | simCC ==> (T.CMP(ty, T.GE, T.LI x, T.LI y)) = cc (I.GE (ty, x, y))
             | simCC ==> (T.CMP(ty, T.LT, T.LI x, T.LI y)) = cc (I.LT (ty, x, y))
             | simCC ==> (T.CMP(ty, T.LE, T.LI x, T.LI y)) = cc (I.LE (ty, x, y))
             | simCC ==> (T.CMP(ty, T.GTU, T.LI x, T.LI y)) = cc (I.GTU (ty, x, y))
             | simCC ==> (T.CMP(ty, T.LTU, T.LI x, T.LI y)) = cc (I.LTU (ty, x, y))
             | simCC ==> (T.CMP(ty, T.GEU, T.LI x, T.LI y)) = cc (I.GEU (ty, x, y))
             | simCC ==> (T.CMP(ty, T.LEU, T.LI x, T.LI y)) = cc (I.LEU (ty, x, y))
             | simCC ==> (T.AND(T.TRUE, x)) = x
             | simCC ==> (T.AND(x, T.TRUE)) = x
             | simCC ==> (T.AND(T.FALSE, x)) = T.FALSE
             | simCC ==> (T.AND(x, T.FALSE)) = T.FALSE
             | simCC ==> (T.OR(T.FALSE, x)) = x
             | simCC ==> (T.OR(x, T.FALSE)) = x
             | simCC ==> (T.OR(T.TRUE, x)) = T.TRUE
             | simCC ==> (T.OR(x, T.TRUE)) = T.TRUE
             | simCC ==> (T.XOR(T.TRUE, T.TRUE)) = T.FALSE
             | simCC ==> (T.XOR(T.FALSE, x)) = x
             | simCC ==> (T.XOR(x, T.FALSE)) = x
             | simCC ==> (T.XOR(T.TRUE, x)) = T.NOT x
             | simCC ==> (T.XOR(x, T.TRUE)) = T.NOT x
             | simCC ==> (T.EQV(T.FALSE, T.FALSE)) = T.TRUE
             | simCC ==> (T.EQV(T.TRUE, x)) = x
             | simCC ==> (T.EQV(x, T.TRUE)) = x
             | simCC ==> (T.EQV(T.FALSE, x)) = T.NOT x
             | simCC ==> (T.EQV(x, T.FALSE)) = T.NOT x
             | simCC ==> exp = exp
       in R.rewrite {rexp=sim, fexp=simF, ccexp=simCC, stm=simStm}
       end
end


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