aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-data-ref.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/tree-data-ref.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/tree-data-ref.h')
-rw-r--r--gcc/tree-data-ref.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/gcc/tree-data-ref.h b/gcc/tree-data-ref.h
index 50718c0..4d1a5c4 100644
--- a/gcc/tree-data-ref.h
+++ b/gcc/tree-data-ref.h
@@ -592,7 +592,7 @@ extern bool dr_known_forward_stride_p (struct data_reference *);
/* Return true when the base objects of data references A and B are
the same memory object. */
-static inline bool
+inline bool
same_data_refs_base_objects (data_reference_p a, data_reference_p b)
{
return DR_NUM_DIMENSIONS (a) == DR_NUM_DIMENSIONS (b)
@@ -603,7 +603,7 @@ same_data_refs_base_objects (data_reference_p a, data_reference_p b)
memory object with the same access functions. Optionally skip the
last OFFSET dimensions in the data reference. */
-static inline bool
+inline bool
same_data_refs (data_reference_p a, data_reference_p b, int offset = 0)
{
unsigned int i;
@@ -641,7 +641,7 @@ known_dependences_p (vec<ddr_p> dependence_relations)
LEVEL = 0 means a lexicographic dependence, i.e. a dependence due
to the sequence of statements, not carried by any loop. */
-static inline unsigned
+inline unsigned
dependence_level (lambda_vector dist_vect, int length)
{
int i;
@@ -655,7 +655,7 @@ dependence_level (lambda_vector dist_vect, int length)
/* Return the dependence level for the DDR relation. */
-static inline unsigned
+inline unsigned
ddr_dependence_level (ddr_p ddr)
{
unsigned vector;
@@ -672,7 +672,7 @@ ddr_dependence_level (ddr_p ddr)
/* Return the index of the variable VAR in the LOOP_NEST array. */
-static inline int
+inline int
index_in_loop_nest (int var, const vec<loop_p> &loop_nest)
{
class loop *loopi;
@@ -688,7 +688,7 @@ index_in_loop_nest (int var, const vec<loop_p> &loop_nest)
/* Returns true when the data reference DR the form "A[i] = ..."
with a stride equal to its unit type size. */
-static inline bool
+inline bool
adjacent_dr_p (struct data_reference *dr)
{
/* If this is a bitfield store bail out. */
@@ -709,7 +709,7 @@ void split_constant_offset (tree , tree *, tree *);
/* Compute the greatest common divisor of a VECTOR of SIZE numbers. */
-static inline lambda_int
+inline lambda_int
lambda_vector_gcd (lambda_vector vector, int size)
{
int i;
@@ -726,7 +726,7 @@ lambda_vector_gcd (lambda_vector vector, int size)
/* Allocate a new vector of given SIZE. */
-static inline lambda_vector
+inline lambda_vector
lambda_vector_new (int size)
{
/* ??? We shouldn't abuse the GC allocator here. */
@@ -735,7 +735,7 @@ lambda_vector_new (int size)
/* Clear out vector VEC1 of length SIZE. */
-static inline void
+inline void
lambda_vector_clear (lambda_vector vec1, int size)
{
memset (vec1, 0, size * sizeof (*vec1));
@@ -744,7 +744,7 @@ lambda_vector_clear (lambda_vector vec1, int size)
/* Returns true when the vector V is lexicographically positive, in
other words, when the first nonzero element is positive. */
-static inline bool
+inline bool
lambda_vector_lexico_pos (lambda_vector v,
unsigned n)
{
@@ -763,7 +763,7 @@ lambda_vector_lexico_pos (lambda_vector v,
/* Return true if vector VEC1 of length SIZE is the zero vector. */
-static inline bool
+inline bool
lambda_vector_zerop (lambda_vector vec1, int size)
{
int i;
@@ -775,7 +775,7 @@ lambda_vector_zerop (lambda_vector vec1, int size)
/* Allocate a matrix of M rows x N cols. */
-static inline lambda_matrix
+inline lambda_matrix
lambda_matrix_new (int m, int n, struct obstack *lambda_obstack)
{
lambda_matrix mat;