diff python/ppci/ir2tree.py @ 354:5477e499b039

Added some sort of string functionality
author Windel Bouwman
date Thu, 13 Mar 2014 18:59:06 +0100
parents e9fe6988497c
children c2ddc8a36f5e
line wrap: on
line diff
--- a/python/ppci/ir2tree.py	Sun Mar 09 18:49:10 2014 +0100
+++ b/python/ppci/ir2tree.py	Thu Mar 13 18:59:06 2014 +0100
@@ -27,14 +27,26 @@
 
 @register(ir.Const)
 def const_to_tree(e):
-    t = Tree('CONSTI32')
-    t.value = e.value
-    return t
+    if type(e.value) is bytes:
+        t = Tree('CONSTDATA')
+        t.value = e.value
+        print(t.value)
+        return t
+    elif type(e.value) is int:
+        t = Tree('CONSTI32')
+        t.value = e.value
+        return t
+    else:
+        raise Exception('{} not implemented'.format(type(e.value)))
 
 @register(ir.Mem)
 def mem_to_tree(e):
     return Tree('MEMI32', makeTree(e.e))
 
+@register(ir.Addr)
+def mem_to_tree(e):
+    return Tree('ADR', makeTree(e.e))
+
 @register(ir.Call)
 def call_to_tree(e):
     t = Tree('CALL')