Group normalized instructions by the function they belong to.
(lines)
| 168 | |
| 169 | |
| 170 | def split_functions(lines): |
| 171 | """Group normalized instructions by the function they belong to.""" |
| 172 | functions = {} |
| 173 | current = None |
| 174 | for line in lines: |
| 175 | match = FUNC_RE.match(line) |
| 176 | if match: |
| 177 | current = functions.setdefault(match.group(1), []) |
| 178 | continue |
| 179 | if current is None: |
| 180 | continue |
| 181 | for pattern, replacement in SUBSTITUTIONS: |
| 182 | line = pattern.sub(replacement, line) |
| 183 | if line: |
| 184 | current.append(line) |
| 185 | return functions |
| 186 | |
| 187 | |
| 188 | def call_targets(instructions): |