|
From: <sv...@va...> - 2011-03-14 12:35:26
|
Author: sewardj
Date: 2011-03-14 12:35:18 +0000 (Mon, 14 Mar 2011)
New Revision: 2108
Log:
Wrap up "__attribute__((regparm(n)))" inside a macro so it is only
visible on x86, so as to avoid producing compiler warnings on targets
for which it is ignored. Fixes #247223. (Modified version of patch
from Bart Van Assche).
Modified:
trunk/priv/guest_generic_bb_to_IR.c
trunk/priv/guest_x86_defs.h
trunk/priv/guest_x86_helpers.c
trunk/pub/libvex_basictypes.h
trunk/pub/libvex_ir.h
Modified: trunk/priv/guest_generic_bb_to_IR.c
===================================================================
--- trunk/priv/guest_generic_bb_to_IR.c 2011-03-14 11:27:26 UTC (rev 2107)
+++ trunk/priv/guest_generic_bb_to_IR.c 2011-03-14 12:35:18 UTC (rev 2108)
@@ -42,58 +42,58 @@
/* Forwards .. */
-__attribute__((regparm(2)))
+VEX_REGPARM(2)
static UInt genericg_compute_checksum_4al ( HWord first_w32, HWord n_w32s );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static UInt genericg_compute_checksum_4al_1 ( HWord first_w32 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static UInt genericg_compute_checksum_4al_2 ( HWord first_w32 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static UInt genericg_compute_checksum_4al_3 ( HWord first_w32 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static UInt genericg_compute_checksum_4al_4 ( HWord first_w32 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static UInt genericg_compute_checksum_4al_5 ( HWord first_w32 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static UInt genericg_compute_checksum_4al_6 ( HWord first_w32 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static UInt genericg_compute_checksum_4al_7 ( HWord first_w32 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static UInt genericg_compute_checksum_4al_8 ( HWord first_w32 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static UInt genericg_compute_checksum_4al_9 ( HWord first_w32 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static UInt genericg_compute_checksum_4al_10 ( HWord first_w32 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static UInt genericg_compute_checksum_4al_11 ( HWord first_w32 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static UInt genericg_compute_checksum_4al_12 ( HWord first_w32 );
-__attribute__((regparm(2)))
+VEX_REGPARM(2)
static ULong genericg_compute_checksum_8al ( HWord first_w64, HWord n_w64s );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static ULong genericg_compute_checksum_8al_1 ( HWord first_w64 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static ULong genericg_compute_checksum_8al_2 ( HWord first_w64 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static ULong genericg_compute_checksum_8al_3 ( HWord first_w64 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static ULong genericg_compute_checksum_8al_4 ( HWord first_w64 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static ULong genericg_compute_checksum_8al_5 ( HWord first_w64 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static ULong genericg_compute_checksum_8al_6 ( HWord first_w64 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static ULong genericg_compute_checksum_8al_7 ( HWord first_w64 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static ULong genericg_compute_checksum_8al_8 ( HWord first_w64 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static ULong genericg_compute_checksum_8al_9 ( HWord first_w64 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static ULong genericg_compute_checksum_8al_10 ( HWord first_w64 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static ULong genericg_compute_checksum_8al_11 ( HWord first_w64 );
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static ULong genericg_compute_checksum_8al_12 ( HWord first_w64 );
/* Small helpers */
@@ -425,8 +425,8 @@
UInt len2check;
HWord expectedhW;
IRTemp tistart_tmp, tilen_tmp;
- HWord __attribute__((regparm(2))) (*fn_generic)(HWord, HWord);
- HWord __attribute__((regparm(1))) (*fn_spec)(HWord);
+ HWord VEX_REGPARM(2) (*fn_generic)(HWord, HWord);
+ HWord VEX_REGPARM(1) (*fn_spec)(HWord);
HChar* nm_generic;
HChar* nm_spec;
HWord fn_generic_entry = 0;
@@ -466,11 +466,11 @@
/* vex_printf("%lx %lx %ld\n", first_w32, last_w32, w32s_to_check); */
if (host_word_szB == 8) {
- fn_generic = (__attribute__((regparm(2))) HWord(*)(HWord, HWord))
+ fn_generic = (VEX_REGPARM(2) HWord(*)(HWord, HWord))
genericg_compute_checksum_8al;
nm_generic = "genericg_compute_checksum_8al";
} else {
- fn_generic = (__attribute__((regparm(2))) HWord(*)(HWord, HWord))
+ fn_generic = (VEX_REGPARM(2) HWord(*)(HWord, HWord))
genericg_compute_checksum_4al;
nm_generic = "genericg_compute_checksum_4al";
}
@@ -480,7 +480,7 @@
if (host_word_szB == 8) {
HChar* nm = NULL;
- ULong __attribute__((regparm(1))) (*fn)(HWord) = NULL;
+ ULong VEX_REGPARM(1) (*fn)(HWord) = NULL;
switch (hWs_to_check) {
case 1: fn = genericg_compute_checksum_8al_1;
nm = "genericg_compute_checksum_8al_1"; break;
@@ -508,11 +508,11 @@
nm = "genericg_compute_checksum_8al_12"; break;
default: break;
}
- fn_spec = (__attribute__((regparm(1))) HWord(*)(HWord)) fn;
+ fn_spec = (VEX_REGPARM(1) HWord(*)(HWord)) fn;
nm_spec = nm;
} else {
HChar* nm = NULL;
- UInt __attribute__((regparm(1))) (*fn)(HWord) = NULL;
+ UInt VEX_REGPARM(1) (*fn)(HWord) = NULL;
switch (hWs_to_check) {
case 1: fn = genericg_compute_checksum_4al_1;
nm = "genericg_compute_checksum_4al_1"; break;
@@ -540,7 +540,7 @@
nm = "genericg_compute_checksum_4al_12"; break;
default: break;
}
- fn_spec = (__attribute__((regparm(1))) HWord(*)(HWord))fn;
+ fn_spec = (VEX_REGPARM(1) HWord(*)(HWord))fn;
nm_spec = nm;
}
@@ -661,7 +661,7 @@
return w;
}
-__attribute((regparm(2)))
+VEX_REGPARM(2)
static UInt genericg_compute_checksum_4al ( HWord first_w32, HWord n_w32s )
{
UInt sum1 = 0, sum2 = 0;
@@ -689,7 +689,7 @@
/* Specialised versions of the above function */
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static UInt genericg_compute_checksum_4al_1 ( HWord first_w32 )
{
UInt sum1 = 0, sum2 = 0;
@@ -700,7 +700,7 @@
return sum1 + sum2;
}
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static UInt genericg_compute_checksum_4al_2 ( HWord first_w32 )
{
UInt sum1 = 0, sum2 = 0;
@@ -713,7 +713,7 @@
return sum1 + sum2;
}
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static UInt genericg_compute_checksum_4al_3 ( HWord first_w32 )
{
UInt sum1 = 0, sum2 = 0;
@@ -728,7 +728,7 @@
return sum1 + sum2;
}
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static UInt genericg_compute_checksum_4al_4 ( HWord first_w32 )
{
UInt sum1 = 0, sum2 = 0;
@@ -742,7 +742,7 @@
return sum1 + sum2;
}
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static UInt genericg_compute_checksum_4al_5 ( HWord first_w32 )
{
UInt sum1 = 0, sum2 = 0;
@@ -758,7 +758,7 @@
return sum1 + sum2;
}
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static UInt genericg_compute_checksum_4al_6 ( HWord first_w32 )
{
UInt sum1 = 0, sum2 = 0;
@@ -776,7 +776,7 @@
return sum1 + sum2;
}
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static UInt genericg_compute_checksum_4al_7 ( HWord first_w32 )
{
UInt sum1 = 0, sum2 = 0;
@@ -796,7 +796,7 @@
return sum1 + sum2;
}
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static UInt genericg_compute_checksum_4al_8 ( HWord first_w32 )
{
UInt sum1 = 0, sum2 = 0;
@@ -815,7 +815,7 @@
return sum1 + sum2;
}
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static UInt genericg_compute_checksum_4al_9 ( HWord first_w32 )
{
UInt sum1 = 0, sum2 = 0;
@@ -836,7 +836,7 @@
return sum1 + sum2;
}
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static UInt genericg_compute_checksum_4al_10 ( HWord first_w32 )
{
UInt sum1 = 0, sum2 = 0;
@@ -859,7 +859,7 @@
return sum1 + sum2;
}
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static UInt genericg_compute_checksum_4al_11 ( HWord first_w32 )
{
UInt sum1 = 0, sum2 = 0;
@@ -884,7 +884,7 @@
return sum1 + sum2;
}
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static UInt genericg_compute_checksum_4al_12 ( HWord first_w32 )
{
UInt sum1 = 0, sum2 = 0;
@@ -916,7 +916,7 @@
return w;
}
-__attribute((regparm(2)))
+VEX_REGPARM(2)
static ULong genericg_compute_checksum_8al ( HWord first_w64, HWord n_w64s )
{
ULong sum1 = 0, sum2 = 0;
@@ -944,7 +944,7 @@
/* Specialised versions of the above function */
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static ULong genericg_compute_checksum_8al_1 ( HWord first_w64 )
{
ULong sum1 = 0, sum2 = 0;
@@ -955,7 +955,7 @@
return sum1 + sum2;
}
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static ULong genericg_compute_checksum_8al_2 ( HWord first_w64 )
{
ULong sum1 = 0, sum2 = 0;
@@ -968,7 +968,7 @@
return sum1 + sum2;
}
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static ULong genericg_compute_checksum_8al_3 ( HWord first_w64 )
{
ULong sum1 = 0, sum2 = 0;
@@ -983,7 +983,7 @@
return sum1 + sum2;
}
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static ULong genericg_compute_checksum_8al_4 ( HWord first_w64 )
{
ULong sum1 = 0, sum2 = 0;
@@ -997,7 +997,7 @@
return sum1 + sum2;
}
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static ULong genericg_compute_checksum_8al_5 ( HWord first_w64 )
{
ULong sum1 = 0, sum2 = 0;
@@ -1013,7 +1013,7 @@
return sum1 + sum2;
}
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static ULong genericg_compute_checksum_8al_6 ( HWord first_w64 )
{
ULong sum1 = 0, sum2 = 0;
@@ -1031,7 +1031,7 @@
return sum1 + sum2;
}
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static ULong genericg_compute_checksum_8al_7 ( HWord first_w64 )
{
ULong sum1 = 0, sum2 = 0;
@@ -1051,7 +1051,7 @@
return sum1 + sum2;
}
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static ULong genericg_compute_checksum_8al_8 ( HWord first_w64 )
{
ULong sum1 = 0, sum2 = 0;
@@ -1070,7 +1070,7 @@
return sum1 + sum2;
}
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static ULong genericg_compute_checksum_8al_9 ( HWord first_w64 )
{
ULong sum1 = 0, sum2 = 0;
@@ -1091,7 +1091,7 @@
return sum1 + sum2;
}
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static ULong genericg_compute_checksum_8al_10 ( HWord first_w64 )
{
ULong sum1 = 0, sum2 = 0;
@@ -1114,7 +1114,7 @@
return sum1 + sum2;
}
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static ULong genericg_compute_checksum_8al_11 ( HWord first_w64 )
{
ULong sum1 = 0, sum2 = 0;
@@ -1139,7 +1139,7 @@
return sum1 + sum2;
}
-__attribute__((regparm(1)))
+VEX_REGPARM(1)
static ULong genericg_compute_checksum_8al_12 ( HWord first_w64 )
{
ULong sum1 = 0, sum2 = 0;
Modified: trunk/priv/guest_x86_defs.h
===================================================================
--- trunk/priv/guest_x86_defs.h 2011-03-14 11:27:26 UTC (rev 2107)
+++ trunk/priv/guest_x86_defs.h 2011-03-14 12:35:18 UTC (rev 2108)
@@ -86,7 +86,7 @@
UInt cc_op, UInt cc_dep1, UInt cc_dep2, UInt cc_ndep
);
-__attribute((regparm(3)))
+VEX_REGPARM(3)
extern UInt x86g_calculate_eflags_c (
UInt cc_op, UInt cc_dep1, UInt cc_dep2, UInt cc_ndep
);
Modified: trunk/priv/guest_x86_helpers.c
===================================================================
--- trunk/priv/guest_x86_helpers.c 2011-03-14 11:27:26 UTC (rev 2107)
+++ trunk/priv/guest_x86_helpers.c 2011-03-14 12:35:18 UTC (rev 2108)
@@ -588,7 +588,7 @@
/* CALLED FROM GENERATED CODE: CLEAN HELPER */
/* Calculate just the carry flag from the supplied thunk parameters. */
-__attribute((regparm(3)))
+VEX_REGPARM(3)
UInt x86g_calculate_eflags_c ( UInt cc_op,
UInt cc_dep1,
UInt cc_dep2,
Modified: trunk/pub/libvex_basictypes.h
===================================================================
--- trunk/pub/libvex_basictypes.h 2011-03-14 11:27:26 UTC (rev 2107)
+++ trunk/pub/libvex_basictypes.h 2011-03-14 12:35:18 UTC (rev 2108)
@@ -130,29 +130,40 @@
and ULong_to_Ptr in a way that doesn't cause compilers to complain.
These functions allow us to cast pointers to and from 64-bit
integers without complaints from compilers, regardless of the host
- word size. */
+ word size.
+ Also set up VEX_REGPARM.
+*/
+
#undef VEX_HOST_WORDSIZE
+#undef VEX_REGPARM
/* The following 4 work OK for Linux. */
#if defined(__x86_64__)
# define VEX_HOST_WORDSIZE 8
+# define VEX_REGPARM(_n) /* */
#elif defined(__i386__)
# define VEX_HOST_WORDSIZE 4
+# define VEX_REGPARM(_n) __attribute__((regparm(_n)))
#elif defined(__powerpc__) && defined(__powerpc64__)
# define VEX_HOST_WORDSIZE 8
+# define VEX_REGPARM(_n) /* */
#elif defined(__powerpc__) && !defined(__powerpc64__)
# define VEX_HOST_WORDSIZE 4
#elif defined(__arm__)
# define VEX_HOST_WORDSIZE 4
+# define VEX_REGPARM(_n) /* */
#elif defined(_AIX) && !defined(__64BIT__)
# define VEX_HOST_WORDSIZE 4
+# define VEX_REGPARM(_n) /* */
#elif defined(_AIX) && defined(__64BIT__)
# define VEX_HOST_WORDSIZE 8
+# define VEX_REGPARM(_n) /* */
#elif defined(__s390x__)
# define VEX_HOST_WORDSIZE 8
+# define VEX_REGPARM(_n) /* */
#else
# error "Vex: Fatal: Can't establish the host architecture"
Modified: trunk/pub/libvex_ir.h
===================================================================
--- trunk/pub/libvex_ir.h 2011-03-14 11:27:26 UTC (rev 2107)
+++ trunk/pub/libvex_ir.h 2011-03-14 12:35:18 UTC (rev 2108)
@@ -322,9 +322,10 @@
/* Describes a helper function to call. The name part is purely for
pretty printing and not actually used. regparms=n tells the back
end that the callee has been declared
- "__attribute__((regparm(n)))". On some targets (x86) the back end
- will need to construct a non-standard sequence to call a function
- declared like this.
+ "__attribute__((regparm(n)))", although indirectly using the
+ VEX_REGPARM(n) macro. On some targets (x86) the back end will need
+ to construct a non-standard sequence to call a function declared
+ like this.
mcx_mask is a sop to Memcheck. It indicates which args should be
considered 'always defined' when lazily computing definedness of
|