[Passes] llvm::Optional => std::optional
This commit is contained in:
parent
f3b6dbfda8
commit
4e62072ca1
|
@ -773,7 +773,7 @@ static void addSanitizers(const Triple &TargetTriple,
|
||||||
void EmitAssemblyHelper::RunOptimizationPipeline(
|
void EmitAssemblyHelper::RunOptimizationPipeline(
|
||||||
BackendAction Action, std::unique_ptr<raw_pwrite_stream> &OS,
|
BackendAction Action, std::unique_ptr<raw_pwrite_stream> &OS,
|
||||||
std::unique_ptr<llvm::ToolOutputFile> &ThinLinkOS) {
|
std::unique_ptr<llvm::ToolOutputFile> &ThinLinkOS) {
|
||||||
Optional<PGOOptions> PGOOpt;
|
std::optional<PGOOptions> PGOOpt;
|
||||||
|
|
||||||
if (CodeGenOpts.hasProfileIRInstr())
|
if (CodeGenOpts.hasProfileIRInstr())
|
||||||
// -fprofile-generate.
|
// -fprofile-generate.
|
||||||
|
|
|
@ -97,7 +97,7 @@ public:
|
||||||
class PassBuilder {
|
class PassBuilder {
|
||||||
TargetMachine *TM;
|
TargetMachine *TM;
|
||||||
PipelineTuningOptions PTO;
|
PipelineTuningOptions PTO;
|
||||||
Optional<PGOOptions> PGOOpt;
|
std::optional<PGOOptions> PGOOpt;
|
||||||
PassInstrumentationCallbacks *PIC;
|
PassInstrumentationCallbacks *PIC;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -116,7 +116,7 @@ public:
|
||||||
|
|
||||||
explicit PassBuilder(TargetMachine *TM = nullptr,
|
explicit PassBuilder(TargetMachine *TM = nullptr,
|
||||||
PipelineTuningOptions PTO = PipelineTuningOptions(),
|
PipelineTuningOptions PTO = PipelineTuningOptions(),
|
||||||
Optional<PGOOptions> PGOOpt = std::nullopt,
|
std::optional<PGOOptions> PGOOpt = std::nullopt,
|
||||||
PassInstrumentationCallbacks *PIC = nullptr);
|
PassInstrumentationCallbacks *PIC = nullptr);
|
||||||
|
|
||||||
/// Cross register the analysis managers through their proxies.
|
/// Cross register the analysis managers through their proxies.
|
||||||
|
@ -587,7 +587,7 @@ private:
|
||||||
void addVectorPasses(OptimizationLevel Level, FunctionPassManager &FPM,
|
void addVectorPasses(OptimizationLevel Level, FunctionPassManager &FPM,
|
||||||
bool IsFullLTO);
|
bool IsFullLTO);
|
||||||
|
|
||||||
static Optional<std::vector<PipelineElement>>
|
static std::optional<std::vector<PipelineElement>>
|
||||||
parsePipelineText(StringRef Text);
|
parsePipelineText(StringRef Text);
|
||||||
|
|
||||||
Error parseModulePass(ModulePassManager &MPM, const PipelineElement &E);
|
Error parseModulePass(ModulePassManager &MPM, const PipelineElement &E);
|
||||||
|
|
|
@ -127,7 +127,7 @@ public:
|
||||||
// in the Graph (BBGuard). That is if any of the block is deleted or RAUWed
|
// in the Graph (BBGuard). That is if any of the block is deleted or RAUWed
|
||||||
// then the CFG is treated poisoned and no block pointer of the Graph is used.
|
// then the CFG is treated poisoned and no block pointer of the Graph is used.
|
||||||
struct CFG {
|
struct CFG {
|
||||||
Optional<DenseMap<intptr_t, BBGuard>> BBGuards;
|
std::optional<DenseMap<intptr_t, BBGuard>> BBGuards;
|
||||||
DenseMap<const BasicBlock *, DenseMap<const BasicBlock *, unsigned>> Graph;
|
DenseMap<const BasicBlock *, DenseMap<const BasicBlock *, unsigned>> Graph;
|
||||||
|
|
||||||
CFG(const Function *F, bool TrackBBLifetime);
|
CFG(const Function *F, bool TrackBBLifetime);
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
#ifndef LLVM_TARGET_TARGETMACHINE_H
|
#ifndef LLVM_TARGET_TARGETMACHINE_H
|
||||||
#define LLVM_TARGET_TARGETMACHINE_H
|
#define LLVM_TARGET_TARGETMACHINE_H
|
||||||
|
|
||||||
#include "llvm/ADT/Optional.h"
|
|
||||||
#include "llvm/ADT/StringRef.h"
|
#include "llvm/ADT/StringRef.h"
|
||||||
#include "llvm/ADT/Triple.h"
|
#include "llvm/ADT/Triple.h"
|
||||||
#include "llvm/IR/DataLayout.h"
|
#include "llvm/IR/DataLayout.h"
|
||||||
|
@ -111,7 +110,7 @@ protected: // Can only create subclasses.
|
||||||
unsigned O0WantsFastISel : 1;
|
unsigned O0WantsFastISel : 1;
|
||||||
|
|
||||||
// PGO related tunables.
|
// PGO related tunables.
|
||||||
Optional<PGOOptions> PGOOption = std::nullopt;
|
std::optional<PGOOptions> PGOOption = std::nullopt;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const TargetOptions DefaultOptions;
|
const TargetOptions DefaultOptions;
|
||||||
|
@ -311,8 +310,8 @@ public:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setPGOOption(Optional<PGOOptions> PGOOpt) { PGOOption = PGOOpt; }
|
void setPGOOption(std::optional<PGOOptions> PGOOpt) { PGOOption = PGOOpt; }
|
||||||
const Optional<PGOOptions> &getPGOOption() const { return PGOOption; }
|
const std::optional<PGOOptions> &getPGOOption() const { return PGOOption; }
|
||||||
|
|
||||||
/// If the specified generic pointer could be assumed as a pointer to a
|
/// If the specified generic pointer could be assumed as a pointer to a
|
||||||
/// specific address space, return that address space.
|
/// specific address space, return that address space.
|
||||||
|
|
|
@ -340,7 +340,7 @@ static IdentifyingPassPtr overridePass(AnalysisID StandardID,
|
||||||
static std::string getFSProfileFile(const TargetMachine *TM) {
|
static std::string getFSProfileFile(const TargetMachine *TM) {
|
||||||
if (!FSProfileFile.empty())
|
if (!FSProfileFile.empty())
|
||||||
return FSProfileFile.getValue();
|
return FSProfileFile.getValue();
|
||||||
const Optional<PGOOptions> &PGOOpt = TM->getPGOOption();
|
const std::optional<PGOOptions> &PGOOpt = TM->getPGOOption();
|
||||||
if (PGOOpt == std::nullopt || PGOOpt->Action != PGOOptions::SampleUse)
|
if (PGOOpt == std::nullopt || PGOOpt->Action != PGOOptions::SampleUse)
|
||||||
return std::string();
|
return std::string();
|
||||||
return PGOOpt->ProfileFile;
|
return PGOOpt->ProfileFile;
|
||||||
|
@ -351,7 +351,7 @@ static std::string getFSProfileFile(const TargetMachine *TM) {
|
||||||
static std::string getFSRemappingFile(const TargetMachine *TM) {
|
static std::string getFSRemappingFile(const TargetMachine *TM) {
|
||||||
if (!FSRemappingFile.empty())
|
if (!FSRemappingFile.empty())
|
||||||
return FSRemappingFile.getValue();
|
return FSRemappingFile.getValue();
|
||||||
const Optional<PGOOptions> &PGOOpt = TM->getPGOOption();
|
const std::optional<PGOOptions> &PGOOpt = TM->getPGOOption();
|
||||||
if (PGOOpt == std::nullopt || PGOOpt->Action != PGOOptions::SampleUse)
|
if (PGOOpt == std::nullopt || PGOOpt->Action != PGOOptions::SampleUse)
|
||||||
return std::string();
|
return std::string();
|
||||||
return PGOOpt->ProfileRemappingFile;
|
return PGOOpt->ProfileRemappingFile;
|
||||||
|
|
|
@ -232,7 +232,7 @@ static void runNewPMPasses(const Config &Conf, Module &Mod, TargetMachine *TM,
|
||||||
unsigned OptLevel, bool IsThinLTO,
|
unsigned OptLevel, bool IsThinLTO,
|
||||||
ModuleSummaryIndex *ExportSummary,
|
ModuleSummaryIndex *ExportSummary,
|
||||||
const ModuleSummaryIndex *ImportSummary) {
|
const ModuleSummaryIndex *ImportSummary) {
|
||||||
Optional<PGOOptions> PGOOpt;
|
std::optional<PGOOptions> PGOOpt;
|
||||||
if (!Conf.SampleProfile.empty())
|
if (!Conf.SampleProfile.empty())
|
||||||
PGOOpt = PGOOptions(Conf.SampleProfile, "", Conf.ProfileRemapping,
|
PGOOpt = PGOOptions(Conf.SampleProfile, "", Conf.ProfileRemapping,
|
||||||
PGOOptions::SampleUse, PGOOptions::NoCSAction, true);
|
PGOOptions::SampleUse, PGOOptions::NoCSAction, true);
|
||||||
|
|
|
@ -237,7 +237,7 @@ crossImportIntoModule(Module &TheModule, const ModuleSummaryIndex &Index,
|
||||||
static void optimizeModule(Module &TheModule, TargetMachine &TM,
|
static void optimizeModule(Module &TheModule, TargetMachine &TM,
|
||||||
unsigned OptLevel, bool Freestanding,
|
unsigned OptLevel, bool Freestanding,
|
||||||
bool DebugPassManager, ModuleSummaryIndex *Index) {
|
bool DebugPassManager, ModuleSummaryIndex *Index) {
|
||||||
Optional<PGOOptions> PGOOpt;
|
std::optional<PGOOptions> PGOOpt;
|
||||||
LoopAnalysisManager LAM;
|
LoopAnalysisManager LAM;
|
||||||
FunctionAnalysisManager FAM;
|
FunctionAnalysisManager FAM;
|
||||||
CGSCCAnalysisManager CGAM;
|
CGSCCAnalysisManager CGAM;
|
||||||
|
|
|
@ -395,7 +395,7 @@ public:
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
PassBuilder::PassBuilder(TargetMachine *TM, PipelineTuningOptions PTO,
|
PassBuilder::PassBuilder(TargetMachine *TM, PipelineTuningOptions PTO,
|
||||||
Optional<PGOOptions> PGOOpt,
|
std::optional<PGOOptions> PGOOpt,
|
||||||
PassInstrumentationCallbacks *PIC)
|
PassInstrumentationCallbacks *PIC)
|
||||||
: TM(TM), PTO(PTO), PGOOpt(PGOOpt), PIC(PIC) {
|
: TM(TM), PTO(PTO), PGOOpt(PGOOpt), PIC(PIC) {
|
||||||
if (TM)
|
if (TM)
|
||||||
|
@ -1027,7 +1027,7 @@ static bool isLoopPassName(StringRef Name, CallbacksT &Callbacks,
|
||||||
return callbacksAcceptPassName<LoopPassManager>(Name, Callbacks);
|
return callbacksAcceptPassName<LoopPassManager>(Name, Callbacks);
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<std::vector<PassBuilder::PipelineElement>>
|
std::optional<std::vector<PassBuilder::PipelineElement>>
|
||||||
PassBuilder::parsePipelineText(StringRef Text) {
|
PassBuilder::parsePipelineText(StringRef Text) {
|
||||||
std::vector<PipelineElement> ResultPipeline;
|
std::vector<PipelineElement> ResultPipeline;
|
||||||
|
|
||||||
|
|
|
@ -333,7 +333,7 @@ bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM,
|
||||||
bool EnableDebugify, bool VerifyDIPreserve) {
|
bool EnableDebugify, bool VerifyDIPreserve) {
|
||||||
bool VerifyEachPass = VK == VK_VerifyEachPass;
|
bool VerifyEachPass = VK == VK_VerifyEachPass;
|
||||||
|
|
||||||
Optional<PGOOptions> P;
|
std::optional<PGOOptions> P;
|
||||||
switch (PGOKindFlag) {
|
switch (PGOKindFlag) {
|
||||||
case InstrGen:
|
case InstrGen:
|
||||||
P = PGOOptions(ProfileFile, "", "", PGOOptions::IRInstr);
|
P = PGOOptions(ProfileFile, "", "", PGOOptions::IRInstr);
|
||||||
|
|
Loading…
Reference in New Issue