annotate python/ppci/core/function.py @ 106:f2d980eef509

improved code generation
author Windel Bouwman
date Mon, 31 Dec 2012 18:26:56 +0100
parents 6a303f835c6d
children 9e552d34bd60
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
35286e8abd03 Added some llvm classes
windel
parents:
diff changeset
8 class Function:
104
ed230e947dc6 Added hexviewer
windel
parents: 95
diff changeset
9 def __init__(self, functiontype, name, module):
ed230e947dc6 Added hexviewer
windel
parents: 95
diff changeset
10 self.functiontype = functiontype
ed230e947dc6 Added hexviewer
windel
parents: 95
diff changeset
11 self.name = name
ed230e947dc6 Added hexviewer
windel
parents: 95
diff changeset
12 self.module = module
106
f2d980eef509 improved code generation
Windel Bouwman
parents: 105
diff changeset
13
f2d980eef509 improved code generation
Windel Bouwman
parents: 105
diff changeset
14 self.module.Functions.append(self)
105
6a303f835c6d Removed compilers directory
Windel Bouwman
parents: 104
diff changeset
15 self.basicblocks = []
6a303f835c6d Removed compilers directory
Windel Bouwman
parents: 104
diff changeset
16 self.arguments = []
6a303f835c6d Removed compilers directory
Windel Bouwman
parents: 104
diff changeset
17 # Construct formal arguments depending on function type
70
35286e8abd03 Added some llvm classes
windel
parents:
diff changeset
18
105
6a303f835c6d Removed compilers directory
Windel Bouwman
parents: 104
diff changeset
19 BasicBlocks = property(lambda self: self.basicblocks)
6a303f835c6d Removed compilers directory
Windel Bouwman
parents: 104
diff changeset
20 Arguments = property(lambda self: self.arguments)
6a303f835c6d Removed compilers directory
Windel Bouwman
parents: 104
diff changeset
21 ReturnType = property(lambda self: self.functiontype.returnType)
6a303f835c6d Removed compilers directory
Windel Bouwman
parents: 104
diff changeset
22 FunctionType = property(lambda self: self.functiontype)
6a303f835c6d Removed compilers directory
Windel Bouwman
parents: 104
diff changeset
23