public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/aoliva/heads/testme)] untyped calls: enable target switching [PR112334]
@ 2023-12-06 2:31 Alexandre Oliva
0 siblings, 0 replies; 11+ messages in thread
From: Alexandre Oliva @ 2023-12-06 2:31 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:de2f100acfd6130049b5457f522b5c9d34e50afc
commit de2f100acfd6130049b5457f522b5c9d34e50afc
Author: Alexandre Oliva <oliva@adacore.com>
Date: Fri Dec 1 09:44:07 2023 -0300
untyped calls: enable target switching [PR112334]
The computation of apply_args_size and apply_result_size is saved in a
static variable, so that the corresponding _mode arrays are
initialized only once. That is not compatible with switchable
targets, and ARM's arm_set_current_function, by saving and restoring
target globals, exercises this problem with a testcase such as that in
the PR, in which more than one function in the translation unit calls
__builtin_apply or __builtin_return, respectively.
This patch moves the _size statics into the target_builtins array,
with a bit of ugliness over _plus_one so that zero initialization of
the struct does the right thing.
for gcc/ChangeLog
PR target/112334
* builtins.h (target_builtins): Add fields for apply_args_size
and apply_result_size.
* builtins.cc (apply_args_size, apply_result_size): Cache
results in fields rather than in static variables.
(get_apply_args_size, set_apply_args_size): New.
(get_apply_result_size, set_apply_result_size): New.
Diff:
---
gcc/builtins.cc | 16 ++++++++++++++--
gcc/builtins.h | 7 +++++++
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/gcc/builtins.cc b/gcc/builtins.cc
index afa9be51443..d2884bd60af 100644
--- a/gcc/builtins.cc
+++ b/gcc/builtins.cc
@@ -1403,8 +1403,16 @@ get_memory_rtx (tree exp, tree len)
\f
/* Built-in functions to perform an untyped call and return. */
+#define set_apply_args_size(x) \
+ (this_target_builtins->x_apply_args_size_plus_one = 1 + (x))
+#define get_apply_args_size() \
+ (this_target_builtins->x_apply_args_size_plus_one - 1)
#define apply_args_mode \
(this_target_builtins->x_apply_args_mode)
+#define set_apply_result_size(x) \
+ (this_target_builtins->x_apply_result_size_plus_one = 1 + (x))
+#define get_apply_result_size() \
+ (this_target_builtins->x_apply_result_size_plus_one - 1)
#define apply_result_mode \
(this_target_builtins->x_apply_result_mode)
@@ -1414,7 +1422,7 @@ get_memory_rtx (tree exp, tree len)
static int
apply_args_size (void)
{
- static int size = -1;
+ int size = get_apply_args_size ();
int align;
unsigned int regno;
@@ -1447,6 +1455,8 @@ apply_args_size (void)
}
else
apply_args_mode[regno] = as_a <fixed_size_mode> (VOIDmode);
+
+ set_apply_args_size (size);
}
return size;
}
@@ -1457,7 +1467,7 @@ apply_args_size (void)
static int
apply_result_size (void)
{
- static int size = -1;
+ int size = get_apply_result_size ();
int align, regno;
/* The values computed by this function never change. */
@@ -1489,6 +1499,8 @@ apply_result_size (void)
#ifdef APPLY_RESULT_SIZE
size = APPLY_RESULT_SIZE;
#endif
+
+ set_apply_result_size (size);
}
return size;
}
diff --git a/gcc/builtins.h b/gcc/builtins.h
index 88a26d70cd5..1a26fc63a6d 100644
--- a/gcc/builtins.h
+++ b/gcc/builtins.h
@@ -37,6 +37,13 @@ struct target_builtins {
register windows, this gives only the outbound registers.
INCOMING_REGNO gives the corresponding inbound register. */
fixed_size_mode_pod x_apply_result_mode[FIRST_PSEUDO_REGISTER];
+
+ /* Nonzero iff the arrays above have been initialized. The _plus_one suffix
+ is for zero initialization to make it an unreasonable size, used to signal
+ that the size and the corresponding mode array has not been
+ initialized. */
+ int x_apply_args_size_plus_one;
+ int x_apply_result_size_plus_one;
};
extern struct target_builtins default_target_builtins;
^ permalink raw reply [flat|nested] 11+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] untyped calls: enable target switching [PR112334]
@ 2023-12-12 2:38 Alexandre Oliva
0 siblings, 0 replies; 11+ messages in thread
From: Alexandre Oliva @ 2023-12-12 2:38 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:2e5a17a4c1de33de7ec96088fda1329072735af6
commit 2e5a17a4c1de33de7ec96088fda1329072735af6
Author: Alexandre Oliva <oliva@adacore.com>
Date: Thu Dec 7 00:38:24 2023 -0300
untyped calls: enable target switching [PR112334]
The computation of apply_args_size and apply_result_size is saved in a
static variable, so that the corresponding _mode arrays are
initialized only once. That is not compatible with switchable
targets, and ARM's arm_set_current_function, by saving and restoring
target globals, exercises this problem with a testcase such as that in
the PR, in which more than one function in the translation unit calls
__builtin_apply or __builtin_return, respectively.
This patch moves the _size statics into the target_builtins array,
with a bit of ugliness over _plus_one so that zero initialization of
the struct does the right thing.
for gcc/ChangeLog
PR target/112334
* builtins.h (target_builtins): Add fields for apply_args_size
and apply_result_size.
* builtins.cc (apply_args_size, apply_result_size): Cache
results in fields rather than in static variables.
(get_apply_args_size, set_apply_args_size): New.
(get_apply_result_size, set_apply_result_size): New.
Diff:
---
gcc/builtins.cc | 16 ++++++++++++++--
gcc/builtins.h | 7 +++++++
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/gcc/builtins.cc b/gcc/builtins.cc
index f6c96498f07..7c2732ab79e 100644
--- a/gcc/builtins.cc
+++ b/gcc/builtins.cc
@@ -1403,8 +1403,16 @@ get_memory_rtx (tree exp, tree len)
\f
/* Built-in functions to perform an untyped call and return. */
+#define set_apply_args_size(x) \
+ (this_target_builtins->x_apply_args_size_plus_one = 1 + (x))
+#define get_apply_args_size() \
+ (this_target_builtins->x_apply_args_size_plus_one - 1)
#define apply_args_mode \
(this_target_builtins->x_apply_args_mode)
+#define set_apply_result_size(x) \
+ (this_target_builtins->x_apply_result_size_plus_one = 1 + (x))
+#define get_apply_result_size() \
+ (this_target_builtins->x_apply_result_size_plus_one - 1)
#define apply_result_mode \
(this_target_builtins->x_apply_result_mode)
@@ -1414,7 +1422,7 @@ get_memory_rtx (tree exp, tree len)
static int
apply_args_size (void)
{
- static int size = -1;
+ int size = get_apply_args_size ();
int align;
unsigned int regno;
@@ -1447,6 +1455,8 @@ apply_args_size (void)
}
else
apply_args_mode[regno] = as_a <fixed_size_mode> (VOIDmode);
+
+ set_apply_args_size (size);
}
return size;
}
@@ -1457,7 +1467,7 @@ apply_args_size (void)
static int
apply_result_size (void)
{
- static int size = -1;
+ int size = get_apply_result_size ();
int align, regno;
/* The values computed by this function never change. */
@@ -1489,6 +1499,8 @@ apply_result_size (void)
#ifdef APPLY_RESULT_SIZE
size = APPLY_RESULT_SIZE;
#endif
+
+ set_apply_result_size (size);
}
return size;
}
diff --git a/gcc/builtins.h b/gcc/builtins.h
index 88a26d70cd5..1a26fc63a6d 100644
--- a/gcc/builtins.h
+++ b/gcc/builtins.h
@@ -37,6 +37,13 @@ struct target_builtins {
register windows, this gives only the outbound registers.
INCOMING_REGNO gives the corresponding inbound register. */
fixed_size_mode_pod x_apply_result_mode[FIRST_PSEUDO_REGISTER];
+
+ /* Nonzero iff the arrays above have been initialized. The _plus_one suffix
+ is for zero initialization to make it an unreasonable size, used to signal
+ that the size and the corresponding mode array has not been
+ initialized. */
+ int x_apply_args_size_plus_one;
+ int x_apply_result_size_plus_one;
};
extern struct target_builtins default_target_builtins;
^ permalink raw reply [flat|nested] 11+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] untyped calls: enable target switching [PR112334]
@ 2023-12-06 22:47 Alexandre Oliva
0 siblings, 0 replies; 11+ messages in thread
From: Alexandre Oliva @ 2023-12-06 22:47 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:6d136df5de940de8da186f65d39f3490f1ab4e79
commit 6d136df5de940de8da186f65d39f3490f1ab4e79
Author: Alexandre Oliva <oliva@adacore.com>
Date: Fri Dec 1 09:44:07 2023 -0300
untyped calls: enable target switching [PR112334]
The computation of apply_args_size and apply_result_size is saved in a
static variable, so that the corresponding _mode arrays are
initialized only once. That is not compatible with switchable
targets, and ARM's arm_set_current_function, by saving and restoring
target globals, exercises this problem with a testcase such as that in
the PR, in which more than one function in the translation unit calls
__builtin_apply or __builtin_return, respectively.
This patch moves the _size statics into the target_builtins array,
with a bit of ugliness over _plus_one so that zero initialization of
the struct does the right thing.
for gcc/ChangeLog
PR target/112334
* builtins.h (target_builtins): Add fields for apply_args_size
and apply_result_size.
* builtins.cc (apply_args_size, apply_result_size): Cache
results in fields rather than in static variables.
(get_apply_args_size, set_apply_args_size): New.
(get_apply_result_size, set_apply_result_size): New.
Diff:
---
gcc/builtins.cc | 16 ++++++++++++++--
gcc/builtins.h | 7 +++++++
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/gcc/builtins.cc b/gcc/builtins.cc
index afa9be51443..d2884bd60af 100644
--- a/gcc/builtins.cc
+++ b/gcc/builtins.cc
@@ -1403,8 +1403,16 @@ get_memory_rtx (tree exp, tree len)
\f
/* Built-in functions to perform an untyped call and return. */
+#define set_apply_args_size(x) \
+ (this_target_builtins->x_apply_args_size_plus_one = 1 + (x))
+#define get_apply_args_size() \
+ (this_target_builtins->x_apply_args_size_plus_one - 1)
#define apply_args_mode \
(this_target_builtins->x_apply_args_mode)
+#define set_apply_result_size(x) \
+ (this_target_builtins->x_apply_result_size_plus_one = 1 + (x))
+#define get_apply_result_size() \
+ (this_target_builtins->x_apply_result_size_plus_one - 1)
#define apply_result_mode \
(this_target_builtins->x_apply_result_mode)
@@ -1414,7 +1422,7 @@ get_memory_rtx (tree exp, tree len)
static int
apply_args_size (void)
{
- static int size = -1;
+ int size = get_apply_args_size ();
int align;
unsigned int regno;
@@ -1447,6 +1455,8 @@ apply_args_size (void)
}
else
apply_args_mode[regno] = as_a <fixed_size_mode> (VOIDmode);
+
+ set_apply_args_size (size);
}
return size;
}
@@ -1457,7 +1467,7 @@ apply_args_size (void)
static int
apply_result_size (void)
{
- static int size = -1;
+ int size = get_apply_result_size ();
int align, regno;
/* The values computed by this function never change. */
@@ -1489,6 +1499,8 @@ apply_result_size (void)
#ifdef APPLY_RESULT_SIZE
size = APPLY_RESULT_SIZE;
#endif
+
+ set_apply_result_size (size);
}
return size;
}
diff --git a/gcc/builtins.h b/gcc/builtins.h
index 88a26d70cd5..1a26fc63a6d 100644
--- a/gcc/builtins.h
+++ b/gcc/builtins.h
@@ -37,6 +37,13 @@ struct target_builtins {
register windows, this gives only the outbound registers.
INCOMING_REGNO gives the corresponding inbound register. */
fixed_size_mode_pod x_apply_result_mode[FIRST_PSEUDO_REGISTER];
+
+ /* Nonzero iff the arrays above have been initialized. The _plus_one suffix
+ is for zero initialization to make it an unreasonable size, used to signal
+ that the size and the corresponding mode array has not been
+ initialized. */
+ int x_apply_args_size_plus_one;
+ int x_apply_result_size_plus_one;
};
extern struct target_builtins default_target_builtins;
^ permalink raw reply [flat|nested] 11+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] untyped calls: enable target switching [PR112334]
@ 2023-12-06 20:01 Alexandre Oliva
0 siblings, 0 replies; 11+ messages in thread
From: Alexandre Oliva @ 2023-12-06 20:01 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:7e7a437d1a272c99d4a8d18ed8e24a16444be6e3
commit 7e7a437d1a272c99d4a8d18ed8e24a16444be6e3
Author: Alexandre Oliva <oliva@adacore.com>
Date: Fri Dec 1 09:44:07 2023 -0300
untyped calls: enable target switching [PR112334]
The computation of apply_args_size and apply_result_size is saved in a
static variable, so that the corresponding _mode arrays are
initialized only once. That is not compatible with switchable
targets, and ARM's arm_set_current_function, by saving and restoring
target globals, exercises this problem with a testcase such as that in
the PR, in which more than one function in the translation unit calls
__builtin_apply or __builtin_return, respectively.
This patch moves the _size statics into the target_builtins array,
with a bit of ugliness over _plus_one so that zero initialization of
the struct does the right thing.
for gcc/ChangeLog
PR target/112334
* builtins.h (target_builtins): Add fields for apply_args_size
and apply_result_size.
* builtins.cc (apply_args_size, apply_result_size): Cache
results in fields rather than in static variables.
(get_apply_args_size, set_apply_args_size): New.
(get_apply_result_size, set_apply_result_size): New.
Diff:
---
gcc/builtins.cc | 16 ++++++++++++++--
gcc/builtins.h | 7 +++++++
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/gcc/builtins.cc b/gcc/builtins.cc
index afa9be51443..d2884bd60af 100644
--- a/gcc/builtins.cc
+++ b/gcc/builtins.cc
@@ -1403,8 +1403,16 @@ get_memory_rtx (tree exp, tree len)
\f
/* Built-in functions to perform an untyped call and return. */
+#define set_apply_args_size(x) \
+ (this_target_builtins->x_apply_args_size_plus_one = 1 + (x))
+#define get_apply_args_size() \
+ (this_target_builtins->x_apply_args_size_plus_one - 1)
#define apply_args_mode \
(this_target_builtins->x_apply_args_mode)
+#define set_apply_result_size(x) \
+ (this_target_builtins->x_apply_result_size_plus_one = 1 + (x))
+#define get_apply_result_size() \
+ (this_target_builtins->x_apply_result_size_plus_one - 1)
#define apply_result_mode \
(this_target_builtins->x_apply_result_mode)
@@ -1414,7 +1422,7 @@ get_memory_rtx (tree exp, tree len)
static int
apply_args_size (void)
{
- static int size = -1;
+ int size = get_apply_args_size ();
int align;
unsigned int regno;
@@ -1447,6 +1455,8 @@ apply_args_size (void)
}
else
apply_args_mode[regno] = as_a <fixed_size_mode> (VOIDmode);
+
+ set_apply_args_size (size);
}
return size;
}
@@ -1457,7 +1467,7 @@ apply_args_size (void)
static int
apply_result_size (void)
{
- static int size = -1;
+ int size = get_apply_result_size ();
int align, regno;
/* The values computed by this function never change. */
@@ -1489,6 +1499,8 @@ apply_result_size (void)
#ifdef APPLY_RESULT_SIZE
size = APPLY_RESULT_SIZE;
#endif
+
+ set_apply_result_size (size);
}
return size;
}
diff --git a/gcc/builtins.h b/gcc/builtins.h
index 88a26d70cd5..1a26fc63a6d 100644
--- a/gcc/builtins.h
+++ b/gcc/builtins.h
@@ -37,6 +37,13 @@ struct target_builtins {
register windows, this gives only the outbound registers.
INCOMING_REGNO gives the corresponding inbound register. */
fixed_size_mode_pod x_apply_result_mode[FIRST_PSEUDO_REGISTER];
+
+ /* Nonzero iff the arrays above have been initialized. The _plus_one suffix
+ is for zero initialization to make it an unreasonable size, used to signal
+ that the size and the corresponding mode array has not been
+ initialized. */
+ int x_apply_args_size_plus_one;
+ int x_apply_result_size_plus_one;
};
extern struct target_builtins default_target_builtins;
^ permalink raw reply [flat|nested] 11+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] untyped calls: enable target switching [PR112334]
@ 2023-12-05 21:51 Alexandre Oliva
0 siblings, 0 replies; 11+ messages in thread
From: Alexandre Oliva @ 2023-12-05 21:51 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:3372f92d34692389b0c46b9574c56998134d1487
commit 3372f92d34692389b0c46b9574c56998134d1487
Author: Alexandre Oliva <oliva@adacore.com>
Date: Fri Dec 1 09:44:07 2023 -0300
untyped calls: enable target switching [PR112334]
The computation of apply_args_size and apply_result_size is saved in a
static variable, so that the corresponding _mode arrays are
initialized only once. That is not compatible with switchable
targets, and ARM's arm_set_current_function, by saving and restoring
target globals, exercises this problem with a testcase such as that in
the PR, in which more than one function in the translation unit calls
__builtin_apply or __builtin_return, respectively.
This patch moves the _size statics into the target_builtins array,
with a bit of ugliness over _plus_one so that zero initialization of
the struct does the right thing.
for gcc/ChangeLog
PR target/112334
* builtins.h (target_builtins): Add fields for apply_args_size
and apply_result_size.
* builtins.cc (apply_args_size, apply_result_size): Cache
results in fields rather than in static variables.
(get_apply_args_size, set_apply_args_size): New.
(get_apply_result_size, set_apply_result_size): New.
Diff:
---
gcc/builtins.cc | 16 ++++++++++++++--
gcc/builtins.h | 7 +++++++
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/gcc/builtins.cc b/gcc/builtins.cc
index afa9be51443..d2884bd60af 100644
--- a/gcc/builtins.cc
+++ b/gcc/builtins.cc
@@ -1403,8 +1403,16 @@ get_memory_rtx (tree exp, tree len)
\f
/* Built-in functions to perform an untyped call and return. */
+#define set_apply_args_size(x) \
+ (this_target_builtins->x_apply_args_size_plus_one = 1 + (x))
+#define get_apply_args_size() \
+ (this_target_builtins->x_apply_args_size_plus_one - 1)
#define apply_args_mode \
(this_target_builtins->x_apply_args_mode)
+#define set_apply_result_size(x) \
+ (this_target_builtins->x_apply_result_size_plus_one = 1 + (x))
+#define get_apply_result_size() \
+ (this_target_builtins->x_apply_result_size_plus_one - 1)
#define apply_result_mode \
(this_target_builtins->x_apply_result_mode)
@@ -1414,7 +1422,7 @@ get_memory_rtx (tree exp, tree len)
static int
apply_args_size (void)
{
- static int size = -1;
+ int size = get_apply_args_size ();
int align;
unsigned int regno;
@@ -1447,6 +1455,8 @@ apply_args_size (void)
}
else
apply_args_mode[regno] = as_a <fixed_size_mode> (VOIDmode);
+
+ set_apply_args_size (size);
}
return size;
}
@@ -1457,7 +1467,7 @@ apply_args_size (void)
static int
apply_result_size (void)
{
- static int size = -1;
+ int size = get_apply_result_size ();
int align, regno;
/* The values computed by this function never change. */
@@ -1489,6 +1499,8 @@ apply_result_size (void)
#ifdef APPLY_RESULT_SIZE
size = APPLY_RESULT_SIZE;
#endif
+
+ set_apply_result_size (size);
}
return size;
}
diff --git a/gcc/builtins.h b/gcc/builtins.h
index 88a26d70cd5..1a26fc63a6d 100644
--- a/gcc/builtins.h
+++ b/gcc/builtins.h
@@ -37,6 +37,13 @@ struct target_builtins {
register windows, this gives only the outbound registers.
INCOMING_REGNO gives the corresponding inbound register. */
fixed_size_mode_pod x_apply_result_mode[FIRST_PSEUDO_REGISTER];
+
+ /* Nonzero iff the arrays above have been initialized. The _plus_one suffix
+ is for zero initialization to make it an unreasonable size, used to signal
+ that the size and the corresponding mode array has not been
+ initialized. */
+ int x_apply_args_size_plus_one;
+ int x_apply_result_size_plus_one;
};
extern struct target_builtins default_target_builtins;
^ permalink raw reply [flat|nested] 11+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] untyped calls: enable target switching [PR112334]
@ 2023-12-05 19:30 Alexandre Oliva
0 siblings, 0 replies; 11+ messages in thread
From: Alexandre Oliva @ 2023-12-05 19:30 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:0a980facd793ff933aa32af59f76fd7b8b6f676d
commit 0a980facd793ff933aa32af59f76fd7b8b6f676d
Author: Alexandre Oliva <oliva@adacore.com>
Date: Fri Dec 1 09:44:07 2023 -0300
untyped calls: enable target switching [PR112334]
The computation of apply_args_size and apply_result_size is saved in a
static variable, so that the corresponding _mode arrays are
initialized only once. That is not compatible with switchable
targets, and ARM's arm_set_current_function, by saving and restoring
target globals, exercises this problem with a testcase such as that in
the PR, in which more than one function in the translation unit calls
__builtin_apply or __builtin_return, respectively.
This patch moves the _size statics into the target_builtins array,
with a bit of ugliness over _plus_one so that zero initialization of
the struct does the right thing.
for gcc/ChangeLog
PR target/112334
* builtins.h (target_builtins): Add fields for apply_args_size
and apply_result_size.
* builtins.cc (apply_args_size, apply_result_size): Cache
results in fields rather than in static variables.
(get_apply_args_size, set_apply_args_size): New.
(get_apply_result_size, set_apply_result_size): New.
Diff:
---
gcc/builtins.cc | 16 ++++++++++++++--
gcc/builtins.h | 7 +++++++
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/gcc/builtins.cc b/gcc/builtins.cc
index afa9be51443..d2884bd60af 100644
--- a/gcc/builtins.cc
+++ b/gcc/builtins.cc
@@ -1403,8 +1403,16 @@ get_memory_rtx (tree exp, tree len)
\f
/* Built-in functions to perform an untyped call and return. */
+#define set_apply_args_size(x) \
+ (this_target_builtins->x_apply_args_size_plus_one = 1 + (x))
+#define get_apply_args_size() \
+ (this_target_builtins->x_apply_args_size_plus_one - 1)
#define apply_args_mode \
(this_target_builtins->x_apply_args_mode)
+#define set_apply_result_size(x) \
+ (this_target_builtins->x_apply_result_size_plus_one = 1 + (x))
+#define get_apply_result_size() \
+ (this_target_builtins->x_apply_result_size_plus_one - 1)
#define apply_result_mode \
(this_target_builtins->x_apply_result_mode)
@@ -1414,7 +1422,7 @@ get_memory_rtx (tree exp, tree len)
static int
apply_args_size (void)
{
- static int size = -1;
+ int size = get_apply_args_size ();
int align;
unsigned int regno;
@@ -1447,6 +1455,8 @@ apply_args_size (void)
}
else
apply_args_mode[regno] = as_a <fixed_size_mode> (VOIDmode);
+
+ set_apply_args_size (size);
}
return size;
}
@@ -1457,7 +1467,7 @@ apply_args_size (void)
static int
apply_result_size (void)
{
- static int size = -1;
+ int size = get_apply_result_size ();
int align, regno;
/* The values computed by this function never change. */
@@ -1489,6 +1499,8 @@ apply_result_size (void)
#ifdef APPLY_RESULT_SIZE
size = APPLY_RESULT_SIZE;
#endif
+
+ set_apply_result_size (size);
}
return size;
}
diff --git a/gcc/builtins.h b/gcc/builtins.h
index 88a26d70cd5..1a26fc63a6d 100644
--- a/gcc/builtins.h
+++ b/gcc/builtins.h
@@ -37,6 +37,13 @@ struct target_builtins {
register windows, this gives only the outbound registers.
INCOMING_REGNO gives the corresponding inbound register. */
fixed_size_mode_pod x_apply_result_mode[FIRST_PSEUDO_REGISTER];
+
+ /* Nonzero iff the arrays above have been initialized. The _plus_one suffix
+ is for zero initialization to make it an unreasonable size, used to signal
+ that the size and the corresponding mode array has not been
+ initialized. */
+ int x_apply_args_size_plus_one;
+ int x_apply_result_size_plus_one;
};
extern struct target_builtins default_target_builtins;
^ permalink raw reply [flat|nested] 11+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] untyped calls: enable target switching [PR112334]
@ 2023-12-03 1:46 Alexandre Oliva
0 siblings, 0 replies; 11+ messages in thread
From: Alexandre Oliva @ 2023-12-03 1:46 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:ae28c27840afaac8962a40e124c3c9893837c823
commit ae28c27840afaac8962a40e124c3c9893837c823
Author: Alexandre Oliva <oliva@adacore.com>
Date: Fri Dec 1 09:44:07 2023 -0300
untyped calls: enable target switching [PR112334]
The computation of apply_args_size and apply_result_size is saved in a
static variable, so that the corresponding _mode arrays are
initialized only once. That is not compatible with switchable
targets, and ARM's arm_set_current_function, by saving and restoring
target globals, exercises this problem with a testcase such as that in
the PR, in which more than one function in the translation unit calls
__builtin_apply or __builtin_return, respectively.
This patch moves the _size statics into the target_builtins array,
with a bit of ugliness over _plus_one so that zero initialization of
the struct does the right thing.
for gcc/ChangeLog
PR target/112334
* builtins.h (target_builtins): Add fields for apply_args_size
and apply_result_size.
* builtins.cc (apply_args_size, apply_result_size): Cache
results in fields rather than in static variables.
(get_apply_args_size, set_apply_args_size): New.
(get_apply_result_size, set_apply_result_size): New.
Diff:
---
gcc/builtins.cc | 16 ++++++++++++++--
gcc/builtins.h | 7 +++++++
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/gcc/builtins.cc b/gcc/builtins.cc
index 555d2897938..1a105955db6 100644
--- a/gcc/builtins.cc
+++ b/gcc/builtins.cc
@@ -1400,8 +1400,16 @@ get_memory_rtx (tree exp, tree len)
\f
/* Built-in functions to perform an untyped call and return. */
+#define set_apply_args_size(x) \
+ (this_target_builtins->x_apply_args_size_plus_one = 1 + (x))
+#define get_apply_args_size() \
+ (this_target_builtins->x_apply_args_size_plus_one - 1)
#define apply_args_mode \
(this_target_builtins->x_apply_args_mode)
+#define set_apply_result_size(x) \
+ (this_target_builtins->x_apply_result_size_plus_one = 1 + (x))
+#define get_apply_result_size() \
+ (this_target_builtins->x_apply_result_size_plus_one - 1)
#define apply_result_mode \
(this_target_builtins->x_apply_result_mode)
@@ -1411,7 +1419,7 @@ get_memory_rtx (tree exp, tree len)
static int
apply_args_size (void)
{
- static int size = -1;
+ int size = get_apply_args_size ();
int align;
unsigned int regno;
@@ -1444,6 +1452,8 @@ apply_args_size (void)
}
else
apply_args_mode[regno] = as_a <fixed_size_mode> (VOIDmode);
+
+ set_apply_args_size (size);
}
return size;
}
@@ -1454,7 +1464,7 @@ apply_args_size (void)
static int
apply_result_size (void)
{
- static int size = -1;
+ int size = get_apply_result_size ();
int align, regno;
/* The values computed by this function never change. */
@@ -1486,6 +1496,8 @@ apply_result_size (void)
#ifdef APPLY_RESULT_SIZE
size = APPLY_RESULT_SIZE;
#endif
+
+ set_apply_result_size (size);
}
return size;
}
diff --git a/gcc/builtins.h b/gcc/builtins.h
index 88a26d70cd5..1a26fc63a6d 100644
--- a/gcc/builtins.h
+++ b/gcc/builtins.h
@@ -37,6 +37,13 @@ struct target_builtins {
register windows, this gives only the outbound registers.
INCOMING_REGNO gives the corresponding inbound register. */
fixed_size_mode_pod x_apply_result_mode[FIRST_PSEUDO_REGISTER];
+
+ /* Nonzero iff the arrays above have been initialized. The _plus_one suffix
+ is for zero initialization to make it an unreasonable size, used to signal
+ that the size and the corresponding mode array has not been
+ initialized. */
+ int x_apply_args_size_plus_one;
+ int x_apply_result_size_plus_one;
};
extern struct target_builtins default_target_builtins;
^ permalink raw reply [flat|nested] 11+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] untyped calls: enable target switching [PR112334]
@ 2023-12-02 17:48 Alexandre Oliva
0 siblings, 0 replies; 11+ messages in thread
From: Alexandre Oliva @ 2023-12-02 17:48 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:c3cb70c67e0e8094d3eb57c9242740a4ded20a62
commit c3cb70c67e0e8094d3eb57c9242740a4ded20a62
Author: Alexandre Oliva <oliva@adacore.com>
Date: Fri Dec 1 09:44:07 2023 -0300
untyped calls: enable target switching [PR112334]
The computation of apply_args_size and apply_result_size is saved in a
static variable, so that the corresponding _mode arrays are
initialized only once. That is not compatible with switchable
targets, and ARM's arm_set_current_function, by saving and restoring
target globals, exercises this problem with a testcase such as that in
the PR, in which more than one function in the translation unit calls
__builtin_apply or __builtin_return, respectively.
This patch moves the _size statics into the target_builtins array,
with a bit of ugliness over _plus_one so that zero initialization of
the struct does the right thing.
for gcc/ChangeLog
PR target/112334
* builtins.h (target_builtins): Add fields for apply_args_size
and apply_result_size.
* builtins.cc (apply_args_size, apply_result_size): Cache
results in fields rather than in static variables.
(get_apply_args_size, set_apply_args_size): New.
(get_apply_result_size, set_apply_result_size): New.
Diff:
---
gcc/builtins.cc | 16 ++++++++++++++--
gcc/builtins.h | 7 +++++++
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/gcc/builtins.cc b/gcc/builtins.cc
index 555d2897938..1a105955db6 100644
--- a/gcc/builtins.cc
+++ b/gcc/builtins.cc
@@ -1400,8 +1400,16 @@ get_memory_rtx (tree exp, tree len)
\f
/* Built-in functions to perform an untyped call and return. */
+#define set_apply_args_size(x) \
+ (this_target_builtins->x_apply_args_size_plus_one = 1 + (x))
+#define get_apply_args_size() \
+ (this_target_builtins->x_apply_args_size_plus_one - 1)
#define apply_args_mode \
(this_target_builtins->x_apply_args_mode)
+#define set_apply_result_size(x) \
+ (this_target_builtins->x_apply_result_size_plus_one = 1 + (x))
+#define get_apply_result_size() \
+ (this_target_builtins->x_apply_result_size_plus_one - 1)
#define apply_result_mode \
(this_target_builtins->x_apply_result_mode)
@@ -1411,7 +1419,7 @@ get_memory_rtx (tree exp, tree len)
static int
apply_args_size (void)
{
- static int size = -1;
+ int size = get_apply_args_size ();
int align;
unsigned int regno;
@@ -1444,6 +1452,8 @@ apply_args_size (void)
}
else
apply_args_mode[regno] = as_a <fixed_size_mode> (VOIDmode);
+
+ set_apply_args_size (size);
}
return size;
}
@@ -1454,7 +1464,7 @@ apply_args_size (void)
static int
apply_result_size (void)
{
- static int size = -1;
+ int size = get_apply_result_size ();
int align, regno;
/* The values computed by this function never change. */
@@ -1486,6 +1496,8 @@ apply_result_size (void)
#ifdef APPLY_RESULT_SIZE
size = APPLY_RESULT_SIZE;
#endif
+
+ set_apply_result_size (size);
}
return size;
}
diff --git a/gcc/builtins.h b/gcc/builtins.h
index 88a26d70cd5..1a26fc63a6d 100644
--- a/gcc/builtins.h
+++ b/gcc/builtins.h
@@ -37,6 +37,13 @@ struct target_builtins {
register windows, this gives only the outbound registers.
INCOMING_REGNO gives the corresponding inbound register. */
fixed_size_mode_pod x_apply_result_mode[FIRST_PSEUDO_REGISTER];
+
+ /* Nonzero iff the arrays above have been initialized. The _plus_one suffix
+ is for zero initialization to make it an unreasonable size, used to signal
+ that the size and the corresponding mode array has not been
+ initialized. */
+ int x_apply_args_size_plus_one;
+ int x_apply_result_size_plus_one;
};
extern struct target_builtins default_target_builtins;
^ permalink raw reply [flat|nested] 11+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] untyped calls: enable target switching [PR112334]
@ 2023-12-01 23:42 Alexandre Oliva
0 siblings, 0 replies; 11+ messages in thread
From: Alexandre Oliva @ 2023-12-01 23:42 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:98f8c203797ee77ad99d7dc4a3ac69a9cbad03af
commit 98f8c203797ee77ad99d7dc4a3ac69a9cbad03af
Author: Alexandre Oliva <oliva@adacore.com>
Date: Fri Dec 1 09:44:07 2023 -0300
untyped calls: enable target switching [PR112334]
The computation of apply_args_size and apply_result_size is saved in a
static variable, so that the corresponding _mode arrays are
initialized only once. That is not compatible with switchable
targets, and ARM's arm_set_current_function, by saving and restoring
target globals, exercises this problem with a testcase such as that in
the PR, in which more than one function in the translation unit calls
__builtin_apply or __builtin_return, respectively.
This patch moves the _size statics into the target_builtins array,
with a bit of ugliness over _plus_one so that zero initialization of
the struct does the right thing.
for gcc/ChangeLog
PR target/112334
* builtins.h (target_builtins): Add fields for apply_args_size
and apply_result_size.
* builtins.cc (apply_args_size, apply_result_size): Cache
results in fields rather than in static variables.
(get_apply_args_size, set_apply_args_size): New.
(get_apply_result_size, set_apply_result_size): New.
Diff:
---
gcc/builtins.cc | 16 ++++++++++++++--
gcc/builtins.h | 7 +++++++
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/gcc/builtins.cc b/gcc/builtins.cc
index 4fc58a0bda9..039bb5e997a 100644
--- a/gcc/builtins.cc
+++ b/gcc/builtins.cc
@@ -1398,8 +1398,16 @@ get_memory_rtx (tree exp, tree len)
\f
/* Built-in functions to perform an untyped call and return. */
+#define set_apply_args_size(x) \
+ (this_target_builtins->x_apply_args_size_plus_one = 1 + (x))
+#define get_apply_args_size() \
+ (this_target_builtins->x_apply_args_size_plus_one - 1)
#define apply_args_mode \
(this_target_builtins->x_apply_args_mode)
+#define set_apply_result_size(x) \
+ (this_target_builtins->x_apply_result_size_plus_one = 1 + (x))
+#define get_apply_result_size() \
+ (this_target_builtins->x_apply_result_size_plus_one - 1)
#define apply_result_mode \
(this_target_builtins->x_apply_result_mode)
@@ -1409,7 +1417,7 @@ get_memory_rtx (tree exp, tree len)
static int
apply_args_size (void)
{
- static int size = -1;
+ int size = get_apply_args_size ();
int align;
unsigned int regno;
@@ -1442,6 +1450,8 @@ apply_args_size (void)
}
else
apply_args_mode[regno] = as_a <fixed_size_mode> (VOIDmode);
+
+ set_apply_args_size (size);
}
return size;
}
@@ -1452,7 +1462,7 @@ apply_args_size (void)
static int
apply_result_size (void)
{
- static int size = -1;
+ int size = get_apply_result_size ();
int align, regno;
/* The values computed by this function never change. */
@@ -1484,6 +1494,8 @@ apply_result_size (void)
#ifdef APPLY_RESULT_SIZE
size = APPLY_RESULT_SIZE;
#endif
+
+ set_apply_result_size (size);
}
return size;
}
diff --git a/gcc/builtins.h b/gcc/builtins.h
index 88a26d70cd5..1a26fc63a6d 100644
--- a/gcc/builtins.h
+++ b/gcc/builtins.h
@@ -37,6 +37,13 @@ struct target_builtins {
register windows, this gives only the outbound registers.
INCOMING_REGNO gives the corresponding inbound register. */
fixed_size_mode_pod x_apply_result_mode[FIRST_PSEUDO_REGISTER];
+
+ /* Nonzero iff the arrays above have been initialized. The _plus_one suffix
+ is for zero initialization to make it an unreasonable size, used to signal
+ that the size and the corresponding mode array has not been
+ initialized. */
+ int x_apply_args_size_plus_one;
+ int x_apply_result_size_plus_one;
};
extern struct target_builtins default_target_builtins;
^ permalink raw reply [flat|nested] 11+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] untyped calls: enable target switching [PR112334]
@ 2023-12-01 18:04 Alexandre Oliva
0 siblings, 0 replies; 11+ messages in thread
From: Alexandre Oliva @ 2023-12-01 18:04 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:0d2dd5153c9622f193f28edb5efa931483225537
commit 0d2dd5153c9622f193f28edb5efa931483225537
Author: Alexandre Oliva <oliva@adacore.com>
Date: Fri Dec 1 09:44:07 2023 -0300
untyped calls: enable target switching [PR112334]
The computation of apply_args_size and apply_result_size is saved in a
static variable, so that the corresponding _mode arrays are
initialized only once. That is not compatible with switchable
targets, and ARM's arm_set_current_function, by saving and restoring
target globals, exercises this problem with a testcase such as that in
the PR, in which more than one function in the translation unit calls
__builtin_apply or __builtin_return, respectively.
This patch moves the _size statics into the target_builtins array,
with a bit of ugliness over _plus_one so that zero initialization of
the struct does the right thing.
for gcc/ChangeLog
PR target/112334
* builtins.h (target_builtins): Add fields for apply_args_size
and apply_result_size.
* builtins.cc (apply_args_size, apply_result_size): Cache
results in fields rather than in static variables.
(get_apply_args_size, set_apply_args_size): New.
(get_apply_result_size, set_apply_result_size): New.
Diff:
---
gcc/builtins.cc | 16 ++++++++++++++--
gcc/builtins.h | 7 +++++++
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/gcc/builtins.cc b/gcc/builtins.cc
index 4fc58a0bda9..039bb5e997a 100644
--- a/gcc/builtins.cc
+++ b/gcc/builtins.cc
@@ -1398,8 +1398,16 @@ get_memory_rtx (tree exp, tree len)
\f
/* Built-in functions to perform an untyped call and return. */
+#define set_apply_args_size(x) \
+ (this_target_builtins->x_apply_args_size_plus_one = 1 + (x))
+#define get_apply_args_size() \
+ (this_target_builtins->x_apply_args_size_plus_one - 1)
#define apply_args_mode \
(this_target_builtins->x_apply_args_mode)
+#define set_apply_result_size(x) \
+ (this_target_builtins->x_apply_result_size_plus_one = 1 + (x))
+#define get_apply_result_size() \
+ (this_target_builtins->x_apply_result_size_plus_one - 1)
#define apply_result_mode \
(this_target_builtins->x_apply_result_mode)
@@ -1409,7 +1417,7 @@ get_memory_rtx (tree exp, tree len)
static int
apply_args_size (void)
{
- static int size = -1;
+ int size = get_apply_args_size ();
int align;
unsigned int regno;
@@ -1442,6 +1450,8 @@ apply_args_size (void)
}
else
apply_args_mode[regno] = as_a <fixed_size_mode> (VOIDmode);
+
+ set_apply_args_size (size);
}
return size;
}
@@ -1452,7 +1462,7 @@ apply_args_size (void)
static int
apply_result_size (void)
{
- static int size = -1;
+ int size = get_apply_result_size ();
int align, regno;
/* The values computed by this function never change. */
@@ -1484,6 +1494,8 @@ apply_result_size (void)
#ifdef APPLY_RESULT_SIZE
size = APPLY_RESULT_SIZE;
#endif
+
+ set_apply_result_size (size);
}
return size;
}
diff --git a/gcc/builtins.h b/gcc/builtins.h
index 88a26d70cd5..1a26fc63a6d 100644
--- a/gcc/builtins.h
+++ b/gcc/builtins.h
@@ -37,6 +37,13 @@ struct target_builtins {
register windows, this gives only the outbound registers.
INCOMING_REGNO gives the corresponding inbound register. */
fixed_size_mode_pod x_apply_result_mode[FIRST_PSEUDO_REGISTER];
+
+ /* Nonzero iff the arrays above have been initialized. The _plus_one suffix
+ is for zero initialization to make it an unreasonable size, used to signal
+ that the size and the corresponding mode array has not been
+ initialized. */
+ int x_apply_args_size_plus_one;
+ int x_apply_result_size_plus_one;
};
extern struct target_builtins default_target_builtins;
^ permalink raw reply [flat|nested] 11+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] untyped calls: enable target switching [PR112334]
@ 2023-12-01 13:35 Alexandre Oliva
0 siblings, 0 replies; 11+ messages in thread
From: Alexandre Oliva @ 2023-12-01 13:35 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:3bc2a403f5463b0cc65de18a7b3da58782065563
commit 3bc2a403f5463b0cc65de18a7b3da58782065563
Author: Alexandre Oliva <oliva@adacore.com>
Date: Fri Dec 1 09:44:07 2023 -0300
untyped calls: enable target switching [PR112334]
The computation of apply_args_size and apply_result_size is saved in a
static variable, so that the corresponding _mode arrays are
initialized only once. That is not compatible with switchable
targets, and ARM's arm_set_current_function, by saving and restoring
target globals, exercises this problem with a testcase such as that in
the PR, in which more than one function in the translation unit calls
__builtin_apply or __builtin_return, respectively.
This patch moves the _size statics into the target_builtins array,
with a bit of ugliness over _plus_one so that zero initialization of
the struct does the right thing.
for gcc/ChangeLog
PR target/112334
* builtins.h (target_builtins): Add fields for apply_args_size
and apply_result_size.
* builtins.cc (apply_args_size, apply_result_size): Cache
results in fields rather than in static variables.
(get_apply_args_size, set_apply_args_size): New.
(get_apply_result_size, set_apply_result_size): New.
Diff:
---
gcc/builtins.cc | 16 ++++++++++++++--
gcc/builtins.h | 7 +++++++
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/gcc/builtins.cc b/gcc/builtins.cc
index 4fc58a0bda9..039bb5e997a 100644
--- a/gcc/builtins.cc
+++ b/gcc/builtins.cc
@@ -1398,8 +1398,16 @@ get_memory_rtx (tree exp, tree len)
\f
/* Built-in functions to perform an untyped call and return. */
+#define set_apply_args_size(x) \
+ (this_target_builtins->x_apply_args_size_plus_one = 1 + (x))
+#define get_apply_args_size() \
+ (this_target_builtins->x_apply_args_size_plus_one - 1)
#define apply_args_mode \
(this_target_builtins->x_apply_args_mode)
+#define set_apply_result_size(x) \
+ (this_target_builtins->x_apply_result_size_plus_one = 1 + (x))
+#define get_apply_result_size() \
+ (this_target_builtins->x_apply_result_size_plus_one - 1)
#define apply_result_mode \
(this_target_builtins->x_apply_result_mode)
@@ -1409,7 +1417,7 @@ get_memory_rtx (tree exp, tree len)
static int
apply_args_size (void)
{
- static int size = -1;
+ int size = get_apply_args_size ();
int align;
unsigned int regno;
@@ -1442,6 +1450,8 @@ apply_args_size (void)
}
else
apply_args_mode[regno] = as_a <fixed_size_mode> (VOIDmode);
+
+ set_apply_args_size (size);
}
return size;
}
@@ -1452,7 +1462,7 @@ apply_args_size (void)
static int
apply_result_size (void)
{
- static int size = -1;
+ int size = get_apply_result_size ();
int align, regno;
/* The values computed by this function never change. */
@@ -1484,6 +1494,8 @@ apply_result_size (void)
#ifdef APPLY_RESULT_SIZE
size = APPLY_RESULT_SIZE;
#endif
+
+ set_apply_result_size (size);
}
return size;
}
diff --git a/gcc/builtins.h b/gcc/builtins.h
index 88a26d70cd5..1a26fc63a6d 100644
--- a/gcc/builtins.h
+++ b/gcc/builtins.h
@@ -37,6 +37,13 @@ struct target_builtins {
register windows, this gives only the outbound registers.
INCOMING_REGNO gives the corresponding inbound register. */
fixed_size_mode_pod x_apply_result_mode[FIRST_PSEUDO_REGISTER];
+
+ /* Nonzero iff the arrays above have been initialized. The _plus_one suffix
+ is for zero initialization to make it an unreasonable size, used to signal
+ that the size and the corresponding mode array has not been
+ initialized. */
+ int x_apply_args_size_plus_one;
+ int x_apply_result_size_plus_one;
};
extern struct target_builtins default_target_builtins;
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2023-12-12 2:38 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-06 2:31 [gcc(refs/users/aoliva/heads/testme)] untyped calls: enable target switching [PR112334] Alexandre Oliva
-- strict thread matches above, loose matches on Subject: below --
2023-12-12 2:38 Alexandre Oliva
2023-12-06 22:47 Alexandre Oliva
2023-12-06 20:01 Alexandre Oliva
2023-12-05 21:51 Alexandre Oliva
2023-12-05 19:30 Alexandre Oliva
2023-12-03 1:46 Alexandre Oliva
2023-12-02 17:48 Alexandre Oliva
2023-12-01 23:42 Alexandre Oliva
2023-12-01 18:04 Alexandre Oliva
2023-12-01 13:35 Alexandre Oliva
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).