Mercurial > lcfOS
comparison python/ppci/codegen/codegen.py @ 364:c49459768aaa
Work on globals
author | Windel Bouwman |
---|---|
date | Wed, 19 Mar 2014 20:24:03 +0100 |
parents | c2ddc8a36f5e |
children | 39bf68bf1891 |
comparison
equal
deleted
inserted
replaced
363:396e5cefba13 | 364:c49459768aaa |
---|---|
49 return frame | 49 return frame |
50 | 50 |
51 def generate(self, ircode, outs): | 51 def generate(self, ircode, outs): |
52 """ Generate code into output stream """ | 52 """ Generate code into output stream """ |
53 assert isinstance(ircode, ir.Module) | 53 assert isinstance(ircode, ir.Module) |
54 outs.select_section('data') | |
55 for global_variable in ircode.Variables: | |
56 print(global_variable) | |
57 self.target.emit_global(outs, ir.label_name(global_variable)) | |
54 outs.select_section('code') | 58 outs.select_section('code') |
55 | 59 |
56 # Munch program into a bunch of frames. One frame per function. | 60 # Munch program into a bunch of frames. One frame per function. |
57 # Each frame has a flat list of abstract instructions. | 61 # Each frame has a flat list of abstract instructions. |
58 # Generate code for all functions: | 62 # Generate code for all functions: |