annotate 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
rev   line source
105
6a303f835c6d Removed compilers directory
Windel Bouwman
parents: 104
diff changeset
1
6a303f835c6d Removed compilers directory
Windel Bouwman
parents: 104
diff changeset
2 class Argument:
6a303f835c6d Removed compilers directory
Windel Bouwman
parents: 104
diff changeset
3 def __init__(self, argtype, name, function):
6a303f835c6d Removed compilers directory
Windel Bouwman
parents: 104
diff changeset
4 self.t = argtype
6a303f835c6d Removed compilers directory
Windel Bouwman
parents: 104
diff changeset
5 self.name = name
6a303f835c6d Removed compilers directory
Windel Bouwman
parents: 104
diff changeset
6 self.function = function
70
35286e8abd03 Added some llvm classes
windel
parents:
diff changeset
7
110
9e552d34bd60 Work on compiler
Windel Bouwman
parents: 106
diff changeset
8 class Function(GlobalValue):
104
ed230e947dc6 Added hexviewer
windel
parents: 95
diff changeset
9 def __init__(self, functiontype, name, module):
110
9e552d34bd60 Work on compiler
Windel Bouwman
parents: 106
diff changeset
10 super().__init__()
104
ed230e947dc6 Added hexviewer
windel
parents: 95
diff changeset
11 self.functiontype = functiontype
ed230e947dc6 Added hexviewer
windel
parents: 95
diff changeset
12 self.name = name
ed230e947dc6 Added hexviewer
windel
parents: 95
diff changeset
13 self.module = module
106
f2d980eef509 improved code generation
Windel Bouwman
parents: 105
diff changeset
14
f2d980eef509 improved code generation
Windel Bouwman
parents: 105
diff changeset
15 self.module.Functions.append(self)
105
6a303f835c6d Removed compilers directory
Windel Bouwman
parents: 104
diff changeset
16 self.basicblocks = []
6a303f835c6d Removed compilers directory
Windel Bouwman
parents: 104
diff changeset
17 self.arguments = []
6a303f835c6d Removed compilers directory
Windel Bouwman
parents: 104
diff changeset
18 # Construct formal arguments depending on function type
70
35286e8abd03 Added some llvm classes
windel
parents:
diff changeset
19
105
6a303f835c6d Removed compilers directory
Windel Bouwman
parents: 104
diff changeset
20 BasicBlocks = property(lambda self: self.basicblocks)
6a303f835c6d Removed compilers directory
Windel Bouwman
parents: 104
diff changeset
21 Arguments = property(lambda self: self.arguments)
6a303f835c6d Removed compilers directory
Windel Bouwman
parents: 104
diff changeset
22 ReturnType = property(lambda self: self.functiontype.returnType)
6a303f835c6d Removed compilers directory
Windel Bouwman
parents: 104
diff changeset
23 FunctionType = property(lambda self: self.functiontype)
6a303f835c6d Removed compilers directory
Windel Bouwman
parents: 104
diff changeset
24