aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/ModuleSummaryIndex.cpp
diff options
context:
space:
mode:
authorevgeny <eleviant@accesssoftek.com>2020-02-18 17:49:54 +0300
committerevgeny <eleviant@accesssoftek.com>2020-02-18 17:49:54 +0300
commitc85055b20392ab0e5d2ac2a9112224106e04f6a2 (patch)
tree50d390010fae4c366b03f38064fc27d955c95e42 /llvm/lib/IR/ModuleSummaryIndex.cpp
parent37c452a2895071dac1782668bfcd884951ec2aa5 (diff)
downloadllvm-c85055b20392ab0e5d2ac2a9112224106e04f6a2.zip
llvm-c85055b20392ab0e5d2ac2a9112224106e04f6a2.tar.gz
llvm-c85055b20392ab0e5d2ac2a9112224106e04f6a2.tar.bz2
[Assembler] Emit summary index flags
Differential revision: https://reviews.llvm.org/D74420
Diffstat (limited to 'llvm/lib/IR/ModuleSummaryIndex.cpp')
-rw-r--r--llvm/lib/IR/ModuleSummaryIndex.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/llvm/lib/IR/ModuleSummaryIndex.cpp b/llvm/lib/IR/ModuleSummaryIndex.cpp
index d92943d..13a685e 100644
--- a/llvm/lib/IR/ModuleSummaryIndex.cpp
+++ b/llvm/lib/IR/ModuleSummaryIndex.cpp
@@ -72,6 +72,52 @@ std::pair<unsigned, unsigned> FunctionSummary::specialRefCounts() const {
constexpr uint64_t ModuleSummaryIndex::BitcodeSummaryVersion;
+uint64_t ModuleSummaryIndex::getFlags() const {
+ uint64_t Flags = 0;
+ if (withGlobalValueDeadStripping())
+ Flags |= 0x1;
+ if (skipModuleByDistributedBackend())
+ Flags |= 0x2;
+ if (hasSyntheticEntryCounts())
+ Flags |= 0x4;
+ if (enableSplitLTOUnit())
+ Flags |= 0x8;
+ if (partiallySplitLTOUnits())
+ Flags |= 0x10;
+ if (withAttributePropagation())
+ Flags |= 0x20;
+ return Flags;
+}
+
+void ModuleSummaryIndex::setFlags(uint64_t Flags) {
+ assert(Flags <= 0x3f && "Unexpected bits in flag");
+ // 1 bit: WithGlobalValueDeadStripping flag.
+ // Set on combined index only.
+ if (Flags & 0x1)
+ setWithGlobalValueDeadStripping();
+ // 1 bit: SkipModuleByDistributedBackend flag.
+ // Set on combined index only.
+ if (Flags & 0x2)
+ setSkipModuleByDistributedBackend();
+ // 1 bit: HasSyntheticEntryCounts flag.
+ // Set on combined index only.
+ if (Flags & 0x4)
+ setHasSyntheticEntryCounts();
+ // 1 bit: DisableSplitLTOUnit flag.
+ // Set on per module indexes. It is up to the client to validate
+ // the consistency of this flag across modules being linked.
+ if (Flags & 0x8)
+ setEnableSplitLTOUnit();
+ // 1 bit: PartiallySplitLTOUnits flag.
+ // Set on combined index only.
+ if (Flags & 0x10)
+ setPartiallySplitLTOUnits();
+ // 1 bit: WithAttributePropagation flag.
+ // Set on combined index only.
+ if (Flags & 0x20)
+ setWithAttributePropagation();
+}
+
// Collect for the given module the list of function it defines
// (GUID -> Summary).
void ModuleSummaryIndex::collectDefinedFunctionsForModule(