aboutsummaryrefslogtreecommitdiff
path: root/gcc/function.cc
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2023-11-06 10:49:58 +0000
committerRichard Sandiford <richard.sandiford@arm.com>2023-11-06 10:49:58 +0000
commita7a45364dddef399bfb550235166df51108a3142 (patch)
tree8e1948d50cc17514a215e485bfbe91913d685e05 /gcc/function.cc
parent17df6ddcf11aef6d200305d35641a7deb2f430e1 (diff)
downloadgcc-a7a45364dddef399bfb550235166df51108a3142.zip
gcc-a7a45364dddef399bfb550235166df51108a3142.tar.gz
gcc-a7a45364dddef399bfb550235166df51108a3142.tar.bz2
explow: Allow dynamic allocations after vregs
This patch allows allocate_dynamic_stack_space to be called before or after virtual registers have been instantiated. It uses the same approach as allocate_stack_local, which already supported this. gcc/ * function.h (get_stack_dynamic_offset): Declare. * function.cc (get_stack_dynamic_offset): New function, split out from... (get_stack_dynamic_offset): ...here. * explow.cc (allocate_dynamic_stack_space): Handle calls made after virtual registers have been instantiated.
Diffstat (limited to 'gcc/function.cc')
-rw-r--r--gcc/function.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/function.cc b/gcc/function.cc
index afb0b33..527ea48 100644
--- a/gcc/function.cc
+++ b/gcc/function.cc
@@ -1943,6 +1943,16 @@ instantiate_decls (tree fndecl)
vec_free (cfun->local_decls);
}
+/* Return the value of STACK_DYNAMIC_OFFSET for the current function.
+ This is done through a function wrapper so that the macro sees a
+ predictable set of included files. */
+
+poly_int64
+get_stack_dynamic_offset ()
+{
+ return STACK_DYNAMIC_OFFSET (current_function_decl);
+}
+
/* Pass through the INSNS of function FNDECL and convert virtual register
references to hard register references. */
@@ -1954,7 +1964,7 @@ instantiate_virtual_regs (void)
/* Compute the offsets to use for this function. */
in_arg_offset = FIRST_PARM_OFFSET (current_function_decl);
var_offset = targetm.starting_frame_offset ();
- dynamic_offset = STACK_DYNAMIC_OFFSET (current_function_decl);
+ dynamic_offset = get_stack_dynamic_offset ();
out_arg_offset = STACK_POINTER_OFFSET;
#ifdef FRAME_POINTER_CFA_OFFSET
cfa_offset = FRAME_POINTER_CFA_OFFSET (current_function_decl);