Mercurial > lcfOS
comparison python/ppci/transform.py @ 334:6f4753202b9a
Added more recipes
author | Windel Bouwman |
---|---|
date | Thu, 13 Feb 2014 22:02:08 +0100 |
parents | e30a77ae359b |
children | d1ecc493384e |
comparison
equal
deleted
inserted
replaced
333:dcae6574c974 | 334:6f4753202b9a |
---|---|
10 def __init__(self): | 10 def __init__(self): |
11 self.logger = logging.getLogger(str(self.__class__.__name__)) | 11 self.logger = logging.getLogger(str(self.__class__.__name__)) |
12 | 12 |
13 def run(self, ir): | 13 def run(self, ir): |
14 """ Main entry point for the pass """ | 14 """ Main entry point for the pass """ |
15 self.logger.info('Running pass {}'.format(type(self))) | 15 self.logger.debug('Running pass {}'.format(self.__class__.__name__)) |
16 self.prepare() | 16 self.prepare() |
17 for f in ir.Functions: | 17 for f in ir.Functions: |
18 self.onFunction(f) | 18 self.onFunction(f) |
19 | 19 |
20 def onFunction(self, f): | 20 def onFunction(self, f): |
155 self.glue_blocks(preds[0], block, f) | 155 self.glue_blocks(preds[0], block, f) |
156 change = True | 156 change = True |
157 | 157 |
158 def glue_blocks(self, block1, block2, f): | 158 def glue_blocks(self, block1, block2, f): |
159 """ Glue two blocks together into the first block """ | 159 """ Glue two blocks together into the first block """ |
160 self.logger.info('Glueing {} and {}'.format(block1, block2)) | 160 self.logger.debug('Glueing {} and {}'.format(block1, block2)) |
161 | 161 |
162 # Remove the last jump: | 162 # Remove the last jump: |
163 block1.removeInstruction(block1.LastInstruction) | 163 block1.removeInstruction(block1.LastInstruction) |
164 | 164 |
165 # Copy all instructions to block1: | 165 # Copy all instructions to block1: |