summary refs log tree commit diff
path: root/source/xi_lib/ir_utils.ml
diff options
context:
space:
mode:
Diffstat (limited to 'source/xi_lib/ir_utils.ml')
-rw-r--r--source/xi_lib/ir_utils.ml15
1 files changed, 14 insertions, 1 deletions
diff --git a/source/xi_lib/ir_utils.ml b/source/xi_lib/ir_utils.ml
index 48b59a1..b43655d 100644
--- a/source/xi_lib/ir_utils.ml
+++ b/source/xi_lib/ir_utils.ml
@@ -1,5 +1,18 @@
 open Ir
 
+let string_of_reg = function
+  | REG_Tmp i -> Format.sprintf "%%tmp%u" i
+  | REG_Hard i -> Format.sprintf "%%hard%u" i
+  | REG_Spec i -> Format.sprintf "%%spec%u" i
+
+let string_of_cond = function
+  | COND_Eq -> "eq"
+  | COND_Ne -> "ne"
+  | COND_Lt -> "lt"
+  | COND_Gt -> "gt"
+  | COND_Le -> "le"
+  | COND_Ge -> "ge"
+
 let remap_register_reg sb r = 
   try
     Hashtbl.find sb r
@@ -665,4 +678,4 @@ let string_of_module_definition xs =
   String.concat "\n" @@ List.map string_of_procedure xs
 
 let string_of_program (Program {procedures; _}) =
-  String.concat "\n" @@ List.map string_of_procedure procedures
\ No newline at end of file
+  String.concat "\n" @@ List.map string_of_procedure procedures