diff options
author | Keith Packard <keithp@keithp.com> | 2025-01-15 22:11:01 -0700 |
---|---|---|
committer | Jeff Law <jlaw@ventanamicro.com> | 2025-01-15 22:11:01 -0700 |
commit | cf9de710aaacd8a3c2cddf348c704b19a5404a0f (patch) | |
tree | f785151e0ebb2f2c8d98014cd52f69da879bf657 /libgomp/testsuite/libgomp.c-c++-common/metadirective-target-device.c | |
parent | 423e9a8ad59e6972cd6f25238cd328080fed11cc (diff) | |
download | gcc-cf9de710aaacd8a3c2cddf348c704b19a5404a0f.zip gcc-cf9de710aaacd8a3c2cddf348c704b19a5404a0f.tar.gz gcc-cf9de710aaacd8a3c2cddf348c704b19a5404a0f.tar.bz2 |
lm32: In va_arg, skip to stack args with too few remaining reg args
lm32 has 8 register parameter slots, so many vararg functions end up
with several anonymous parameters passed in registers. If we run out
of registers in the middle of a parameter, the entire parameter will
be placed on the stack, skipping any remaining available registers.
The receiving varargs function doesn't know this, and will save all of
the possible parameter register values just below the stack parameters.
When processing a va_arg call with a type size larger than a single
register, we must check to see if it spans the boundary between
register and stack parameters. If so, we need to skip to the stack
parameters.
This is done by making va_list a structure containing the arg pointer
and the address of the start of the stack parameters. Boundary checks
are inserted in va_arg calls to detect this case and the address of
the parameter is set to the stack parameter start when the parameter
crosses over.
gcc/
* config/lm32/lm32.cc: Add several #includes.
(va_list_type): New.
(lm32_build_va_list): New function.
(lm32_builtin_va_start): Likewise.
(lm32_sd_gimplify_va_arg_expr): Likewise.
(lm32_gimplify_va_arg_expr): Likewise.
Diffstat (limited to 'libgomp/testsuite/libgomp.c-c++-common/metadirective-target-device.c')
0 files changed, 0 insertions, 0 deletions