diff python/ir/function.py @ 147:4e79484a9d47

Moved core to ir folder
author Windel Bouwman
date Fri, 22 Feb 2013 10:33:48 +0100
parents python/ppci/core/function.py@9e552d34bd60
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/python/ir/function.py	Fri Feb 22 10:33:48 2013 +0100
@@ -0,0 +1,24 @@
+
+class Argument:
+   def __init__(self, argtype, name, function):
+      self.t = argtype
+      self.name = name
+      self.function = function
+
+class Function(GlobalValue):
+   def __init__(self, functiontype, name, module):
+      super().__init__()
+      self.functiontype = functiontype
+      self.name = name
+      self.module = module
+
+      self.module.Functions.append(self)
+      self.basicblocks = []
+      self.arguments = []
+      # Construct formal arguments depending on function type
+
+   BasicBlocks = property(lambda self: self.basicblocks)
+   Arguments = property(lambda self: self.arguments)
+   ReturnType = property(lambda self: self.functiontype.returnType)
+   FunctionType = property(lambda self: self.functiontype)
+