#include "llvm/IR/ModuleSummaryIndex.h"
#include "llvm/ADT/SCCIterator.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_ostream.h"
usingnamespacellvm;
#define DEBUG_TYPE …
STATISTIC(ReadOnlyLiveGVars,
"Number of live global variables marked read only");
STATISTIC(WriteOnlyLiveGVars,
"Number of live global variables marked write only");
static cl::opt<bool> PropagateAttrs("propagate-attrs", cl::init(true),
cl::Hidden,
cl::desc("Propagate attributes in index"));
static cl::opt<bool> ImportConstantsWithRefs(
"import-constants-with-refs", cl::init(true), cl::Hidden,
cl::desc("Import constant global variables with references"));
constexpr uint32_t FunctionSummary::ParamAccess::RangeWidth;
FunctionSummary FunctionSummary::ExternalNode = …;
GlobalValue::VisibilityTypes ValueInfo::getELFVisibility() const { … }
bool ValueInfo::isDSOLocal(bool WithDSOLocalPropagation) const { … }
bool ValueInfo::canAutoHide() const { … }
std::pair<unsigned, unsigned> FunctionSummary::specialRefCounts() const { … }
constexpr uint64_t ModuleSummaryIndex::BitcodeSummaryVersion;
uint64_t ModuleSummaryIndex::getFlags() const { … }
void ModuleSummaryIndex::setFlags(uint64_t Flags) { … }
void ModuleSummaryIndex::collectDefinedFunctionsForModule(
StringRef ModulePath, GVSummaryMapTy &GVSummaryMap) const { … }
GlobalValueSummary *
ModuleSummaryIndex::getGlobalValueSummary(uint64_t ValueGUID,
bool PerModuleIndex) const { … }
bool ModuleSummaryIndex::isGUIDLive(GlobalValue::GUID GUID) const { … }
static void
propagateAttributesToRefs(GlobalValueSummary *S,
DenseSet<ValueInfo> &MarkedNonReadWriteOnly) { … }
void ModuleSummaryIndex::propagateAttributes(
const DenseSet<GlobalValue::GUID> &GUIDPreservedSymbols) { … }
bool ModuleSummaryIndex::canImportGlobalVar(const GlobalValueSummary *S,
bool AnalyzeRefs) const { … }
LLVM_DUMP_METHOD
void ModuleSummaryIndex::dumpSCCs(raw_ostream &O) { … }
namespace {
struct Attributes { … };
struct Edge { … };
}
void Attributes::add(const Twine &Name, const Twine &Value,
const Twine &Comment) { … }
void Attributes::addComment(const Twine &Comment) { … }
std::string Attributes::getAsString() const { … }
static std::string linkageToString(GlobalValue::LinkageTypes LT) { … }
static std::string fflagsToString(FunctionSummary::FFlags F) { … }
static std::string getSummaryAttributes(GlobalValueSummary* GVS) { … }
static std::string getNodeVisualName(GlobalValue::GUID Id) { … }
static std::string getNodeVisualName(const ValueInfo &VI) { … }
static std::string getNodeLabel(const ValueInfo &VI, GlobalValueSummary *GVS) { … }
static void defineExternalNode(raw_ostream &OS, const char *Pfx,
const ValueInfo &VI, GlobalValue::GUID Id) { … }
static bool hasReadOnlyFlag(const GlobalValueSummary *S) { … }
static bool hasWriteOnlyFlag(const GlobalValueSummary *S) { … }
static bool hasConstantFlag(const GlobalValueSummary *S) { … }
void ModuleSummaryIndex::exportToDot(
raw_ostream &OS,
const DenseSet<GlobalValue::GUID> &GUIDPreservedSymbols) const { … }