aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/target.def
diff options
context:
space:
mode:
authorCarrot Wei <carrot@google.com>2014-05-15 10:06:33 +0800
committerAndrew Hsieh <andrewhsieh@google.com>2014-05-15 15:59:04 +0800
commit331e362574142e4c1d9d509533d1c96b6dc54d13 (patch)
treeb078d9e04e3437c2d322b4d3406fedc973833440 /gcc-4.9/gcc/target.def
parent5cd97bdbf2d97af4b0e4301f5f2b6c2a4301baf9 (diff)
downloadtoolchain_gcc-331e362574142e4c1d9d509533d1c96b6dc54d13.tar.gz
toolchain_gcc-331e362574142e4c1d9d509533d1c96b6dc54d13.tar.bz2
toolchain_gcc-331e362574142e4c1d9d509533d1c96b6dc54d13.zip
[4.8, 4.9] Add simplify-got
This pass optimize GOT_PREL (already exists in toolchain/gcc/gcc-4.6) Backport from svn://gcc.gnu.org/svn/gcc/branches/google/gcc-4_6-mobile UNSPEC_GOT_PREL_SYM is now in new file arm/unspecs.md 4.9 port is slightly different due to changes in gcc passes See Google b/14811006 r173209 | carrot | 2011-04-30 16:07:46 +0800 (Sat, 30 Apr 2011) | 21 lines * hooks.c (hook_rtx_void_null): New function. * hooks.h (hook_rtx_void_null): New prototype. * target.def (got_access): New hook vector declaration. * tree-pass.h (pass_simplify_got): New pass. * timevar.def (TV_SIMPLIFY_GOT): New TV id. * simplify-got.c: New source file. * Makefile.in (simplify-got.o): Add a new file. * passes.c (init_optimization_passes): Add a new pass. * config/arm/arm.c (arm_output_addr_const_extra): Output GOT_PREL relocation. (arm_get_pic_reg): New function. (arm_clear_pic_reg): New function. (arm_can_simplify_got_access): New function. (arm_loaded_global_var): New function. (arm_load_global_address): New function. * config/arm/arm.md (UNSPEC_GOT_PREL_SYM): New UNSPEC symbol. * testsuite/gcc.target/arm/got1.c: New testcase. * testsuite/gcc.target/arm/got2.c: New testcase. Change-Id: I91e881df19bb6937a5fbcc8e6b83d158717c7773
Diffstat (limited to 'gcc-4.9/gcc/target.def')
-rw-r--r--gcc-4.9/gcc/target.def45
1 files changed, 45 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/target.def b/gcc-4.9/gcc/target.def
index 3a64cd143..a67ffa8b5 100644
--- a/gcc-4.9/gcc/target.def
+++ b/gcc-4.9/gcc/target.def
@@ -5116,6 +5116,51 @@ specific target options and the caller does not use the same options.",
HOOK_VECTOR_END (target_option)
+/* Functions used to simplify GOT access. */
+#undef HOOK_PREFIX
+#define HOOK_PREFIX "TARGET_"
+HOOK_VECTOR (TARGET_SIMPLIFY_GOT_ACCESS, simplify_got_access)
+
+/* Function to get the pic_reg which holds the base address of GOT. */
+DEFHOOK
+(get_pic_reg,
+ "",
+ rtx, (void),
+ hook_rtx_void_null)
+
+/* Function to clear the pic_reg which is useless now. */
+DEFHOOK
+(clear_pic_reg,
+ "",
+ void, (void),
+ NULL)
+
+/* Function to detect if the specified insn loads a global variable's
+ address from GOT. If so returns that symbol. */
+DEFHOOK
+(loaded_global_var,
+ "",
+ rtx, (rtx insn, rtx *offset_reg, rtx *offset_insn),
+ NULL)
+
+/* This function checks if it satisfies the target dependent conditions
+ that we can simplify GOT accesses. */
+DEFHOOK
+(can_simplify_got_access,
+ "",
+ bool, (int n_symbol, int n_access),
+ NULL)
+
+/* This function does the actual rewriting of GOT accesses. */
+DEFHOOK
+(load_global_address,
+ "",
+ void, (rtx symbol, rtx offset_reg, rtx address_reg, rtx load_insn,
+ rtx offset_insn),
+ NULL)
+
+HOOK_VECTOR_END (got_access)
+
/* For targets that need to mark extra registers as live on entry to
the function, they should define this target hook and set their
bits in the bitmap passed in. */