#include <functional>
#include <list>
#include <map>
+#include <optional>
#include <set>
#include <string>
#include <system_error>
/// Address of the code/function that is executed before any other code in
/// the binary.
- Optional<uint64_t> StartFunctionAddress;
+ std::optional<uint64_t> StartFunctionAddress;
/// Address of the code/function that is going to be executed right before
/// the execution of the binary is completed.
- Optional<uint64_t> FiniFunctionAddress;
+ std::optional<uint64_t> FiniFunctionAddress;
/// Page alignment used for code layout.
uint64_t PageAlign{HugePageSize};
#include "bolt/Core/BinaryContext.h"
#include "bolt/Core/BinaryFunction.h"
#include "llvm/Support/Errc.h"
+#include <optional>
#include <queue>
namespace llvm {
return *static_cast<const Derived *>(this);
}
- mutable Optional<unsigned> AnnotationIndex;
+ mutable std::optional<unsigned> AnnotationIndex;
protected:
const BinaryContext &BC;
#include "bolt/Passes/DataflowAnalysis.h"
#include "bolt/Passes/RegAnalysis.h"
-#include "llvm/ADT/Optional.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Timer.h"
+#include <optional>
namespace opts {
extern llvm::cl::opt<bool> TimeOpts;
public:
ReachingDefOrUse(const RegAnalysis &RA, BinaryFunction &BF,
- Optional<MCPhysReg> TrackingReg = std::nullopt,
+ std::optional<MCPhysReg> TrackingReg = std::nullopt,
MCPlusBuilder::AllocatorIdTy AllocId = 0)
: InstrsDataflowAnalysis<ReachingDefOrUse<Def>, !Def>(BF, AllocId),
RA(RA), TrackingReg(TrackingReg) {}
/// If set, limit the dataflow to only track instructions affecting this
/// register. Otherwise the analysis can be too permissive.
- Optional<MCPhysReg> TrackingReg;
+ std::optional<MCPhysReg> TrackingReg;
void preflight() {
// Populate our universe of tracked expressions with all instructions
#include "bolt/Passes/MCF.h"
#include "bolt/Utils/CommandLineOpts.h"
#include <numeric>
+#include <optional>
#include <stack>
#define DEBUG_TYPE "shrinkwrapping"
decltype(ShrinkWrapping::Todo) &TodoMap;
DataflowInfoManager &Info;
- Optional<unsigned> AnnotationIndex;
+ std::optional<unsigned> AnnotationIndex;
protected:
void compNextAux(const MCInst &Point,
#include "bolt/Passes/FrameAnalysis.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/MC/MCInstPrinter.h"
+#include <optional>
#include <queue>
#define DEBUG_TYPE "bolt-internalcalls"
friend class DataflowAnalysis<StackPointerTrackingForInternalCalls,
std::pair<int, int>>;
- Optional<unsigned> AnnotationIndex;
+ std::optional<unsigned> AnnotationIndex;
protected:
// We change the starting state to only consider the first block as an
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/ToolOutputFile.h"
#include <memory>
+#include <optional>
namespace opts {
return DataInCode;
}
-Optional<uint64_t> readStartAddress(const MachOObjectFile &O) {
- Optional<uint64_t> StartOffset;
- Optional<uint64_t> TextVMAddr;
+std::optional<uint64_t> readStartAddress(const MachOObjectFile &O) {
+ std::optional<uint64_t> StartOffset;
+ std::optional<uint64_t> TextVMAddr;
for (const object::MachOObjectFile::LoadCommandInfo &LC : O.load_commands()) {
switch (LC.C.cmd) {
case MachO::LC_MAIN: {
}
}
return (TextVMAddr && StartOffset)
- ? Optional<uint64_t>(*TextVMAddr + *StartOffset)
+ ? std::optional<uint64_t>(*TextVMAddr + *StartOffset)
: std::nullopt;
}
#include <algorithm>
#include <fstream>
#include <memory>
+#include <optional>
#include <system_error>
#undef DEBUG_TYPE
if (opts::Lite) {
// Forcibly include functions specified in the -function-order file.
if (opts::ReorderFunctions == ReorderFunctions::RT_USER) {
- Optional<StringRef> Match = Function.forEachName([&](StringRef Name) {
- return ReorderFunctionsUserSet.contains(Name);
- });
+ std::optional<StringRef> Match =
+ Function.forEachName([&](StringRef Name) {
+ return ReorderFunctionsUserSet.contains(Name);
+ });
if (Match.has_value())
return true;
}
assert(SymbolName && "cannot get symbol name");
auto updateSymbolValue = [&](const StringRef Name,
- Optional<uint64_t> Value = std::nullopt) {
+ std::optional<uint64_t> Value = std::nullopt) {
NewSymbol.st_value = Value ? *Value : getNewValueForSymbol(Name);
NewSymbol.st_shndx = ELF::SHN_ABS;
outs() << "BOLT-INFO: setting " << Name << " to 0x"