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

SCM Repository

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

Diff of /branches/vis12/src/compiler/codegen/clang.sml

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

revision 1367, Wed Jun 22 18:40:52 2011 UTC revision 1368, Wed Jun 22 20:58:28 2011 UTC
# Line 20  Line 20 
20        | T_Array of ty * int option        | T_Array of ty * int option
21        | T_Named of string        | T_Named of string
22    
23        datatype typed_var = V of ty * var
24    
25      val voidTy = T_Named "void"      val voidTy = T_Named "void"
26      val charTy = T_Named "char"      val charTy = T_Named "char"
27        val boolTy = T_Named "bool"
28      val charPtr = T_Ptr(charTy)      val charPtr = T_Ptr(charTy)
29      val charArrayPtr = T_Ptr(charPtr)      val charArrayPtr = T_Ptr(charPtr)
30      val intTy = T_Named "int"      val intTy = T_Named "int"
# Line 52  Line 55 
55      and stm      and stm
56        = S_Block of stm list             (* "{" stms "}" *)        = S_Block of stm list             (* "{" stms "}" *)
57        | S_Comment of string list        | S_Comment of string list
58        | S_Decl of ty * var * initializer option (* ty var [ '=' exp ]';' *)        | S_Decl of attr list * ty * var * initializer option
59                                            (* ty var [ '=' exp ]';' *)
60        | S_Exp of exp                    (* exp ';' *)        | S_Exp of exp                    (* exp ';' *)
61        | S_If of exp * stm * stm         (* 'if' exp stm 'else' stm *)        | S_If of exp * stm * stm         (* 'if' exp stm 'else' stm *)
62        | S_While of exp * stm            (* 'while' exp stm *)        | S_While of exp * stm            (* 'while' exp stm *)
# Line 189  Line 193 
193            else E_Indirect(e, f)            else E_Indirect(e, f)
194      fun mkCast (ty, e) = E_Cast(ty, e)      fun mkCast (ty, e) = E_Cast(ty, e)
195      val mkVar = E_Var      val mkVar = E_Var
196      fun mkInt (n, ty) = if n < 0 then E_UnOp(%-, E_Int(~n, ty)) else E_Int(n, ty)      fun mkIntTy (n, ty) = if n < 0 then E_UnOp(%-, E_Int(~n, ty)) else E_Int(n, ty)
197        fun mkInt n = mkIntTy(n, intTy)
198      fun mkFlt (f, ty) = if FloatLit.isNeg f      fun mkFlt (f, ty) = if FloatLit.isNeg f
199            then E_UnOp(%-, E_Flt(FloatLit.negate f, ty))            then E_UnOp(%-, E_Flt(FloatLit.negate f, ty))
200            else E_Flt(f, ty)            else E_Flt(f, ty)
# Line 207  Line 212 
212      val mkComment = S_Comment      val mkComment = S_Comment
213      fun mkBlock [stm] = stm      fun mkBlock [stm] = stm
214        | mkBlock stms = S_Block stms        | mkBlock stms = S_Block stms
215      val mkDecl = S_Decl      fun mkDecl (ty, x, init) = S_Decl([], ty, x, init)
216        val mkAttrDecl = S_Decl
217      val mkExpStm = S_Exp      val mkExpStm = S_Exp
218      fun mkAssign (e1, e2) = S_Exp(mkAssignOp(e1, $=, e2))      fun mkAssign (e1, e2) = S_Exp(mkAssignOp(e1, $=, e2))
219      fun mkIfThenElse (e, b1, b2) = S_If(paren e, b1, b2)      fun mkIfThenElse (e, b1, b2) = S_If(paren e, b1, b2)

Legend:
Removed from v.1367  
changed lines
  Added in v.1368

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