@@ -221,13 +221,6 @@ STATIC void emit_cpy_load_const_str(emit_t *emit, qstr qstr, bool bytes) {
221221 }
222222}
223223
224- STATIC void emit_cpy_load_const_verbatim_str (emit_t * emit , const char * str ) {
225- emit_pre (emit , 1 , 3 );
226- if (emit -> pass == PASS_3 ) {
227- printf ("LOAD_CONST %s\n" , str );
228- }
229- }
230-
231224STATIC void emit_cpy_load_null (emit_t * emit ) {
232225 // unused for cpy
233226 assert (0 );
@@ -247,13 +240,6 @@ STATIC void emit_cpy_load_deref(emit_t *emit, qstr qstr, int local_num) {
247240 }
248241}
249242
250- STATIC void emit_cpy_load_closure (emit_t * emit , qstr qstr , int local_num ) {
251- emit_pre (emit , 1 , 3 );
252- if (emit -> pass == PASS_3 ) {
253- printf ("LOAD_CLOSURE %d %s\n" , local_num , qstr_str (qstr ));
254- }
255- }
256-
257243STATIC void emit_cpy_load_name (emit_t * emit , qstr qstr ) {
258244 emit_pre (emit , 1 , 3 );
259245 if (emit -> pass == PASS_3 ) {
@@ -452,13 +438,6 @@ STATIC void emit_cpy_jump_if_false_or_pop(emit_t *emit, uint label) {
452438 }
453439}
454440
455- STATIC void emit_cpy_setup_loop (emit_t * emit , uint label ) {
456- emit_pre (emit , 0 , 3 );
457- if (emit -> pass == PASS_3 ) {
458- printf ("SETUP_LOOP %d\n" , emit -> label_offsets [label ]);
459- }
460- }
461-
462441STATIC void emit_cpy_break_loop (emit_t * emit , uint label , int except_depth ) {
463442 emit_pre (emit , 0 , 1 );
464443 if (emit -> pass == PASS_3 ) {
@@ -798,6 +777,27 @@ STATIC void emit_cpy_yield_from(emit_t *emit) {
798777 }
799778}
800779
780+ STATIC void emit_cpy_load_const_verbatim_str (emit_t * emit , const char * str ) {
781+ emit_pre (emit , 1 , 3 );
782+ if (emit -> pass == PASS_3 ) {
783+ printf ("LOAD_CONST %s\n" , str );
784+ }
785+ }
786+
787+ STATIC void emit_cpy_load_closure (emit_t * emit , qstr qstr , int local_num ) {
788+ emit_pre (emit , 1 , 3 );
789+ if (emit -> pass == PASS_3 ) {
790+ printf ("LOAD_CLOSURE %d %s\n" , local_num , qstr_str (qstr ));
791+ }
792+ }
793+
794+ STATIC void emit_cpy_setup_loop (emit_t * emit , uint label ) {
795+ emit_pre (emit , 0 , 3 );
796+ if (emit -> pass == PASS_3 ) {
797+ printf ("SETUP_LOOP %d\n" , emit -> label_offsets [label ]);
798+ }
799+ }
800+
801801const emit_method_table_t emit_cpython_method_table = {
802802 emit_cpy_set_native_types ,
803803 emit_cpy_start_pass ,
@@ -820,11 +820,9 @@ const emit_method_table_t emit_cpython_method_table = {
820820 emit_cpy_load_const_dec ,
821821 emit_cpy_load_const_id ,
822822 emit_cpy_load_const_str ,
823- emit_cpy_load_const_verbatim_str ,
824823 emit_cpy_load_null ,
825824 emit_cpy_load_fast ,
826825 emit_cpy_load_deref ,
827- emit_cpy_load_closure ,
828826 emit_cpy_load_name ,
829827 emit_cpy_load_global ,
830828 emit_cpy_load_attr ,
@@ -853,7 +851,6 @@ const emit_method_table_t emit_cpython_method_table = {
853851 emit_cpy_pop_jump_if_false ,
854852 emit_cpy_jump_if_true_or_pop ,
855853 emit_cpy_jump_if_false_or_pop ,
856- emit_cpy_setup_loop ,
857854 emit_cpy_break_loop ,
858855 emit_cpy_continue_loop ,
859856 emit_cpy_setup_with ,
@@ -887,6 +884,11 @@ const emit_method_table_t emit_cpython_method_table = {
887884 emit_cpy_raise_varargs ,
888885 emit_cpy_yield_value ,
889886 emit_cpy_yield_from ,
887+
888+ // emitcpy specific functions
889+ emit_cpy_load_const_verbatim_str ,
890+ emit_cpy_load_closure ,
891+ emit_cpy_setup_loop ,
890892};
891893
892894#endif // MICROPY_EMIT_CPYTHON
0 commit comments