tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Insert arm-xxx_FILES into Makefile to suport CROSS_TARGET


From: Pursuer
Subject: [Tinycc-devel] Insert arm-xxx_FILES into Makefile to suport CROSS_TARGET and Remove duplicate function lexpand_nr
Date: Wed, 9 Jan 2019 03:00:43 +0800

1.CROSS_TARGET option don't work correctly.
I added arm-xxx_FILES in Makefile so we can build cross target by using command like this:

make libtcc.a CROSS_TARGET=arm-vfp

2.function 'lexpand_nr' seems doing the same thing as 'lexpand'. So I remove lexpand_nr function and change the reference to lexpand

The patch detail show below, If no one protests, I would push this patch.

diff --git a/Makefile b/Makefile
index 02d3625..d5e10c8 100644
--- a/Makefile
+++ b/Makefile
@@ -164,6 +164,12 @@ x86_64-win32_FILES = $(x86_64_FILES) tccpe.c
 x86_64-osx_FILES = $(x86_64_FILES)
 arm_FILES = $(CORE_FILES) arm-gen.c arm-link.c arm-asm.c
 arm-wince_FILES = $(arm_FILES) tccpe.c
+arm-eabihf_FILES = $(arm_FILES)
+arm-fpa_FILES     = $(arm_FILES)
+arm-fpa-ld_FILES  = $(arm_FILES)
+arm-vfp_FILES     = $(arm_FILES)
+arm-eabi_FILES    = $(arm_FILES)
+arm-eabihf_FILES  = $(arm_FILES)
 arm64_FILES = $(CORE_FILES) arm64-gen.c arm64-link.c
 c67_FILES = $(CORE_FILES) c67-gen.c c67-link.c tcccoff.c

diff --git a/arm-gen.c b/arm-gen.c
index c5de065..e766ce4 100644
--- a/arm-gen.c
+++ b/arm-gen.c
@@ -1141,7 +1141,7 @@ again:
               /* XXX: implicit cast ? */
               size=4;
               if ((pplan->sval->type.t & VT_BTYPE) == VT_LLONG) {
-                lexpand_nr();
+                lexpand();
                 size = 8;
                 r = gv(RC_INT);
                 o(0xE52D0004|(intr(r)<<12)); /* push r */
@@ -1165,7 +1165,7 @@ again:

         case CORE_CLASS:
           if ((pplan->sval->type.t & VT_BTYPE) == VT_LLONG) {
-            lexpand_nr();
+            lexpand();
             gv(regmask(pplan->end));
             pplan->sval->r2 = vtop->r;
             vtop--;
diff --git a/tcc.h b/tcc.h
index cc85291..165249f 100644
--- a/tcc.h
+++ b/tcc.h
@@ -1321,9 +1321,11 @@ ST_FUNC void vpush_global_sym(CType *type, int v);
 ST_FUNC void vrote(SValue *e, int n);
 ST_FUNC void vrott(int n);
 ST_FUNC void vrotb(int n);
+#if PTR_SIZE == 4
+ST_FUNC void lexpand(void);
+#endif
 #ifdef TCC_TARGET_ARM
 ST_FUNC int get_reg_ex(int rc, int rc2);
-ST_FUNC void lexpand_nr(void);
 #endif
 ST_FUNC void vpushv(SValue *v);
 ST_FUNC void save_reg(int r);
diff --git a/tccgen.c b/tccgen.c
index 9f671e0..9b3749d 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -1521,7 +1521,7 @@ static int reg_fret(int t)

 #if PTR_SIZE == 4
 /* expand 64bit on stack in two ints */
-static void lexpand(void)
+ST_FUNC void lexpand(void)
 {
     int u, v;
     u = vtop->type.t & (VT_DEFSIGN | VT_UNSIGNED);
@@ -1542,34 +1542,6 @@ static void lexpand(void)
 }
 #endif

-#ifdef TCC_TARGET_ARM
-/* expand long long on stack */
-ST_FUNC void lexpand_nr(void)
-{
-    int u,v;
-
-    u = vtop->type.t & (VT_DEFSIGN | VT_UNSIGNED);
-    vdup();
-    vtop->r2 = VT_CONST;
-    vtop->type.t = VT_INT | u;
-    v=vtop[-1].r & (VT_VALMASK | VT_LVAL);
-    if (v == VT_CONST) {
-      vtop[-1].c.i = vtop->c.i;
-      vtop->c.i = vtop->c.i >> 32;
-      vtop->r = VT_CONST;
-    } else if (v == (VT_LVAL|VT_CONST) || v == (VT_LVAL|VT_LOCAL)) {
-      vtop->c.i += 4;
-      vtop->r = vtop[-1].r;
-    } else if (v > VT_CONST) {
-      vtop--;
-      lexpand();
-    } else
-      vtop->r = vtop[-1].r2;
-    vtop[-1].r2 = VT_CONST;
-    vtop[-1].type.t = VT_INT | u;
-}
-#endif
-
 #if PTR_SIZE == 4
 /* build a long long from two ints */
 static void lbuild(int t)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]