Mercurial > lcfOS
comparison python/ir/module.py @ 268:5ec7580976d9
Op naar tree-IR
author | Windel Bouwman |
---|---|
date | Wed, 14 Aug 2013 20:12:40 +0200 |
parents | 04c19282a5aa |
children | cf7d5fb7d9c8 |
comparison
equal
deleted
inserted
replaced
267:e7c8f7eb3f59 | 268:5ec7580976d9 |
---|---|
1 # IR-Structures: | 1 # IR-Structures: |
2 from .instruction import * | 2 from .instruction import * |
3 from .basicblock import BasicBlock | 3 from .basicblock import Block |
4 | 4 |
5 class Module: | 5 class Module: |
6 """ Main container for a piece of code. """ | 6 """ Main container for a piece of code. """ |
7 def __init__(self, name): | 7 def __init__(self, name): |
8 self.name = name | 8 self.name = name |
79 | 79 |
80 # Analysis functions: | 80 # Analysis functions: |
81 def check(self): | 81 def check(self): |
82 """ Perform sanity check on module """ | 82 """ Perform sanity check on module """ |
83 for i in self.Instructions: | 83 for i in self.Instructions: |
84 for t in i.defs: | 84 pass |
85 assert type(t) is Value, "def must be Value, not {0}".format(type(t)) | |
86 for t in i.uses: | |
87 assert type(t) is Use, "use must be Value, not {0}".format(type(t)) | |
88 for f in self.Functions: | 85 for f in self.Functions: |
89 f.check() | 86 f.check() |
90 | 87 |
91 | 88 |