Lines Matching defs:ICF

1 //===- ICF.cpp ------------------------------------------------------------===//
9 // ICF is short for Identical Code Folding. This is a size optimization to
14 // In ICF, two sections are considered identical if they have the same
18 // terms of ICF*.
21 // same machine instructions, ICF can and should merge the two, although
63 // boost when applying ICF on large programs. For example, MSVC link.exe
64 // or GNU gold takes 10-20 seconds to apply ICF on Chromium, whose output
66 // 2.8 GHz 40 core machine. Even without threading, LLD's ICF is still
69 // [1] Safe ICF: Pointer Safe and Unwinding aware Identical Code Folding
75 #include "ICF.h"
98 template <class ELFT> class ICF {
100 ICF(Ctx &ctx) : ctx(ctx) {}
162 // Returns true if section S is subject of ICF.
173 // SHF_LINK_ORDER sections are ICF'd as a unit with their dependent sections,
174 // so we don't consider them for ICF individually.
179 // The Data member needs to be valid for ICF as it is used by ICF to determine
190 // __start_* and __stop_* symbols. We cannot ICF any such sections because
200 void ICF<ELFT>::segregate(size_t begin, size_t end, uint32_t eqClassBase,
240 bool ICF<ELFT>::constantEq(const InputSection *secA, Relocs<RelTy> ra,
317 bool ICF<ELFT>::equalsConstant(const InputSection *a, const InputSection *b) {
337 // relocations point to the same section in terms of ICF.
340 bool ICF<ELFT>::variableEq(const InputSection *secA, Relocs<RelTy> ra,
378 bool ICF<ELFT>::equalsVariable(const InputSection *a, const InputSection *b) {
388 template <class ELFT> size_t ICF<ELFT>::findBoundary(size_t begin, size_t end) {
402 void ICF<ELFT>::forEachClassRange(size_t begin, size_t end,
413 void ICF<ELFT>::forEachClass(llvm::function_ref<void(size_t, size_t)> fn) {
462 // The main function of ICF.
463 template <class ELFT> void ICF<ELFT>::run() {
533 Log(ctx) << "ICF needed " << cnt << " iterations";
572 // ICF may fold some input sections assigned to output sections. Remove them.
581 // ICF entry point function.
583 llvm::TimeTraceScope timeScope("ICF");
584 ICF<ELFT>(ctx).run();