public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/partial-linking-v4)] Come up with faster build (PARTIAL_LTO=1).
@ 2022-11-29 21:10 Martin Liska
  0 siblings, 0 replies; only message in thread
From: Martin Liska @ 2022-11-29 21:10 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:fcd652e18e0aa82e1995c8a5426df2eedd5c6501

commit fcd652e18e0aa82e1995c8a5426df2eedd5c6501
Author: Martin Liska <mliska@suse.cz>
Date:   Thu Feb 3 12:13:42 2022 +0100

    Come up with faster build (PARTIAL_LTO=1).

Diff:
---
 gcc/Makefile.in | 37 +++++++++++++++++++++++++++++++------
 1 file changed, 31 insertions(+), 6 deletions(-)

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index fa5e5b444bb..8b9042757f4 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -223,7 +223,9 @@ libgcov-util.o-warn = -Wno-error
 libgcov-driver-tool.o-warn = -Wno-error
 libgcov-merge-tool.o-warn = -Wno-error
 gimple-match.o-warn = -Wno-unused
+gimple-match-lto.o-warn = -Wno-unused
 generic-match.o-warn = -Wno-unused
+generic-match-lto.o-warn = -Wno-unused
 dfp.o-warn = -Wno-strict-aliasing
 
 # All warnings have to be shut off in stage1 if the compiler used then
@@ -1297,12 +1299,10 @@ ANALYZER_OBJS = \
 # will build them sooner, because they are large and otherwise tend to be
 # the last objects to finish building.
 OBJS = \
-	gimple-match.o \
-	generic-match.o \
+	common-base.a \
 	insn-attrtab.o \
 	insn-automata.o \
 	insn-dfatab.o \
-	insn-emit.o \
 	insn-extract.o \
 	insn-latencytab.o \
 	insn-modes.o \
@@ -1310,7 +1310,6 @@ OBJS = \
 	insn-output.o \
 	insn-peep.o \
 	insn-preds.o \
-	insn-recog.o \
 	insn-enums.o \
 	ggc-page.o \
 	adjust-alignment.o \
@@ -2649,8 +2648,8 @@ s-tm-texi: build/genhooks$(build_exeext) $(srcdir)/doc/tm.texi.in
 	  false; \
 	fi
 
-gimple-match.cc: s-match gimple-match-head.cc ; @true
-generic-match.cc: s-match generic-match-head.cc ; @true
+gimple-match.cc: s-match gimple-match-head.cc insn-attr-common.h ; @true
+generic-match.cc: s-match generic-match-head.cc insn-attr-common.h ; @true
 
 s-match: build/genmatch$(build_exeext) $(srcdir)/match.pd cfn-operators.pd
 	$(RUN_GEN) build/genmatch$(build_exeext) --gimple $(srcdir)/match.pd \
@@ -2663,6 +2662,32 @@ s-match: build/genmatch$(build_exeext) $(srcdir)/match.pd cfn-operators.pd
 	    					generic-match.cc
 	$(STAMP) s-match
 
+ifdef PARTIAL_LTO
+LTO_LINKER_FLAGS = -flto=auto --param=lto-partitions=`nproc` -flinker-output=nolto-rel -r
+LTO_FLAGS = -flto
+
+gimple-match-lto.o: gimple-match.cc $(TARGET_H) $(generated_files)
+	$(COMPILE) $< $(LTO_FLAGS)
+generic-match-lto.o: generic-match.cc $(TARGET_H) $(generated_files)
+	$(COMPILE) $< $(LTO_FLAGS)
+insn-recog-lto.o: insn-recog.cc
+	$(COMPILE) $< $(LTO_FLAGS)
+insn-emit-lto.o: insn-emit.cc
+	$(COMPILE) $< $(LTO_FLAGS)
+
+common-base.a: gimple-match-lto.o generic-match-lto.o insn-recog-lto.o insn-emit-lto.o
+	-rm -rf $@
+	$(LINKER) $^ $(LTO_LINKER_FLAGS) -o common-base.o
+	$(AR) $(AR_FLAGS)T $@ common-base.o
+else
+insn-recog.o: insn-recog.cc insn-attr-common.h
+insn-emit.o: insn-emit.cc insn-attr-common.h
+
+common-base.a: gimple-match.o generic-match.o insn-recog.o insn-emit.o
+	-rm -rf $@
+	$(AR) $(AR_FLAGS)T $@ $^
+endif
+
 GTFILES = $(CPPLIB_H) $(srcdir)/input.h $(srcdir)/coretypes.h \
   $(host_xm_file_list) \
   $(OPTIONS_H_EXTRA) \

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-29 21:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-29 21:10 [gcc(refs/users/marxin/heads/partial-linking-v4)] Come up with faster build (PARTIAL_LTO=1) Martin Liska

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).