1. Shawn Hyam
  2. son_of_blub

Commits

Shawn Hyam  committed e53f56f

Added a few more comparison routines.

  • Participants
  • Parent commits c0771f4
  • Branches default

Comments (0)

Files changed (1)

File part3/son_of_blub.ml

View file
  • Ignore whitespace
   "+", gen_bin_op L.build_add;
   "-", gen_bin_op L.build_sub;
   "*", gen_bin_op L.build_mul;
+  "/", gen_bin_op L.build_sdiv;
   "=", Sllvminst (fun [x; y] builder ->
 		    (builder, L.build_icmp L.Icmp.Eq x y "" builder));
   "<", Sllvminst (fun [x; y] builder ->
-		    (builder, L.build_icmp L.Icmp.Slt x y "" builder)) 
+		    (builder, L.build_icmp L.Icmp.Slt x y "" builder));
+  "<=", Sllvminst (fun [x; y] builder ->
+		    (builder, L.build_icmp L.Icmp.Sle x y "" builder));
+  ">", Sllvminst (fun [x; y] builder ->
+		    (builder, L.build_icmp L.Icmp.Sgt x y "" builder));
+  ">=", Sllvminst (fun [x; y] builder ->
+		    (builder, L.build_icmp L.Icmp.Sge x y "" builder));
+
 ] ;;
 		
 let globals = make_global_env globals ;;