From 5b52a44b524916bf564a9c399ce536a7ea5b5201 Mon Sep 17 00:00:00 2001 From: jiang <30155751@qq.com> Date: Fri, 2 May 2014 09:42:33 +0800 Subject: [PATCH] gen_putz () and struct_copy (), is to reduce the third-party call that generates faster code tcc Now only for x86-64 parse_number also to reduce the reliance on third-party libraries, allowing faster analysis tcc --- tccgen.c | 53 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/tccgen.c b/tccgen.c index 0844d40d..b8721b12 100644 --- a/tccgen.c +++ b/tccgen.c @@ -2543,30 +2543,32 @@ ST_FUNC void vstore(void) vtop -=2; }else{ size = type_size(&vtop->type, &align); -#ifdef TCC_ARM_EABI - /* destination */ - vswap(); - vtop->type.t = VT_PTR; - gaddrof(); +#ifndef TCC_TARGET_X86_64 + /* destination */ + vswap(); + vtop->type.t = VT_PTR; + gaddrof(); - /* address of memcpy() */ - if(!(align & 7)) - vpush_global_sym(&func_old_type, TOK_memcpy8); - else if(!(align & 3)) - vpush_global_sym(&func_old_type, TOK_memcpy4); - else - vpush_global_sym(&func_old_type, TOK_memcpy); + /* address of memcpy() */ +# ifdef TCC_ARM_EABI + if(!(align & 7)) + vpush_global_sym(&func_old_type, TOK_memcpy8); + else if(!(align & 3)) + vpush_global_sym(&func_old_type, TOK_memcpy4); + else +# endif + vpush_global_sym(&func_old_type, TOK_memcpy); - vswap(); - /* source */ - vpushv(vtop - 2); - vtop->type.t = VT_PTR; - gaddrof(); - /* type size */ - vpushi(size); - gfunc_call(3); + vswap(); + /* source */ + vpushv(vtop - 2); + vtop->type.t = VT_PTR; + gaddrof(); + /* type size */ + vpushi(size); + gfunc_call(3); #else - /* destination */ + /* destination */ vswap(); vtop->type.t = VT_PTR; gaddrof(); @@ -5239,14 +5241,19 @@ static void init_putz(CType *t, Section *sec, unsigned long c, int size) if (sec) { /* nothing to do because globals are already set to zero */ } else { -#ifdef TCC_TARGET_ARM +#ifndef TCC_TARGET_X86_64 vpush_global_sym(&func_old_type, TOK_memset); vseti(VT_LOCAL, c); +#ifdef TCC_TARGET_ARM vpushs(size); vpushi(0); +#else + vpushi(0); + vpushs(size); +#endif gfunc_call(3); #else - vseti(VT_LOCAL, c); + vseti(VT_LOCAL, c); gen_putz(vtop, size); vtop--; #endif