A series of fixes for ARC port (#844)
authorYuriy Kolerov <ykolerov@synopsys.com>
Sun, 15 Sep 2024 11:39:01 +0000 (14:39 +0300)
committerGitHub <noreply@github.com>
Sun, 15 Sep 2024 11:39:01 +0000 (07:39 -0400)
* arc: Fix warnings

These warnings are fixed:

1. A series of "unused variables".
2. Implicit conversion from a pointer to uint32_t.

Signed-off-by: Yuriy Kolerov <ykolerov@synopsys.com>
* arc: Do not use mov_s and movl_s instructions

mov_s and movl_s instructions use a restricted set of registers.
However, a list of available registers for such instructions for
one ARC target may not match a list for another ARC targets. For
example, it is applicable to ARC700 and ARC HS3x/4x - build
fails because mov_s formats may be incompatible in some cases.

The easiest and the most straightforward way to fix this issue
is to use mov and movl instead of mov_s and movl_s.

Signed-off-by: Yuriy Kolerov <ykolerov@synopsys.com>
---------

Signed-off-by: Yuriy Kolerov <ykolerov@synopsys.com>
src/arc/arcompact.S
src/arc/ffi.c

index 1d7f1a1fc79bb7760e3296f9f8a46f7a24204728..e74934110202b483d5414b51756350ec0d8bfea9 100644 (file)
 #define LARG ldl
 #define SARG stl
 #define ADDPTR addl
-#define MOVPTR movl_s
+#define MOVPTR movl
 #else
 #define PTRS 4
 #define FLTS 4
 #define LARG ld
 #define SARG st
 #define ADDPTR add
-#define MOVPTR mov_s
+#define MOVPTR mov
 #endif
 
 #define FRAME_LEN (8 * PTRS + 16)
index d72927487cfa316d1bdd1ecf102554275f60fdea..0632319139bb535c0627526848be8acf6974b4d7 100644 (file)
@@ -192,9 +192,10 @@ static void unmarshal_atom(call_builder *cb, int type, void *data) {
 /* for arguments passed by reference returns the pointer, otherwise the arg is copied (up to MAXCOPYARG bytes) */
 static void *unmarshal(call_builder *cb, ffi_type *type, int var, void *data) {
   size_t realign[2];
-  void *pointer;
 
 #if defined(__ARC64_ARCH64__)
+  void *pointer;
+
   if (type->size > 2 * __SIZEOF_POINTER__) {
         /* pass by reference */
         unmarshal_atom(cb, FFI_TYPE_POINTER, (char*)&pointer);
@@ -348,7 +349,10 @@ ffi_prep_closure_loc (ffi_closure * closure, ffi_cif * cif,
                      void *user_data, void *codeloc)
 {
   uint32_t *tramp = (uint32_t *) & (closure->tramp[0]);
+
+#if defined(__ARC64_ARCH64__)
   size_t address_ffi_closure = (size_t) ffi_closure_asm;
+#endif
 
   switch (cif->abi)
     {
@@ -367,7 +371,7 @@ ffi_prep_closure_loc (ffi_closure * closure, ffi_cif * cif,
       FFI_ASSERT (tramp == codeloc);
       tramp[0] = CODE_ENDIAN (0x200a1fc0);     /* mov r8, pcl  */
       tramp[1] = CODE_ENDIAN (0x20200f80);     /* j [long imm] */
-      tramp[2] = CODE_ENDIAN (ffi_closure_asm);
+      tramp[2] = CODE_ENDIAN ((uint32_t) ffi_closure_asm);
       break;
 #endif