Mercurial > lcfOS
diff python/ir/function.py @ 269:5f8c04a8d26b
Towards better modularity
author | Windel Bouwman |
---|---|
date | Sun, 18 Aug 2013 17:43:18 +0200 |
parents | 5ec7580976d9 |
children | cdc76d183bcc |
line wrap: on
line diff
--- a/python/ir/function.py Wed Aug 14 20:12:40 2013 +0200 +++ b/python/ir/function.py Sun Aug 18 17:43:18 2013 +0200 @@ -2,8 +2,9 @@ class Function: def __init__(self, name): - self.name = name - self.entry = Block('entry') + self.name = name + self.entry = Block('{}_entry'.format(name)) + self.epiloog = Block('{}_epilog'.format(name)) def __repr__(self): return 'Function {0}'.format(self.name) @@ -26,6 +27,10 @@ if sb not in bbs: bbs.append(sb) worklist.append(sb) + bbs.remove(self.entry) + bbs.remove(self.epiloog) + bbs.insert(0, self.entry) + bbs.append(self.epiloog) return bbs def findBasicBlock(self, name): @@ -38,7 +43,7 @@ @property def Entry(self): - return self.BasicBlocks[0] + return self.entry def check(self): for bb in self.BasicBlocks: