annotate python/ir/function.py @ 172:5a7d37d615ee

Added function to IR
author Windel Bouwman
date Thu, 04 Apr 2013 17:58:37 +0200
parents
children c1d2b6b9f9a7
rev   line source
172
5a7d37d615ee Added function to IR
Windel Bouwman
parents:
diff changeset
1 from .basicblock import BasicBlock
5a7d37d615ee Added function to IR
Windel Bouwman
parents:
diff changeset
2
5a7d37d615ee Added function to IR
Windel Bouwman
parents:
diff changeset
3 class Function:
5a7d37d615ee Added function to IR
Windel Bouwman
parents:
diff changeset
4 def __init__(self, name):
5a7d37d615ee Added function to IR
Windel Bouwman
parents:
diff changeset
5 self.name = name
5a7d37d615ee Added function to IR
Windel Bouwman
parents:
diff changeset
6 self.bbs = []
5a7d37d615ee Added function to IR
Windel Bouwman
parents:
diff changeset
7 self.entry = None
5a7d37d615ee Added function to IR
Windel Bouwman
parents:
diff changeset
8 def __repr__(self):
5a7d37d615ee Added function to IR
Windel Bouwman
parents:
diff changeset
9 return 'FUNC {0}, entry:{1}'.format(self.name, self.entry)
5a7d37d615ee Added function to IR
Windel Bouwman
parents:
diff changeset
10 def addBB(self, bb):
5a7d37d615ee Added function to IR
Windel Bouwman
parents:
diff changeset
11 self.bbs.append(bb)
5a7d37d615ee Added function to IR
Windel Bouwman
parents:
diff changeset
12 def getBBs(self):
5a7d37d615ee Added function to IR
Windel Bouwman
parents:
diff changeset
13 return self.bbs
5a7d37d615ee Added function to IR
Windel Bouwman
parents:
diff changeset
14 BasicBlocks = property(getBBs)
5a7d37d615ee Added function to IR
Windel Bouwman
parents:
diff changeset
15
5a7d37d615ee Added function to IR
Windel Bouwman
parents:
diff changeset
16