diff options
author | Damien George <damien.p.george@gmail.com> | 2015-03-26 15:49:53 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-03-26 16:52:45 +0000 |
commit | a210c774f9cfbcde284f5b8a63442b4d6da1ae5b (patch) | |
tree | 1277140fe133c950ac047cb909a01ce7330a0b84 /py/emit.h | |
parent | 542bd6b4a1ead90fde42f24d01c82580f9d048de (diff) | |
download | micropython-a210c774f9cfbcde284f5b8a63442b4d6da1ae5b.tar.gz micropython-a210c774f9cfbcde284f5b8a63442b4d6da1ae5b.zip |
py, compiler: Remove emit_pass1 code, using emit_bc to do its job.
First pass for the compiler is computing the scope (eg if an identifier
is local or not) and originally had an entire table of methods dedicated
to this, most of which did nothing. With changes from previous commit,
this set of methods can be removed and the methods from the bytecode
emitter used instead, with very little modification -- this is what is
done in this commit.
This factoring has little to no impact on the speed of the compiler
(tested by compiling 3763 Python scripts and timing it).
This factoring reduces code size by about 270-300 bytes on Thumb2 archs,
and 400 bytes on x86.
Diffstat (limited to 'py/emit.h')
-rw-r--r-- | py/emit.h | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -159,7 +159,6 @@ void mp_emit_common_get_id_for_load(scope_t *scope, qstr qst); void mp_emit_common_get_id_for_modification(scope_t *scope, qstr qst); void mp_emit_common_id_op(emit_t *emit, const mp_emit_method_table_id_ops_t *emit_method_table, scope_t *scope, qstr qst); -extern const emit_method_table_t emit_pass1_method_table; extern const emit_method_table_t emit_cpython_method_table; extern const emit_method_table_t emit_bc_method_table; extern const emit_method_table_t emit_native_x64_method_table; @@ -167,13 +166,17 @@ extern const emit_method_table_t emit_native_x86_method_table; extern const emit_method_table_t emit_native_thumb_method_table; extern const emit_method_table_t emit_native_arm_method_table; -emit_t *emit_cpython_new(mp_uint_t max_num_labels); -emit_t *emit_bc_new(mp_uint_t max_num_labels); +emit_t *emit_cpython_new(void); +emit_t *emit_bc_new(void); emit_t *emit_native_x64_new(mp_uint_t max_num_labels); emit_t *emit_native_x86_new(mp_uint_t max_num_labels); emit_t *emit_native_thumb_new(mp_uint_t max_num_labels); emit_t *emit_native_arm_new(mp_uint_t max_num_labels); +void emit_cpython_set_max_num_labels(emit_t* emit, mp_uint_t max_num_labels); +void emit_bc_set_max_num_labels(emit_t* emit, mp_uint_t max_num_labels); + +void emit_cpython_free(emit_t *emit); void emit_bc_free(emit_t *emit); void emit_native_x64_free(emit_t *emit); void emit_native_x86_free(emit_t *emit); |