aboutsummaryrefslogtreecommitdiff
path: root/gcc/lra-int.h
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2023-02-16 10:30:20 -0500
committerPatrick Palka <ppalka@redhat.com>2023-02-16 10:30:20 -0500
commitcb3e0eac262e55774949b1717c64da383adbc621 (patch)
treea86ae96b5585e5f6d6c86bf152bc621ae76d632d /gcc/lra-int.h
parenta5de17d9120dde7e6598a05ea4d1556c2783c69b (diff)
downloadgcc-cb3e0eac262e55774949b1717c64da383adbc621.zip
gcc-cb3e0eac262e55774949b1717c64da383adbc621.tar.gz
gcc-cb3e0eac262e55774949b1717c64da383adbc621.tar.bz2
don't declare header-defined functions both static and inline
Many functions defined in our headers are declared 'static inline' which is a C idiom whose use predates our move to C++ as the implementation language. But in C++ the inline keyword is more than just a compiler hint, and is sufficient to give the function the intended semantics. In fact declaring a function both static and inline is a pessimization since static effectively disables the desired definition merging behavior enabled by inline, and is also a source of (harmless) ODR violations when a static inline function gets called from a non-static inline one (such as tree_operand_check calling tree_operand_length). This patch mechanically fixes the vast majority of occurrences of this anti-pattern throughout the compiler's headers via the command line sed -i 's/^static inline/inline/g' gcc/*.h gcc/*/*.h There's also a manual change to remove the redundant declarations of is_ivar and lookup_category in gcc/objc/objc-act.cc which would otherwise conflict with their modified definitions in objc-act.h (due to the difference in staticness). Besides fixing some ODR violations, this speeds up stage1 cc1plus by about 2% and reduces the size of its text segment by 1.5MB. gcc/ChangeLog: * addresses.h: Mechanically drop 'static' from 'static inline' functions via s/^static inline/inline/g. * asan.h: Likewise. * attribs.h: Likewise. * basic-block.h: Likewise. * bitmap.h: Likewise. * cfghooks.h: Likewise. * cfgloop.h: Likewise. * cgraph.h: Likewise. * cselib.h: Likewise. * data-streamer.h: Likewise. * debug.h: Likewise. * df.h: Likewise. * diagnostic.h: Likewise. * dominance.h: Likewise. * dumpfile.h: Likewise. * emit-rtl.h: Likewise. * except.h: Likewise. * expmed.h: Likewise. * expr.h: Likewise. * fixed-value.h: Likewise. * gengtype.h: Likewise. * gimple-expr.h: Likewise. * gimple-iterator.h: Likewise. * gimple-predict.h: Likewise. * gimple-range-fold.h: Likewise. * gimple-ssa.h: Likewise. * gimple.h: Likewise. * graphite.h: Likewise. * hard-reg-set.h: Likewise. * hash-map.h: Likewise. * hash-set.h: Likewise. * hash-table.h: Likewise. * hwint.h: Likewise. * input.h: Likewise. * insn-addr.h: Likewise. * internal-fn.h: Likewise. * ipa-fnsummary.h: Likewise. * ipa-icf-gimple.h: Likewise. * ipa-inline.h: Likewise. * ipa-modref.h: Likewise. * ipa-prop.h: Likewise. * ira-int.h: Likewise. * ira.h: Likewise. * lra-int.h: Likewise. * lra.h: Likewise. * lto-streamer.h: Likewise. * memmodel.h: Likewise. * omp-general.h: Likewise. * optabs-query.h: Likewise. * optabs.h: Likewise. * plugin.h: Likewise. * pretty-print.h: Likewise. * range.h: Likewise. * read-md.h: Likewise. * recog.h: Likewise. * regs.h: Likewise. * rtl-iter.h: Likewise. * rtl.h: Likewise. * sbitmap.h: Likewise. * sched-int.h: Likewise. * sel-sched-ir.h: Likewise. * sese.h: Likewise. * sparseset.h: Likewise. * ssa-iterators.h: Likewise. * system.h: Likewise. * target-globals.h: Likewise. * target.h: Likewise. * timevar.h: Likewise. * tree-chrec.h: Likewise. * tree-data-ref.h: Likewise. * tree-iterator.h: Likewise. * tree-outof-ssa.h: Likewise. * tree-phinodes.h: Likewise. * tree-scalar-evolution.h: Likewise. * tree-sra.h: Likewise. * tree-ssa-alias.h: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-manip.h: Likewise. * tree-ssa-loop.h: Likewise. * tree-ssa-operands.h: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa.h: Likewise. * tree-ssanames.h: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.h: Likewise. * tree-vectorizer.h: Likewise. * tree.h: Likewise. * wide-int.h: Likewise. gcc/c-family/ChangeLog: * c-common.h: Mechanically drop static from static inline functions via s/^static inline/inline/g. gcc/c/ChangeLog: * c-parser.h: Mechanically drop static from static inline functions via s/^static inline/inline/g. gcc/cp/ChangeLog: * cp-tree.h: Mechanically drop static from static inline functions via s/^static inline/inline/g. gcc/fortran/ChangeLog: * gfortran.h: Mechanically drop static from static inline functions via s/^static inline/inline/g. gcc/jit/ChangeLog: * jit-dejagnu.h: Mechanically drop static from static inline functions via s/^static inline/inline/g. * jit-recording.h: Likewise. gcc/objc/ChangeLog: * objc-act.h: Mechanically drop static from static inline functions via s/^static inline/inline/g. * objc-map.h: Likewise. * objc-act.cc: Remove the redundant redeclarations of is_ivar and lookup_category.
Diffstat (limited to 'gcc/lra-int.h')
-rw-r--r--gcc/lra-int.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/gcc/lra-int.h b/gcc/lra-int.h
index 2f1450b..73f8eb0 100644
--- a/gcc/lra-int.h
+++ b/gcc/lra-int.h
@@ -419,7 +419,7 @@ extern void lra_eliminate_reg_if_possible (rtx *);
/* Return the hard register which given pseudo REGNO assigned to.
Negative value means that the register got memory or we don't know
allocation yet. */
-static inline int
+inline int
lra_get_regno_hard_regno (int regno)
{
resize_reg_info ();
@@ -443,7 +443,7 @@ lra_change_class (int regno, enum reg_class new_class,
/* Update insn operands which are duplication of NOP operand. The
insn is represented by its LRA internal representation ID. */
-static inline void
+inline void
lra_update_dup (lra_insn_recog_data_t id, int nop)
{
int i;
@@ -458,7 +458,7 @@ lra_update_dup (lra_insn_recog_data_t id, int nop)
operands processing. Generally speaking, we could do this probably
simultaneously with operands processing because a common practice
is to enumerate the operators after their operands. */
-static inline void
+inline void
lra_update_operator_dups (lra_insn_recog_data_t id)
{
int i;
@@ -474,7 +474,7 @@ lra_update_operator_dups (lra_insn_recog_data_t id)
}
/* Return info about INSN. Set up the info if it is not done yet. */
-static inline lra_insn_recog_data_t
+inline lra_insn_recog_data_t
lra_get_insn_recog_data (rtx_insn *insn)
{
lra_insn_recog_data_t data;
@@ -494,7 +494,7 @@ lra_get_insn_recog_data (rtx_insn *insn)
}
/* Update offset from pseudos with VAL by INCR. */
-static inline void
+inline void
lra_update_reg_val_offset (int val, poly_int64 incr)
{
int i;
@@ -507,7 +507,7 @@ lra_update_reg_val_offset (int val, poly_int64 incr)
}
/* Return true if register content is equal to VAL with OFFSET. */
-static inline bool
+inline bool
lra_reg_val_equal_p (int regno, int val, poly_int64 offset)
{
if (lra_reg_info[regno].val == val
@@ -518,7 +518,7 @@ lra_reg_val_equal_p (int regno, int val, poly_int64 offset)
}
/* Assign value of register FROM to TO. */
-static inline void
+inline void
lra_assign_reg_val (int from, int to)
{
lra_reg_info[to].val = lra_reg_info[from].val;