summaryrefslogtreecommitdiff
path: root/gcc/target-globals.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2019-09-30 16:19:38 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2019-09-30 16:19:38 +0000
commitbd785b44932274f7067105de417938597289962c (patch)
tree503a651572b5e0035d9cb5422d10f45b3e051b5c /gcc/target-globals.c
parent0c88d078eba7f51d2e5fc76a630f7eb369c09c87 (diff)
Add function_abi.{h,cc}
This patch adds new structures and functions for handling multiple ABIs in a translation unit. The structures are: - predefined_function_abi: describes a static, predefined ABI - function_abi: describes either a predefined ABI or a local variant of one (e.g. taking -fipa-ra into account) The patch adds functions for getting the ABI from a given type or decl; a later patch will also add a function for getting the ABI of the target of a call insn. Although ABIs are about much more than call-clobber/saved choices, I wanted to keep the name general in case we add more ABI-related information in future. 2019-09-30 Richard Sandiford <richard.sandiford@arm.com> gcc/ * Makefile.in (OBJS): Add function-abi.o. (GTFILES): Add function-abi.h. * function-abi.cc: New file. * function-abi.h: Likewise. * emit-rtl.h (rtl_data::abi): New field. * function.c: Include function-abi.h. (prepare_function_start): Initialize crtl->abi. * read-rtl-function.c: Include regs.h and function-abi.h. (read_rtl_function_body): Initialize crtl->abi. (read_rtl_function_body_from_file_range): Likewise. * reginfo.c: Include function-abi.h. (init_reg_sets_1): Initialize default_function_abi. (globalize_reg): Call add_full_reg_clobber for each predefined ABI when making a register global. * target-globals.h (this_target_function_abi_info): Declare. (target_globals::function_abi_info): New field. (restore_target_globals): Copy it. * target-globals.c: Include function-abi.h. (default_target_globals): Initialize the function_abi_info field. (target_globals): Allocate it. (save_target_globals): Free it. From-SVN: r276307
Diffstat (limited to 'gcc/target-globals.c')
-rw-r--r--gcc/target-globals.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/target-globals.c b/gcc/target-globals.c
index 8928fc19fd3..359677e68af 100644
--- a/gcc/target-globals.c
+++ b/gcc/target-globals.c
@@ -40,6 +40,7 @@ along with GCC; see the file COPYING3. If not see
#include "gcse.h"
#include "bb-reorder.h"
#include "lower-subreg.h"
+#include "function-abi.h"
#if SWITCHABLE_TARGET
class target_globals default_target_globals = {
@@ -48,6 +49,7 @@ class target_globals default_target_globals = {
&default_target_rtl,
&default_target_recog,
&default_target_hard_regs,
+ &default_target_function_abi_info,
&default_target_reload,
&default_target_expmed,
&default_target_optabs,
@@ -70,6 +72,7 @@ save_target_globals (void)
g->rtl = ggc_cleared_alloc<target_rtl> ();
g->recog = XCNEW (struct target_recog);
g->hard_regs = XCNEW (struct target_hard_regs);
+ g->function_abi_info = XCNEW (struct target_function_abi_info);
g->reload = XCNEW (struct target_reload);
g->expmed = XCNEW (struct target_expmed);
g->optabs = XCNEW (struct target_optabs);
@@ -127,6 +130,7 @@ target_globals::~target_globals ()
XDELETE (regs);
XDELETE (recog);
XDELETE (hard_regs);
+ XDELETE (function_abi_info);
XDELETE (reload);
XDELETE (expmed);
XDELETE (optabs);