uint64_t getOrCompColdCountThreshold() const;
/// Returns HotCountThreshold if set.
uint64_t getHotCountThreshold() const {
- return HotCountThreshold.getValueOr(0);
+ return HotCountThreshold.value_or(0);
}
/// Returns ColdCountThreshold if set.
uint64_t getColdCountThreshold() const {
- return ColdCountThreshold.getValueOr(0);
+ return ColdCountThreshold.value_or(0);
}
private:
Error CodeGenPassBuilder<Derived>::addCoreISelPasses(
AddMachinePass &addPass) const {
// Enable FastISel with -fast-isel, but allow that to be overridden.
- TM.setO0WantsFastISel(Opt.EnableFastISelOption.getValueOr(true));
+ TM.setO0WantsFastISel(Opt.EnableFastISelOption.value_or(true));
// Determine an instruction selector.
enum class SelectorType { SelectionDAG, FastISel, GlobalISel };
uint64_t Size = 0, const AAMDNodes &AAInfo = AAMDNodes()) {
// Ensure that codegen never sees alignment 0
return getMemIntrinsicNode(Opcode, dl, VTList, Ops, MemVT, PtrInfo,
- Alignment.getValueOr(getEVTAlign(MemVT)), Flags,
+ Alignment.value_or(getEVTAlign(MemVT)), Flags,
Size, AAInfo);
}
const AAMDNodes &AAInfo = AAMDNodes(), const MDNode *Ranges = nullptr) {
// Ensures that codegen never sees a None Alignment.
return getLoad(AM, ExtType, VT, dl, Chain, Ptr, Offset, PtrInfo, MemVT,
- Alignment.getValueOr(getEVTAlign(MemVT)), MMOFlags, AAInfo,
+ Alignment.value_or(getEVTAlign(MemVT)), MMOFlags, AAInfo,
Ranges);
}
/// FIXME: Remove once transition to Align is over.
MachineMemOperand::Flags MMOFlags = MachineMemOperand::MONone,
const AAMDNodes &AAInfo = AAMDNodes()) {
return getStore(Chain, dl, Val, Ptr, PtrInfo,
- Alignment.getValueOr(getEVTAlign(Val.getValueType())),
+ Alignment.value_or(getEVTAlign(Val.getValueType())),
MMOFlags, AAInfo);
}
/// FIXME: Remove once transition to Align is over.
MachineMemOperand::Flags MMOFlags = MachineMemOperand::MONone,
const AAMDNodes &AAInfo = AAMDNodes()) {
return getTruncStore(Chain, dl, Val, Ptr, PtrInfo, SVT,
- Alignment.getValueOr(getEVTAlign(SVT)), MMOFlags,
+ Alignment.value_or(getEVTAlign(SVT)), MMOFlags,
AAInfo);
}
/// FIXME: Remove once transition to Align is over.
const MDNode *Ranges = nullptr, bool IsExpanding = false) {
// Ensures that codegen never sees a None Alignment.
return getLoadVP(AM, ExtType, VT, dl, Chain, Ptr, Offset, Mask, EVL,
- PtrInfo, MemVT, Alignment.getValueOr(getEVTAlign(MemVT)),
+ PtrInfo, MemVT, Alignment.value_or(getEVTAlign(MemVT)),
MMOFlags, AAInfo, Ranges, IsExpanding);
}
SDValue getLoadVP(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT,
// Ensures that codegen never sees a None Alignment.
return getStridedLoadVP(AM, ExtType, VT, DL, Chain, Ptr, Offset, Stride,
Mask, EVL, PtrInfo, MemVT,
- Alignment.getValueOr(getEVTAlign(MemVT)), MMOFlags,
+ Alignment.value_or(getEVTAlign(MemVT)), MMOFlags,
AAInfo, Ranges, IsExpanding);
}
SDValue getStridedLoadVP(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType,
/// value or the form value's encoding wasn't an unsigned constant form.
inline uint64_t toUnsigned(const Optional<DWARFFormValue> &V,
uint64_t Default) {
- return toUnsigned(V).getValueOr(Default);
+ return toUnsigned(V).value_or(Default);
}
/// Take an optional DWARFFormValue and try to extract an reference.
/// value or the form value's encoding wasn't a reference form.
inline uint64_t toReference(const Optional<DWARFFormValue> &V,
uint64_t Default) {
- return toReference(V).getValueOr(Default);
+ return toReference(V).value_or(Default);
}
/// Take an optional DWARFFormValue and try to extract an signed constant.
/// \returns the extracted signed integer value or Default if the V doesn't
/// have a value or the form value's encoding wasn't a signed integer form.
inline int64_t toSigned(const Optional<DWARFFormValue> &V, int64_t Default) {
- return toSigned(V).getValueOr(Default);
+ return toSigned(V).value_or(Default);
}
/// Take an optional DWARFFormValue and try to extract an address.
/// \returns the extracted address value or Default if the V doesn't have a
/// value or the form value's encoding wasn't an address form.
inline uint64_t toAddress(const Optional<DWARFFormValue> &V, uint64_t Default) {
- return toAddress(V).getValueOr(Default);
+ return toAddress(V).value_or(Default);
}
/// Take an optional DWARFFormValue and try to extract an section offset.
/// have a value or the form value's encoding wasn't a section offset form.
inline uint64_t toSectionOffset(const Optional<DWARFFormValue> &V,
uint64_t Default) {
- return toSectionOffset(V).getValueOr(Default);
+ return toSectionOffset(V).value_or(Default);
}
/// Take an optional DWARFFormValue and try to extract block data.
const DILocation *getInlinedAt() const { return InlinedAt; }
FragmentInfo getFragmentOrDefault() const {
- return Fragment.getValueOr(DefaultFragment);
+ return Fragment.value_or(DefaultFragment);
}
static bool isDefaultFragment(const FragmentInfo F) {
const VersionEntry &Entry = *VersionMap[VersionIndex];
// A default version (@@) is only available for defined symbols.
- if (!Entry.IsVerDef || IsSymHidden.getValueOr(false))
+ if (!Entry.IsVerDef || IsSymHidden.value_or(false))
IsDefault = false;
else
IsDefault = !(SymbolVersionIndex & llvm::ELF::VERSYM_HIDDEN);
}
}
- const MemoryLocation &Loc = OptLoc.getValueOr(MemoryLocation());
+ const MemoryLocation &Loc = OptLoc.value_or(MemoryLocation());
switch (I->getOpcode()) {
case Instruction::VAArg:
// Scale down loop exiting weight by trip count.
Weight = std::max(
static_cast<uint32_t>(BlockExecWeight::LOWEST_NON_ZERO),
- Weight.getValueOr(static_cast<uint32_t>(BlockExecWeight::DEFAULT)) /
+ Weight.value_or(static_cast<uint32_t>(BlockExecWeight::DEFAULT)) /
TC);
}
bool IsUnlikelyEdge = LoopBB.getLoop() && UnlikelyBlocks.contains(SuccBB);
// 'Unlikely' blocks have twice lower weight.
Weight = std::max(
static_cast<uint32_t>(BlockExecWeight::LOWEST_NON_ZERO),
- Weight.getValueOr(static_cast<uint32_t>(BlockExecWeight::DEFAULT)) /
- 2);
+ Weight.value_or(static_cast<uint32_t>(BlockExecWeight::DEFAULT)) / 2);
}
if (Weight)
FoundEstimatedWeight = true;
auto WeightVal =
- Weight.getValueOr(static_cast<uint32_t>(BlockExecWeight::DEFAULT));
+ Weight.value_or(static_cast<uint32_t>(BlockExecWeight::DEFAULT));
TotalWeight += WeightVal;
SuccWeights.push_back(WeightVal);
}
};
return llvm::shouldInline(
CB, GetInlineCost, ORE,
- Params.EnableDeferral.getValueOr(EnableInlineDeferral));
+ Params.EnableDeferral.value_or(EnableInlineDeferral));
}
std::unique_ptr<InlineAdvice>
if (Op0->getType()->isIntOrIntVectorTy(1)) {
// Op0&Op1 -> Op0 where Op0 implies Op1
- if (isImpliedCondition(Op0, Op1, Q.DL).getValueOr(false))
+ if (isImpliedCondition(Op0, Op1, Q.DL).value_or(false))
return Op0;
// Op0&Op1 -> Op1 where Op1 implies Op0
- if (isImpliedCondition(Op1, Op0, Q.DL).getValueOr(false))
+ if (isImpliedCondition(Op1, Op0, Q.DL).value_or(false))
return Op1;
}
if (Op0->getType()->isIntOrIntVectorTy(1)) {
// Op0|Op1 -> Op1 where Op0 implies Op1
- if (isImpliedCondition(Op0, Op1, Q.DL).getValueOr(false))
+ if (isImpliedCondition(Op0, Op1, Q.DL).value_or(false))
return Op1;
// Op0|Op1 -> Op0 where Op1 implies Op0
- if (isImpliedCondition(Op1, Op0, Q.DL).getValueOr(false))
+ if (isImpliedCondition(Op1, Op0, Q.DL).value_or(false))
return Op0;
}
default:
break;
case ICmpInst::ICMP_UGE:
- if (isImpliedCondition(RHS, LHS, Q.DL).getValueOr(false))
+ if (isImpliedCondition(RHS, LHS, Q.DL).value_or(false))
return getTrue(ITy);
break;
case ICmpInst::ICMP_SGE:
/// 0 | 1 | 1 (0 >= -1) | 1
/// 1 | 0 | 0 (-1 >= 0) | 0
/// 1 | 1 | 1 (-1 >= -1) | 1
- if (isImpliedCondition(LHS, RHS, Q.DL).getValueOr(false))
+ if (isImpliedCondition(LHS, RHS, Q.DL).value_or(false))
return getTrue(ITy);
break;
case ICmpInst::ICMP_ULE:
- if (isImpliedCondition(LHS, RHS, Q.DL).getValueOr(false))
+ if (isImpliedCondition(LHS, RHS, Q.DL).value_or(false))
return getTrue(ITy);
break;
}
if (Constant *VC = dyn_cast<Constant>(Val))
return ValueLatticeElement::get(VC);
- ValueLatticeElement LocalResult = getEdgeValueLocal(Val, BBFrom, BBTo)
- .getValueOr(ValueLatticeElement::getOverdefined());
+ ValueLatticeElement LocalResult =
+ getEdgeValueLocal(Val, BBFrom, BBTo)
+ .value_or(ValueLatticeElement::getOverdefined());
if (hasSingleValue(LocalResult))
// Can't get any more precise here
return LocalResult;
}
bool llvm::getBooleanLoopAttribute(const Loop *TheLoop, StringRef Name) {
- return getOptionalBoolLoopAttribute(TheLoop, Name).getValueOr(false);
+ return getOptionalBoolLoopAttribute(TheLoop, Name).value_or(false);
}
llvm::Optional<int> llvm::getOptionalIntLoopAttribute(const Loop *TheLoop,
StringRef Name) {
const MDOperand *AttrMD =
- findStringMetadataForLoop(TheLoop, Name).getValueOr(nullptr);
+ findStringMetadataForLoop(TheLoop, Name).value_or(nullptr);
if (!AttrMD)
return None;
int llvm::getIntLoopAttribute(const Loop *TheLoop, StringRef Name,
int Default) {
- return getOptionalIntLoopAttribute(TheLoop, Name).getValueOr(Default);
+ return getOptionalIntLoopAttribute(TheLoop, Name).value_or(Default);
}
bool llvm::isFinite(const Loop *L) {
Result.AllocTy = MallocLike;
Result.NumParams = Callee->getNumOperands();
Result.FstParam = Args.first;
- Result.SndParam = Args.second.getValueOr(-1);
+ Result.SndParam = Args.second.value_or(-1);
// Allocsize has no way to specify an alignment argument
Result.AlignParam = -1;
return Result;
computeHotness(OptDiag);
// Only emit it if its hotness meets the threshold.
- if (OptDiag.getHotness().getValueOr(0) <
+ if (OptDiag.getHotness().value_or(0) <
F->getContext().getDiagnosticsHotnessThreshold()) {
return;
}
}
uint64_t ProfileSummaryInfo::getOrCompHotCountThreshold() const {
- return HotCountThreshold.getValueOr(UINT64_MAX);
+ return HotCountThreshold.value_or(UINT64_MAX);
}
uint64_t ProfileSummaryInfo::getOrCompColdCountThreshold() const {
- return ColdCountThreshold.getValueOr(0);
+ return ColdCountThreshold.value_or(0);
}
bool ProfileSummaryInfo::isHotBlock(const BasicBlock *BB,
Res = Multiple;
Res = (unsigned)GreatestCommonDivisor64(*Res, Multiple);
}
- return Res.getValueOr(1);
+ return Res.value_or(1);
}
unsigned ScalarEvolution::getSmallConstantTripMultiple(const Loop *L,
const SCEV *Max = SE.getMinusSCEV(ToDiffTy(SE.getConstant(Size.getUpper())),
ToDiffTy(AccessSize));
return SE.evaluatePredicateAt(ICmpInst::Predicate::ICMP_SGE, Diff, Min, I)
- .getValueOr(false) &&
+ .value_or(false) &&
SE.evaluatePredicateAt(ICmpInst::Predicate::ICMP_SLE, Diff, Max, I)
- .getValueOr(false);
+ .value_or(false);
}
/// The function analyzes all local uses of Ptr (alloca or argument) and
PFS.getFunction().getParent()->getDataLayout().getTypeStoreSize(
Cmp->getType()));
- AtomicCmpXchgInst *CXI = new AtomicCmpXchgInst(
- Ptr, Cmp, New, Alignment.getValueOr(DefaultAlignment), SuccessOrdering,
- FailureOrdering, SSID);
+ AtomicCmpXchgInst *CXI =
+ new AtomicCmpXchgInst(Ptr, Cmp, New, Alignment.value_or(DefaultAlignment),
+ SuccessOrdering, FailureOrdering, SSID);
CXI->setVolatile(isVolatile);
CXI->setWeak(isWeak);
Val->getType()));
AtomicRMWInst *RMWI =
new AtomicRMWInst(Operation, Ptr, Val,
- Alignment.getValueOr(DefaultAlignment), Ordering, SSID);
+ Alignment.value_or(DefaultAlignment), Ordering, SSID);
RMWI->setVolatile(isVolatile);
Inst = RMWI;
return AteExtraComma ? InstExtraComma : InstNormal;
Options.LowerGlobalDtorsViaCxaAtExit = getLowerGlobalDtorsViaCxaAtExit();
Options.RelaxELFRelocations = getRelaxELFRelocations();
Options.DataSections =
- getExplicitDataSections().getValueOr(TheTriple.hasDefaultDataSections());
+ getExplicitDataSections().value_or(TheTriple.hasDefaultDataSections());
Options.FunctionSections = getFunctionSections();
Options.IgnoreXCOFFVisibility = getIgnoreXCOFFVisibility();
Options.XCOFFTracebackTable = getXCOFFTracebackTable();
for (Function &F : M)
setFunctionAttributes(CPU, Features, F);
}
-
return false;
// Fallback to whether the intrinsic is speculatable.
Optional<unsigned> OpcOpt = VPI.getFunctionalOpcode();
- unsigned FunctionalOpc = OpcOpt.getValueOr((unsigned)Instruction::Call);
+ unsigned FunctionalOpc = OpcOpt.value_or((unsigned)Instruction::Call);
return isSafeToSpeculativelyExecuteWithOpcode(FunctionalOpc,
cast<Operator>(&VPI));
}
TargetLowering::IntrinsicInfo Info;
// TODO: Add a GlobalISel version of getTgtMemIntrinsic.
if (TLI.getTgtMemIntrinsic(Info, CI, *MF, ID)) {
- Align Alignment = Info.align.getValueOr(
+ Align Alignment = Info.align.value_or(
DL->getABITypeAlign(Info.memVT.getTypeForEVT(F->getContext())));
LLT MemTy = Info.memVT.isSimple()
? getLLTForMVT(Info.memVT.getSimpleVT())
return error(Error, YamlConstant.Value.SourceRange);
const Align PrefTypeAlign =
M.getDataLayout().getPrefTypeAlign(Value->getType());
- const Align Alignment = YamlConstant.Alignment.getValueOr(PrefTypeAlign);
+ const Align Alignment = YamlConstant.Alignment.value_or(PrefTypeAlign);
unsigned Index = ConstantPool.getConstantPoolIndex(Value, Alignment);
if (!ConstantPoolSlots.insert(std::make_pair(YamlConstant.ID.Value, Index))
.second)
LLVMContext &Ctx = MF.getFunction().getContext();
// Only emit it if its hotness meets the threshold.
- if (OptDiag.getHotness().getValueOr(0) <
- Ctx.getDiagnosticsHotnessThreshold()) {
+ if (OptDiag.getHotness().value_or(0) < Ctx.getDiagnosticsHotnessThreshold())
return;
- }
Ctx.diagnose(OptDiag);
}
EVT VT = Src0.getValueType();
Align Alignment = cast<ConstantInt>(I.getArgOperand(2))
->getMaybeAlignValue()
- .getValueOr(DAG.getEVTAlign(VT.getScalarType()));
+ .value_or(DAG.getEVTAlign(VT.getScalarType()));
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
SDValue Base;
EVT VT = TLI.getValueType(DAG.getDataLayout(), I.getType());
Align Alignment = cast<ConstantInt>(I.getArgOperand(1))
->getMaybeAlignValue()
- .getValueOr(DAG.getEVTAlign(VT.getScalarType()));
+ .value_or(DAG.getEVTAlign(VT.getScalarType()));
const MDNode *Ranges = I.getMetadata(LLVMContext::MD_range);
unsigned DefaultID = StatepointDirectives::DeoptBundleStatepointID;
auto SD = parseStatepointDirectivesFromAttrs(Call->getAttributes());
- SI.ID = SD.StatepointID.getValueOr(DefaultID);
- SI.NumPatchBytes = SD.NumPatchBytes.getValueOr(0);
+ SI.ID = SD.StatepointID.value_or(DefaultID);
+ SI.NumPatchBytes = SD.NumPatchBytes.value_or(0);
SI.DeoptState =
ArrayRef<const Use>(DeoptBundle.Inputs.begin(), DeoptBundle.Inputs.end());
// generation bugs aside, this is really wrong in the case of labels, where
// a label marking the end of a function will have a PC == CU's high_pc.
if (dwarf::toAddress(OrigUnit.getUnitDIE().find(dwarf::DW_AT_high_pc))
- .getValueOr(UINT64_MAX) <= LowPc)
+ .value_or(UINT64_MAX) <= LowPc)
return Flags;
Unit.addLabelLowPc(*LowPc, MyInfo.AddrAdjust);
return Flags | TF_Keep;
uint32_t Hash = hashFullyQualifiedName(InputDIE, Unit, File);
uint64_t RuntimeLang =
dwarf::toUnsigned(InputDIE.find(dwarf::DW_AT_APPLE_runtime_class))
- .getValueOr(0);
+ .value_or(0);
bool ObjCClassIsImplementation =
(RuntimeLang == dwarf::DW_LANG_ObjC ||
RuntimeLang == dwarf::DW_LANG_ObjC_plus_plus) &&
dwarf::toUnsigned(InputDIE.find(dwarf::DW_AT_APPLE_objc_complete_type))
- .getValueOr(0);
+ .value_or(0);
Unit.addTypeAccelerator(Die, AttrInfo.Name, ObjCClassIsImplementation,
Hash);
}
if (!Filter.SymbolOffset)
return visitSymbolStream(Symbols);
uint32_t SymbolOffset = *Filter.SymbolOffset;
- uint32_t ParentRecurseDepth = Filter.ParentRecursiveDepth.getValueOr(0);
- uint32_t ChildrenRecurseDepth = Filter.ChildRecursiveDepth.getValueOr(0);
+ uint32_t ParentRecurseDepth = Filter.ParentRecursiveDepth.value_or(0);
+ uint32_t ChildrenRecurseDepth = Filter.ChildRecursiveDepth.value_or(0);
if (!Symbols.isOffsetValid(SymbolOffset))
return createStringError(inconvertibleErrorCode(), "Invalid symbol offset");
CVSymbol Sym = *Symbols.at(SymbolOffset);
UpperBoundAttr->getAsSignedConstant()) {
int64_t LowerBound = 0;
if (auto LowerBoundAttr = Child.find(DW_AT_lower_bound))
- LowerBound = LowerBoundAttr->getAsSignedConstant().getValueOr(0);
+ LowerBound = LowerBoundAttr->getAsSignedConstant().value_or(0);
Size *= *UpperBound - LowerBound + 1;
}
}
DWO->setAddrOffsetSection(AddrOffsetSection, *AddrOffsetSectionBase);
if (getVersion() == 4) {
auto DWORangesBase = UnitDie.getRangesBaseAttribute();
- DWO->setRangesSection(RangeSection, DWORangesBase.getValueOr(0));
+ DWO->setRangesSection(RangeSection, DWORangesBase.value_or(0));
}
return true;
// Print all values for checksum together, or not at all.
if (N->getChecksum())
Printer.printChecksum(*N->getChecksum());
- Printer.printString("source", N->getSource().getValueOr(StringRef()),
+ Printer.printString("source", N->getSource().value_or(StringRef()),
/* ShouldSkipEmpty */ true);
Out << ")";
}
"Attempting to pack a reserved value");
return uint64_t(ElemSizeArg) << 32 |
- NumElemsArg.getValueOr(AllocSizeNumElemsNotPresent);
+ NumElemsArg.value_or(AllocSizeNumElemsNotPresent);
}
static std::pair<unsigned, Optional<unsigned>>
static uint64_t packVScaleRangeArgs(unsigned MinValue,
Optional<unsigned> MaxValue) {
- return uint64_t(MinValue) << 32 | MaxValue.getValueOr(0);
+ return uint64_t(MinValue) << 32 | MaxValue.value_or(0);
}
static std::pair<unsigned, Optional<unsigned>>
unsigned MinValue = getVScaleRangeMin();
Optional<unsigned> MaxValue = getVScaleRangeMax();
return ("vscale_range(" + Twine(MinValue) + "," +
- Twine(MaxValue.getValueOr(0)) + ")")
+ Twine(MaxValue.value_or(0)) + ")")
.str();
}
assert((!Source || isCanonical(*Source)) && "Expected canonical MDString");
DEFINE_GETIMPL_LOOKUP(DIFile, (Filename, Directory, CS, Source));
Metadata *Ops[] = {Filename, Directory, CS ? CS->Value : nullptr,
- Source.getValueOr(nullptr)};
+ Source.value_or(nullptr)};
DEFINE_GETIMPL_STORE(DIFile, (CS, Source), Ops);
}
DICompileUnit::DICompileUnit(LLVMContext &C, StorageType Storage,
Weights.getValue()[SI.getNumSuccessors() - 1] = *W;
} else if (Weights) {
Changed = true;
- Weights.getValue().push_back(W.getValueOr(0));
+ Weights.getValue().push_back(W.value_or(0));
}
if (Weights)
assert(SI.getNumSuccessors() == Weights->size() &&
return pImpl->MisExpectWarningRequested;
}
uint64_t LLVMContext::getDiagnosticsHotnessThreshold() const {
- return pImpl->DiagnosticsHotnessThreshold.getValueOr(UINT64_MAX);
+ return pImpl->DiagnosticsHotnessThreshold.value_or(UINT64_MAX);
}
void LLVMContext::setDiagnosticsMisExpectTolerance(
Optional<uint64_t> Tolerance) {
pImpl->DiagnosticsMisExpectTolerance = Tolerance;
}
uint64_t LLVMContext::getDiagnosticsMisExpectTolerance() const {
- return pImpl->DiagnosticsMisExpectTolerance.getValueOr(0);
+ return pImpl->DiagnosticsMisExpectTolerance.value_or(0);
}
bool LLVMContext::isDiagnosticsHotnessThresholdSetFromPSI() const {
unsigned getHashValue() const {
return hash_combine(Filename, Directory, Checksum ? Checksum->Kind : 0,
Checksum ? Checksum->Value : nullptr,
- Source.getValueOr(nullptr));
+ Source.value_or(nullptr));
}
};
// Whether the mask and vlen parameter are at the end of the parameter list.
bool TrailingMaskAndVLen =
- std::min<size_t>(MaskPosOpt.getValueOr(NumInstParams),
- VLenPosOpt.getValueOr(NumInstParams)) >= NumInstParams;
+ std::min<size_t>(MaskPosOpt.value_or(NumInstParams),
+ VLenPosOpt.value_or(NumInstParams)) >= NumInstParams;
if (TrailingMaskAndVLen) {
// Fast path for trailing mask, vector length.
// Insert mask and evl operands in between the instruction operands.
for (size_t VPParamIdx = 0, ParamIdx = 0; VPParamIdx < NumVPParams;
++VPParamIdx) {
- if ((MaskPosOpt && MaskPosOpt.getValueOr(NumVPParams) == VPParamIdx) ||
- (VLenPosOpt && VLenPosOpt.getValueOr(NumVPParams) == VPParamIdx))
+ if ((MaskPosOpt && MaskPosOpt.value_or(NumVPParams) == VPParamIdx) ||
+ (VLenPosOpt && VLenPosOpt.value_or(NumVPParams) == VPParamIdx))
continue;
assert(ParamIdx < NumInstParams);
IntrinParams[VPParamIdx] = InstOpArray[ParamIdx++];
// time as long as it is not SHN_UNDEF. Set shndx to 1, which
// points to ".dynsym".
uint16_t Shndx = Sym.Undefined ? SHN_UNDEF : 1;
- uint64_t Size = Sym.Size.getValueOr(0);
+ uint64_t Size = Sym.Size.value_or(0);
DynSym.Content.add(DynStr.Content.getOffset(Sym.Name), Size, Bind,
convertIFSSymbolTypeToELF(Sym.Type), 0, Shndx);
}
}
if (HasSource) {
if (LineStr)
- LineStr->emitRef(MCOS, DwarfFile.Source.getValueOr(StringRef()));
+ LineStr->emitRef(MCOS, DwarfFile.Source.value_or(StringRef()));
else {
- MCOS->emitBytes(
- DwarfFile.Source.getValueOr(StringRef())); // Source and...
- MCOS->emitBytes(StringRef("\0", 1)); // its null terminator.
+ MCOS->emitBytes(DwarfFile.Source.value_or(StringRef())); // Source and...
+ MCOS->emitBytes(StringRef("\0", 1)); // its null terminator.
}
}
}
emitDarwinTargetVariantBuildVersion(
getMachoBuildVersionPlatformType(Target),
LinkedTargetVersion.getMajor(),
- LinkedTargetVersion.getMinor().getValueOr(0),
- LinkedTargetVersion.getSubminor().getValueOr(0), SDKVersion);
+ LinkedTargetVersion.getMinor().value_or(0),
+ LinkedTargetVersion.getSubminor().value_or(0), SDKVersion);
return;
}
emitBuildVersion(getMachoBuildVersionPlatformType(Target),
LinkedTargetVersion.getMajor(),
- LinkedTargetVersion.getMinor().getValueOr(0),
- LinkedTargetVersion.getSubminor().getValueOr(0),
- SDKVersion);
+ LinkedTargetVersion.getMinor().value_or(0),
+ LinkedTargetVersion.getSubminor().value_or(0), SDKVersion);
ShouldEmitBuildVersion = true;
}
emitDarwinTargetVariantBuildVersion(
getMachoBuildVersionPlatformType(*TVT),
TVLinkedTargetVersion.getMajor(),
- TVLinkedTargetVersion.getMinor().getValueOr(0),
- TVLinkedTargetVersion.getSubminor().getValueOr(0),
+ TVLinkedTargetVersion.getMinor().value_or(0),
+ TVLinkedTargetVersion.getSubminor().value_or(0),
DarwinTargetVariantSDKVersion);
}
}
emitVersionMin(getMachoVersionMinLoadCommandType(Target),
LinkedTargetVersion.getMajor(),
- LinkedTargetVersion.getMinor().getValueOr(0),
- LinkedTargetVersion.getSubminor().getValueOr(0), SDKVersion);
+ LinkedTargetVersion.getMinor().value_or(0),
+ LinkedTargetVersion.getSubminor().value_or(0), SDKVersion);
}
[&](const MCAssembler::VersionInfoType &VersionInfo) {
auto EncodeVersion = [](VersionTuple V) -> uint32_t {
assert(!V.empty() && "empty version");
- unsigned Update = V.getSubminor().getValueOr(0);
- unsigned Minor = V.getMinor().getValueOr(0);
+ unsigned Update = V.getSubminor().value_or(0);
+ unsigned Minor = V.getMinor().value_or(0);
assert(Update < 256 && "unencodable update target version");
assert(Minor < 256 && "unencodable minor target version");
assert(V.getMajor() < 65536 && "unencodable major target version");
continue;
const auto &WS = static_cast<const MCSymbolWasm &>(S);
- LLVM_DEBUG(dbgs()
- << "MCSymbol: "
- << toString(WS.getType().getValueOr(wasm::WASM_SYMBOL_TYPE_DATA))
+ LLVM_DEBUG(
+ dbgs() << "MCSymbol: "
+ << toString(WS.getType().value_or(wasm::WASM_SYMBOL_TYPE_DATA))
<< " '" << S << "'"
<< " isDefined=" << S.isDefined() << " isExternal="
<< S.isExternal() << " isTemporary=" << S.isTemporary()
wasm::WasmSymbolInfo Info;
Info.Name = WS.getName();
- Info.Kind = WS.getType().getValueOr(wasm::WASM_SYMBOL_TYPE_DATA);
+ Info.Kind = WS.getType().value_or(wasm::WASM_SYMBOL_TYPE_DATA);
Info.Flags = Flags;
if (!WS.isData()) {
assert(WasmIndices.count(&WS) > 0);
return Obj.takeError();
const ElfType OutputElfType =
- getOutputElfType(Config.OutputArch.getValueOr(MachineInfo()));
+ getOutputElfType(Config.OutputArch.value_or(MachineInfo()));
if (Error E = handleArgs(Config, ELFConfig, **Obj))
return E;
return writeOutput(Config, **Obj, Out, OutputElfType);
// Prefer OutputArch (-O<format>) if set, otherwise fallback to BinaryArch
// (-B<arch>).
const ElfType OutputElfType =
- getOutputElfType(Config.OutputArch.getValueOr(MachineInfo()));
+ getOutputElfType(Config.OutputArch.value_or(MachineInfo()));
if (Error E = handleArgs(Config, ELFConfig, **Obj))
return E;
return writeOutput(Config, **Obj, Out, OutputElfType);
std::string EntryBuffer;
raw_string_ostream EntryBufferOS(EntryBuffer);
- uint64_t AbbrevTableID = Unit.AbbrevTableID.getValueOr(I);
+ uint64_t AbbrevTableID = Unit.AbbrevTableID.value_or(I);
for (const DWARFYAML::Entry &Entry : Unit.Entries) {
if (Expected<uint64_t> EntryLength =
writeDIE(DI, I, AbbrevTableID, Params, Entry, EntryBufferOS,
for (auto OpByte : Op.UnknownOpcodeData)
writeInteger((uint8_t)OpByte, OpBufferOS, IsLittleEndian);
}
- uint64_t ExtLen = Op.ExtLen.getValueOr(OpBuffer.size());
+ uint64_t ExtLen = Op.ExtLen.value_or(OpBuffer.size());
encodeULEB128(ExtLen, OS);
OS.write(OpBuffer.data(), OpBuffer.size());
}
writeInteger(LineTable.LineRange, BufferOS, DI.IsLittleEndian);
std::vector<uint8_t> StandardOpcodeLengths =
- LineTable.StandardOpcodeLengths.getValueOr(
+ LineTable.StandardOpcodeLengths.value_or(
getStandardOpcodeLengths(LineTable.Version, LineTable.OpcodeBase));
uint8_t OpcodeBase = LineTable.OpcodeBase
? *LineTable.OpcodeBase
for (auto &AbbrevTable : enumerate(DebugAbbrev)) {
// If the abbrev table's ID isn't specified, we use the index as its ID.
uint64_t AbbrevTableID =
- AbbrevTable.value().ID.getValueOr(AbbrevTable.index());
+ AbbrevTable.value().ID.value_or(AbbrevTable.index());
auto It = AbbrevTableInfoMap.insert(
{AbbrevTableID, AbbrevTableInfo{/*Index=*/AbbrevTable.index(),
/*Offset=*/AbbrevTableOffset}});
}
// TODO: Only create the .strtab here if any symbols have been requested.
ImplicitSections.insert(".strtab");
- if (!SecHdrTable || !SecHdrTable->NoHeaders.getValueOr(false))
+ if (!SecHdrTable || !SecHdrTable->NoHeaders.value_or(false))
ImplicitSections.insert(SectionHeaderStringTableName);
// Insert placeholders for implicit sections that are not
SectionHeaders.isDefault())
return Index;
- assert(!SectionHeaders.NoHeaders.getValueOr(false) ||
- !SectionHeaders.Sections);
+ assert(!SectionHeaders.NoHeaders.value_or(false) || !SectionHeaders.Sections);
size_t FirstExcluded =
SectionHeaders.Sections ? SectionHeaders.Sections->size() : 0;
if (Index > FirstExcluded) {
if (ELFYAML::SectionHeaderTable *S =
dyn_cast<ELFYAML::SectionHeaderTable>(D.get())) {
- if (S->NoHeaders.getValueOr(false))
+ if (S->NoHeaders.value_or(false))
continue;
if (!S->Offset)
SHeader.sh_entsize = *Sec->EntSize;
else
SHeader.sh_entsize = ELFYAML::getDefaultShEntSize<ELFT>(
- Doc.Header.Machine.getValueOr(ELF::EM_NONE), Sec->Type, Sec->Name);
+ Doc.Header.Machine.value_or(ELF::EM_NONE), Sec->Type, Sec->Name);
// We have a few sections like string or symbol tables that are usually
// added implicitly to the end. However, if they are explicitly specified
else if (Sym.Index)
Symbol.st_shndx = *Sym.Index;
- Symbol.st_value = Sym.Value.getValueOr(yaml::Hex64(0));
+ Symbol.st_value = Sym.Value.value_or(yaml::Hex64(0));
Symbol.st_other = Sym.Other ? *Sym.Other : 0;
- Symbol.st_size = Sym.Size.getValueOr(yaml::Hex64(0));
+ Symbol.st_size = Sym.Size.value_or(yaml::Hex64(0));
}
return Ret;
// Write number of BBEntries (number of basic blocks in the function). This
// is overridden by the 'NumBlocks' YAML field when specified.
uint64_t NumBlocks =
- E.NumBlocks.getValueOr(E.BBEntries ? E.BBEntries->size() : 0);
+ E.NumBlocks.value_or(E.BBEntries ? E.BBEntries->size() : 0);
SHeader.sh_size += sizeof(uintX_t) + CBA.writeULEB128(NumBlocks);
// Write all BBEntries.
if (!E.BBEntries)
return;
CBA.write<uint32_t>(
- Section.NBucket.getValueOr(llvm::yaml::Hex64(Section.Bucket->size())),
+ Section.NBucket.value_or(llvm::yaml::Hex64(Section.Bucket->size())),
ELFT::TargetEndianness);
CBA.write<uint32_t>(
- Section.NChain.getValueOr(llvm::yaml::Hex64(Section.Chain->size())),
+ Section.NChain.value_or(llvm::yaml::Hex64(Section.Chain->size())),
ELFT::TargetEndianness);
for (uint32_t Val : *Section.Bucket)
const ELFYAML::VerdefEntry &E = (*Section.Entries)[I];
Elf_Verdef VerDef;
- VerDef.vd_version = E.Version.getValueOr(1);
- VerDef.vd_flags = E.Flags.getValueOr(0);
- VerDef.vd_ndx = E.VersionNdx.getValueOr(0);
- VerDef.vd_hash = E.Hash.getValueOr(0);
+ VerDef.vd_version = E.Version.value_or(1);
+ VerDef.vd_flags = E.Flags.value_or(0);
+ VerDef.vd_ndx = E.VersionNdx.value_or(0);
+ VerDef.vd_hash = E.Hash.value_or(0);
VerDef.vd_aux = sizeof(Elf_Verdef);
VerDef.vd_cnt = E.VerNames.size();
if (I == Section.Entries->size() - 1)
if (!ExcludedSectionHeaders.insert(Hdr.Name).second)
llvm_unreachable("buildSectionIndex() failed");
- if (SectionHeaders.NoHeaders.getValueOr(false))
+ if (SectionHeaders.NoHeaders.value_or(false))
for (const ELFYAML::Section *S : Sections)
if (!ExcludedSectionHeaders.insert(S->Name).second)
llvm_unreachable("buildSectionIndex() failed");
writeArrayData(OS, makeArrayRef(PHeaders));
const ELFYAML::SectionHeaderTable &SHT = Doc.getSectionHeaderTable();
- if (!SHT.NoHeaders.getValueOr(false))
+ if (!SHT.NoHeaders.value_or(false))
CBA.updateDataAt(*SHT.Offset, SHeaders.data(),
SHT.getNumHeaders(SHeaders.size()) * sizeof(Elf_Shdr));
// If DataEnd is not set, we assume everything we generated is a part of the
// stream.
Result.Location.DataSize =
- DataEnd.getValueOr(File.tell()) - Result.Location.RVA;
+ DataEnd.value_or(File.tell()) - Result.Location.RVA;
return Result;
}
for (const std::unique_ptr<XCOFFYAML::AuxSymbolEnt> &AuxSym :
YamlSym.AuxEntries) {
if (auto AS = dyn_cast<XCOFFYAML::FileAuxEnt>(AuxSym.get()))
- if (nameShouldBeInStringTable(AS->FileNameOrString.getValueOr("")))
- StrTblBuilder.add(AS->FileNameOrString.getValueOr(""));
+ if (nameShouldBeInStringTable(AS->FileNameOrString.value_or("")))
+ StrTblBuilder.add(AS->FileNameOrString.value_or(""));
}
}
Twine(AuxCount));
return false;
}
- YamlSym.NumberOfAuxEntries =
- YamlSym.NumberOfAuxEntries.getValueOr(AuxCount);
+ YamlSym.NumberOfAuxEntries = YamlSym.NumberOfAuxEntries.value_or(AuxCount);
// Add the number of auxiliary symbols to the total number.
InitFileHdr.NumberOfSymTableEntries += *YamlSym.NumberOfAuxEntries;
}
}
void XCOFFWriter::writeAuxFileHeader() {
- W.write<uint16_t>(InitAuxFileHdr.Magic.getValueOr(yaml::Hex16(1)));
- W.write<uint16_t>(InitAuxFileHdr.Version.getValueOr(yaml::Hex16(1)));
+ W.write<uint16_t>(InitAuxFileHdr.Magic.value_or(yaml::Hex16(1)));
+ W.write<uint16_t>(InitAuxFileHdr.Version.value_or(yaml::Hex16(1)));
if (Is64Bit) {
W.OS.write_zeros(4); // Reserved for debugger.
- W.write<uint64_t>(InitAuxFileHdr.TextStartAddr.getValueOr(yaml::Hex64(0)));
- W.write<uint64_t>(InitAuxFileHdr.DataStartAddr.getValueOr(yaml::Hex64(0)));
- W.write<uint64_t>(InitAuxFileHdr.TOCAnchorAddr.getValueOr(yaml::Hex64(0)));
+ W.write<uint64_t>(InitAuxFileHdr.TextStartAddr.value_or(yaml::Hex64(0)));
+ W.write<uint64_t>(InitAuxFileHdr.DataStartAddr.value_or(yaml::Hex64(0)));
+ W.write<uint64_t>(InitAuxFileHdr.TOCAnchorAddr.value_or(yaml::Hex64(0)));
} else {
- W.write<uint32_t>(InitAuxFileHdr.TextSize.getValueOr(yaml::Hex64(0)));
- W.write<uint32_t>(InitAuxFileHdr.InitDataSize.getValueOr(yaml::Hex64(0)));
- W.write<uint32_t>(InitAuxFileHdr.BssDataSize.getValueOr(yaml::Hex64(0)));
- W.write<uint32_t>(InitAuxFileHdr.EntryPointAddr.getValueOr(yaml::Hex64(0)));
- W.write<uint32_t>(InitAuxFileHdr.TextStartAddr.getValueOr(yaml::Hex64(0)));
- W.write<uint32_t>(InitAuxFileHdr.DataStartAddr.getValueOr(yaml::Hex64(0)));
- W.write<uint32_t>(InitAuxFileHdr.TOCAnchorAddr.getValueOr(yaml::Hex64(0)));
+ W.write<uint32_t>(InitAuxFileHdr.TextSize.value_or(yaml::Hex64(0)));
+ W.write<uint32_t>(InitAuxFileHdr.InitDataSize.value_or(yaml::Hex64(0)));
+ W.write<uint32_t>(InitAuxFileHdr.BssDataSize.value_or(yaml::Hex64(0)));
+ W.write<uint32_t>(InitAuxFileHdr.EntryPointAddr.value_or(yaml::Hex64(0)));
+ W.write<uint32_t>(InitAuxFileHdr.TextStartAddr.value_or(yaml::Hex64(0)));
+ W.write<uint32_t>(InitAuxFileHdr.DataStartAddr.value_or(yaml::Hex64(0)));
+ W.write<uint32_t>(InitAuxFileHdr.TOCAnchorAddr.value_or(yaml::Hex64(0)));
}
- W.write<uint16_t>(InitAuxFileHdr.SecNumOfEntryPoint.getValueOr(0));
- W.write<uint16_t>(InitAuxFileHdr.SecNumOfText.getValueOr(0));
- W.write<uint16_t>(InitAuxFileHdr.SecNumOfData.getValueOr(0));
- W.write<uint16_t>(InitAuxFileHdr.SecNumOfTOC.getValueOr(0));
- W.write<uint16_t>(InitAuxFileHdr.SecNumOfLoader.getValueOr(0));
- W.write<uint16_t>(InitAuxFileHdr.SecNumOfBSS.getValueOr(0));
- W.write<uint16_t>(InitAuxFileHdr.MaxAlignOfText.getValueOr(yaml::Hex16(0)));
- W.write<uint16_t>(InitAuxFileHdr.MaxAlignOfData.getValueOr(yaml::Hex16(0)));
- W.write<uint16_t>(InitAuxFileHdr.ModuleType.getValueOr(yaml::Hex16(0)));
- W.write<uint8_t>(InitAuxFileHdr.CpuFlag.getValueOr(yaml::Hex8(0)));
+ W.write<uint16_t>(InitAuxFileHdr.SecNumOfEntryPoint.value_or(0));
+ W.write<uint16_t>(InitAuxFileHdr.SecNumOfText.value_or(0));
+ W.write<uint16_t>(InitAuxFileHdr.SecNumOfData.value_or(0));
+ W.write<uint16_t>(InitAuxFileHdr.SecNumOfTOC.value_or(0));
+ W.write<uint16_t>(InitAuxFileHdr.SecNumOfLoader.value_or(0));
+ W.write<uint16_t>(InitAuxFileHdr.SecNumOfBSS.value_or(0));
+ W.write<uint16_t>(InitAuxFileHdr.MaxAlignOfText.value_or(yaml::Hex16(0)));
+ W.write<uint16_t>(InitAuxFileHdr.MaxAlignOfData.value_or(yaml::Hex16(0)));
+ W.write<uint16_t>(InitAuxFileHdr.ModuleType.value_or(yaml::Hex16(0)));
+ W.write<uint8_t>(InitAuxFileHdr.CpuFlag.value_or(yaml::Hex8(0)));
W.write<uint8_t>(0); // Reserved for CPU type.
if (Is64Bit) {
- W.write<uint8_t>(InitAuxFileHdr.TextPageSize.getValueOr(yaml::Hex8(0)));
- W.write<uint8_t>(InitAuxFileHdr.DataPageSize.getValueOr(yaml::Hex8(0)));
- W.write<uint8_t>(InitAuxFileHdr.StackPageSize.getValueOr(yaml::Hex8(0)));
+ W.write<uint8_t>(InitAuxFileHdr.TextPageSize.value_or(yaml::Hex8(0)));
+ W.write<uint8_t>(InitAuxFileHdr.DataPageSize.value_or(yaml::Hex8(0)));
+ W.write<uint8_t>(InitAuxFileHdr.StackPageSize.value_or(yaml::Hex8(0)));
W.write<uint8_t>(
- InitAuxFileHdr.FlagAndTDataAlignment.getValueOr(yaml::Hex8(0x80)));
- W.write<uint64_t>(InitAuxFileHdr.TextSize.getValueOr(yaml::Hex64(0)));
- W.write<uint64_t>(InitAuxFileHdr.InitDataSize.getValueOr(yaml::Hex64(0)));
- W.write<uint64_t>(InitAuxFileHdr.BssDataSize.getValueOr(yaml::Hex64(0)));
- W.write<uint64_t>(InitAuxFileHdr.EntryPointAddr.getValueOr(yaml::Hex64(0)));
- W.write<uint64_t>(InitAuxFileHdr.MaxStackSize.getValueOr(yaml::Hex64(0)));
- W.write<uint64_t>(InitAuxFileHdr.MaxDataSize.getValueOr(yaml::Hex64(0)));
+ InitAuxFileHdr.FlagAndTDataAlignment.value_or(yaml::Hex8(0x80)));
+ W.write<uint64_t>(InitAuxFileHdr.TextSize.value_or(yaml::Hex64(0)));
+ W.write<uint64_t>(InitAuxFileHdr.InitDataSize.value_or(yaml::Hex64(0)));
+ W.write<uint64_t>(InitAuxFileHdr.BssDataSize.value_or(yaml::Hex64(0)));
+ W.write<uint64_t>(InitAuxFileHdr.EntryPointAddr.value_or(yaml::Hex64(0)));
+ W.write<uint64_t>(InitAuxFileHdr.MaxStackSize.value_or(yaml::Hex64(0)));
+ W.write<uint64_t>(InitAuxFileHdr.MaxDataSize.value_or(yaml::Hex64(0)));
} else {
- W.write<uint32_t>(InitAuxFileHdr.MaxStackSize.getValueOr(yaml::Hex64(0)));
- W.write<uint32_t>(InitAuxFileHdr.MaxDataSize.getValueOr(yaml::Hex64(0)));
+ W.write<uint32_t>(InitAuxFileHdr.MaxStackSize.value_or(yaml::Hex64(0)));
+ W.write<uint32_t>(InitAuxFileHdr.MaxDataSize.value_or(yaml::Hex64(0)));
W.OS.write_zeros(4); // Reserved for debugger.
- W.write<uint8_t>(InitAuxFileHdr.TextPageSize.getValueOr(yaml::Hex8(0)));
- W.write<uint8_t>(InitAuxFileHdr.DataPageSize.getValueOr(yaml::Hex8(0)));
- W.write<uint8_t>(InitAuxFileHdr.StackPageSize.getValueOr(yaml::Hex8(0)));
+ W.write<uint8_t>(InitAuxFileHdr.TextPageSize.value_or(yaml::Hex8(0)));
+ W.write<uint8_t>(InitAuxFileHdr.DataPageSize.value_or(yaml::Hex8(0)));
+ W.write<uint8_t>(InitAuxFileHdr.StackPageSize.value_or(yaml::Hex8(0)));
W.write<uint8_t>(
- InitAuxFileHdr.FlagAndTDataAlignment.getValueOr(yaml::Hex8(0)));
+ InitAuxFileHdr.FlagAndTDataAlignment.value_or(yaml::Hex8(0)));
}
- W.write<uint16_t>(InitAuxFileHdr.SecNumOfTData.getValueOr(0));
- W.write<uint16_t>(InitAuxFileHdr.SecNumOfTBSS.getValueOr(0));
+ W.write<uint16_t>(InitAuxFileHdr.SecNumOfTData.value_or(0));
+ W.write<uint16_t>(InitAuxFileHdr.SecNumOfTBSS.value_or(0));
if (Is64Bit) {
- W.write<uint16_t>(InitAuxFileHdr.Flag.getValueOr(yaml::Hex16(XCOFF::SHR_SYMTAB)));
+ W.write<uint16_t>(
+ InitAuxFileHdr.Flag.value_or(yaml::Hex16(XCOFF::SHR_SYMTAB)));
if (InitFileHdr.AuxHeaderSize > XCOFF::AuxFileHeaderSize64)
W.OS.write_zeros(InitFileHdr.AuxHeaderSize - XCOFF::AuxFileHeaderSize64);
} else if (InitFileHdr.AuxHeaderSize > XCOFF::AuxFileHeaderSize32) {
void XCOFFWriter::writeAuxSymbol(const XCOFFYAML::CsectAuxEnt &AuxSym) {
if (Is64Bit) {
- W.write<uint32_t>(AuxSym.SectionOrLengthLo.getValueOr(0));
- W.write<uint32_t>(AuxSym.ParameterHashIndex.getValueOr(0));
- W.write<uint16_t>(AuxSym.TypeChkSectNum.getValueOr(0));
- W.write<uint8_t>(AuxSym.SymbolAlignmentAndType.getValueOr(0));
- W.write<uint8_t>(AuxSym.StorageMappingClass.getValueOr(XCOFF::XMC_PR));
- W.write<uint32_t>(AuxSym.SectionOrLengthHi.getValueOr(0));
+ W.write<uint32_t>(AuxSym.SectionOrLengthLo.value_or(0));
+ W.write<uint32_t>(AuxSym.ParameterHashIndex.value_or(0));
+ W.write<uint16_t>(AuxSym.TypeChkSectNum.value_or(0));
+ W.write<uint8_t>(AuxSym.SymbolAlignmentAndType.value_or(0));
+ W.write<uint8_t>(AuxSym.StorageMappingClass.value_or(XCOFF::XMC_PR));
+ W.write<uint32_t>(AuxSym.SectionOrLengthHi.value_or(0));
W.write<uint8_t>(0);
W.write<uint8_t>(XCOFF::AUX_CSECT);
} else {
- W.write<uint32_t>(AuxSym.SectionOrLength.getValueOr(0));
- W.write<uint32_t>(AuxSym.ParameterHashIndex.getValueOr(0));
- W.write<uint16_t>(AuxSym.TypeChkSectNum.getValueOr(0));
- W.write<uint8_t>(AuxSym.SymbolAlignmentAndType.getValueOr(0));
- W.write<uint8_t>(AuxSym.StorageMappingClass.getValueOr(XCOFF::XMC_PR));
- W.write<uint32_t>(AuxSym.StabInfoIndex.getValueOr(0));
- W.write<uint16_t>(AuxSym.StabSectNum.getValueOr(0));
+ W.write<uint32_t>(AuxSym.SectionOrLength.value_or(0));
+ W.write<uint32_t>(AuxSym.ParameterHashIndex.value_or(0));
+ W.write<uint16_t>(AuxSym.TypeChkSectNum.value_or(0));
+ W.write<uint8_t>(AuxSym.SymbolAlignmentAndType.value_or(0));
+ W.write<uint8_t>(AuxSym.StorageMappingClass.value_or(XCOFF::XMC_PR));
+ W.write<uint32_t>(AuxSym.StabInfoIndex.value_or(0));
+ W.write<uint16_t>(AuxSym.StabSectNum.value_or(0));
}
}
void XCOFFWriter::writeAuxSymbol(const XCOFFYAML::ExcpetionAuxEnt &AuxSym) {
assert(Is64Bit && "can't write the exception auxiliary symbol for XCOFF32");
- W.write<uint64_t>(AuxSym.OffsetToExceptionTbl.getValueOr(0));
- W.write<uint32_t>(AuxSym.SizeOfFunction.getValueOr(0));
- W.write<uint32_t>(AuxSym.SymIdxOfNextBeyond.getValueOr(0));
+ W.write<uint64_t>(AuxSym.OffsetToExceptionTbl.value_or(0));
+ W.write<uint32_t>(AuxSym.SizeOfFunction.value_or(0));
+ W.write<uint32_t>(AuxSym.SymIdxOfNextBeyond.value_or(0));
W.write<uint8_t>(0);
W.write<uint8_t>(XCOFF::AUX_EXCEPT);
}
void XCOFFWriter::writeAuxSymbol(const XCOFFYAML::FunctionAuxEnt &AuxSym) {
if (Is64Bit) {
- W.write<uint64_t>(AuxSym.PtrToLineNum.getValueOr(0));
- W.write<uint32_t>(AuxSym.SizeOfFunction.getValueOr(0));
- W.write<uint32_t>(AuxSym.SymIdxOfNextBeyond.getValueOr(0));
+ W.write<uint64_t>(AuxSym.PtrToLineNum.value_or(0));
+ W.write<uint32_t>(AuxSym.SizeOfFunction.value_or(0));
+ W.write<uint32_t>(AuxSym.SymIdxOfNextBeyond.value_or(0));
W.write<uint8_t>(0);
W.write<uint8_t>(XCOFF::AUX_FCN);
} else {
- W.write<uint32_t>(AuxSym.OffsetToExceptionTbl.getValueOr(0));
- W.write<uint32_t>(AuxSym.SizeOfFunction.getValueOr(0));
- W.write<uint32_t>(AuxSym.PtrToLineNum.getValueOr(0));
- W.write<uint32_t>(AuxSym.SymIdxOfNextBeyond.getValueOr(0));
+ W.write<uint32_t>(AuxSym.OffsetToExceptionTbl.value_or(0));
+ W.write<uint32_t>(AuxSym.SizeOfFunction.value_or(0));
+ W.write<uint32_t>(AuxSym.PtrToLineNum.value_or(0));
+ W.write<uint32_t>(AuxSym.SymIdxOfNextBeyond.value_or(0));
W.OS.write_zeros(2);
}
}
void XCOFFWriter::writeAuxSymbol(const XCOFFYAML::FileAuxEnt &AuxSym) {
- StringRef FileName = AuxSym.FileNameOrString.getValueOr("");
+ StringRef FileName = AuxSym.FileNameOrString.value_or("");
if (nameShouldBeInStringTable(FileName)) {
W.write<int32_t>(0);
W.write<uint32_t>(StrTblBuilder.getOffset(FileName));
writeName(FileName, W);
}
W.OS.write_zeros(XCOFF::FileNamePadSize);
- W.write<uint8_t>(AuxSym.FileStringType.getValueOr(XCOFF::XFT_FN));
+ W.write<uint8_t>(AuxSym.FileStringType.value_or(XCOFF::XFT_FN));
if (Is64Bit) {
W.OS.write_zeros(2);
W.write<uint8_t>(XCOFF::AUX_FILE);
void XCOFFWriter::writeAuxSymbol(const XCOFFYAML::BlockAuxEnt &AuxSym) {
if (Is64Bit) {
- W.write<uint32_t>(AuxSym.LineNum.getValueOr(0));
+ W.write<uint32_t>(AuxSym.LineNum.value_or(0));
W.OS.write_zeros(13);
W.write<uint8_t>(XCOFF::AUX_SYM);
} else {
W.OS.write_zeros(2);
- W.write<uint16_t>(AuxSym.LineNumHi.getValueOr(0));
- W.write<uint16_t>(AuxSym.LineNumLo.getValueOr(0));
+ W.write<uint16_t>(AuxSym.LineNumHi.value_or(0));
+ W.write<uint16_t>(AuxSym.LineNumLo.value_or(0));
W.OS.write_zeros(12);
}
}
void XCOFFWriter::writeAuxSymbol(const XCOFFYAML::SectAuxEntForDWARF &AuxSym) {
if (Is64Bit) {
- W.write<uint64_t>(AuxSym.LengthOfSectionPortion.getValueOr(0));
- W.write<uint64_t>(AuxSym.NumberOfRelocEnt.getValueOr(0));
+ W.write<uint64_t>(AuxSym.LengthOfSectionPortion.value_or(0));
+ W.write<uint64_t>(AuxSym.NumberOfRelocEnt.value_or(0));
W.write<uint8_t>(0);
W.write<uint8_t>(XCOFF::AUX_SECT);
} else {
- W.write<uint32_t>(AuxSym.LengthOfSectionPortion.getValueOr(0));
+ W.write<uint32_t>(AuxSym.LengthOfSectionPortion.value_or(0));
W.OS.write_zeros(4);
- W.write<uint32_t>(AuxSym.NumberOfRelocEnt.getValueOr(0));
+ W.write<uint32_t>(AuxSym.NumberOfRelocEnt.value_or(0));
W.OS.write_zeros(6);
}
}
void XCOFFWriter::writeAuxSymbol(const XCOFFYAML::SectAuxEntForStat &AuxSym) {
assert(!Is64Bit && "can't write the stat auxiliary symbol for XCOFF64");
- W.write<uint32_t>(AuxSym.SectionLength.getValueOr(0));
- W.write<uint16_t>(AuxSym.NumberOfRelocEnt.getValueOr(0));
- W.write<uint16_t>(AuxSym.NumberOfLineNum.getValueOr(0));
+ W.write<uint32_t>(AuxSym.SectionLength.value_or(0));
+ W.write<uint16_t>(AuxSym.NumberOfRelocEnt.value_or(0));
+ W.write<uint16_t>(AuxSym.NumberOfLineNum.value_or(0));
W.OS.write_zeros(10);
}
W.write<uint16_t>(YamlSym.Type);
W.write<uint8_t>(YamlSym.StorageClass);
- uint8_t NumOfAuxSym = YamlSym.NumberOfAuxEntries.getValueOr(0);
+ uint8_t NumOfAuxSym = YamlSym.NumberOfAuxEntries.value_or(0);
W.write<uint8_t>(NumOfAuxSym);
if (!NumOfAuxSym && !YamlSym.AuxEntries.size())
LLVM_DEBUG(Die.dump(dbgs()));
}
this->addProbe(*FunctionName, *CFGHash, *CounterPtr - CountersStart,
- FunctionPtr.getValueOr(0), *NumCounters);
+ FunctionPtr.value_or(0), *NumCounters);
};
for (auto &CU : DICtx->normal_units())
for (const auto &Entry : CU->dies())
Optional<size_t> Width) {
const size_t kMaxWidth = 128u;
- size_t W = std::min(kMaxWidth, Width.getValueOr(0u));
+ size_t W = std::min(kMaxWidth, Width.value_or(0u));
unsigned Nibbles = (64 - countLeadingZeros(N) + 3) / 4;
bool Prefix = (Style == HexPrintStyle::PrefixLower ||
void llvm::write_double(raw_ostream &S, double N, FloatStyle Style,
Optional<size_t> Precision) {
- size_t Prec = Precision.getValueOr(getDefaultPrecision(Style));
+ size_t Prec = Precision.value_or(getDefaultPrecision(Style));
if (std::isnan(N)) {
S << "nan";
detail::InMemoryDirectory *Dir = Root.get();
auto I = llvm::sys::path::begin(Path), E = sys::path::end(Path);
- const auto ResolvedUser = User.getValueOr(0);
- const auto ResolvedGroup = Group.getValueOr(0);
- const auto ResolvedType = Type.getValueOr(sys::fs::file_type::regular_file);
- const auto ResolvedPerms = Perms.getValueOr(sys::fs::all_all);
+ const auto ResolvedUser = User.value_or(0);
+ const auto ResolvedGroup = Group.value_or(0);
+ const auto ResolvedType = Type.value_or(sys::fs::file_type::regular_file);
+ const auto ResolvedPerms = Perms.value_or(sys::fs::all_all);
// Any intermediate directories we create should be accessible by
// the owner, even if Perms says otherwise for the final path.
const auto NewDirectoryPerms = ResolvedPerms | sys::fs::owner_all;
// modify the stack. Check if hasRedZone is true or unknown; if yes, don't
// outline from it.
AArch64FunctionInfo *AFI = MF.getInfo<AArch64FunctionInfo>();
- if (!AFI || AFI->hasRedZone().getValueOr(true))
+ if (!AFI || AFI->hasRedZone().value_or(true))
return false;
// FIXME: Teach the outliner to generate/handle Windows unwind info.
}
auto PRFM = LookupByEncoding(MCE->getValue());
- Operands.push_back(AArch64Operand::CreatePrefetch(
- prfop, PRFM.getValueOr(""), S, getContext()));
+ Operands.push_back(AArch64Operand::CreatePrefetch(prfop, PRFM.value_or(""),
+ S, getContext()));
return MatchOperand_Success;
}
const DataLayout &DL = GV->getParent()->getDataLayout();
uint64_t Size = DL.getTypeAllocSize(GV->getValueType());
- Align Alignment = GV->getAlign().getValueOr(Align(4));
+ Align Alignment = GV->getAlign().value_or(Align(4));
emitVisibility(GVSym, GV->getVisibility(), !GV->isDeclaration());
emitLinkage(GV, GVSym);
const MCRegisterInfo &MRI,
const MCTargetOptions &Options) {
return new ELFAMDGPUAsmBackend(T, STI.getTargetTriple(),
- getHsaAbiVersion(&STI).getValueOr(0));
+ getHsaAbiVersion(&STI).value_or(0));
}
using namespace llvm;
static Reloc::Model getRelocModel(Optional<Reloc::Model> RM) {
- return RM.getValueOr(Reloc::Static);
+ return RM.value_or(Reloc::Static);
}
/// ARCTargetMachine ctor - Create an ILP32 architecture model
}
static Reloc::Model getEffectiveRelocModel(Optional<Reloc::Model> RM) {
- return RM.getValueOr(Reloc::Static);
+ return RM.value_or(Reloc::Static);
}
AVRTargetMachine::AVRTargetMachine(const Target &T, const Triple &TT,
}
static Reloc::Model getEffectiveRelocModel(Optional<Reloc::Model> RM) {
- return RM.getValueOr(Reloc::PIC_);
+ return RM.value_or(Reloc::PIC_);
}
BPFTargetMachine::BPFTargetMachine(const Target &T, const Triple &TT,
Optional<CodeModel::Model> CM,
CodeGenOpt::Level OL, bool JIT)
: LLVMTargetMachine(T, computeDataLayout(TT), TT, CPU, FS, Options,
- RM.getValueOr(Reloc::Static),
+ RM.value_or(Reloc::Static),
getEffectiveCodeModel(CM, CodeModel::Small), OL),
TLOF(std::make_unique<CSKYELFTargetObjectFile>()) {
initAsmInfo();
auto &Ctx = M.getContext();
Metadata *MDVals[DXILVersionNumFields];
MDVals[0] = Uint32ToConstMD(ValidatorVer.getMajor(), Ctx);
- MDVals[1] = Uint32ToConstMD(ValidatorVer.getMinor().getValueOr(0), Ctx);
+ MDVals[1] = Uint32ToConstMD(ValidatorVer.getMinor().value_or(0), Ctx);
DXILValidatorVersionMD->addOperand(MDNode::get(Ctx, MDVals));
}
} // end namespace llvm;
static Reloc::Model getEffectiveRelocModel(Optional<Reloc::Model> RM) {
- return RM.getValueOr(Reloc::Static);
+ return RM.value_or(Reloc::Static);
}
extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeHexagonTarget() {
}
static Reloc::Model getEffectiveRelocModel(Optional<Reloc::Model> RM) {
- return RM.getValueOr(Reloc::PIC_);
+ return RM.value_or(Reloc::PIC_);
}
LanaiTargetMachine::LanaiTargetMachine(const Target &T, const Triple &TT,
// later load/stores assume that alignment, and we are going to replace
// the use of the byval parameter with this alloca instruction.
AllocA->setAlignment(Func->getParamAlign(Arg->getArgNo())
- .getValueOr(DL.getPrefTypeAlign(StructType)));
+ .value_or(DL.getPrefTypeAlign(StructType)));
Arg->replaceAllUsesWith(AllocA);
Value *ArgInParam = new AddrSpaceCastInst(
// Handle common and zero-initialized local symbols.
if (GV->hasCommonLinkage() || GVKind.isBSSLocal() ||
GVKind.isThreadBSSLocal()) {
- Align Alignment = GV->getAlign().getValueOr(DL.getPreferredAlign(GV));
+ Align Alignment = GV->getAlign().value_or(DL.getPreferredAlign(GV));
uint64_t Size = DL.getTypeAllocSize(GV->getValueType());
GVSym->setStorageClass(
TargetLoweringObjectFileXCOFF::getStorageClassForGlobal(GV));
}
static Reloc::Model getEffectiveRelocModel(Optional<Reloc::Model> RM) {
- return RM.getValueOr(Reloc::Static);
+ return RM.value_or(Reloc::Static);
}
// Code models. Some only make sense for 64-bit code.
bool maySafelyIgnoreMask(SDValue Op) {
auto VVPOpc = getVVPOpcode(Op->getOpcode());
- auto Opc = VVPOpc.getValueOr(Op->getOpcode());
+ auto Opc = VVPOpc.value_or(Op->getOpcode());
switch (Opc) {
case VEISD::VVP_SDIV:
}
static Reloc::Model getEffectiveRelocModel(Optional<Reloc::Model> RM) {
- return RM.getValueOr(Reloc::Static);
+ return RM.value_or(Reloc::Static);
}
class VEELFTargetObjectFile : public TargetLoweringObjectFileELF {
if (getSymRef(ErrorLoc, Inst, SymRef))
return true;
auto WasmSym = cast<MCSymbolWasm>(&SymRef->getSymbol());
- switch (WasmSym->getType().getValueOr(wasm::WASM_SYMBOL_TYPE_DATA)) {
+ switch (WasmSym->getType().value_or(wasm::WASM_SYMBOL_TYPE_DATA)) {
case wasm::WASM_SYMBOL_TYPE_GLOBAL:
Type = static_cast<wasm::ValType>(WasmSym->getGlobalType().Type);
break;
if (getSymRef(ErrorLoc, Inst, SymRef))
return true;
auto WasmSym = cast<MCSymbolWasm>(&SymRef->getSymbol());
- if (WasmSym->getType().getValueOr(wasm::WASM_SYMBOL_TYPE_DATA) !=
+ if (WasmSym->getType().value_or(wasm::WASM_SYMBOL_TYPE_DATA) !=
wasm::WASM_SYMBOL_TYPE_TABLE)
return typeError(ErrorLoc, StringRef("symbol ") + WasmSym->getName() +
" missing .tabletype");
const bool AllowExtraUsesByDefault = Subtarget->hasBMI2();
auto checkUses = [AllowExtraUsesByDefault](SDValue Op, unsigned NUses,
Optional<bool> AllowExtraUses) {
- return AllowExtraUses.getValueOr(AllowExtraUsesByDefault) ||
+ return AllowExtraUses.value_or(AllowExtraUsesByDefault) ||
Op.getNode()->hasNUsesOfValue(NUses, Op.getResNo());
};
auto checkOneUse = [checkUses](SDValue Op,
using namespace llvm;
static Reloc::Model getEffectiveRelocModel(Optional<Reloc::Model> RM) {
- return RM.getValueOr(Reloc::Static);
+ return RM.value_or(Reloc::Static);
}
static CodeModel::Model
Code.reserve(Text.size());
while (!Text.empty()) {
if (Text.consume_front("^")) {
- Points[Name.getValueOr("")].push_back(Code.size());
+ Points[Name.value_or("")].push_back(Code.size());
Name = llvm::None;
continue;
}
if (Text.consume_front("[[")) {
- OpenRanges.emplace_back(Name.getValueOr(""), Code.size());
+ OpenRanges.emplace_back(Name.value_or(""), Code.size());
Name = llvm::None;
continue;
}
unsigned IterationCounter = 1;
unsigned MaxIterations =
- Configuration.MaxFixpointIterations.getValueOr(SetFixpointIterations);
+ Configuration.MaxFixpointIterations.value_or(SetFixpointIterations);
SmallVector<AbstractAttribute *, 32> ChangedAAs;
SetVector<AbstractAttribute *> Worklist, InvalidAAs;
}
static Align getAlign(GlobalVariable *GV) {
- return GV->getAlign().getValueOr(
+ return GV->getAlign().value_or(
GV->getParent()->getDataLayout().getPreferredAlign(GV));
}
Optional<unsigned> CanonNum = Candidate->getCanonicalNum(*GVN);
Optional<unsigned> FirstGVN = Other.Candidate->fromCanonicalNum(*CanonNum);
Optional<Value *> FoundValueOpt = Other.Candidate->fromGVN(*FirstGVN);
- return FoundValueOpt.getValueOr(nullptr);
+ return FoundValueOpt.value_or(nullptr);
}
BasicBlock *
int CBCostMult =
getStringFnAttrAsInt(
*CB, InlineConstants::FunctionInlineCostMultiplierAttributeName)
- .getValueOr(1);
+ .value_or(1);
// Setup the data structure used to plumb customization into the
// `InlineFunction` routine.
};
auto BBProfileCount = [BFI](BasicBlock *BB) {
- return BFI->getBlockProfileCount(BB).getValueOr(0);
+ return BFI->getBlockProfileCount(BB).value_or(0);
};
// Use the same computeBBInlineCost function to compute the cost savings of
FunctionAnalysisManager &FAM) {
BlockFrequencyInfo &BFI = FAM.getResult<BlockFrequencyAnalysis>(F);
auto BBProfileCount = [&BFI](BasicBlock *BB) {
- return BFI.getBlockProfileCount(BB).getValueOr(0);
+ return BFI.getBlockProfileCount(BB).value_or(0);
};
// Collect the sum of execution weight for each probe.
// of an aggregate. If we did, that means the CurrIVI will later be
// overwritten with the already-recorded value. But if not, let's record it!
Optional<Instruction *> &Elt = AggElts[Indices.front()];
- Elt = Elt.getValueOr(InsertedValue);
+ Elt = Elt.value_or(InsertedValue);
// FIXME: should we handle chain-terminating undef base operand?
}
// Create the combined branch condition and constant-fold the branches/selects
// in the hot path.
fixupBranchesAndSelects(Scope, PreEntryBlock, MergedBr,
- ProfileCount.getValueOr(0));
+ ProfileCount.value_or(0));
}
// A helper for transformScopes. Clone the blocks in the scope (excluding the
//===----------------------------------------------------------------------===//
bool GVNPass::isPREEnabled() const {
- return Options.AllowPRE.getValueOr(GVNEnablePRE);
+ return Options.AllowPRE.value_or(GVNEnablePRE);
}
bool GVNPass::isLoadPREEnabled() const {
- return Options.AllowLoadPRE.getValueOr(GVNEnableLoadPRE);
+ return Options.AllowLoadPRE.value_or(GVNEnableLoadPRE);
}
bool GVNPass::isLoadInLoopPREEnabled() const {
- return Options.AllowLoadInLoopPRE.getValueOr(GVNEnableLoadInLoopPRE);
+ return Options.AllowLoadInLoopPRE.value_or(GVNEnableLoadInLoopPRE);
}
bool GVNPass::isLoadPRESplitBackedgeEnabled() const {
- return Options.AllowLoadPRESplitBackedge.getValueOr(
+ return Options.AllowLoadPRESplitBackedge.value_or(
GVNEnableSplitBackedgeInLoadPRE);
}
bool GVNPass::isMemDepEnabled() const {
- return Options.AllowMemDep.getValueOr(GVNEnableMemDep);
+ return Options.AllowMemDep.value_or(GVNEnableMemDep);
}
PreservedAnalyses GVNPass::run(Function &F, FunctionAnalysisManager &AM) {
"may not insert runtime check with convergent operation");
}
- if (Pred.getComplexity() > (IsForced.getValueOr(false)
+ if (Pred.getComplexity() > (IsForced.value_or(false)
? PragmaDistributeSCEVCheckThreshold
: DistributeSCEVCheckThreshold))
return fail("TooManySCEVRuntimeChecks",
"too many SCEV run-time checks needed.\n");
- if (!IsForced.getValueOr(false) && hasDisableAllTransformsHint(L))
+ if (!IsForced.value_or(false) && hasDisableAllTransformsHint(L))
return fail("HeuristicDisabled", "distribution heuristic disabled");
LLVM_DEBUG(dbgs() << "\nDistributing loop: " << *L << "\n");
/// Provide diagnostics then \return with false.
bool fail(StringRef RemarkName, StringRef Message) {
LLVMContext &Ctx = F->getContext();
- bool Forced = isForced().getValueOr(false);
+ bool Forced = isForced().value_or(false);
LLVM_DEBUG(dbgs() << "Skipping; " << Message << "\n");
// If distribution was forced for the specific loop to be
// enabled/disabled, follow that. Otherwise use the global flag.
- if (LDL.isForced().getValueOr(EnableLoopDistribute))
+ if (LDL.isForced().value_or(EnableLoopDistribute))
Changed |= LDL.processLoop(GetLAA);
}
T getWithDefaultOverride(const cl::opt<T> &ClOption,
const llvm::Optional<T> &DefaultOverride) {
return ClOption.getNumOccurrences() ? ClOption
- : DefaultOverride.getValueOr(ClOption);
+ : DefaultOverride.value_or(ClOption);
}
class ScalarizerVisitor : public InstVisitor<ScalarizerVisitor, bool> {
<< "loop not vectorized: the optimizer was unable to perform the "
"requested transformation; the transformation might be disabled "
"or specified as part of an unsupported transformation ordering");
- else if (InterleaveCount.getValueOr(0) != 1)
+ else if (InterleaveCount.value_or(0) != 1)
ORE->emit(
DiagnosticInfoOptimizationFailure(DEBUG_TYPE,
"FailedRequestedInterleaving",
return;
auto CallSiteCount = PSI ? PSI->getProfileCount(TheCall, CallerBFI) : None;
int64_t CallCount =
- std::min(CallSiteCount.getValueOr(0), CalleeEntryCount.getCount());
+ std::min(CallSiteCount.value_or(0), CalleeEntryCount.getCount());
updateProfileCallee(Callee, -CallCount, &VMap);
}
if (Width.hasValue()) {
Optional<int> IsScalable = getOptionalIntLoopAttribute(
TheLoop, "llvm.loop.vectorize.scalable.enable");
- return ElementCount::get(*Width, IsScalable.getValueOr(false));
+ return ElementCount::get(*Width, IsScalable.value_or(false));
}
return None;
return V->hasOneUse();
if (IE1) {
if ((IE1 != VU && !IE1->hasOneUse()) ||
- getInsertIndex(IE1).getValueOr(Idx2) == Idx2)
+ getInsertIndex(IE1).value_or(Idx2) == Idx2)
IE1 = nullptr;
else
IE1 = dyn_cast<InsertElementInst>(IE1->getOperand(0));
}
if (IE2) {
if ((IE2 != V && !IE2->hasOneUse()) ||
- getInsertIndex(IE2).getValueOr(Idx1) == Idx1)
+ getInsertIndex(IE2).value_or(Idx1) == Idx1)
IE2 = nullptr;
else
IE2 = dyn_cast<InsertElementInst>(IE2->getOperand(0));
PrevI1 = I1;
PrevI2 = I2;
if (I1 && (I1 == IE1 || I1->hasOneUse()) &&
- getInsertIndex(I1).getValueOr(Idx2) != Idx2)
+ getInsertIndex(I1).value_or(Idx2) != Idx2)
I1 = dyn_cast<InsertElementInst>(I1->getOperand(0));
if (I2 && ((I2 == IE2 || I2->hasOneUse())) &&
- getInsertIndex(I2).getValueOr(Idx1) != Idx1)
+ getInsertIndex(I2).value_or(Idx1) != Idx1)
I2 = dyn_cast<InsertElementInst>(I2->getOperand(0));
} while ((I1 && PrevI1 != I1) || (I2 && PrevI2 != I2));
llvm_unreachable("Two different buildvectors not expected.");
while (auto *IEBase = dyn_cast<InsertElementInst>(Base)) {
if (IEBase != EU.User &&
(!IEBase->hasOneUse() ||
- getInsertIndex(IEBase).getValueOr(*InsertIdx) == *InsertIdx))
+ getInsertIndex(IEBase).value_or(*InsertIdx) == *InsertIdx))
break;
// Build the mask for the vectorized insertelement instructions.
if (const TreeEntry *E = getTreeEntry(IEBase)) {
while (auto *IEBase = dyn_cast<InsertElementInst>(Base)) {
if (IEBase != User &&
(!IEBase->hasOneUse() ||
- getInsertIndex(IEBase).getValueOr(Idx) == Idx))
+ getInsertIndex(IEBase).value_or(Idx) == Idx))
break;
// Build the mask for the vectorized insertelement instructions.
if (const TreeEntry *E = getTreeEntry(IEBase)) {
{"mayLoad", IIVD.mayLoad},
{"mayStore", IIVD.mayStore},
{"hasUnmodeledSideEffects", IIVD.hasUnmodeledSideEffects}});
- JO.try_emplace("RThroughput", IIVD.RThroughput.getValueOr(0.0));
+ JO.try_emplace("RThroughput", IIVD.RThroughput.value_or(0.0));
return JO;
}
"no assembly info for target " + TripleName);
if (MCPU.empty())
- MCPU = Obj->tryGetCPUName().getValueOr("").str();
+ MCPU = Obj->tryGetCPUName().value_or("").str();
std::unique_ptr<const MCSubtargetInfo> STI(
TheTarget->createMCSubtargetInfo(TripleName, MCPU, Features.getString()));
if (opts::bytes::DumpBlockRange.hasValue()) {
auto &R = *opts::bytes::DumpBlockRange;
- uint32_t Max = R.Max.getValueOr(R.Min);
+ uint32_t Max = R.Max.value_or(R.Min);
if (Max < R.Min)
return make_error<StringError>(
if (opts::bytes::DumpByteRange.hasValue()) {
auto &R = *opts::bytes::DumpByteRange;
- uint32_t Max = R.Max.getValueOr(File.getFileSize());
+ uint32_t Max = R.Max.value_or(File.getFileSize());
if (Max < R.Min)
return make_error<StringError>("Invalid byte range specified. Max < Min",
pdb::yaml::PdbTpiStream DefaultTpiStream;
pdb::yaml::PdbTpiStream DefaultIpiStream;
- const auto &Info = YamlObj.PdbStream.getValueOr(DefaultInfoStream);
+ const auto &Info = YamlObj.PdbStream.value_or(DefaultInfoStream);
auto &InfoBuilder = Builder.getInfoBuilder();
InfoBuilder.setAge(Info.Age);
for (auto F : Info.Features)
InfoBuilder.addFeature(F);
- const auto &Dbi = YamlObj.DbiStream.getValueOr(DefaultDbiStream);
+ const auto &Dbi = YamlObj.DbiStream.value_or(DefaultDbiStream);
auto &DbiBuilder = Builder.getDbiBuilder();
DbiBuilder.setAge(Dbi.Age);
DbiBuilder.setBuildNumber(Dbi.BuildNumber);
}
auto &TpiBuilder = Builder.getTpiBuilder();
- const auto &Tpi = YamlObj.TpiStream.getValueOr(DefaultTpiStream);
+ const auto &Tpi = YamlObj.TpiStream.value_or(DefaultTpiStream);
TpiBuilder.setVersionHeader(Tpi.Version);
AppendingTypeTableBuilder TS(Allocator);
for (const auto &R : Tpi.Records) {
TpiBuilder.addTypeRecord(Type.RecordData, None);
}
- const auto &Ipi = YamlObj.IpiStream.getValueOr(DefaultIpiStream);
+ const auto &Ipi = YamlObj.IpiStream.value_or(DefaultIpiStream);
auto &IpiBuilder = Builder.getIpiBuilder();
IpiBuilder.setVersionHeader(Ipi.Version);
for (const auto &R : Ipi.Records) {
auto TypeInfo = Control::SupportedCtls.lookup(Ctl.Type);
IntWithNotMask CtlStyle(TypeInfo.Style);
- CtlStyle |= Ctl.Style.getValueOr(RCInt(0));
- uint32_t CtlExtStyle = Ctl.ExtStyle.getValueOr(0);
+ CtlStyle |= Ctl.Style.value_or(RCInt(0));
+ uint32_t CtlExtStyle = Ctl.ExtStyle.value_or(0);
// DIALOG(EX) item header prefix.
if (!IsExtended) {
ulittle32_t HelpID;
ulittle32_t ExtStyle;
ulittle32_t Style;
- } Prefix{ulittle32_t(Ctl.HelpID.getValueOr(0)), ulittle32_t(CtlExtStyle),
+ } Prefix{ulittle32_t(Ctl.HelpID.value_or(0)), ulittle32_t(CtlExtStyle),
ulittle32_t(CtlStyle.getValue())};
writeObject(Prefix);
}
const uint32_t StyleFontFlag = 0x40;
const uint32_t StyleCaptionFlag = 0x00C00000;
- uint32_t UsedStyle = ObjectData.Style.getValueOr(DefaultStyle);
+ uint32_t UsedStyle = ObjectData.Style.value_or(DefaultStyle);
if (ObjectData.Font)
UsedStyle |= StyleFontFlag;
else
UsedStyle |= StyleCaptionFlag;
const uint16_t DialogExMagic = 0xFFFF;
- uint32_t ExStyle = ObjectData.ExStyle.getValueOr(0);
+ uint32_t ExStyle = ObjectData.ExStyle.value_or(0);
// Write DIALOG(EX) header prefix. These are pretty different.
if (!Res->IsExtended) {
return;
}
- uint64_t SymValue =
- Resolver(R.Type, Offset, RelocSymValue, Data.getAddress(&Offset),
- R.Addend.getValueOr(0));
+ uint64_t SymValue = Resolver(R.Type, Offset, RelocSymValue,
+ Data.getAddress(&Offset), R.Addend.value_or(0));
this->printFunctionStackSize(SymValue, FunctionSec, StackSizeSec, Data,
&Offset);
}
RawSec->EntSize)
return true;
- ELFYAML::ELF_SHF ShFlags = RawSec->Flags.getValueOr(ELFYAML::ELF_SHF(0));
+ ELFYAML::ELF_SHF ShFlags = RawSec->Flags.value_or(ELFYAML::ELF_SHF(0));
if (SecName == "debug_str")
return ShFlags != ELFYAML::ELF_SHF(ELF::SHF_MERGE | ELF::SHF_STRINGS);
// are empty, which should not normally happen.
if (S.Type == ELF::SHT_STRTAB || S.Type == ELF::SHT_SYMTAB ||
S.Type == ELF::SHT_DYNSYM) {
- return S.Size || S.Flags.getValueOr(ELFYAML::ELF_SHF(0)) & ELF::SHF_ALLOC;
+ return S.Size || S.Flags.value_or(ELFYAML::ELF_SHF(0)) & ELF::SHF_ALLOC;
}
return true;
MatchTableRecord(Optional<unsigned> LabelID_, StringRef EmitStr,
unsigned NumElements, unsigned Flags,
int64_t RawValue = std::numeric_limits<int64_t>::min())
- : LabelID(LabelID_.getValueOr(~0u)), EmitStr(EmitStr),
+ : LabelID(LabelID_.value_or(~0u)), EmitStr(EmitStr),
NumElements(NumElements), Flags(Flags), RawValue(RawValue) {
assert((!LabelID_.hasValue() || LabelID != ~0u) &&
"This value is reserved for non-labels");
Ret.NormalizedValuesScope = R.getValueAsString("NormalizedValuesScope");
Ret.ImpliedCheck = R.getValueAsString("ImpliedCheck");
Ret.ImpliedValue =
- R.getValueAsOptionalString("ImpliedValue").getValueOr(Ret.DefaultValue);
+ R.getValueAsOptionalString("ImpliedValue").value_or(Ret.DefaultValue);
Ret.ShouldParse = R.getValueAsString("ShouldParse");
Ret.Normalizer = R.getValueAsString("Normalizer");