annotate python/ir/module.py @ 170:4348da5ca307

Cleanup of ir dir
author Windel Bouwman
date Fri, 29 Mar 2013 17:33:17 +0100
parents 9683a4cd848f
children 3eb9b9e2958d
rev   line source
157
8f3924b6076e Added some code generator things
Windel Bouwman
parents: 156
diff changeset
1 # IR-Structures:
8f3924b6076e Added some code generator things
Windel Bouwman
parents: 156
diff changeset
2
155
b28a11c01dbe Simplified IR classes
Windel Bouwman
parents: 147
diff changeset
3 class Module:
170
4348da5ca307 Cleanup of ir dir
Windel Bouwman
parents: 158
diff changeset
4 """ Main container for a piece of code. """
155
b28a11c01dbe Simplified IR classes
Windel Bouwman
parents: 147
diff changeset
5 def __init__(self, name):
b28a11c01dbe Simplified IR classes
Windel Bouwman
parents: 147
diff changeset
6 self.name = name
170
4348da5ca307 Cleanup of ir dir
Windel Bouwman
parents: 158
diff changeset
7 self.instructions = []
158
9683a4cd848f Added some functions for code generation
Windel Bouwman
parents: 157
diff changeset
8 def __repr__(self):
170
4348da5ca307 Cleanup of ir dir
Windel Bouwman
parents: 158
diff changeset
9 return 'IR-module [{0}]'.format(self.name)
155
b28a11c01dbe Simplified IR classes
Windel Bouwman
parents: 147
diff changeset
10 def getInstructions(self):
b28a11c01dbe Simplified IR classes
Windel Bouwman
parents: 147
diff changeset
11 return self.instructions
b28a11c01dbe Simplified IR classes
Windel Bouwman
parents: 147
diff changeset
12 Instructions = property(getInstructions)
170
4348da5ca307 Cleanup of ir dir
Windel Bouwman
parents: 158
diff changeset
13 def dump(self):
4348da5ca307 Cleanup of ir dir
Windel Bouwman
parents: 158
diff changeset
14 print(self)
4348da5ca307 Cleanup of ir dir
Windel Bouwman
parents: 158
diff changeset
15 for i in self.Instructions:
4348da5ca307 Cleanup of ir dir
Windel Bouwman
parents: 158
diff changeset
16 print(i)
4348da5ca307 Cleanup of ir dir
Windel Bouwman
parents: 158
diff changeset
17 print('END')
155
b28a11c01dbe Simplified IR classes
Windel Bouwman
parents: 147
diff changeset
18