aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/BasicBlockSections.cpp
diff options
context:
space:
mode:
authorRahman Lavaee <rahmanl@google.com>2021-07-29 19:20:12 -0700
committerRahman Lavaee <rahmanl@google.com>2021-07-30 12:08:04 -0700
commit2256b359d7937b734fd66c9a48b30b10fa441db3 (patch)
tree28facc00a7704e73ad55e47bc664ecb54c913525 /llvm/lib/CodeGen/BasicBlockSections.cpp
parentbb438f6cbfc08eaa2cd9124a0ad581dd29f819b4 (diff)
downloadllvm-2256b359d7937b734fd66c9a48b30b10fa441db3.zip
llvm-2256b359d7937b734fd66c9a48b30b10fa441db3.tar.gz
llvm-2256b359d7937b734fd66c9a48b30b10fa441db3.tar.bz2
Explain the symbols of basic block clusters with an example in the header comments.
This prevents from confusion with the ``labels`` option. Reviewed By: snehasish Differential Revision: https://reviews.llvm.org/D107128
Diffstat (limited to 'llvm/lib/CodeGen/BasicBlockSections.cpp')
-rw-r--r--llvm/lib/CodeGen/BasicBlockSections.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/BasicBlockSections.cpp b/llvm/lib/CodeGen/BasicBlockSections.cpp
index 1a6eed2..c1901bc 100644
--- a/llvm/lib/CodeGen/BasicBlockSections.cpp
+++ b/llvm/lib/CodeGen/BasicBlockSections.cpp
@@ -21,9 +21,21 @@
// clusters of basic blocks. Every cluster will be emitted into a separate
// section with its basic blocks sequenced in the given order. To get the
// optimized performance, the clusters must form an optimal BB layout for the
-// function. Every cluster's section is labeled with a symbol to allow the
-// linker to reorder the sections in any arbitrary sequence. A global order of
-// these sections would encapsulate the function layout.
+// function. We insert a symbol at the beginning of every cluster's section to
+// allow the linker to reorder the sections in any arbitrary sequence. A global
+// order of these sections would encapsulate the function layout.
+// For example, consider the following clusters for a function foo (consisting
+// of 6 basic blocks 0, 1, ..., 5).
+//
+// 0 2
+// 1 3 5
+//
+// * Basic blocks 0 and 2 are placed in one section with symbol `foo`
+// referencing the beginning of this section.
+// * Basic blocks 1, 3, 5 are placed in a separate section. A new symbol
+// `foo.__part.1` will reference the beginning of this section.
+// * Basic block 4 (note that it is not referenced in the list) is placed in
+// one section, and a new symbol `foo.cold` will point to it.
//
// There are a couple of challenges to be addressed:
//