annotate python/ppci/core/function.py @ 139:2ec4d4332b7a

Improve hexedit
author Windel Bouwman
date Sat, 26 Jan 2013 19:44:36 +0100
parents 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