Mercurial > lcfOS
comparison python/ppci/buildfunctions.py @ 394:988f3fb861e4
c3 code generator rewrite
author | Windel Bouwman |
---|---|
date | Thu, 22 May 2014 08:14:12 +0200 |
parents | 6ae782a085e0 |
children |
comparison
equal
deleted
inserted
replaced
393:6ae782a085e0 | 394:988f3fb861e4 |
---|---|
12 from .codegen import CodeGenerator | 12 from .codegen import CodeGenerator |
13 from .transform import CleanPass, RemoveAddZero | 13 from .transform import CleanPass, RemoveAddZero |
14 from .linker import Linker | 14 from .linker import Linker |
15 from .layout import Layout, load_layout | 15 from .layout import Layout, load_layout |
16 from .target.target_list import targets | 16 from .target.target_list import targets |
17 from .outstream import BinaryAndLoggingStream | 17 from .outstream import BinaryOutputStream |
18 from .objectfile import ObjectFile, load_object | 18 from .objectfile import ObjectFile, load_object |
19 from . import DiagnosticsManager | 19 from . import DiagnosticsManager |
20 from .tasks import TaskError, TaskRunner | 20 from .tasks import TaskError, TaskRunner |
21 from .recipe import RecipeLoader | 21 from .recipe import RecipeLoader |
22 | 22 |
89 target = fix_target(target) | 89 target = fix_target(target) |
90 source = fix_file(source) | 90 source = fix_file(source) |
91 output = ObjectFile() | 91 output = ObjectFile() |
92 assembler = target.assembler | 92 assembler = target.assembler |
93 logger.debug('Assembling into code section') | 93 logger.debug('Assembling into code section') |
94 ostream = BinaryAndLoggingStream(output) | 94 ostream = BinaryOutputStream(output) |
95 ostream.select_section('code') | 95 ostream.select_section('code') |
96 assembler.prepare() | 96 assembler.prepare() |
97 assembler.assemble(source, ostream) | 97 assembler.assemble(source, ostream) |
98 assembler.flush() | 98 assembler.flush() |
99 return output | 99 return output |
109 output = ObjectFile() | 109 output = ObjectFile() |
110 diag = DiagnosticsManager() | 110 diag = DiagnosticsManager() |
111 c3b = Builder(diag, target) | 111 c3b = Builder(diag, target) |
112 cg = CodeGenerator(target) | 112 cg = CodeGenerator(target) |
113 | 113 |
114 output_stream = BinaryAndLoggingStream(output) | 114 output_stream = BinaryOutputStream(output) |
115 | 115 |
116 for ircode in c3b.build(sources, includes): | 116 for ircode in c3b.build(sources, includes): |
117 if not ircode: | 117 if not ircode: |
118 # Something went wrong, do not continue the code generation | 118 # Something went wrong, do not continue the code generation |
119 continue | 119 continue |