From e55e5e640b052220b1cd9f86f9729662df5b1e02 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Fri, 31 Jul 2020 21:22:58 +0000 Subject: Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp master 2e10b7a39b9, the last commit before the llvmorg-12-init tag, from which release/11.x was branched. Note that for now, I rolled back all our local changes to make merging easier, and I will reapply the still-relevant ones after updating to 11.0.0-rc1. (cherry picked from commit 5ffd83dbcc34f10e07f6d3e968ae6365869615f4) --- contrib/llvm-project/llvm/include/llvm-c/Core.h | 56 +- .../llvm-project/llvm/include/llvm-c/DataTypes.h | 6 - .../llvm-project/llvm/include/llvm-c/DebugInfo.h | 13 +- .../llvm/include/llvm-c/ExecutionEngine.h | 5 + contrib/llvm-project/llvm/include/llvm-c/Orc.h | 335 ++ .../llvm/include/llvm-c/Transforms/Coroutines.h | 4 + contrib/llvm-project/llvm/include/llvm-c/lto.h | 17 +- .../llvm-project/llvm/include/llvm/ADT/APFloat.h | 72 +- contrib/llvm-project/llvm/include/llvm/ADT/APInt.h | 19 +- .../llvm/include/llvm/ADT/AllocatorList.h | 4 +- contrib/llvm-project/llvm/include/llvm/ADT/Any.h | 63 +- .../llvm-project/llvm/include/llvm/ADT/ArrayRef.h | 58 +- .../llvm-project/llvm/include/llvm/ADT/BitVector.h | 58 +- .../llvm-project/llvm/include/llvm/ADT/Bitfields.h | 289 + .../llvm/include/llvm/ADT/BitmaskEnum.h | 41 +- .../llvm/include/llvm/ADT/CachedHashString.h | 3 +- .../llvm/include/llvm/ADT/CoalescingBitVector.h | 444 ++ .../llvm/include/llvm/ADT/DAGDeltaAlgorithm.h | 2 +- .../llvm/include/llvm/ADT/DeltaAlgorithm.h | 2 +- .../llvm-project/llvm/include/llvm/ADT/DenseMap.h | 87 +- .../llvm/include/llvm/ADT/DenseMapInfo.h | 114 +- .../llvm-project/llvm/include/llvm/ADT/DenseSet.h | 6 + .../llvm/include/llvm/ADT/EnumeratedArray.h | 1 + .../llvm/include/llvm/ADT/FloatingPointMode.h | 141 +- .../llvm/include/llvm/ADT/FoldingSet.h | 138 +- .../llvm/include/llvm/ADT/FunctionExtras.h | 225 +- .../llvm-project/llvm/include/llvm/ADT/Hashing.h | 20 +- .../llvm/include/llvm/ADT/ImmutableMap.h | 98 +- .../llvm/include/llvm/ADT/ImmutableSet.h | 104 +- .../llvm/include/llvm/ADT/IntervalMap.h | 14 +- .../llvm-project/llvm/include/llvm/ADT/Optional.h | 2 +- .../llvm/include/llvm/ADT/PointerEmbeddedInt.h | 2 +- .../llvm/include/llvm/ADT/PointerIntPair.h | 5 +- .../llvm/include/llvm/ADT/PointerSumType.h | 2 +- .../llvm/include/llvm/ADT/PointerUnion.h | 4 +- .../llvm/include/llvm/ADT/PostOrderIterator.h | 3 +- .../llvm/include/llvm/ADT/PriorityWorklist.h | 2 +- .../llvm/include/llvm/ADT/SCCIterator.h | 8 +- .../llvm-project/llvm/include/llvm/ADT/STLExtras.h | 631 +- .../llvm/include/llvm/ADT/ScopedHashTable.h | 2 +- .../llvm/include/llvm/ADT/SetOperations.h | 21 + .../llvm-project/llvm/include/llvm/ADT/SetVector.h | 25 +- .../llvm/include/llvm/ADT/SmallBitVector.h | 37 +- .../llvm/include/llvm/ADT/SmallPtrSet.h | 16 +- .../llvm/include/llvm/ADT/SmallString.h | 6 +- .../llvm/include/llvm/ADT/SmallVector.h | 107 +- .../llvm/include/llvm/ADT/SparseMultiSet.h | 2 +- .../llvm-project/llvm/include/llvm/ADT/SparseSet.h | 4 +- .../llvm/include/llvm/ADT/StringExtras.h | 22 +- .../llvm-project/llvm/include/llvm/ADT/StringMap.h | 230 +- .../llvm/include/llvm/ADT/StringMapEntry.h | 135 + .../llvm-project/llvm/include/llvm/ADT/StringRef.h | 32 +- .../llvm-project/llvm/include/llvm/ADT/StringSet.h | 66 +- .../llvm/include/llvm/ADT/TinyPtrVector.h | 8 +- .../llvm-project/llvm/include/llvm/ADT/Triple.h | 44 +- contrib/llvm-project/llvm/include/llvm/ADT/Twine.h | 4 +- .../llvm/include/llvm/ADT/TypeSwitch.h | 176 + .../llvm/include/llvm/ADT/Waymarking.h | 325 + contrib/llvm-project/llvm/include/llvm/ADT/bit.h | 23 +- .../llvm/include/llvm/ADT/fallible_iterator.h | 8 +- contrib/llvm-project/llvm/include/llvm/ADT/ilist.h | 8 +- .../llvm/include/llvm/ADT/ilist_iterator.h | 7 +- .../llvm-project/llvm/include/llvm/ADT/iterator.h | 20 +- .../llvm/include/llvm/Analysis/AliasAnalysis.h | 66 +- .../llvm/include/llvm/Analysis/AliasSetTracker.h | 7 +- .../include/llvm/Analysis/AssumeBundleQueries.h | 167 + .../llvm/include/llvm/Analysis/AssumptionCache.h | 42 +- .../include/llvm/Analysis/BasicAliasAnalysis.h | 4 +- .../include/llvm/Analysis/BlockFrequencyInfo.h | 3 + .../include/llvm/Analysis/BlockFrequencyInfoImpl.h | 126 +- .../include/llvm/Analysis/BranchProbabilityInfo.h | 22 +- .../llvm-project/llvm/include/llvm/Analysis/CFG.h | 6 +- .../llvm/include/llvm/Analysis/CFGPrinter.h | 194 +- .../llvm/include/llvm/Analysis/CGSCCPassManager.h | 87 +- .../llvm/include/llvm/Analysis/CallGraph.h | 36 +- .../llvm/include/llvm/Analysis/CallGraphSCCPass.h | 4 + .../llvm/include/llvm/Analysis/CaptureTracking.h | 46 +- .../llvm/include/llvm/Analysis/CodeMetrics.h | 4 +- .../llvm/include/llvm/Analysis/ConstantFolding.h | 14 +- .../llvm-project/llvm/include/llvm/Analysis/DDG.h | 40 + .../include/llvm/Analysis/DOTGraphTraitsPass.h | 2 - .../include/llvm/Analysis/DependenceAnalysis.h | 29 +- .../include/llvm/Analysis/DependenceGraphBuilder.h | 31 +- .../include/llvm/Analysis/DivergenceAnalysis.h | 2 +- .../llvm/include/llvm/Analysis/DomTreeUpdater.h | 8 +- .../llvm/include/llvm/Analysis/DominanceFrontier.h | 2 +- .../llvm/include/llvm/Analysis/EHPersonalities.h | 2 +- .../llvm/include/llvm/Analysis/GlobalsModRef.h | 5 +- .../llvm/include/llvm/Analysis/HeatUtils.h | 40 + .../llvm/include/llvm/Analysis/IVDescriptors.h | 23 +- .../include/llvm/Analysis/IndirectCallVisitor.h | 4 +- .../llvm/include/llvm/Analysis/InlineAdvisor.h | 238 + .../llvm/include/llvm/Analysis/InlineCost.h | 108 +- .../include/llvm/Analysis/InlineFeaturesAnalysis.h | 45 + .../include/llvm/Analysis/InlineModelFeatureMaps.h | 70 + .../llvm/Analysis/InlineSizeEstimatorAnalysis.h | 35 + .../llvm/Analysis/InstructionPrecedenceTracking.h | 20 +- .../include/llvm/Analysis/InstructionSimplify.h | 16 +- .../llvm/Analysis/IteratedDominanceFrontier.h | 2 +- .../llvm/Analysis/LazyBranchProbabilityInfo.h | 2 +- .../llvm/include/llvm/Analysis/LazyCallGraph.h | 17 + .../llvm/include/llvm/Analysis/LazyValueInfo.h | 24 +- .../llvm/Analysis/LegacyDivergenceAnalysis.h | 12 +- .../llvm/include/llvm/Analysis/Loads.h | 17 +- .../include/llvm/Analysis/LoopAccessAnalysis.h | 136 +- .../include/llvm/Analysis/LoopAnalysisManager.h | 23 +- .../llvm/include/llvm/Analysis/LoopInfo.h | 20 +- .../llvm/include/llvm/Analysis/LoopInfoImpl.h | 1 - .../llvm/include/llvm/Analysis/LoopNestAnalysis.h | 162 + .../llvm/include/llvm/Analysis/LoopPass.h | 40 - .../llvm/include/llvm/Analysis/MLInlineAdvisor.h | 107 + .../llvm/include/llvm/Analysis/MLModelRunner.h | 39 + .../llvm/include/llvm/Analysis/MemoryBuiltins.h | 14 +- .../llvm/Analysis/MemoryDependenceAnalysis.h | 30 +- .../llvm/include/llvm/Analysis/MemoryLocation.h | 42 +- .../llvm/include/llvm/Analysis/MemorySSA.h | 31 +- .../llvm/include/llvm/Analysis/MemorySSAUpdater.h | 24 +- .../include/llvm/Analysis/ModuleSummaryAnalysis.h | 26 +- .../llvm/include/llvm/Analysis/MustExecute.h | 135 +- .../include/llvm/Analysis/ObjCARCAnalysisUtils.h | 23 +- .../llvm/include/llvm/Analysis/ObjCARCInstKind.h | 2 - .../llvm/Analysis/OptimizationRemarkEmitter.h | 10 +- .../llvm/include/llvm/Analysis/OrderedBasicBlock.h | 74 - .../include/llvm/Analysis/OrderedInstructions.h | 64 - .../llvm/include/llvm/Analysis/Passes.h | 3 - .../llvm/include/llvm/Analysis/PhiValues.h | 1 - .../llvm/include/llvm/Analysis/PostDominators.h | 4 +- .../include/llvm/Analysis/ProfileSummaryInfo.h | 107 +- .../llvm/include/llvm/Analysis/PtrUseVisitor.h | 7 +- .../llvm/include/llvm/Analysis/RegionInfo.h | 5 +- .../llvm/include/llvm/Analysis/RegionInfoImpl.h | 8 +- .../llvm/include/llvm/Analysis/RegionPass.h | 4 +- .../llvm/include/llvm/Analysis/ScalarEvolution.h | 22 +- .../llvm/Analysis/ScalarEvolutionDivision.h | 69 + .../llvm/Analysis/ScalarEvolutionExpander.h | 415 -- .../llvm/Analysis/ScalarEvolutionExpressions.h | 24 +- .../llvm/Analysis/ScalarEvolutionNormalization.h | 2 +- .../llvm/include/llvm/Analysis/ScopedNoAliasAA.h | 1 - .../llvm/include/llvm/Analysis/StackLifetime.h | 202 + .../include/llvm/Analysis/StackSafetyAnalysis.h | 59 +- .../include/llvm/Analysis/SyncDependenceAnalysis.h | 5 - .../include/llvm/Analysis/SyntheticCountsUtils.h | 3 - .../llvm/include/llvm/Analysis/TargetFolder.h | 115 +- .../include/llvm/Analysis/TargetLibraryInfo.def | 36 + .../llvm/include/llvm/Analysis/TargetLibraryInfo.h | 36 +- .../include/llvm/Analysis/TargetTransformInfo.h | 923 +-- .../llvm/Analysis/TargetTransformInfoImpl.h | 715 ++- .../include/llvm/Analysis/TypeBasedAliasAnalysis.h | 3 +- .../llvm/include/llvm/Analysis/TypeMetadataUtils.h | 9 +- .../llvm/include/llvm/Analysis/Utils/Local.h | 18 +- .../llvm/include/llvm/Analysis/Utils/TFUtils.h | 115 + .../llvm/include/llvm/Analysis/ValueLattice.h | 267 +- .../llvm/include/llvm/Analysis/ValueTracking.h | 91 +- .../llvm/include/llvm/Analysis/VecFuncs.def | 23 + .../llvm/include/llvm/Analysis/VectorUtils.h | 237 +- .../llvm/include/llvm/AsmParser/Parser.h | 81 +- .../llvm/include/llvm/BinaryFormat/COFF.h | 6 + .../llvm/include/llvm/BinaryFormat/Dwarf.def | 94 +- .../llvm/include/llvm/BinaryFormat/Dwarf.h | 39 +- .../llvm/include/llvm/BinaryFormat/ELF.h | 129 +- .../llvm/BinaryFormat/ELFRelocs/AArch64.def | 4 + .../llvm/BinaryFormat/ELFRelocs/PowerPC64.def | 6 + .../include/llvm/BinaryFormat/ELFRelocs/RISCV.def | 1 + .../include/llvm/BinaryFormat/ELFRelocs/VE.def | 48 + .../llvm/include/llvm/BinaryFormat/MachO.h | 17 +- .../llvm/include/llvm/BinaryFormat/Magic.h | 6 +- .../include/llvm/BinaryFormat/MsgPackDocument.h | 99 +- .../llvm/include/llvm/BinaryFormat/MsgPackReader.h | 2 + .../llvm/include/llvm/BinaryFormat/Wasm.h | 31 +- .../llvm/include/llvm/BinaryFormat/WasmRelocs.def | 31 +- .../llvm/include/llvm/BinaryFormat/XCOFF.h | 57 +- .../llvm/include/llvm/Bitcode/BitcodeReader.h | 24 +- .../llvm/include/llvm/Bitcode/LLVMBitCodes.h | 17 +- .../llvm/include/llvm/Bitstream/BitstreamReader.h | 1 + .../llvm/include/llvm/CodeGen/Analysis.h | 6 +- .../llvm/include/llvm/CodeGen/AntiDepBreaker.h | 97 + .../llvm/include/llvm/CodeGen/AsmPrinter.h | 138 +- .../llvm/include/llvm/CodeGen/AsmPrinterHandler.h | 6 + .../llvm/include/llvm/CodeGen/BasicTTIImpl.h | 920 +-- .../llvm/include/llvm/CodeGen/CallingConvLower.h | 84 +- .../llvm/include/llvm/CodeGen/CommandFlags.h | 151 + .../llvm/include/llvm/CodeGen/CommandFlags.inc | 428 -- .../llvm-project/llvm/include/llvm/CodeGen/DIE.h | 49 +- .../llvm/CodeGen/DbgEntityHistoryCalculator.h | 3 +- .../llvm/include/llvm/CodeGen/DebugHandlerBase.h | 9 +- .../llvm/include/llvm/CodeGen/EdgeBundles.h | 1 - .../llvm/include/llvm/CodeGen/ExecutionDomainFix.h | 15 +- .../llvm/include/llvm/CodeGen/FastISel.h | 64 +- .../include/llvm/CodeGen/FunctionLoweringInfo.h | 75 +- .../llvm/include/llvm/CodeGen/GlobalISel/CSEInfo.h | 8 +- .../include/llvm/CodeGen/GlobalISel/CallLowering.h | 24 +- .../llvm/CodeGen/GlobalISel/CombinerHelper.h | 88 +- .../include/llvm/CodeGen/GlobalISel/CombinerInfo.h | 2 +- .../llvm/CodeGen/GlobalISel/GISelChangeObserver.h | 24 +- .../llvm/CodeGen/GlobalISel/GISelKnownBits.h | 36 +- .../include/llvm/CodeGen/GlobalISel/IRTranslator.h | 19 +- .../llvm/CodeGen/GlobalISel/InlineAsmLowering.h | 67 + .../llvm/CodeGen/GlobalISel/InstructionSelector.h | 7 + .../CodeGen/GlobalISel/InstructionSelectorImpl.h | 36 +- .../GlobalISel/LegalizationArtifactCombiner.h | 353 +- .../include/llvm/CodeGen/GlobalISel/Legalizer.h | 2 + .../llvm/CodeGen/GlobalISel/LegalizerHelper.h | 117 +- .../llvm/CodeGen/GlobalISel/LegalizerInfo.h | 120 +- .../include/llvm/CodeGen/GlobalISel/Localizer.h | 4 +- .../llvm/CodeGen/GlobalISel/LostDebugLocObserver.h | 50 + .../llvm/CodeGen/GlobalISel/MIPatternMatch.h | 74 +- .../llvm/CodeGen/GlobalISel/MachineIRBuilder.h | 236 +- .../llvm/include/llvm/CodeGen/GlobalISel/Types.h | 33 - .../llvm/include/llvm/CodeGen/GlobalISel/Utils.h | 58 +- .../llvm/include/llvm/CodeGen/ISDOpcodes.h | 2355 ++++---- .../llvm/include/llvm/CodeGen/IndirectThunks.h | 110 + .../llvm/include/llvm/CodeGen/IntrinsicLowering.h | 1 - .../llvm/include/llvm/CodeGen/LexicalScopes.h | 9 +- .../llvm/include/llvm/CodeGen/LiveInterval.h | 13 +- .../llvm/include/llvm/CodeGen/LiveIntervalCalc.h | 71 + .../llvm/include/llvm/CodeGen/LiveIntervals.h | 31 +- .../llvm/include/llvm/CodeGen/LiveRangeCalc.h | 57 +- .../llvm/include/llvm/CodeGen/LiveRangeEdit.h | 36 +- .../llvm/include/llvm/CodeGen/LiveVariables.h | 5 + .../llvm/include/llvm/CodeGen/MBFIWrapper.h | 46 + .../llvm/include/llvm/CodeGen/MIRParser/MIParser.h | 17 +- .../include/llvm/CodeGen/MIRParser/MIRParser.h | 6 +- .../llvm/include/llvm/CodeGen/MIRYamlMapping.h | 33 +- .../llvm/include/llvm/CodeGen/MachineBasicBlock.h | 149 +- .../llvm/CodeGen/MachineBlockFrequencyInfo.h | 2 + .../include/llvm/CodeGen/MachineCombinerPattern.h | 4 + .../include/llvm/CodeGen/MachineConstantPool.h | 40 +- .../llvm/include/llvm/CodeGen/MachineDominators.h | 12 +- .../llvm/include/llvm/CodeGen/MachineFrameInfo.h | 63 +- .../llvm/include/llvm/CodeGen/MachineFunction.h | 100 +- .../llvm/include/llvm/CodeGen/MachineInstr.h | 125 +- .../llvm/include/llvm/CodeGen/MachineInstrBundle.h | 4 +- .../llvm/CodeGen/MachineInstrBundleIterator.h | 4 +- .../llvm/include/llvm/CodeGen/MachineMemOperand.h | 30 +- .../llvm/include/llvm/CodeGen/MachineModuleInfo.h | 11 +- .../llvm/include/llvm/CodeGen/MachineOperand.h | 9 +- .../CodeGen/MachineOptimizationRemarkEmitter.h | 4 +- .../llvm/include/llvm/CodeGen/MachinePipeliner.h | 23 +- .../include/llvm/CodeGen/MachinePostDominators.h | 10 +- .../include/llvm/CodeGen/MachineRegisterInfo.h | 184 +- .../llvm/include/llvm/CodeGen/MachineSSAUpdater.h | 16 +- .../llvm/include/llvm/CodeGen/MachineScheduler.h | 11 +- .../llvm/include/llvm/CodeGen/MachineSizeOpts.h | 7 + .../llvm/include/llvm/CodeGen/ModuloSchedule.h | 35 +- .../llvm/include/llvm/CodeGen/ParallelCG.h | 5 +- .../llvm/include/llvm/CodeGen/Passes.h | 28 +- .../llvm/include/llvm/CodeGen/PseudoSourceValue.h | 5 +- .../include/llvm/CodeGen/ReachingDefAnalysis.h | 171 +- .../llvm/include/llvm/CodeGen/Register.h | 23 +- .../include/llvm/CodeGen/ResourcePriorityQueue.h | 10 +- .../llvm/include/llvm/CodeGen/ScheduleDAG.h | 4 + .../llvm/include/llvm/CodeGen/ScheduleDFS.h | 2 +- .../llvm/CodeGen/ScoreboardHazardRecognizer.h | 8 +- .../llvm/include/llvm/CodeGen/SelectionDAG.h | 337 +- .../llvm/include/llvm/CodeGen/SelectionDAGISel.h | 14 +- .../llvm/include/llvm/CodeGen/SelectionDAGNodes.h | 91 +- .../include/llvm/CodeGen/SelectionDAGTargetInfo.h | 11 +- .../llvm/include/llvm/CodeGen/SlotIndexes.h | 24 +- .../llvm/include/llvm/CodeGen/Spiller.h | 42 + .../llvm/include/llvm/CodeGen/StackMaps.h | 37 +- .../llvm/include/llvm/CodeGen/StackProtector.h | 2 +- .../llvm/include/llvm/CodeGen/TailDuplicator.h | 34 +- .../llvm/include/llvm/CodeGen/TargetCallingConv.h | 28 +- .../include/llvm/CodeGen/TargetFrameLowering.h | 73 +- .../llvm/include/llvm/CodeGen/TargetInstrInfo.h | 98 +- .../llvm/include/llvm/CodeGen/TargetLowering.h | 453 +- .../llvm/CodeGen/TargetLoweringObjectFileImpl.h | 36 +- .../llvm/include/llvm/CodeGen/TargetPassConfig.h | 20 +- .../llvm/include/llvm/CodeGen/TargetRegisterInfo.h | 84 +- .../include/llvm/CodeGen/TargetSubtargetInfo.h | 17 +- .../llvm/include/llvm/CodeGen/ValueTypes.h | 76 +- .../llvm/include/llvm/CodeGen/ValueTypes.td | 305 +- .../llvm/include/llvm/CodeGen/VirtRegMap.h | 1 - .../llvm/include/llvm/CodeGen/WasmEHFuncInfo.h | 6 +- .../llvm/include/llvm/DWARFLinker/DWARFLinker.h | 619 +- .../llvm/DWARFLinker/DWARFLinkerCompileUnit.h | 5 + .../llvm/DWARFLinker/DWARFLinkerDeclContext.h | 1 + .../llvm/include/llvm/DWARFLinker/DWARFStreamer.h | 219 + .../DebugInfo/CodeView/AppendingTypeTableBuilder.h | 3 +- .../llvm/DebugInfo/CodeView/CodeViewRecordIO.h | 14 +- .../DebugInfo/CodeView/ContinuationRecordBuilder.h | 1 - .../DebugInfo/CodeView/DebugSubsectionRecord.h | 23 +- .../DebugInfo/CodeView/GlobalTypeTableBuilder.h | 3 +- .../DebugInfo/CodeView/LazyRandomTypeCollection.h | 1 + .../DebugInfo/CodeView/MergingTypeTableBuilder.h | 3 +- .../llvm/DebugInfo/CodeView/SimpleTypeSerializer.h | 16 +- .../include/llvm/DebugInfo/CodeView/SymbolRecord.h | 7 + .../llvm/DebugInfo/CodeView/TypeCollection.h | 1 + .../llvm/DebugInfo/CodeView/TypeSymbolEmitter.h | 4 +- .../llvm/DebugInfo/CodeView/TypeTableCollection.h | 1 + .../llvm/include/llvm/DebugInfo/DIContext.h | 22 +- .../llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h | 27 +- .../llvm/DebugInfo/DWARF/DWARFAddressRange.h | 18 + .../include/llvm/DebugInfo/DWARF/DWARFContext.h | 83 +- .../llvm/DebugInfo/DWARF/DWARFDataExtractor.h | 28 + .../include/llvm/DebugInfo/DWARF/DWARFDebugAddr.h | 86 +- .../llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h | 13 +- .../llvm/DebugInfo/DWARF/DWARFDebugAranges.h | 8 +- .../include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h | 30 +- .../include/llvm/DebugInfo/DWARF/DWARFDebugLine.h | 84 +- .../include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h | 81 +- .../llvm/DebugInfo/DWARF/DWARFDebugPubTable.h | 16 +- .../llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h | 16 +- .../include/llvm/DebugInfo/DWARF/DWARFExpression.h | 28 +- .../include/llvm/DebugInfo/DWARF/DWARFFormValue.h | 2 + .../include/llvm/DebugInfo/DWARF/DWARFObject.h | 2 + .../llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h | 35 +- .../include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h | 75 +- .../include/llvm/DebugInfo/DWARF/DWARFVerifier.h | 11 +- .../include/llvm/DebugInfo/GSYM/DwarfTransformer.h | 91 + .../llvm/include/llvm/DebugInfo/GSYM/GsymCreator.h | 72 +- .../llvm/include/llvm/DebugInfo/GSYM/GsymReader.h | 63 +- .../llvm/include/llvm/DebugInfo/GSYM/InlineInfo.h | 2 +- .../llvm/include/llvm/DebugInfo/GSYM/LineTable.h | 18 + .../include/llvm/DebugInfo/GSYM/LookupResult.h | 4 +- .../llvm/DebugInfo/GSYM/ObjectFileTransformer.h | 51 + .../llvm/include/llvm/DebugInfo/GSYM/Range.h | 2 + .../include/llvm/DebugInfo/PDB/DIA/DIASession.h | 12 +- .../llvm/include/llvm/DebugInfo/PDB/GenericError.h | 1 - .../llvm/DebugInfo/PDB/IPDBInjectedSource.h | 6 +- .../include/llvm/DebugInfo/PDB/IPDBLineNumber.h | 2 +- .../include/llvm/DebugInfo/PDB/IPDBRawSymbol.h | 6 +- .../llvm/include/llvm/DebugInfo/PDB/IPDBSession.h | 11 +- .../PDB/Native/DbiModuleDescriptorBuilder.h | 3 +- .../llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h | 8 +- .../llvm/DebugInfo/PDB/Native/GSIStreamBuilder.h | 78 +- .../DebugInfo/PDB/Native/NativeEnumLineNumbers.h | 39 + .../DebugInfo/PDB/Native/NativeFunctionSymbol.h | 45 + .../llvm/DebugInfo/PDB/Native/NativeLineNumber.h | 51 + .../llvm/DebugInfo/PDB/Native/NativePublicSymbol.h | 44 + .../llvm/DebugInfo/PDB/Native/NativeSession.h | 23 +- .../llvm/DebugInfo/PDB/Native/NativeSourceFile.h | 40 + .../DebugInfo/PDB/Native/NativeTypeFunctionSig.h | 2 +- .../llvm/DebugInfo/PDB/Native/NativeTypePointer.h | 2 +- .../llvm/DebugInfo/PDB/Native/NativeTypeTypedef.h | 2 +- .../llvm/DebugInfo/PDB/Native/NativeTypeUDT.h | 2 +- .../llvm/DebugInfo/PDB/Native/NativeTypeVTShape.h | 2 +- .../llvm/DebugInfo/PDB/Native/PDBFileBuilder.h | 1 - .../llvm/DebugInfo/PDB/Native/SymbolCache.h | 51 +- .../llvm/include/llvm/DebugInfo/PDB/PDBSymbol.h | 6 +- .../llvm/include/llvm/DebugInfo/PDB/PDBTypes.h | 84 + .../include/llvm/DebugInfo/Symbolize/DIPrinter.h | 10 +- .../llvm/DebugInfo/Symbolize/SymbolizableModule.h | 5 +- .../include/llvm/DebugInfo/Symbolize/Symbolize.h | 6 +- .../llvm/include/llvm/Demangle/Demangle.h | 16 +- .../llvm/include/llvm/Demangle/ItaniumDemangle.h | 47 +- .../include/llvm/Demangle/MicrosoftDemangleNodes.h | 12 +- .../include/llvm/ExecutionEngine/ExecutionEngine.h | 16 +- .../include/llvm/ExecutionEngine/JITLink/ELF.h | 31 + .../llvm/ExecutionEngine/JITLink/ELF_x86_64.h | 52 + .../include/llvm/ExecutionEngine/JITLink/JITLink.h | 35 +- .../ExecutionEngine/JITLink/JITLinkMemoryManager.h | 12 + .../llvm/ExecutionEngine/JITLink/MachO_x86_64.h | 1 + .../llvm/include/llvm/ExecutionEngine/JITSymbol.h | 38 +- .../include/llvm/ExecutionEngine/ObjectCache.h | 3 +- .../ExecutionEngine/Orc/CompileOnDemandLayer.h | 92 +- .../llvm/ExecutionEngine/Orc/CompileUtils.h | 4 +- .../llvm/include/llvm/ExecutionEngine/Orc/Core.h | 405 +- .../include/llvm/ExecutionEngine/Orc/DebugUtils.h | 72 + .../llvm/ExecutionEngine/Orc/ExecutionUtils.h | 72 + .../llvm/ExecutionEngine/Orc/IRCompileLayer.h | 10 +- .../llvm/ExecutionEngine/Orc/IRTransformLayer.h | 7 +- .../llvm/ExecutionEngine/Orc/IndirectionUtils.h | 136 +- .../ExecutionEngine/Orc/JITTargetMachineBuilder.h | 11 +- .../llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h | 170 +- .../llvm/include/llvm/ExecutionEngine/Orc/Layer.h | 33 +- .../llvm/ExecutionEngine/Orc/LazyEmittingLayer.h | 2 +- .../llvm/ExecutionEngine/Orc/LazyReexports.h | 96 +- .../llvm/include/llvm/ExecutionEngine/Orc/Legacy.h | 12 +- .../llvm/ExecutionEngine/Orc/MachOPlatform.h | 161 + .../include/llvm/ExecutionEngine/Orc/Mangling.h | 66 + .../llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h | 15 + .../llvm/ExecutionEngine/Orc/OrcABISupport.h | 355 +- .../include/llvm/ExecutionEngine/Orc/OrcError.h | 4 +- .../ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h | 3 +- .../ExecutionEngine/Orc/OrcRemoteTargetServer.h | 44 +- .../ExecutionEngine/Orc/RPC/RPCSerialization.h | 17 +- .../llvm/ExecutionEngine/Orc/RPC/RPCUtils.h | 43 +- .../llvm/ExecutionEngine/Orc/RPC/RawByteChannel.h | 32 +- .../ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h | 30 +- .../include/llvm/ExecutionEngine/Orc/Speculation.h | 5 +- .../llvm/ExecutionEngine/Orc/SymbolStringPool.h | 7 +- .../llvm/ExecutionEngine/Orc/ThreadSafeModule.h | 7 +- .../include/llvm/ExecutionEngine/RuntimeDyld.h | 27 +- .../llvm/ExecutionEngine/SectionMemoryManager.h | 1 - .../llvm/Frontend/Directive/DirectiveBase.td | 109 + .../llvm/include/llvm/Frontend/OpenACC/ACC.td | 604 ++ .../llvm/include/llvm/Frontend/OpenMP/OMP.td | 1489 +++++ .../include/llvm/Frontend/OpenMP/OMPConstants.h | 69 +- .../llvm/include/llvm/Frontend/OpenMP/OMPContext.h | 187 + .../include/llvm/Frontend/OpenMP/OMPGridValues.h | 131 + .../include/llvm/Frontend/OpenMP/OMPIRBuilder.h | 258 +- .../llvm/include/llvm/Frontend/OpenMP/OMPKinds.def | 870 ++- .../llvm/include/llvm/FuzzMutate/FuzzerCLI.h | 3 +- .../llvm/include/llvm/FuzzMutate/Random.h | 6 +- .../llvm/include/llvm/IR/AbstractCallSite.h | 247 + .../llvm-project/llvm/include/llvm/IR/Argument.h | 11 +- .../llvm-project/llvm/include/llvm/IR/Attributes.h | 46 +- .../llvm/include/llvm/IR/Attributes.td | 34 +- .../llvm/include/llvm/IR/AutoUpgrade.h | 8 +- .../llvm-project/llvm/include/llvm/IR/BasicBlock.h | 107 +- contrib/llvm-project/llvm/include/llvm/IR/CFG.h | 43 +- .../llvm-project/llvm/include/llvm/IR/CFGDiff.h | 284 - .../llvm-project/llvm/include/llvm/IR/CallSite.h | 926 --- .../llvm-project/llvm/include/llvm/IR/Constant.h | 2 + .../llvm/include/llvm/IR/ConstantFolder.h | 107 +- .../llvm/include/llvm/IR/ConstantRange.h | 4 + .../llvm-project/llvm/include/llvm/IR/Constants.h | 103 +- .../llvm/include/llvm/IR/ConstrainedOps.def | 105 +- .../llvm-project/llvm/include/llvm/IR/DIBuilder.h | 35 +- .../llvm-project/llvm/include/llvm/IR/DataLayout.h | 42 +- .../llvm-project/llvm/include/llvm/IR/DebugInfo.h | 18 +- .../llvm/include/llvm/IR/DebugInfoMetadata.h | 345 +- .../llvm-project/llvm/include/llvm/IR/DebugLoc.h | 2 +- .../llvm/include/llvm/IR/DerivedTypes.h | 275 +- .../llvm/include/llvm/IR/DiagnosticInfo.h | 46 +- .../llvm-project/llvm/include/llvm/IR/Dominators.h | 7 +- contrib/llvm-project/llvm/include/llvm/IR/FPEnv.h | 22 +- .../llvm-project/llvm/include/llvm/IR/Function.h | 28 +- .../include/llvm/IR/GetElementPtrTypeIterator.h | 12 +- .../llvm/include/llvm/IR/GlobalObject.h | 25 +- .../llvm/include/llvm/IR/GlobalValue.h | 31 +- .../llvm/include/llvm/IR/GlobalVariable.h | 1 - .../llvm-project/llvm/include/llvm/IR/IRBuilder.h | 1044 ++-- .../llvm/include/llvm/IR/IRBuilderFolder.h | 141 + .../llvm/include/llvm/IR/IRPrintingPasses.h | 17 +- .../llvm-project/llvm/include/llvm/IR/InlineAsm.h | 91 + .../llvm/include/llvm/IR/InstVisitor.h | 26 +- .../llvm-project/llvm/include/llvm/IR/InstrTypes.h | 170 +- .../llvm/include/llvm/IR/Instruction.h | 87 +- .../llvm/include/llvm/IR/Instructions.h | 655 +-- .../llvm/include/llvm/IR/IntrinsicInst.h | 1685 +++--- .../llvm-project/llvm/include/llvm/IR/Intrinsics.h | 50 +- .../llvm/include/llvm/IR/Intrinsics.td | 436 +- .../llvm/include/llvm/IR/IntrinsicsAArch64.td | 923 ++- .../llvm/include/llvm/IR/IntrinsicsAMDGPU.td | 696 ++- .../llvm/include/llvm/IR/IntrinsicsARM.td | 361 +- .../llvm/include/llvm/IR/IntrinsicsBPF.td | 5 +- .../llvm/include/llvm/IR/IntrinsicsHexagon.td | 6212 +------------------- .../llvm/include/llvm/IR/IntrinsicsHexagonDep.td | 6144 +++++++++++++++++++ .../llvm/include/llvm/IR/IntrinsicsMips.td | 268 +- .../llvm/include/llvm/IR/IntrinsicsNVVM.td | 26 +- .../llvm/include/llvm/IR/IntrinsicsPowerPC.td | 223 +- .../llvm/include/llvm/IR/IntrinsicsRISCV.td | 4 +- .../llvm/include/llvm/IR/IntrinsicsSystemZ.td | 126 +- .../llvm/include/llvm/IR/IntrinsicsWebAssembly.td | 63 +- .../llvm/include/llvm/IR/IntrinsicsX86.td | 801 +-- .../llvm/include/llvm/IR/IntrinsicsXCore.td | 72 +- .../llvm/include/llvm/IR/LLVMContext.h | 50 +- .../llvm/include/llvm/IR/LLVMRemarkStreamer.h | 95 + .../llvm/include/llvm/IR/LegacyPassManagers.h | 3 +- .../llvm/include/llvm/IR/LegacyPassNameParser.h | 41 - .../llvm-project/llvm/include/llvm/IR/Mangler.h | 2 +- .../llvm/include/llvm/IR/MatrixBuilder.h | 221 + .../llvm-project/llvm/include/llvm/IR/Metadata.h | 32 +- contrib/llvm-project/llvm/include/llvm/IR/Module.h | 42 +- .../llvm/include/llvm/IR/ModuleSummaryIndex.h | 150 +- .../llvm/include/llvm/IR/ModuleSummaryIndexYAML.h | 9 +- .../llvm-project/llvm/include/llvm/IR/NoFolder.h | 155 +- .../llvm-project/llvm/include/llvm/IR/Operator.h | 47 +- .../llvm/include/llvm/IR/PassInstrumentation.h | 2 +- .../llvm/include/llvm/IR/PassManager.h | 170 +- .../llvm/include/llvm/IR/PassManagerImpl.h | 157 + .../llvm/include/llvm/IR/PassTimingInfo.h | 9 +- .../llvm/include/llvm/IR/PatternMatch.h | 325 +- .../llvm/include/llvm/IR/ProfileSummary.h | 31 +- .../llvm/include/llvm/IR/RemarkStreamer.h | 108 - .../llvm/include/llvm/IR/RuntimeLibcalls.def | 5 + .../llvm-project/llvm/include/llvm/IR/Statepoint.h | 309 +- contrib/llvm-project/llvm/include/llvm/IR/Type.h | 83 +- contrib/llvm-project/llvm/include/llvm/IR/Use.h | 69 +- contrib/llvm-project/llvm/include/llvm/IR/User.h | 5 + .../llvm/include/llvm/IR/VPIntrinsics.def | 84 + contrib/llvm-project/llvm/include/llvm/IR/Value.h | 62 +- .../llvm/include/llvm/IR/ValueHandle.h | 44 +- .../llvm-project/llvm/include/llvm/IR/ValueMap.h | 2 +- .../llvm/include/llvm/IRReader/IRReader.h | 29 +- .../llvm/include/llvm/InitializePasses.h | 15 + .../llvm-project/llvm/include/llvm/LTO/Config.h | 19 + contrib/llvm-project/llvm/include/llvm/LTO/LTO.h | 29 +- .../llvm/include/llvm/LTO/LTOBackend.h | 3 + .../include/llvm/LTO/legacy/LTOCodeGenerator.h | 6 +- .../llvm/include/llvm/LTO/legacy/LTOModule.h | 4 + .../llvm-project/llvm/include/llvm/LinkAllPasses.h | 7 +- .../llvm/include/llvm/MC/ConstantPools.h | 1 - .../llvm/include/llvm/MC/LaneBitmask.h | 6 +- .../llvm/include/llvm/MC/MCAsmBackend.h | 25 +- .../llvm-project/llvm/include/llvm/MC/MCAsmInfo.h | 47 +- .../llvm/include/llvm/MC/MCAsmLayout.h | 4 + .../llvm/include/llvm/MC/MCAssembler.h | 5 +- .../llvm-project/llvm/include/llvm/MC/MCContext.h | 88 +- .../llvm/include/llvm/MC/MCDirectives.h | 51 +- .../llvm/MC/MCDisassembler/MCDisassembler.h | 87 +- .../llvm-project/llvm/include/llvm/MC/MCDwarf.h | 23 +- .../llvm/include/llvm/MC/MCELFObjectWriter.h | 14 +- .../llvm/include/llvm/MC/MCELFStreamer.h | 42 +- contrib/llvm-project/llvm/include/llvm/MC/MCExpr.h | 237 +- .../llvm-project/llvm/include/llvm/MC/MCFixup.h | 13 +- .../llvm-project/llvm/include/llvm/MC/MCFragment.h | 33 +- .../llvm/include/llvm/MC/MCInstPrinter.h | 34 +- .../llvm/include/llvm/MC/MCInstrDesc.h | 25 +- .../llvm/include/llvm/MC/MCInstrInfo.h | 25 +- .../llvm/include/llvm/MC/MCInstrItineraries.h | 7 +- .../llvm/include/llvm/MC/MCMachObjectWriter.h | 3 +- .../llvm/include/llvm/MC/MCObjectFileInfo.h | 12 +- .../llvm/include/llvm/MC/MCObjectStreamer.h | 102 +- .../llvm/include/llvm/MC/MCObjectWriter.h | 6 - .../llvm/include/llvm/MC/MCParser/AsmLexer.h | 4 +- .../llvm/include/llvm/MC/MCParser/MCAsmParser.h | 25 +- .../llvm/MC/MCParser/MCAsmParserExtension.h | 2 + .../include/llvm/MC/MCParser/MCTargetAsmParser.h | 18 +- .../llvm-project/llvm/include/llvm/MC/MCRegister.h | 19 +- .../llvm-project/llvm/include/llvm/MC/MCSchedule.h | 2 +- .../llvm-project/llvm/include/llvm/MC/MCSection.h | 9 +- .../llvm/include/llvm/MC/MCSectionCOFF.h | 13 +- .../llvm/include/llvm/MC/MCSectionELF.h | 34 +- .../llvm/include/llvm/MC/MCSectionMachO.h | 7 - .../llvm/include/llvm/MC/MCSectionWasm.h | 18 +- .../llvm/include/llvm/MC/MCSectionXCOFF.h | 22 +- .../llvm-project/llvm/include/llvm/MC/MCStreamer.h | 247 +- .../llvm/include/llvm/MC/MCSubtargetInfo.h | 9 +- .../llvm/include/llvm/MC/MCSymbolWasm.h | 37 +- .../llvm/include/llvm/MC/MCSymbolXCOFF.h | 52 +- .../llvm/include/llvm/MC/MCTargetOptions.h | 11 + .../include/llvm/MC/MCTargetOptionsCommandFlags.h | 57 + .../llvm/MC/MCTargetOptionsCommandFlags.inc | 65 - .../llvm-project/llvm/include/llvm/MC/MCValue.h | 2 - .../llvm/include/llvm/MC/MCWasmObjectWriter.h | 2 +- .../llvm/include/llvm/MC/MCWasmStreamer.h | 36 +- .../llvm/include/llvm/MC/MCWinCOFFObjectWriter.h | 2 +- .../llvm/include/llvm/MC/MCWinCOFFStreamer.h | 29 +- .../llvm/include/llvm/MC/MCXCOFFObjectWriter.h | 7 + .../llvm/include/llvm/MC/MCXCOFFStreamer.h | 18 +- .../llvm/include/llvm/MC/StringTableBuilder.h | 10 + .../llvm/include/llvm/MC/SubtargetFeature.h | 2 +- .../llvm/include/llvm/MCA/CodeEmitter.h | 3 - .../llvm/include/llvm/MCA/HardwareUnits/LSUnit.h | 51 +- .../include/llvm/MCA/HardwareUnits/RegisterFile.h | 3 +- .../llvm/MCA/HardwareUnits/ResourceManager.h | 1 - .../llvm-project/llvm/include/llvm/MCA/Pipeline.h | 2 - .../llvm/include/llvm/MCA/Stages/DispatchStage.h | 1 - .../llvm/include/llvm/Object/ArchiveWriter.h | 3 - .../llvm-project/llvm/include/llvm/Object/Binary.h | 8 +- .../llvm-project/llvm/include/llvm/Object/COFF.h | 136 +- .../llvm/include/llvm/Object/COFFImportFile.h | 2 +- .../llvm-project/llvm/include/llvm/Object/ELF.h | 58 +- .../llvm/include/llvm/Object/ELFObjectFile.h | 121 +- .../llvm/include/llvm/Object/ELFTypes.h | 15 +- .../llvm-project/llvm/include/llvm/Object/Error.h | 10 +- .../llvm/include/llvm/Object/IRObjectFile.h | 2 +- .../llvm/include/llvm/Object/IRSymtab.h | 1 + .../llvm-project/llvm/include/llvm/Object/MachO.h | 11 +- .../llvm/include/llvm/Object/MachOUniversal.h | 23 +- .../llvm/include/llvm/Object/ModuleSymbolTable.h | 1 + .../llvm/include/llvm/Object/ObjectFile.h | 23 +- .../llvm/include/llvm/Object/SymbolicFile.h | 7 +- .../llvm/include/llvm/Object/TapiFile.h | 5 +- .../llvm/include/llvm/Object/TapiUniversal.h | 28 +- .../llvm-project/llvm/include/llvm/Object/Wasm.h | 13 +- .../llvm/include/llvm/Object/XCOFFObjectFile.h | 26 +- .../llvm/include/llvm/ObjectYAML/DWARFEmitter.h | 21 +- .../llvm/include/llvm/ObjectYAML/DWARFYAML.h | 91 +- .../llvm/include/llvm/ObjectYAML/ELFYAML.h | 138 +- .../llvm/include/llvm/ObjectYAML/MachOYAML.h | 20 + .../llvm/include/llvm/ObjectYAML/WasmYAML.h | 20 +- .../llvm/include/llvm/ObjectYAML/yaml2obj.h | 11 +- .../llvm/include/llvm/Option/OptParser.td | 43 + .../llvm-project/llvm/include/llvm/Option/Option.h | 14 +- contrib/llvm-project/llvm/include/llvm/Pass.h | 14 +- .../llvm/include/llvm/PassAnalysisSupport.h | 34 +- .../llvm-project/llvm/include/llvm/PassSupport.h | 4 + .../llvm/include/llvm/Passes/PassBuilder.h | 96 +- .../llvm/ProfileData/Coverage/CoverageMapping.h | 233 +- .../ProfileData/Coverage/CoverageMappingReader.h | 48 +- .../ProfileData/Coverage/CoverageMappingWriter.h | 5 +- .../llvm/include/llvm/ProfileData/GCOV.h | 322 +- .../llvm/include/llvm/ProfileData/InstrProf.h | 14 +- .../include/llvm/ProfileData/InstrProfData.inc | 51 +- .../llvm/include/llvm/ProfileData/ProfileCommon.h | 4 + .../llvm/include/llvm/ProfileData/SampleProf.h | 153 +- .../include/llvm/ProfileData/SampleProfReader.h | 35 +- .../include/llvm/ProfileData/SampleProfWriter.h | 34 +- .../llvm/include/llvm/Remarks/Remark.h | 2 +- .../llvm/include/llvm/Remarks/RemarkLinker.h | 3 +- .../llvm/include/llvm/Remarks/RemarkStreamer.h | 73 + .../llvm/include/llvm/Remarks/RemarkStringTable.h | 5 +- .../include/llvm/Support/AArch64TargetParser.def | 26 + .../include/llvm/Support/AArch64TargetParser.h | 11 +- .../llvm/include/llvm/Support/AMDGPUMetadata.h | 7 +- .../llvm/include/llvm/Support/ARMAttributeParser.h | 173 +- .../llvm/include/llvm/Support/ARMBuildAttributes.h | 109 +- .../llvm/include/llvm/Support/ARMTargetParser.def | 24 + .../llvm/include/llvm/Support/ARMTargetParser.h | 50 +- .../llvm/include/llvm/Support/Alignment.h | 166 +- .../llvm/include/llvm/Support/Allocator.h | 150 +- .../llvm/include/llvm/Support/AllocatorBase.h | 103 + .../llvm/include/llvm/Support/AtomicOrdering.h | 5 +- .../llvm/include/llvm/Support/Base64.h | 56 + .../llvm/include/llvm/Support/BinaryStreamArray.h | 1 + .../llvm/include/llvm/Support/BinaryStreamReader.h | 3 +- .../llvm/include/llvm/Support/BinaryStreamWriter.h | 2 +- .../llvm/include/llvm/Support/BranchProbability.h | 4 +- .../llvm/include/llvm/Support/CFGDiff.h | 250 + .../llvm/include/llvm/Support/CFGUpdate.h | 12 +- .../llvm/include/llvm/Support/CachePruning.h | 3 +- .../llvm/include/llvm/Support/Casting.h | 64 +- .../llvm/include/llvm/Support/CheckedArithmetic.h | 18 +- .../llvm/include/llvm/Support/Chrono.h | 4 +- .../llvm/include/llvm/Support/CommandLine.h | 29 +- .../llvm/include/llvm/Support/Compiler.h | 64 +- .../llvm/include/llvm/Support/DataExtractor.h | 146 +- .../llvm/include/llvm/Support/DebugCounter.h | 7 +- .../llvm/include/llvm/Support/ELFAttributeParser.h | 72 + .../llvm/include/llvm/Support/ELFAttributes.h | 37 + .../llvm/include/llvm/Support/Endian.h | 4 +- .../llvm-project/llvm/include/llvm/Support/Errno.h | 4 +- .../llvm-project/llvm/include/llvm/Support/Error.h | 35 +- .../llvm/include/llvm/Support/ErrorHandling.h | 11 +- .../llvm/include/llvm/Support/ErrorOr.h | 48 +- .../llvm/include/llvm/Support/ExtensibleRTTI.h | 135 + .../llvm/include/llvm/Support/FileCheck.h | 19 +- .../llvm/include/llvm/Support/FileCollector.h | 58 +- .../llvm/include/llvm/Support/FileOutputBuffer.h | 2 - .../llvm/include/llvm/Support/FormatAdapters.h | 11 +- .../llvm/include/llvm/Support/FormatProviders.h | 14 +- .../llvm/include/llvm/Support/FormatVariadic.h | 63 +- .../include/llvm/Support/FormatVariadicDetails.h | 34 +- .../llvm/include/llvm/Support/FormattedStream.h | 40 +- .../llvm/include/llvm/Support/GenericDomTree.h | 66 +- .../llvm/Support/GenericDomTreeConstruction.h | 77 +- .../Support/GenericIteratedDominanceFrontier.h | 20 +- .../llvm/include/llvm/Support/GlobPattern.h | 4 +- .../llvm/include/llvm/Support/GraphWriter.h | 20 +- .../llvm-project/llvm/include/llvm/Support/Host.h | 8 +- .../llvm/Support/ItaniumManglingCanonicalizer.h | 6 +- .../llvm-project/llvm/include/llvm/Support/JSON.h | 29 +- .../llvm/include/llvm/Support/KnownBits.h | 93 +- .../llvm/include/llvm/Support/LEB128.h | 4 +- .../llvm/include/llvm/Support/LockFileManager.h | 4 +- .../llvm/include/llvm/Support/LowLevelTypeImpl.h | 28 + .../llvm-project/llvm/include/llvm/Support/MD5.h | 2 +- .../include/llvm/Support/MSVCErrorWorkarounds.h | 9 +- .../llvm/include/llvm/Support/MachineValueType.h | 489 +- .../llvm/include/llvm/Support/MathExtras.h | 77 +- .../llvm/include/llvm/Support/MemAlloc.h | 23 +- .../llvm/include/llvm/Support/MemoryBuffer.h | 22 +- .../llvm/include/llvm/Support/NativeFormatting.h | 3 +- .../include/llvm/Support/OptimizedStructLayout.h | 142 + .../llvm/include/llvm/Support/Parallel.h | 92 +- .../llvm-project/llvm/include/llvm/Support/Path.h | 42 +- .../include/llvm/Support/PointerLikeTypeTraits.h | 21 +- .../llvm/include/llvm/Support/PrettyStackTrace.h | 7 + .../llvm/include/llvm/Support/Process.h | 7 +- .../llvm/include/llvm/Support/Program.h | 28 +- .../include/llvm/Support/RISCVAttributeParser.h | 37 + .../llvm/include/llvm/Support/RISCVAttributes.h | 44 + .../llvm-project/llvm/include/llvm/Support/Regex.h | 16 +- .../llvm-project/llvm/include/llvm/Support/SHA1.h | 9 +- .../llvm/include/llvm/Support/ScaledNumber.h | 4 +- .../include/llvm/Support/SmallVectorMemoryBuffer.h | 2 +- .../llvm/include/llvm/Support/SourceMgr.h | 98 +- .../llvm/include/llvm/Support/SpecialCaseList.h | 20 +- .../llvm/include/llvm/Support/StringPool.h | 139 - .../llvm/include/llvm/Support/SuffixTree.h | 350 ++ .../llvm/include/llvm/Support/SwapByteOrder.h | 81 +- .../llvm/include/llvm/Support/SystemUtils.h | 7 +- .../llvm/include/llvm/Support/TargetOpcodes.def | 41 +- .../llvm/include/llvm/Support/TargetParser.h | 53 +- .../llvm/include/llvm/Support/TaskQueue.h | 6 +- .../llvm/include/llvm/Support/ThreadPool.h | 25 +- .../llvm/include/llvm/Support/Threading.h | 98 +- .../llvm/include/llvm/Support/TimeProfiler.h | 26 +- .../llvm/include/llvm/Support/ToolOutputFile.h | 11 +- .../llvm/include/llvm/Support/TrailingObjects.h | 8 +- .../llvm/include/llvm/Support/TrigramIndex.h | 1 - .../llvm/include/llvm/Support/TypeSize.h | 70 +- .../llvm/include/llvm/Support/VersionTuple.h | 9 +- .../llvm/include/llvm/Support/VirtualFileSystem.h | 23 +- .../include/llvm/Support/Windows/WindowsSupport.h | 6 + .../llvm/include/llvm/Support/WithColor.h | 48 +- .../llvm/Support/X86DisassemblerDecoderCommon.h | 5 +- .../llvm/include/llvm/Support/X86TargetParser.def | 281 +- .../llvm/include/llvm/Support/X86TargetParser.h | 148 + .../llvm/include/llvm/Support/YAMLParser.h | 2 +- .../llvm/include/llvm/Support/YAMLTraits.h | 127 +- .../include/llvm/Support/circular_raw_ostream.h | 4 +- .../llvm/include/llvm/Support/raw_ostream.h | 93 +- .../llvm/include/llvm/Support/type_traits.h | 13 +- .../llvm-project/llvm/include/llvm/TableGen/Main.h | 2 +- .../llvm/include/llvm/TableGen/Record.h | 22 +- .../include/llvm/TableGen/StringToOffsetTable.h | 2 +- .../llvm/include/llvm/Target/GenericOpcodes.td | 110 +- .../llvm/include/llvm/Target/GlobalISel/Combine.td | 139 +- .../llvm/Target/GlobalISel/SelectionDAGCompat.td | 14 + .../llvm/include/llvm/Target/GlobalISel/Target.td | 9 +- .../llvm/include/llvm/Target/Target.td | 73 +- .../llvm/include/llvm/Target/TargetCallingConv.td | 5 + .../llvm/include/llvm/Target/TargetIntrinsicInfo.h | 1 - .../llvm/include/llvm/Target/TargetItinerary.td | 2 +- .../include/llvm/Target/TargetLoweringObjectFile.h | 66 +- .../llvm/include/llvm/Target/TargetMachine.h | 35 +- .../llvm/include/llvm/Target/TargetOptions.h | 94 +- .../llvm/include/llvm/Target/TargetSchedule.td | 4 +- .../llvm/include/llvm/Target/TargetSelectionDAG.td | 67 +- .../include/llvm/Testing/Support/Annotations.h | 2 + .../llvm/include/llvm/Testing/Support/Error.h | 42 + .../llvm/include/llvm/TextAPI/ELF/TBEHandler.h | 1 - .../include/llvm/TextAPI/MachO/Architecture.def | 27 +- .../llvm/include/llvm/TextAPI/MachO/Architecture.h | 14 +- .../include/llvm/TextAPI/MachO/ArchitectureSet.h | 5 +- .../include/llvm/TextAPI/MachO/InterfaceFile.h | 31 +- .../include/llvm/TextAPI/MachO/PackedVersion.h | 7 +- .../include/llvm/TextAPI/MachO/TextAPIReader.h | 4 +- .../include/llvm/TextAPI/MachO/TextAPIWriter.h | 6 +- .../llvm/Transforms/Coroutines/CoroCleanup.h | 28 + .../include/llvm/Transforms/Coroutines/CoroEarly.h | 31 + .../include/llvm/Transforms/Coroutines/CoroElide.h | 30 + .../include/llvm/Transforms/Coroutines/CoroSplit.h | 30 + .../llvm/include/llvm/Transforms/IPO.h | 24 +- .../llvm/Transforms/IPO/ArgumentPromotion.h | 12 + .../llvm/include/llvm/Transforms/IPO/Attributor.h | 1586 +++-- .../include/llvm/Transforms/IPO/FunctionImport.h | 10 +- .../llvm/include/llvm/Transforms/IPO/Inliner.h | 49 +- .../include/llvm/Transforms/IPO/LowerTypeTests.h | 7 +- .../llvm/include/llvm/Transforms/IPO/OpenMPOpt.h | 66 + .../llvm/Transforms/IPO/PassManagerBuilder.h | 11 +- .../Transforms/IPO/SyntheticCountsPropagation.h | 12 +- .../llvm/Transforms/IPO/WholeProgramDevirt.h | 5 + .../llvm/Transforms/InstCombine/InstCombine.h | 16 +- .../Transforms/InstCombine/InstCombineWorklist.h | 90 +- .../llvm/include/llvm/Transforms/Instrumentation.h | 25 +- .../Transforms/Instrumentation/AddressSanitizer.h | 2 +- .../Instrumentation/AddressSanitizerCommon.h | 49 + .../llvm/Transforms/Instrumentation/CGProfile.h | 5 - .../Transforms/Instrumentation/InstrProfiling.h | 3 + .../Transforms/Instrumentation/SanitizerCoverage.h | 25 +- .../llvm/include/llvm/Transforms/Scalar.h | 4 - .../Transforms/Scalar/AlignmentFromAssumptions.h | 14 +- .../include/llvm/Transforms/Scalar/Float2Int.h | 8 +- .../llvm/include/llvm/Transforms/Scalar/GVN.h | 58 +- .../include/llvm/Transforms/Scalar/GVNExpression.h | 9 +- .../Scalar/InductiveRangeCheckElimination.h | 4 +- .../include/llvm/Transforms/Scalar/JumpThreading.h | 11 +- .../llvm/Transforms/Scalar/LoopPassManager.h | 57 +- .../llvm/Transforms/Scalar/LoopUnrollAndJamPass.h | 3 - .../llvm/Transforms/Scalar/MemCpyOptimizer.h | 11 +- .../include/llvm/Transforms/Scalar/Reassociate.h | 4 +- .../llvm/include/llvm/Transforms/Utils.h | 37 +- .../llvm/Transforms/Utils/AMDGPUEmitPrintf.h | 25 + .../llvm/Transforms/Utils/AssumeBundleBuilder.h | 60 + .../llvm/Transforms/Utils/BasicBlockUtils.h | 100 +- .../include/llvm/Transforms/Utils/BuildLibCalls.h | 103 +- .../llvm/Transforms/Utils/CallGraphUpdater.h | 109 + .../llvm/Transforms/Utils/CallPromotionUtils.h | 39 +- .../Transforms/Utils/CanonicalizeFreezeInLoops.h | 33 + .../llvm/include/llvm/Transforms/Utils/Cloning.h | 24 +- .../include/llvm/Transforms/Utils/CodeExtractor.h | 6 +- .../include/llvm/Transforms/Utils/CodeMoverUtils.h | 41 +- .../llvm/include/llvm/Transforms/Utils/Debugify.h | 22 + .../llvm/include/llvm/Transforms/Utils/Evaluator.h | 20 +- .../llvm/Transforms/Utils/FunctionComparator.h | 2 +- .../llvm/Transforms/Utils/FunctionImportUtils.h | 23 +- .../llvm/include/llvm/Transforms/Utils/Local.h | 102 +- .../include/llvm/Transforms/Utils/LoopSimplify.h | 8 +- .../llvm/include/llvm/Transforms/Utils/LoopUtils.h | 156 +- .../include/llvm/Transforms/Utils/LoopVersioning.h | 20 +- .../llvm/Transforms/Utils/LowerMemIntrinsics.h | 6 +- .../include/llvm/Transforms/Utils/ModuleUtils.h | 8 +- .../include/llvm/Transforms/Utils/PredicateInfo.h | 85 +- .../llvm/Transforms/Utils/PromoteMemToReg.h | 1 - .../include/llvm/Transforms/Utils/SSAUpdaterBulk.h | 1 - .../Transforms/Utils/ScalarEvolutionExpander.h | 435 ++ .../include/llvm/Transforms/Utils/SimplifyIndVar.h | 7 +- .../llvm/Transforms/Utils/SimplifyLibCalls.h | 169 +- .../llvm/include/llvm/Transforms/Utils/SizeOpts.h | 51 +- .../llvm/Transforms/Utils/UnifyFunctionExitNodes.h | 3 +- .../Transforms/Utils/UniqueInternalLinkageNames.h | 31 + .../include/llvm/Transforms/Utils/UnrollLoop.h | 46 +- .../include/llvm/Transforms/Utils/VNCoercion.h | 6 +- .../llvm/include/llvm/Transforms/Vectorize.h | 6 + .../Vectorize/LoopVectorizationLegality.h | 20 +- .../llvm/Transforms/Vectorize/LoopVectorize.h | 32 +- .../llvm/Transforms/Vectorize/SLPVectorizer.h | 13 +- .../llvm/Transforms/Vectorize/VectorCombine.h | 30 + .../llvm-project/llvm/include/llvm/XRay/Graph.h | 24 +- .../llvm/include/llvm/XRay/InstrumentationMap.h | 4 + .../llvm/include/llvm/module.modulemap | 22 +- 787 files changed, 44550 insertions(+), 23836 deletions(-) create mode 100644 contrib/llvm-project/llvm/include/llvm-c/Orc.h create mode 100644 contrib/llvm-project/llvm/include/llvm/ADT/Bitfields.h create mode 100644 contrib/llvm-project/llvm/include/llvm/ADT/CoalescingBitVector.h create mode 100644 contrib/llvm-project/llvm/include/llvm/ADT/StringMapEntry.h create mode 100644 contrib/llvm-project/llvm/include/llvm/ADT/TypeSwitch.h create mode 100644 contrib/llvm-project/llvm/include/llvm/ADT/Waymarking.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Analysis/AssumeBundleQueries.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Analysis/HeatUtils.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Analysis/InlineAdvisor.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Analysis/InlineFeaturesAnalysis.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Analysis/InlineModelFeatureMaps.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Analysis/InlineSizeEstimatorAnalysis.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Analysis/LoopNestAnalysis.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Analysis/MLInlineAdvisor.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Analysis/MLModelRunner.h delete mode 100644 contrib/llvm-project/llvm/include/llvm/Analysis/OrderedBasicBlock.h delete mode 100644 contrib/llvm-project/llvm/include/llvm/Analysis/OrderedInstructions.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Analysis/ScalarEvolutionDivision.h delete mode 100644 contrib/llvm-project/llvm/include/llvm/Analysis/ScalarEvolutionExpander.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Analysis/StackLifetime.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Analysis/Utils/TFUtils.h create mode 100644 contrib/llvm-project/llvm/include/llvm/BinaryFormat/ELFRelocs/VE.def create mode 100644 contrib/llvm-project/llvm/include/llvm/CodeGen/AntiDepBreaker.h create mode 100644 contrib/llvm-project/llvm/include/llvm/CodeGen/CommandFlags.h delete mode 100644 contrib/llvm-project/llvm/include/llvm/CodeGen/CommandFlags.inc create mode 100644 contrib/llvm-project/llvm/include/llvm/CodeGen/GlobalISel/InlineAsmLowering.h create mode 100644 contrib/llvm-project/llvm/include/llvm/CodeGen/GlobalISel/LostDebugLocObserver.h delete mode 100644 contrib/llvm-project/llvm/include/llvm/CodeGen/GlobalISel/Types.h create mode 100644 contrib/llvm-project/llvm/include/llvm/CodeGen/IndirectThunks.h create mode 100644 contrib/llvm-project/llvm/include/llvm/CodeGen/LiveIntervalCalc.h create mode 100644 contrib/llvm-project/llvm/include/llvm/CodeGen/MBFIWrapper.h create mode 100644 contrib/llvm-project/llvm/include/llvm/CodeGen/Spiller.h create mode 100644 contrib/llvm-project/llvm/include/llvm/DWARFLinker/DWARFStreamer.h create mode 100644 contrib/llvm-project/llvm/include/llvm/DebugInfo/GSYM/DwarfTransformer.h create mode 100644 contrib/llvm-project/llvm/include/llvm/DebugInfo/GSYM/ObjectFileTransformer.h create mode 100644 contrib/llvm-project/llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumLineNumbers.h create mode 100644 contrib/llvm-project/llvm/include/llvm/DebugInfo/PDB/Native/NativeFunctionSymbol.h create mode 100644 contrib/llvm-project/llvm/include/llvm/DebugInfo/PDB/Native/NativeLineNumber.h create mode 100644 contrib/llvm-project/llvm/include/llvm/DebugInfo/PDB/Native/NativePublicSymbol.h create mode 100644 contrib/llvm-project/llvm/include/llvm/DebugInfo/PDB/Native/NativeSourceFile.h create mode 100644 contrib/llvm-project/llvm/include/llvm/ExecutionEngine/JITLink/ELF.h create mode 100644 contrib/llvm-project/llvm/include/llvm/ExecutionEngine/JITLink/ELF_x86_64.h create mode 100644 contrib/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/MachOPlatform.h create mode 100644 contrib/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/Mangling.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Frontend/Directive/DirectiveBase.td create mode 100644 contrib/llvm-project/llvm/include/llvm/Frontend/OpenACC/ACC.td create mode 100644 contrib/llvm-project/llvm/include/llvm/Frontend/OpenMP/OMP.td create mode 100644 contrib/llvm-project/llvm/include/llvm/Frontend/OpenMP/OMPContext.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Frontend/OpenMP/OMPGridValues.h create mode 100644 contrib/llvm-project/llvm/include/llvm/IR/AbstractCallSite.h delete mode 100644 contrib/llvm-project/llvm/include/llvm/IR/CFGDiff.h delete mode 100644 contrib/llvm-project/llvm/include/llvm/IR/CallSite.h create mode 100644 contrib/llvm-project/llvm/include/llvm/IR/IRBuilderFolder.h create mode 100644 contrib/llvm-project/llvm/include/llvm/IR/IntrinsicsHexagonDep.td create mode 100644 contrib/llvm-project/llvm/include/llvm/IR/LLVMRemarkStreamer.h create mode 100644 contrib/llvm-project/llvm/include/llvm/IR/MatrixBuilder.h create mode 100644 contrib/llvm-project/llvm/include/llvm/IR/PassManagerImpl.h delete mode 100644 contrib/llvm-project/llvm/include/llvm/IR/RemarkStreamer.h create mode 100644 contrib/llvm-project/llvm/include/llvm/IR/VPIntrinsics.def create mode 100644 contrib/llvm-project/llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h delete mode 100644 contrib/llvm-project/llvm/include/llvm/MC/MCTargetOptionsCommandFlags.inc create mode 100644 contrib/llvm-project/llvm/include/llvm/Remarks/RemarkStreamer.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Support/AllocatorBase.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Support/Base64.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Support/CFGDiff.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Support/ELFAttributeParser.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Support/ELFAttributes.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Support/ExtensibleRTTI.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Support/OptimizedStructLayout.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Support/RISCVAttributeParser.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Support/RISCVAttributes.h delete mode 100644 contrib/llvm-project/llvm/include/llvm/Support/StringPool.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Support/SuffixTree.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Support/X86TargetParser.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Transforms/Coroutines/CoroCleanup.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Transforms/Coroutines/CoroEarly.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Transforms/Coroutines/CoroElide.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Transforms/Coroutines/CoroSplit.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Transforms/IPO/OpenMPOpt.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerCommon.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Transforms/Utils/AMDGPUEmitPrintf.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Transforms/Utils/AssumeBundleBuilder.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Transforms/Utils/CallGraphUpdater.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Transforms/Utils/CanonicalizeFreezeInLoops.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Transforms/Utils/UniqueInternalLinkageNames.h create mode 100644 contrib/llvm-project/llvm/include/llvm/Transforms/Vectorize/VectorCombine.h (limited to 'contrib/llvm-project/llvm/include') diff --git a/contrib/llvm-project/llvm/include/llvm-c/Core.h b/contrib/llvm-project/llvm/include/llvm-c/Core.h index 7a39731d3e0c..2c7b4c6eff10 100644 --- a/contrib/llvm-project/llvm/include/llvm-c/Core.h +++ b/contrib/llvm-project/llvm/include/llvm-c/Core.h @@ -144,23 +144,25 @@ typedef enum { } LLVMOpcode; typedef enum { - LLVMVoidTypeKind, /**< type with no size */ - LLVMHalfTypeKind, /**< 16 bit floating point type */ - LLVMFloatTypeKind, /**< 32 bit floating point type */ - LLVMDoubleTypeKind, /**< 64 bit floating point type */ - LLVMX86_FP80TypeKind, /**< 80 bit floating point type (X87) */ - LLVMFP128TypeKind, /**< 128 bit floating point type (112-bit mantissa)*/ - LLVMPPC_FP128TypeKind, /**< 128 bit floating point type (two 64-bits) */ - LLVMLabelTypeKind, /**< Labels */ - LLVMIntegerTypeKind, /**< Arbitrary bit width integers */ - LLVMFunctionTypeKind, /**< Functions */ - LLVMStructTypeKind, /**< Structures */ - LLVMArrayTypeKind, /**< Arrays */ - LLVMPointerTypeKind, /**< Pointers */ - LLVMVectorTypeKind, /**< SIMD 'packed' format, or other vector type */ - LLVMMetadataTypeKind, /**< Metadata */ - LLVMX86_MMXTypeKind, /**< X86 MMX */ - LLVMTokenTypeKind /**< Tokens */ + LLVMVoidTypeKind, /**< type with no size */ + LLVMHalfTypeKind, /**< 16 bit floating point type */ + LLVMFloatTypeKind, /**< 32 bit floating point type */ + LLVMDoubleTypeKind, /**< 64 bit floating point type */ + LLVMX86_FP80TypeKind, /**< 80 bit floating point type (X87) */ + LLVMFP128TypeKind, /**< 128 bit floating point type (112-bit mantissa)*/ + LLVMPPC_FP128TypeKind, /**< 128 bit floating point type (two 64-bits) */ + LLVMLabelTypeKind, /**< Labels */ + LLVMIntegerTypeKind, /**< Arbitrary bit width integers */ + LLVMFunctionTypeKind, /**< Functions */ + LLVMStructTypeKind, /**< Structures */ + LLVMArrayTypeKind, /**< Arrays */ + LLVMPointerTypeKind, /**< Pointers */ + LLVMVectorTypeKind, /**< Fixed width SIMD vector type */ + LLVMMetadataTypeKind, /**< Metadata */ + LLVMX86_MMXTypeKind, /**< X86 MMX */ + LLVMTokenTypeKind, /**< Tokens */ + LLVMScalableVectorTypeKind, /**< Scalable SIMD vector type */ + LLVMBFloatTypeKind /**< 16 bit brain floating point type */ } LLVMTypeKind; typedef enum { @@ -1162,6 +1164,11 @@ unsigned LLVMGetIntTypeWidth(LLVMTypeRef IntegerTy); */ LLVMTypeRef LLVMHalfTypeInContext(LLVMContextRef C); +/** + * Obtain a 16-bit brain floating point type from a context. + */ +LLVMTypeRef LLVMBFloatTypeInContext(LLVMContextRef C); + /** * Obtain a 32-bit floating point type from a context. */ @@ -1194,6 +1201,7 @@ LLVMTypeRef LLVMPPCFP128TypeInContext(LLVMContextRef C); * These map to the functions in this group of the same name. */ LLVMTypeRef LLVMHalfType(void); +LLVMTypeRef LLVMBFloatType(void); LLVMTypeRef LLVMFloatType(void); LLVMTypeRef LLVMDoubleType(void); LLVMTypeRef LLVMX86FP80Type(void); @@ -2690,7 +2698,7 @@ LLVMValueRef LLVMGetNextGlobalIFunc(LLVMValueRef IFunc); * no previous global aliases. */ LLVMValueRef LLVMGetPreviousGlobalIFunc(LLVMValueRef IFunc); - + /** * Retrieves the resolver function associated with this indirect function, or * NULL if it doesn't not exist. @@ -2944,7 +2952,7 @@ void LLVMInsertExistingBasicBlockAfterInsertBlock(LLVMBuilderRef Builder, */ void LLVMAppendExistingBasicBlock(LLVMValueRef Fn, LLVMBasicBlockRef BB); - + /** * Create a new basic block without inserting it into a function. * @@ -3251,8 +3259,8 @@ LLVMTypeRef LLVMGetCalledFunctionType(LLVMValueRef C); * This expects an LLVMValueRef that corresponds to a llvm::CallInst or * llvm::InvokeInst. * - * @see llvm::CallInst::getCalledValue() - * @see llvm::InvokeInst::getCalledValue() + * @see llvm::CallInst::getCalledOperand() + * @see llvm::InvokeInst::getCalledOperand() */ LLVMValueRef LLVMGetCalledValue(LLVMValueRef Instr); @@ -3755,7 +3763,7 @@ LLVMValueRef LLVMBuildArrayMalloc(LLVMBuilderRef, LLVMTypeRef Ty, LLVMValueRef Val, const char *Name); /** - * Creates and inserts a memset to the specified pointer and the + * Creates and inserts a memset to the specified pointer and the * specified value. * * @see llvm::IRRBuilder::CreateMemSet() @@ -3768,7 +3776,7 @@ LLVMValueRef LLVMBuildMemSet(LLVMBuilderRef B, LLVMValueRef Ptr, * * @see llvm::IRRBuilder::CreateMemCpy() */ -LLVMValueRef LLVMBuildMemCpy(LLVMBuilderRef B, +LLVMValueRef LLVMBuildMemCpy(LLVMBuilderRef B, LLVMValueRef Dst, unsigned DstAlign, LLVMValueRef Src, unsigned SrcAlign, LLVMValueRef Size); @@ -3777,7 +3785,7 @@ LLVMValueRef LLVMBuildMemCpy(LLVMBuilderRef B, * * @see llvm::IRRBuilder::CreateMemMove() */ -LLVMValueRef LLVMBuildMemMove(LLVMBuilderRef B, +LLVMValueRef LLVMBuildMemMove(LLVMBuilderRef B, LLVMValueRef Dst, unsigned DstAlign, LLVMValueRef Src, unsigned SrcAlign, LLVMValueRef Size); diff --git a/contrib/llvm-project/llvm/include/llvm-c/DataTypes.h b/contrib/llvm-project/llvm/include/llvm-c/DataTypes.h index 893b22b49ffc..0f27ba81865e 100644 --- a/contrib/llvm-project/llvm/include/llvm-c/DataTypes.h +++ b/contrib/llvm-project/llvm/include/llvm-c/DataTypes.h @@ -24,12 +24,6 @@ #ifndef LLVM_C_DATATYPES_H #define LLVM_C_DATATYPES_H -#ifdef __cplusplus -#include -#else -#include -#endif - #include #include diff --git a/contrib/llvm-project/llvm/include/llvm-c/DebugInfo.h b/contrib/llvm-project/llvm/include/llvm-c/DebugInfo.h index e933fe4b3f92..cdf5f5a0cca8 100644 --- a/contrib/llvm-project/llvm/include/llvm-c/DebugInfo.h +++ b/contrib/llvm-project/llvm/include/llvm-c/DebugInfo.h @@ -250,6 +250,10 @@ void LLVMDIBuilderFinalize(LLVMDIBuilderRef Builder); * \param SplitDebugInlining Whether to emit inline debug info. * \param DebugInfoForProfiling Whether to emit extra debug info for * profile collection. + * \param SysRoot The Clang system root (value of -isysroot). + * \param SysRootLen The length of the C string passed to \c SysRoot. + * \param SDK The SDK. On Darwin, the last component of the sysroot. + * \param SDKLen The length of the C string passed to \c SDK. */ LLVMMetadataRef LLVMDIBuilderCreateCompileUnit( LLVMDIBuilderRef Builder, LLVMDWARFSourceLanguage Lang, @@ -257,7 +261,8 @@ LLVMMetadataRef LLVMDIBuilderCreateCompileUnit( LLVMBool isOptimized, const char *Flags, size_t FlagsLen, unsigned RuntimeVer, const char *SplitName, size_t SplitNameLen, LLVMDWARFEmissionKind Kind, unsigned DWOId, LLVMBool SplitDebugInlining, - LLVMBool DebugInfoForProfiling); + LLVMBool DebugInfoForProfiling, const char *SysRoot, size_t SysRootLen, + const char *SDK, size_t SDKLen); /** * Create a file descriptor to hold debugging information for a file. @@ -283,15 +288,15 @@ LLVMDIBuilderCreateFile(LLVMDIBuilderRef Builder, const char *Filename, * \param ConfigMacrosLen The length of the C string passed to \c ConfigMacros. * \param IncludePath The path to the module map file. * \param IncludePathLen The length of the C string passed to \c IncludePath. - * \param SysRoot The Clang system root (value of -isysroot). - * \param SysRootLen The length of the C string passed to \c SysRoot. + * \param APINotesFile The path to an API notes file for the module. + * \param APINotesFileLen The length of the C string passed to \c APINotestFile. */ LLVMMetadataRef LLVMDIBuilderCreateModule(LLVMDIBuilderRef Builder, LLVMMetadataRef ParentScope, const char *Name, size_t NameLen, const char *ConfigMacros, size_t ConfigMacrosLen, const char *IncludePath, size_t IncludePathLen, - const char *SysRoot, size_t SysRootLen); + const char *APINotesFile, size_t APINotesFileLen); /** * Creates a new descriptor for a namespace with the specified parent scope. diff --git a/contrib/llvm-project/llvm/include/llvm-c/ExecutionEngine.h b/contrib/llvm-project/llvm/include/llvm-c/ExecutionEngine.h index f31b97ad7623..c5fc9bdb4d07 100644 --- a/contrib/llvm-project/llvm/include/llvm-c/ExecutionEngine.h +++ b/contrib/llvm-project/llvm/include/llvm-c/ExecutionEngine.h @@ -149,6 +149,11 @@ uint64_t LLVMGetGlobalValueAddress(LLVMExecutionEngineRef EE, const char *Name); uint64_t LLVMGetFunctionAddress(LLVMExecutionEngineRef EE, const char *Name); +/// Returns true on error, false on success. If true is returned then the error +/// message is copied to OutStr and cleared in the ExecutionEngine instance. +LLVMBool LLVMExecutionEngineGetErrMsg(LLVMExecutionEngineRef EE, + char **OutError); + /*===-- Operations on memory managers -------------------------------------===*/ typedef uint8_t *(*LLVMMemoryManagerAllocateCodeSectionCallback)( diff --git a/contrib/llvm-project/llvm/include/llvm-c/Orc.h b/contrib/llvm-project/llvm/include/llvm-c/Orc.h new file mode 100644 index 000000000000..09a058846108 --- /dev/null +++ b/contrib/llvm-project/llvm/include/llvm-c/Orc.h @@ -0,0 +1,335 @@ +/*===---------------- llvm-c/Orc.h - OrcV2 C bindings -----------*- C++ -*-===*\ +|* *| +|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| +|* Exceptions. *| +|* See https://llvm.org/LICENSE.txt for license information. *| +|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| +|* *| +|*===----------------------------------------------------------------------===*| +|* *| +|* This header declares the C interface to libLLVMOrcJIT.a, which implements *| +|* JIT compilation of LLVM IR. Minimal documentation of C API specific issues *| +|* (especially memory ownership rules) is provided. Core Orc concepts are *| +|* documented in llvm/docs/ORCv2.rst and APIs are documented in the C++ *| +|* headers *| +|* *| +|* Many exotic languages can interoperate with C code but have a harder time *| +|* with C++ due to name mangling. So in addition to C, this interface enables *| +|* tools written in such languages. *| +|* *| +|* Note: This interface is experimental. It is *NOT* stable, and may be *| +|* changed without warning. Only C API usage documentation is *| +|* provided. See the C++ documentation for all higher level ORC API *| +|* details. *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifndef LLVM_C_ORC_H +#define LLVM_C_ORC_H + +#include "llvm-c/Error.h" +#include "llvm-c/TargetMachine.h" +#include "llvm-c/Types.h" + +LLVM_C_EXTERN_C_BEGIN + +/** + * Represents an address in the target process. + */ +typedef uint64_t LLVMOrcJITTargetAddress; + +/** + * A reference to an orc::ExecutionSession instance. + */ +typedef struct LLVMOrcOpaqueExecutionSession *LLVMOrcExecutionSessionRef; + +/** + * A reference to an orc::SymbolStringPool table entry. + */ +typedef struct LLVMOrcQuaqueSymbolStringPoolEntryPtr + *LLVMOrcSymbolStringPoolEntryRef; + +/** + * A reference to an orc::JITDylib instance. + */ +typedef struct LLVMOrcOpaqueJITDylib *LLVMOrcJITDylibRef; + +/** + * A reference to an orc::JITDylib::DefinitionGenerator. + */ +typedef struct LLVMOrcOpaqueJITDylibDefinitionGenerator + *LLVMOrcJITDylibDefinitionGeneratorRef; + +/** + * Predicate function for SymbolStringPoolEntries. + */ +typedef int (*LLVMOrcSymbolPredicate)(LLVMOrcSymbolStringPoolEntryRef Sym, + void *Ctx); + +/** + * A reference to an orc::ThreadSafeContext instance. + */ +typedef struct LLVMOrcOpaqueThreadSafeContext *LLVMOrcThreadSafeContextRef; + +/** + * A reference to an orc::ThreadSafeModule instance. + */ +typedef struct LLVMOrcOpaqueThreadSafeModule *LLVMOrcThreadSafeModuleRef; + +/** + * A reference to an orc::JITTargetMachineBuilder instance. + */ +typedef struct LLVMOrcOpaqueJITTargetMachineBuilder + *LLVMOrcJITTargetMachineBuilderRef; + +/** + * A reference to an orc::LLJITBuilder instance. + */ +typedef struct LLVMOrcOpaqueLLJITBuilder *LLVMOrcLLJITBuilderRef; + +/** + * A reference to an orc::LLJIT instance. + */ +typedef struct LLVMOrcOpaqueLLJIT *LLVMOrcLLJITRef; + +/** + * Intern a string in the ExecutionSession's SymbolStringPool and return a + * reference to it. This increments the ref-count of the pool entry, and the + * returned value should be released once the client is done with it by + * calling LLVMOrReleaseSymbolStringPoolEntry. + * + * Since strings are uniqued within the SymbolStringPool + * LLVMOrcSymbolStringPoolEntryRefs can be compared by value to test string + * equality. + * + * Note that this function does not perform linker-mangling on the string. + */ +LLVMOrcSymbolStringPoolEntryRef +LLVMOrcExecutionSessionIntern(LLVMOrcExecutionSessionRef ES, const char *Name); + +/** + * Reduces the ref-count for of a SymbolStringPool entry. + */ +void LLVMOrcReleaseSymbolStringPoolEntry(LLVMOrcSymbolStringPoolEntryRef S); + +/** + * Dispose of a JITDylib::DefinitionGenerator. This should only be called if + * ownership has not been passed to a JITDylib (e.g. because some error + * prevented the client from calling LLVMOrcJITDylibAddGenerator). + */ +void LLVMOrcDisposeJITDylibDefinitionGenerator( + LLVMOrcJITDylibDefinitionGeneratorRef DG); + +/** + * Add a JITDylib::DefinitionGenerator to the given JITDylib. + * + * The JITDylib will take ownership of the given generator: The client is no + * longer responsible for managing its memory. + */ +void LLVMOrcJITDylibAddGenerator(LLVMOrcJITDylibRef JD, + LLVMOrcJITDylibDefinitionGeneratorRef DG); + +/** + * Get a DynamicLibrarySearchGenerator that will reflect process symbols into + * the JITDylib. On success the resulting generator is owned by the client. + * Ownership is typically transferred by adding the instance to a JITDylib + * using LLVMOrcJITDylibAddGenerator, + * + * The GlobalPrefix argument specifies the character that appears on the front + * of linker-mangled symbols for the target platform (e.g. '_' on MachO). + * If non-null, this character will be stripped from the start of all symbol + * strings before passing the remaining substring to dlsym. + * + * The optional Filter and Ctx arguments can be used to supply a symbol name + * filter: Only symbols for which the filter returns true will be visible to + * JIT'd code. If the Filter argument is null then all process symbols will + * be visible to JIT'd code. Note that the symbol name passed to the Filter + * function is the full mangled symbol: The client is responsible for stripping + * the global prefix if present. + */ +LLVMErrorRef LLVMOrcCreateDynamicLibrarySearchGeneratorForProcess( + LLVMOrcJITDylibDefinitionGeneratorRef *Result, char GlobalPrefx, + LLVMOrcSymbolPredicate Filter, void *FilterCtx); + +/** + * Create a ThreadSafeContext containing a new LLVMContext. + * + * Ownership of the underlying ThreadSafeContext data is shared: Clients + * can and should dispose of their ThreadSafeContext as soon as they no longer + * need to refer to it directly. Other references (e.g. from ThreadSafeModules + * will keep the data alive as long as it is needed. + */ +LLVMOrcThreadSafeContextRef LLVMOrcCreateNewThreadSafeContext(void); + +/** + * Get a reference to the wrapped LLVMContext. + */ +LLVMContextRef +LLVMOrcThreadSafeContextGetContext(LLVMOrcThreadSafeContextRef TSCtx); + +/** + * Dispose of a ThreadSafeContext. + */ +void LLVMOrcDisposeThreadSafeContext(LLVMOrcThreadSafeContextRef TSCtx); + +/** + * Create a ThreadSafeModule wrapper around the given LLVM module. This takes + * ownership of the M argument which should not be disposed of or referenced + * after this function returns. + * + * Ownership of the ThreadSafeModule is unique: If it is transferred to the JIT + * (e.g. by LLVMOrcLLJITAddLLVMIRModule), in which case the client is no longer + * responsible for it. If it is not transferred to the JIT then the client + * should call LLVMOrcDisposeThreadSafeModule to dispose of it. + */ +LLVMOrcThreadSafeModuleRef +LLVMOrcCreateNewThreadSafeModule(LLVMModuleRef M, + LLVMOrcThreadSafeContextRef TSCtx); + +/** + * Dispose of a ThreadSafeModule. This should only be called if ownership has + * not been passed to LLJIT (e.g. because some error prevented the client from + * adding this to the JIT). + */ +void LLVMOrcDisposeThreadSafeModule(LLVMOrcThreadSafeModuleRef TSM); + +/** + * Create a JITTargetMachineBuilder by detecting the host. + * + * On success the client owns the resulting JITTargetMachineBuilder. It must be + * passed to a consuming operation (e.g. LLVMOrcCreateLLJITBuilder) or disposed + * of by calling LLVMOrcDisposeJITTargetMachineBuilder. + */ +LLVMErrorRef LLVMOrcJITTargetMachineBuilderDetectHost( + LLVMOrcJITTargetMachineBuilderRef *Result); + +/** + * Create a JITTargetMachineBuilder from the given TargetMachine template. + * + * This operation takes ownership of the given TargetMachine and destroys it + * before returing. The resulting JITTargetMachineBuilder is owned by the client + * and must be passed to a consuming operation (e.g. LLVMOrcCreateLLJITBuilder) + * or disposed of by calling LLVMOrcDisposeJITTargetMachineBuilder. + */ +LLVMOrcJITTargetMachineBuilderRef +LLVMOrcJITTargetMachineBuilderCreateFromTargetMachine(LLVMTargetMachineRef TM); + +/** + * Dispose of a JITTargetMachineBuilder. + */ +void LLVMOrcDisposeJITTargetMachineBuilder( + LLVMOrcJITTargetMachineBuilderRef JTMB); + +/** + * Create an LLJITTargetMachineBuilder. + * + * The client owns the resulting LLJITBuilder and should dispose of it using + * LLVMOrcDisposeLLJITBuilder once they are done with it. + */ +LLVMOrcLLJITBuilderRef LLVMOrcCreateLLJITBuilder(void); + +/** + * Dispose of an LLVMOrcLLJITBuilderRef. This should only be called if ownership + * has not been passed to LLVMOrcCreateLLJIT (e.g. because some error prevented + * that function from being called). + */ +void LLVMOrcDisposeLLJITBuilder(LLVMOrcLLJITBuilderRef Builder); + +/** + * Set the JITTargetMachineBuilder to be used when constructing the LLJIT + * instance. Calling this function is optional: if it is not called then the + * LLJITBuilder will use JITTargeTMachineBuilder::detectHost to construct a + * JITTargetMachineBuilder. + */ +void LLVMOrcLLJITBuilderSetJITTargetMachineBuilder( + LLVMOrcLLJITBuilderRef Builder, LLVMOrcJITTargetMachineBuilderRef JTMB); + +/** + * Create an LLJIT instance from an LLJITBuilder. + * + * This operation takes ownership of the Builder argument: clients should not + * dispose of the builder after calling this function (even if the function + * returns an error). If a null Builder argument is provided then a + * default-constructed LLJITBuilder will be used. + * + * On success the resulting LLJIT instance is uniquely owned by the client and + * automatically manages the memory of all JIT'd code and all modules that are + * transferred to it (e.g. via LLVMOrcLLJITAddLLVMIRModule). Disposing of the + * LLJIT instance will free all memory managed by the JIT, including JIT'd code + * and not-yet compiled modules. + */ +LLVMErrorRef LLVMOrcCreateLLJIT(LLVMOrcLLJITRef *Result, + LLVMOrcLLJITBuilderRef Builder); + +/** + * Dispose of an LLJIT instance. + */ +LLVMErrorRef LLVMOrcDisposeLLJIT(LLVMOrcLLJITRef J); + +/** + * Get a reference to the ExecutionSession for this LLJIT instance. + * + * The ExecutionSession is owned by the LLJIT instance. The client is not + * responsible for managing its memory. + */ +LLVMOrcExecutionSessionRef LLVMOrcLLJITGetExecutionSession(LLVMOrcLLJITRef J); + +/** + * Return a reference to the Main JITDylib. + * + * The JITDylib is owned by the LLJIT instance. The client is not responsible + * for managing its memory. + */ +LLVMOrcJITDylibRef LLVMOrcLLJITGetMainJITDylib(LLVMOrcLLJITRef J); + +/** + * Return the target triple for this LLJIT instance. This string is owned by + * the LLJIT instance and should not be freed by the client. + */ +const char *LLVMOrcLLJITGetTripleString(LLVMOrcLLJITRef J); + +/** + * Returns the global prefix character according to the LLJIT's DataLayout. + */ +char LLVMOrcLLJITGetGlobalPrefix(LLVMOrcLLJITRef J); + +/** + * Mangles the given string according to the LLJIT instance's DataLayout, then + * interns the result in the SymbolStringPool and returns a reference to the + * pool entry. Clients should call LLVMOrcReleaseSymbolStringPoolEntry to + * decrement the ref-count on the pool entry once they are finished with this + * value. + */ +LLVMOrcSymbolStringPoolEntryRef +LLVMOrcLLJITMangleAndIntern(LLVMOrcLLJITRef J, const char *UnmangledName); + +/** + * Add a buffer representing an object file to the given JITDylib in the given + * LLJIT instance. This operation transfers ownership of the buffer to the + * LLJIT instance. The buffer should not be disposed of or referenced once this + * function returns. + */ +LLVMErrorRef LLVMOrcLLJITAddObjectFile(LLVMOrcLLJITRef J, LLVMOrcJITDylibRef JD, + LLVMMemoryBufferRef ObjBuffer); + +/** + * Add an IR module to the given JITDylib of the given LLJIT instance. This + * operation transfers ownership of the TSM argument to the LLJIT instance. + * The TSM argument should not be 3disposed of or referenced once this + * function returns. + */ +LLVMErrorRef LLVMOrcLLJITAddLLVMIRModule(LLVMOrcLLJITRef J, + LLVMOrcJITDylibRef JD, + LLVMOrcThreadSafeModuleRef TSM); +/** + * Look up the given symbol in the main JITDylib of the given LLJIT instance. + * + * This operation does not take ownership of the Name argument. + */ +LLVMErrorRef LLVMOrcLLJITLookup(LLVMOrcLLJITRef J, + LLVMOrcJITTargetAddress *Result, + const char *Name); + +LLVM_C_EXTERN_C_END + +#endif /* LLVM_C_ORC_H */ diff --git a/contrib/llvm-project/llvm/include/llvm-c/Transforms/Coroutines.h b/contrib/llvm-project/llvm/include/llvm-c/Transforms/Coroutines.h index 15798af7d661..03b6822033c9 100644 --- a/contrib/llvm-project/llvm/include/llvm-c/Transforms/Coroutines.h +++ b/contrib/llvm-project/llvm/include/llvm-c/Transforms/Coroutines.h @@ -21,6 +21,7 @@ #include "llvm-c/ExternC.h" #include "llvm-c/Types.h" +#include "llvm-c/Transforms/PassManagerBuilder.h" LLVM_C_EXTERN_C_BEGIN @@ -43,6 +44,9 @@ void LLVMAddCoroElidePass(LLVMPassManagerRef PM); /** See llvm::createCoroCleanupLegacyPass function. */ void LLVMAddCoroCleanupPass(LLVMPassManagerRef PM); +/** See llvm::addCoroutinePassesToExtensionPoints. */ +void LLVMPassManagerBuilderAddCoroutinePassesToExtensionPoints(LLVMPassManagerBuilderRef PMB); + /** * @} */ diff --git a/contrib/llvm-project/llvm/include/llvm-c/lto.h b/contrib/llvm-project/llvm/include/llvm-c/lto.h index 97a8f4823320..4dbc77f294c6 100644 --- a/contrib/llvm-project/llvm/include/llvm-c/lto.h +++ b/contrib/llvm-project/llvm/include/llvm-c/lto.h @@ -46,7 +46,7 @@ typedef bool lto_bool_t; * @{ */ -#define LTO_API_VERSION 26 +#define LTO_API_VERSION 27 /** * \since prior to LTO_API_VERSION=3 @@ -297,6 +297,21 @@ lto_module_get_symbol_attribute(lto_module_t mod, unsigned int index); extern const char* lto_module_get_linkeropts(lto_module_t mod); +/** + * If targeting mach-o on darwin, this function gets the CPU type and subtype + * that will end up being encoded in the mach-o header. These are the values + * that can be found in mach/machine.h. + * + * \p out_cputype and \p out_cpusubtype must be non-NULL. + * + * Returns true on error (check lto_get_error_message() for details). + * + * \since LTO_API_VERSION=27 + */ +extern lto_bool_t lto_module_get_macho_cputype(lto_module_t mod, + unsigned int *out_cputype, + unsigned int *out_cpusubtype); + /** * Diagnostic severity. * diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/APFloat.h b/contrib/llvm-project/llvm/include/llvm/ADT/APFloat.h index ed25b2cd89f1..876e52c150a0 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/APFloat.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/APFloat.h @@ -18,6 +18,7 @@ #include "llvm/ADT/APInt.h" #include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/FloatingPointMode.h" #include "llvm/Support/ErrorHandling.h" #include @@ -141,7 +142,7 @@ enum lostFraction { // Example of truncated bits: // members. struct APFloatBase { typedef APInt::WordType integerPart; - static const unsigned integerPartWidth = APInt::APINT_BITS_PER_WORD; + static constexpr unsigned integerPartWidth = APInt::APINT_BITS_PER_WORD; /// A signed type to represent a floating point numbers unbiased exponent. typedef int32_t ExponentType; @@ -150,6 +151,7 @@ struct APFloatBase { /// @{ enum Semantics { S_IEEEhalf, + S_BFloat, S_IEEEsingle, S_IEEEdouble, S_x87DoubleExtended, @@ -161,6 +163,7 @@ struct APFloatBase { static Semantics SemanticsToEnum(const llvm::fltSemantics &Sem); static const fltSemantics &IEEEhalf() LLVM_READNONE; + static const fltSemantics &BFloat() LLVM_READNONE; static const fltSemantics &IEEEsingle() LLVM_READNONE; static const fltSemantics &IEEEdouble() LLVM_READNONE; static const fltSemantics &IEEEquad() LLVM_READNONE; @@ -182,13 +185,15 @@ struct APFloatBase { }; /// IEEE-754R 4.3: Rounding-direction attributes. - enum roundingMode { - rmNearestTiesToEven, - rmTowardPositive, - rmTowardNegative, - rmTowardZero, - rmNearestTiesToAway - }; + using roundingMode = llvm::RoundingMode; + + static constexpr roundingMode rmNearestTiesToEven = + RoundingMode::NearestTiesToEven; + static constexpr roundingMode rmTowardPositive = RoundingMode::TowardPositive; + static constexpr roundingMode rmTowardNegative = RoundingMode::TowardNegative; + static constexpr roundingMode rmTowardZero = RoundingMode::TowardZero; + static constexpr roundingMode rmNearestTiesToAway = + RoundingMode::NearestTiesToAway; /// IEEE-754R 7: Default exception handling. /// @@ -511,6 +516,7 @@ private: opStatus divideSpecials(const IEEEFloat &); opStatus multiplySpecials(const IEEEFloat &); opStatus modSpecials(const IEEEFloat &); + opStatus remainderSpecials(const IEEEFloat&); /// @} @@ -537,6 +543,7 @@ private: /// @} APInt convertHalfAPFloatToAPInt() const; + APInt convertBFloatAPFloatToAPInt() const; APInt convertFloatAPFloatToAPInt() const; APInt convertDoubleAPFloatToAPInt() const; APInt convertQuadrupleAPFloatToAPInt() const; @@ -544,6 +551,7 @@ private: APInt convertPPCDoubleDoubleAPFloatToAPInt() const; void initFromAPInt(const fltSemantics *Sem, const APInt &api); void initFromHalfAPInt(const APInt &api); + void initFromBFloatAPInt(const APInt &api); void initFromFloatAPInt(const APInt &api); void initFromDoubleAPInt(const APInt &api); void initFromQuadrupleAPInt(const APInt &api); @@ -585,7 +593,7 @@ IEEEFloat scalbn(IEEEFloat X, int Exp, IEEEFloat::roundingMode); IEEEFloat frexp(const IEEEFloat &Val, int &Exp, IEEEFloat::roundingMode RM); // This mode implements more precise float in terms of two APFloats. -// The interface and layout is designed for arbitray underlying semantics, +// The interface and layout is designed for arbitrary underlying semantics, // though currently only PPCDoubleDouble semantics are supported, whose // corresponding underlying semantics are IEEEdouble. class DoubleAPFloat final : public APFloatBase { @@ -853,8 +861,8 @@ public: APFloat(const fltSemantics &Semantics) : U(Semantics) {} APFloat(const fltSemantics &Semantics, StringRef S); APFloat(const fltSemantics &Semantics, integerPart I) : U(Semantics, I) {} - template ::value>::type> + template ::value>> APFloat(const fltSemantics &Semantics, T V) = delete; // TODO: Remove this constructor. This isn't faster than the first one. APFloat(const fltSemantics &Semantics, uninitializedTag) @@ -950,9 +958,10 @@ public: /// Returns a float which is bitcasted from an all one value int. /// + /// \param Semantics - type float semantics /// \param BitWidth - Select float type - /// \param isIEEE - If 128 bit number, select between PPC and IEEE - static APFloat getAllOnesValue(unsigned BitWidth, bool isIEEE = false); + static APFloat getAllOnesValue(const fltSemantics &Semantics, + unsigned BitWidth); /// Used to insert APFloat objects, or objects that contain APFloat objects, /// into FoldingSets. @@ -1035,6 +1044,13 @@ public: APFLOAT_DISPATCH_ON_SEMANTICS(next(nextDown)); } + /// Negate an APFloat. + APFloat operator-() const { + APFloat Result(*this); + Result.changeSign(); + return Result; + } + /// Add two APFloats, rounding ties to the nearest even. /// No error checking. APFloat operator+(const APFloat &RHS) const { @@ -1117,7 +1133,27 @@ public: double convertToDouble() const { return getIEEE().convertToDouble(); } float convertToFloat() const { return getIEEE().convertToFloat(); } - bool operator==(const APFloat &) const = delete; + bool operator==(const APFloat &RHS) const { return compare(RHS) == cmpEqual; } + + bool operator!=(const APFloat &RHS) const { return compare(RHS) != cmpEqual; } + + bool operator<(const APFloat &RHS) const { + return compare(RHS) == cmpLessThan; + } + + bool operator>(const APFloat &RHS) const { + return compare(RHS) == cmpGreaterThan; + } + + bool operator<=(const APFloat &RHS) const { + cmpResult Res = compare(RHS); + return Res == cmpLessThan || Res == cmpEqual; + } + + bool operator>=(const APFloat &RHS) const { + cmpResult Res = compare(RHS); + return Res == cmpGreaterThan || Res == cmpEqual; + } cmpResult compare(const APFloat &RHS) const { assert(&getSemantics() == &RHS.getSemantics() && @@ -1249,7 +1285,7 @@ inline APFloat minnum(const APFloat &A, const APFloat &B) { return B; if (B.isNaN()) return A; - return (B.compare(A) == APFloat::cmpLessThan) ? B : A; + return B < A ? B : A; } /// Implements IEEE maxNum semantics. Returns the larger of the 2 arguments if @@ -1260,7 +1296,7 @@ inline APFloat maxnum(const APFloat &A, const APFloat &B) { return B; if (B.isNaN()) return A; - return (A.compare(B) == APFloat::cmpLessThan) ? B : A; + return A < B ? B : A; } /// Implements IEEE 754-2018 minimum semantics. Returns the smaller of 2 @@ -1273,7 +1309,7 @@ inline APFloat minimum(const APFloat &A, const APFloat &B) { return B; if (A.isZero() && B.isZero() && (A.isNegative() != B.isNegative())) return A.isNegative() ? A : B; - return (B.compare(A) == APFloat::cmpLessThan) ? B : A; + return B < A ? B : A; } /// Implements IEEE 754-2018 maximum semantics. Returns the larger of 2 @@ -1286,7 +1322,7 @@ inline APFloat maximum(const APFloat &A, const APFloat &B) { return B; if (A.isZero() && B.isZero() && (A.isNegative() != B.isNegative())) return A.isNegative() ? B : A; - return (A.compare(B) == APFloat::cmpLessThan) ? B : A; + return A < B ? B : A; } } // namespace llvm diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/APInt.h b/contrib/llvm-project/llvm/include/llvm/ADT/APInt.h index 0791a6d686a3..f7df648d27ed 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/APInt.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/APInt.h @@ -84,7 +84,7 @@ public: UP, }; - static const WordType WORDTYPE_MAX = ~WordType(0); + static constexpr WordType WORDTYPE_MAX = ~WordType(0); private: /// This union is used to store the integer value. When the @@ -616,9 +616,11 @@ public: } /// Wrap version of getBitsSet. - /// If \p hiBit is no less than \p loBit, this is same with getBitsSet. - /// If \p hiBit is less than \p loBit, the set bits "wrap". For example, with - /// parameters (32, 28, 4), you would get 0xF000000F. + /// If \p hiBit is bigger than \p loBit, this is same with getBitsSet. + /// If \p hiBit is not bigger than \p loBit, the set bits "wrap". For example, + /// with parameters (32, 28, 4), you would get 0xF000000F. + /// If \p hiBit is equal to \p loBit, you would get a result with all bits + /// set. static APInt getBitsSetWithWrap(unsigned numBits, unsigned loBit, unsigned hiBit) { APInt Res(numBits, 0); @@ -1448,12 +1450,13 @@ public: } /// Set the bits from loBit (inclusive) to hiBit (exclusive) to 1. - /// This function handles "wrap" case when \p loBit > \p hiBit, and calls - /// setBits when \p loBit <= \p hiBit. + /// This function handles "wrap" case when \p loBit >= \p hiBit, and calls + /// setBits when \p loBit < \p hiBit. + /// For \p loBit == \p hiBit wrap case, set every bit to 1. void setBitsWithWrap(unsigned loBit, unsigned hiBit) { assert(hiBit <= BitWidth && "hiBit out of range"); assert(loBit <= BitWidth && "loBit out of range"); - if (loBit <= hiBit) { + if (loBit < hiBit) { setBits(loBit, hiBit); return; } @@ -2283,7 +2286,7 @@ void StoreIntToMemory(const APInt &IntVal, uint8_t *Dst, unsigned StoreBytes); /// LoadIntFromMemory - Loads the integer stored in the LoadBytes bytes starting /// from Src into IntVal, which is assumed to be wide enough and to hold zero. -void LoadIntFromMemory(APInt &IntVal, uint8_t *Src, unsigned LoadBytes); +void LoadIntFromMemory(APInt &IntVal, const uint8_t *Src, unsigned LoadBytes); } // namespace llvm diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/AllocatorList.h b/contrib/llvm-project/llvm/include/llvm/ADT/AllocatorList.h index 405a2e4264df..447d7a7538db 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/AllocatorList.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/AllocatorList.h @@ -110,8 +110,8 @@ private: template IteratorImpl(const IteratorImpl &X, - typename std::enable_if::value>::type * = nullptr) + std::enable_if_t::value> * = nullptr) : base_type(X.wrapped()) {} ~IteratorImpl() = default; diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/Any.h b/contrib/llvm-project/llvm/include/llvm/ADT/Any.h index 49657e02a991..0aded628cda4 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/Any.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/Any.h @@ -59,26 +59,26 @@ public: // When T is Any or T is not copy-constructible we need to explicitly disable // the forwarding constructor so that the copy constructor gets selected // instead. - template < - typename T, - typename std::enable_if< - llvm::conjunction< - llvm::negation::type, Any>>, - // We also disable this overload when an `Any` object can be - // converted to the parameter type because in that case, this - // constructor may combine with that conversion during overload - // resolution for determining copy constructibility, and then - // when we try to determine copy constructibility below we may - // infinitely recurse. This is being evaluated by the standards - // committee as a potential DR in `std::any` as well, but we're - // going ahead and adopting it to work-around usage of `Any` with - // types that need to be implicitly convertible from an `Any`. - llvm::negation::type>>, - std::is_copy_constructible::type>>::value, - int>::type = 0> + template , Any>>, + // We also disable this overload when an `Any` object can be + // converted to the parameter type because in that case, + // this constructor may combine with that conversion during + // overload resolution for determining copy + // constructibility, and then when we try to determine copy + // constructibility below we may infinitely recurse. This is + // being evaluated by the standards committee as a potential + // DR in `std::any` as well, but we're going ahead and + // adopting it to work-around usage of `Any` with types that + // need to be implicitly convertible from an `Any`. + llvm::negation>>, + std::is_copy_constructible>>::value, + int> = 0> Any(T &&Value) { - using U = typename std::decay::type; - Storage = std::make_unique>(std::forward(Value)); + Storage = + std::make_unique>>(std::forward(Value)); } Any(Any &&Other) : Storage(std::move(Other.Storage)) {} @@ -114,32 +114,27 @@ template const char Any::TypeId::Id = 0; template bool any_isa(const Any &Value) { if (!Value.Storage) return false; - using U = - typename std::remove_cv::type>::type; - return Value.Storage->id() == &Any::TypeId::Id; + return Value.Storage->id() == + &Any::TypeId>>::Id; } template T any_cast(const Any &Value) { - using U = - typename std::remove_cv::type>::type; - return static_cast(*any_cast(&Value)); + return static_cast( + *any_cast>>(&Value)); } template T any_cast(Any &Value) { - using U = - typename std::remove_cv::type>::type; - return static_cast(*any_cast(&Value)); + return static_cast( + *any_cast>>(&Value)); } template T any_cast(Any &&Value) { - using U = - typename std::remove_cv::type>::type; - return static_cast(std::move(*any_cast(&Value))); + return static_cast(std::move( + *any_cast>>(&Value))); } template const T *any_cast(const Any *Value) { - using U = - typename std::remove_cv::type>::type; + using U = std::remove_cv_t>; assert(Value && any_isa(*Value) && "Bad any cast!"); if (!Value || !any_isa(*Value)) return nullptr; @@ -147,7 +142,7 @@ template const T *any_cast(const Any *Value) { } template T *any_cast(Any *Value) { - using U = typename std::decay::type; + using U = std::decay_t; assert(Value && any_isa(*Value) && "Bad any cast!"); if (!Value || !any_isa(*Value)) return nullptr; diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/ArrayRef.h b/contrib/llvm-project/llvm/include/llvm/ADT/ArrayRef.h index 3d22442918cd..5ed4d0766c34 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/ArrayRef.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/ArrayRef.h @@ -38,7 +38,7 @@ namespace llvm { /// This is intended to be trivially copyable, so it should be passed by /// value. template - class LLVM_NODISCARD ArrayRef { + class LLVM_GSL_POINTER LLVM_NODISCARD ArrayRef { public: using iterator = const T *; using const_iterator = const T *; @@ -114,30 +114,28 @@ namespace llvm { /// Construct an ArrayRef from ArrayRef. This uses SFINAE to /// ensure that only ArrayRefs of pointers can be converted. template - ArrayRef( - const ArrayRef &A, - typename std::enable_if< - std::is_convertible::value>::type * = nullptr) - : Data(A.data()), Length(A.size()) {} + ArrayRef(const ArrayRef &A, + std::enable_if_t::value> + * = nullptr) + : Data(A.data()), Length(A.size()) {} /// Construct an ArrayRef from a SmallVector. This is /// templated in order to avoid instantiating SmallVectorTemplateCommon /// whenever we copy-construct an ArrayRef. - template + template /*implicit*/ ArrayRef( - const SmallVectorTemplateCommon &Vec, - typename std::enable_if< - std::is_convertible::value>::type * = nullptr) - : Data(Vec.data()), Length(Vec.size()) { - } + const SmallVectorTemplateCommon &Vec, + std::enable_if_t::value> * = + nullptr) + : Data(Vec.data()), Length(Vec.size()) {} /// Construct an ArrayRef from std::vector. This uses SFINAE /// to ensure that only vectors of pointers can be converted. - template + template ArrayRef(const std::vector &Vec, - typename std::enable_if< - std::is_convertible::value>::type* = 0) - : Data(Vec.data()), Length(Vec.size()) {} + std::enable_if_t::value> + * = 0) + : Data(Vec.data()), Length(Vec.size()) {} /// @} /// @name Simple Operations @@ -256,7 +254,7 @@ namespace llvm { /// The declaration here is extra complicated so that "arrayRef = {}" /// continues to select the move assignment operator. template - typename std::enable_if::value, ArrayRef>::type & + std::enable_if_t::value, ArrayRef> & operator=(U &&Temporary) = delete; /// Disallow accidental assignment from a temporary. @@ -264,7 +262,7 @@ namespace llvm { /// The declaration here is extra complicated so that "arrayRef = {}" /// continues to select the move assignment operator. template - typename std::enable_if::value, ArrayRef>::type & + std::enable_if_t::value, ArrayRef> & operator=(std::initializer_list) = delete; /// @} @@ -308,17 +306,17 @@ namespace llvm { /// Construct an empty MutableArrayRef from None. /*implicit*/ MutableArrayRef(NoneType) : ArrayRef() {} - /// Construct an MutableArrayRef from a single element. + /// Construct a MutableArrayRef from a single element. /*implicit*/ MutableArrayRef(T &OneElt) : ArrayRef(OneElt) {} - /// Construct an MutableArrayRef from a pointer and length. + /// Construct a MutableArrayRef from a pointer and length. /*implicit*/ MutableArrayRef(T *data, size_t length) : ArrayRef(data, length) {} - /// Construct an MutableArrayRef from a range. + /// Construct a MutableArrayRef from a range. MutableArrayRef(T *begin, T *end) : ArrayRef(begin, end) {} - /// Construct an MutableArrayRef from a SmallVector. + /// Construct a MutableArrayRef from a SmallVector. /*implicit*/ MutableArrayRef(SmallVectorImpl &Vec) : ArrayRef(Vec) {} @@ -326,12 +324,12 @@ namespace llvm { /*implicit*/ MutableArrayRef(std::vector &Vec) : ArrayRef(Vec) {} - /// Construct an ArrayRef from a std::array + /// Construct a MutableArrayRef from a std::array template /*implicit*/ constexpr MutableArrayRef(std::array &Arr) : ArrayRef(Arr) {} - /// Construct an MutableArrayRef from a C array. + /// Construct a MutableArrayRef from a C array. template /*implicit*/ constexpr MutableArrayRef(T (&Arr)[N]) : ArrayRef(Arr) {} @@ -534,11 +532,21 @@ namespace llvm { return LHS.equals(RHS); } - template + template + inline bool operator==(SmallVectorImpl &LHS, ArrayRef RHS) { + return ArrayRef(LHS).equals(RHS); + } + + template inline bool operator!=(ArrayRef LHS, ArrayRef RHS) { return !(LHS == RHS); } + template + inline bool operator!=(SmallVectorImpl &LHS, ArrayRef RHS) { + return !(LHS == RHS); + } + /// @} template hash_code hash_value(ArrayRef S) { diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/BitVector.h b/contrib/llvm-project/llvm/include/llvm/ADT/BitVector.h index 5284be8c4a02..a8d0f07af94a 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/BitVector.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/BitVector.h @@ -14,6 +14,7 @@ #define LLVM_ADT_BITVECTOR_H #include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/DenseMapInfo.h" #include "llvm/ADT/iterator_range.h" #include "llvm/Support/MathExtras.h" #include @@ -531,24 +532,10 @@ public: // Comparison operators. bool operator==(const BitVector &RHS) const { - unsigned ThisWords = NumBitWords(size()); - unsigned RHSWords = NumBitWords(RHS.size()); - unsigned i; - for (i = 0; i != std::min(ThisWords, RHSWords); ++i) - if (Bits[i] != RHS.Bits[i]) - return false; - - // Verify that any extra words are all zeros. - if (i != ThisWords) { - for (; i != ThisWords; ++i) - if (Bits[i]) - return false; - } else if (i != RHSWords) { - for (; i != RHSWords; ++i) - if (RHS.Bits[i]) - return false; - } - return true; + if (size() != RHS.size()) + return false; + unsigned NumWords = NumBitWords(size()); + return Bits.take_front(NumWords) == RHS.Bits.take_front(NumWords); } bool operator!=(const BitVector &RHS) const { @@ -719,6 +706,14 @@ public: if (this == &RHS) return *this; Size = RHS.size(); + + // Handle tombstone when the BitVector is a key of a DenseHash. + if (RHS.isInvalid()) { + std::free(Bits.data()); + Bits = None; + return *this; + } + unsigned RHSWords = NumBitWords(Size); if (Size <= getBitCapacity()) { if (Size) @@ -758,6 +753,16 @@ public: std::swap(Size, RHS.Size); } + void invalid() { + assert(!Size && Bits.empty()); + Size = (unsigned)-1; + } + bool isInvalid() const { return Size == (unsigned)-1; } + + ArrayRef getData() const { + return Bits.take_front(NumBitWords(size())); + } + //===--------------------------------------------------------------------===// // Portable bit mask operations. //===--------------------------------------------------------------------===// @@ -932,6 +937,23 @@ inline size_t capacity_in_bytes(const BitVector &X) { return X.getMemorySize(); } +template <> struct DenseMapInfo { + static inline BitVector getEmptyKey() { return BitVector(); } + static inline BitVector getTombstoneKey() { + BitVector V; + V.invalid(); + return V; + } + static unsigned getHashValue(const BitVector &V) { + return DenseMapInfo>>::getHashValue( + std::make_pair(V.size(), V.getData())); + } + static bool isEqual(const BitVector &LHS, const BitVector &RHS) { + if (LHS.isInvalid() || RHS.isInvalid()) + return LHS.isInvalid() == RHS.isInvalid(); + return LHS == RHS; + } +}; } // end namespace llvm namespace std { diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/Bitfields.h b/contrib/llvm-project/llvm/include/llvm/ADT/Bitfields.h new file mode 100644 index 000000000000..d93f6483fa52 --- /dev/null +++ b/contrib/llvm-project/llvm/include/llvm/ADT/Bitfields.h @@ -0,0 +1,289 @@ +//===-- llvm/ADT/Bitfield.h - Get and Set bits in an integer ---*- C++ -*--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +/// +/// \file +/// This file implements methods to test, set and extract typed bits from packed +/// unsigned integers. +/// +/// Why not C++ bitfields? +/// ---------------------- +/// C++ bitfields do not offer control over the bit layout nor consistent +/// behavior when it comes to out of range values. +/// For instance, the layout is implementation defined and adjacent bits may be +/// packed together but are not required to. This is problematic when storage is +/// sparse and data must be stored in a particular integer type. +/// +/// The methods provided in this file ensure precise control over the +/// layout/storage as well as protection against out of range values. +/// +/// Usage example +/// ------------- +/// \code{.cpp} +/// uint8_t Storage = 0; +/// +/// // Store and retrieve a single bit as bool. +/// using Bool = Bitfield::Element; +/// Bitfield::set(Storage, true); +/// EXPECT_EQ(Storage, 0b00000001); +/// // ^ +/// EXPECT_EQ(Bitfield::get(Storage), true); +/// +/// // Store and retrieve a 2 bit typed enum. +/// // Note: enum underlying type must be unsigned. +/// enum class SuitEnum : uint8_t { CLUBS, DIAMONDS, HEARTS, SPADES }; +/// // Note: enum maximum value needs to be passed in as last parameter. +/// using Suit = Bitfield::Element; +/// Bitfield::set(Storage, SuitEnum::HEARTS); +/// EXPECT_EQ(Storage, 0b00000101); +/// // ^^ +/// EXPECT_EQ(Bitfield::get(Storage), SuitEnum::HEARTS); +/// +/// // Store and retrieve a 5 bit value as unsigned. +/// using Value = Bitfield::Element; +/// Bitfield::set(Storage, 10); +/// EXPECT_EQ(Storage, 0b01010101); +/// // ^^^^^ +/// EXPECT_EQ(Bitfield::get(Storage), 10U); +/// +/// // Interpret the same 5 bit value as signed. +/// using SignedValue = Bitfield::Element; +/// Bitfield::set(Storage, -2); +/// EXPECT_EQ(Storage, 0b11110101); +/// // ^^^^^ +/// EXPECT_EQ(Bitfield::get(Storage), -2); +/// +/// // Ability to efficiently test if a field is non zero. +/// EXPECT_TRUE(Bitfield::test(Storage)); +/// +/// // Alter Storage changes value. +/// Storage = 0; +/// EXPECT_EQ(Bitfield::get(Storage), false); +/// EXPECT_EQ(Bitfield::get(Storage), SuitEnum::CLUBS); +/// EXPECT_EQ(Bitfield::get(Storage), 0U); +/// EXPECT_EQ(Bitfield::get(Storage), 0); +/// +/// Storage = 255; +/// EXPECT_EQ(Bitfield::get(Storage), true); +/// EXPECT_EQ(Bitfield::get(Storage), SuitEnum::SPADES); +/// EXPECT_EQ(Bitfield::get(Storage), 31U); +/// EXPECT_EQ(Bitfield::get(Storage), -1); +/// \endcode +/// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ADT_BITFIELDS_H +#define LLVM_ADT_BITFIELDS_H + +#include +#include // CHAR_BIT +#include // size_t +#include // uintXX_t +#include // numeric_limits +#include + +namespace llvm { + +namespace bitfields_details { + +/// A struct defining useful bit patterns for n-bits integer types. +template struct BitPatterns { + /// Bit patterns are forged using the equivalent `Unsigned` type because of + /// undefined operations over signed types (e.g. Bitwise shift operators). + /// Moreover same size casting from unsigned to signed is well defined but not + /// the other way around. + using Unsigned = typename std::make_unsigned::type; + static_assert(sizeof(Unsigned) == sizeof(T), "Types must have same size"); + + static constexpr unsigned TypeBits = sizeof(Unsigned) * CHAR_BIT; + static_assert(TypeBits >= Bits, "n-bit must fit in T"); + + /// e.g. with TypeBits == 8 and Bits == 6. + static constexpr Unsigned AllZeros = Unsigned(0); // 00000000 + static constexpr Unsigned AllOnes = ~Unsigned(0); // 11111111 + static constexpr Unsigned Umin = AllZeros; // 00000000 + static constexpr Unsigned Umax = AllOnes >> (TypeBits - Bits); // 00111111 + static constexpr Unsigned SignBitMask = Unsigned(1) << (Bits - 1); // 00100000 + static constexpr Unsigned Smax = Umax >> 1U; // 00011111 + static constexpr Unsigned Smin = ~Smax; // 11100000 + static constexpr Unsigned SignExtend = Unsigned(Smin << 1U); // 11000000 +}; + +/// `Compressor` is used to manipulate the bits of a (possibly signed) integer +/// type so it can be packed and unpacked into a `bits` sized integer, +/// `Compressor` is specialized on signed-ness so no runtime cost is incurred. +/// The `pack` method also checks that the passed in `UserValue` is valid. +template ::value> +struct Compressor { + static_assert(std::is_unsigned::value, "T is unsigned"); + using BP = BitPatterns; + + static T pack(T UserValue, T UserMaxValue) { + assert(UserValue <= UserMaxValue && "value is too big"); + assert(UserValue <= BP::Umax && "value is too big"); + return UserValue; + } + + static T unpack(T StorageValue) { return StorageValue; } +}; + +template struct Compressor { + static_assert(std::is_signed::value, "T is signed"); + using BP = BitPatterns; + + static T pack(T UserValue, T UserMaxValue) { + assert(UserValue <= UserMaxValue && "value is too big"); + assert(UserValue <= T(BP::Smax) && "value is too big"); + assert(UserValue >= T(BP::Smin) && "value is too small"); + if (UserValue < 0) + UserValue &= ~BP::SignExtend; + return UserValue; + } + + static T unpack(T StorageValue) { + if (StorageValue >= T(BP::SignBitMask)) + StorageValue |= BP::SignExtend; + return StorageValue; + } +}; + +/// Impl is where Bifield description and Storage are put together to interact +/// with values. +template struct Impl { + static_assert(std::is_unsigned::value, + "Storage must be unsigned"); + using IntegerType = typename Bitfield::IntegerType; + using C = Compressor; + using BP = BitPatterns; + + static constexpr size_t StorageBits = sizeof(StorageType) * CHAR_BIT; + static_assert(Bitfield::FirstBit <= StorageBits, "Data must fit in mask"); + static_assert(Bitfield::LastBit <= StorageBits, "Data must fit in mask"); + static constexpr StorageType Mask = BP::Umax << Bitfield::Shift; + + /// Checks `UserValue` is within bounds and packs it between `FirstBit` and + /// `LastBit` of `Packed` leaving the rest unchanged. + static void update(StorageType &Packed, IntegerType UserValue) { + const StorageType StorageValue = C::pack(UserValue, Bitfield::UserMaxValue); + Packed &= ~Mask; + Packed |= StorageValue << Bitfield::Shift; + } + + /// Interprets bits between `FirstBit` and `LastBit` of `Packed` as + /// an`IntegerType`. + static IntegerType extract(StorageType Packed) { + const StorageType StorageValue = (Packed & Mask) >> Bitfield::Shift; + return C::unpack(StorageValue); + } + + /// Interprets bits between `FirstBit` and `LastBit` of `Packed` as + /// an`IntegerType`. + static StorageType test(StorageType Packed) { return Packed & Mask; } +}; + +/// `Bitfield` deals with the following type: +/// - unsigned enums +/// - signed and unsigned integer +/// - `bool` +/// Internally though we only manipulate integer with well defined and +/// consistent semantics, this excludes typed enums and `bool` that are replaced +/// with their unsigned counterparts. The correct type is restored in the public +/// API. +template ::value> +struct ResolveUnderlyingType { + using type = typename std::underlying_type::type; +}; +template struct ResolveUnderlyingType { + using type = T; +}; +template <> struct ResolveUnderlyingType { + /// In case sizeof(bool) != 1, replace `void` by an additionnal + /// std::conditional. + using type = std::conditional::type; +}; + +} // namespace bitfields_details + +/// Holds functions to get, set or test bitfields. +struct Bitfield { + /// Describes an element of a Bitfield. This type is then used with the + /// Bitfield static member functions. + /// \tparam T The type of the field once in unpacked form. + /// \tparam Offset The position of the first bit. + /// \tparam Size The size of the field. + /// \tparam MaxValue For enums the maximum enum allowed. + template ::value + ? T(0) // coupled with static_assert below + : std::numeric_limits::max()> + struct Element { + using Type = T; + using IntegerType = + typename bitfields_details::ResolveUnderlyingType::type; + static constexpr unsigned Shift = Offset; + static constexpr unsigned Bits = Size; + static constexpr unsigned FirstBit = Offset; + static constexpr unsigned LastBit = Shift + Bits - 1; + static constexpr unsigned NextBit = Shift + Bits; + + private: + template friend struct bitfields_details::Impl; + + static_assert(Bits > 0, "Bits must be non zero"); + static constexpr size_t TypeBits = sizeof(IntegerType) * CHAR_BIT; + static_assert(Bits <= TypeBits, "Bits may not be greater than T size"); + static_assert(!std::is_enum::value || MaxValue != T(0), + "Enum Bitfields must provide a MaxValue"); + static_assert(!std::is_enum::value || + std::is_unsigned::value, + "Enum must be unsigned"); + static_assert(std::is_integral::value && + std::numeric_limits::is_integer, + "IntegerType must be an integer type"); + + static constexpr IntegerType UserMaxValue = + static_cast(MaxValue); + }; + + /// Unpacks the field from the `Packed` value. + template + static typename Bitfield::Type get(StorageType Packed) { + using I = bitfields_details::Impl; + return static_cast(I::extract(Packed)); + } + + /// Return a non-zero value if the field is non-zero. + /// It is more efficient than `getField`. + template + static StorageType test(StorageType Packed) { + using I = bitfields_details::Impl; + return I::test(Packed); + } + + /// Sets the typed value in the provided `Packed` value. + /// The method will asserts if the provided value is too big to fit in. + template + static void set(StorageType &Packed, typename Bitfield::Type Value) { + using I = bitfields_details::Impl; + I::update(Packed, static_cast(Value)); + } + + /// Returns whether the two bitfields share common bits. + template static constexpr bool isOverlapping() { + return A::LastBit >= B::FirstBit && B::LastBit >= A::FirstBit; + } + + template static constexpr bool areContiguous() { return true; } + template + static constexpr bool areContiguous() { + return A::NextBit == B::FirstBit && areContiguous(); + } +}; + +} // namespace llvm + +#endif // LLVM_ADT_BITFIELDS_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/BitmaskEnum.h b/contrib/llvm-project/llvm/include/llvm/ADT/BitmaskEnum.h index 1a18bc721b21..89e5508e08e1 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/BitmaskEnum.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/BitmaskEnum.h @@ -71,49 +71,49 @@ struct is_bitmask_enum : std::false_type {}; template struct is_bitmask_enum< - E, typename std::enable_if= - 0>::type> : std::true_type {}; + E, std::enable_if_t= 0>> + : std::true_type {}; namespace BitmaskEnumDetail { /// Get a bitmask with 1s in all places up to the high-order bit of E's largest /// value. -template typename std::underlying_type::type Mask() { +template std::underlying_type_t Mask() { // On overflow, NextPowerOf2 returns zero with the type uint64_t, so // subtracting 1 gives us the mask with all bits set, like we want. - return NextPowerOf2(static_cast::type>( + return NextPowerOf2(static_cast>( E::LLVM_BITMASK_LARGEST_ENUMERATOR)) - 1; } /// Check that Val is in range for E, and return Val cast to E's underlying /// type. -template typename std::underlying_type::type Underlying(E Val) { - auto U = static_cast::type>(Val); +template std::underlying_type_t Underlying(E Val) { + auto U = static_cast>(Val); assert(U >= 0 && "Negative enum values are not allowed."); assert(U <= Mask() && "Enum value too large (or largest val too small?)"); return U; } -template ::value>::type> +constexpr unsigned bitWidth(uint64_t Value) { + return Value ? 1 + bitWidth(Value >> 1) : 0; +} + +template ::value>> E operator~(E Val) { return static_cast(~Underlying(Val) & Mask()); } -template ::value>::type> +template ::value>> E operator|(E LHS, E RHS) { return static_cast(Underlying(LHS) | Underlying(RHS)); } -template ::value>::type> +template ::value>> E operator&(E LHS, E RHS) { return static_cast(Underlying(LHS) & Underlying(RHS)); } -template ::value>::type> +template ::value>> E operator^(E LHS, E RHS) { return static_cast(Underlying(LHS) ^ Underlying(RHS)); } @@ -121,22 +121,19 @@ E operator^(E LHS, E RHS) { // |=, &=, and ^= return a reference to LHS, to match the behavior of the // operators on builtin types. -template ::value>::type> +template ::value>> E &operator|=(E &LHS, E RHS) { LHS = LHS | RHS; return LHS; } -template ::value>::type> +template ::value>> E &operator&=(E &LHS, E RHS) { LHS = LHS & RHS; return LHS; } -template ::value>::type> +template ::value>> E &operator^=(E &LHS, E RHS) { LHS = LHS ^ RHS; return LHS; @@ -146,6 +143,10 @@ E &operator^=(E &LHS, E RHS) { // Enable bitmask enums in namespace ::llvm and all nested namespaces. LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE(); +template ::value>> +constexpr unsigned BitWidth = BitmaskEnumDetail::bitWidth(uint64_t{ + static_cast>( + E::LLVM_BITMASK_LARGEST_ENUMERATOR)}); } // namespace llvm diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/CachedHashString.h b/contrib/llvm-project/llvm/include/llvm/ADT/CachedHashString.h index 80144fb87e0e..6233d0fc08fd 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/CachedHashString.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/CachedHashString.h @@ -19,9 +19,8 @@ #ifndef LLVM_ADT_CACHED_HASH_STRING_H #define LLVM_ADT_CACHED_HASH_STRING_H -#include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/DenseMapInfo.h" #include "llvm/ADT/StringRef.h" -#include "llvm/Support/raw_ostream.h" namespace llvm { diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/CoalescingBitVector.h b/contrib/llvm-project/llvm/include/llvm/ADT/CoalescingBitVector.h new file mode 100644 index 000000000000..f8c8fec0ec9e --- /dev/null +++ b/contrib/llvm-project/llvm/include/llvm/ADT/CoalescingBitVector.h @@ -0,0 +1,444 @@ +//===- llvm/ADT/CoalescingBitVector.h - A coalescing bitvector --*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +/// +/// \file A bitvector that uses an IntervalMap to coalesce adjacent elements +/// into intervals. +/// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ADT_COALESCINGBITVECTOR_H +#define LLVM_ADT_COALESCINGBITVECTOR_H + +#include "llvm/ADT/IntervalMap.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/iterator_range.h" +#include "llvm/Support/Debug.h" +#include "llvm/Support/raw_ostream.h" + +#include +#include + +namespace llvm { + +/// A bitvector that, under the hood, relies on an IntervalMap to coalesce +/// elements into intervals. Good for representing sets which predominantly +/// contain contiguous ranges. Bad for representing sets with lots of gaps +/// between elements. +/// +/// Compared to SparseBitVector, CoalescingBitVector offers more predictable +/// performance for non-sequential find() operations. +/// +/// \tparam IndexT - The type of the index into the bitvector. +/// \tparam N - The first N coalesced intervals of set bits are stored in-place. +template class CoalescingBitVector { + static_assert(std::is_unsigned::value, + "Index must be an unsigned integer."); + + using ThisT = CoalescingBitVector; + + /// An interval map for closed integer ranges. The mapped values are unused. + using MapT = IntervalMap; + + using UnderlyingIterator = typename MapT::const_iterator; + + using IntervalT = std::pair; + +public: + using Allocator = typename MapT::Allocator; + + /// Construct by passing in a CoalescingBitVector::Allocator + /// reference. + CoalescingBitVector(Allocator &Alloc) + : Alloc(&Alloc), Intervals(Alloc) {} + + /// \name Copy/move constructors and assignment operators. + /// @{ + + CoalescingBitVector(const ThisT &Other) + : Alloc(Other.Alloc), Intervals(*Other.Alloc) { + set(Other); + } + + ThisT &operator=(const ThisT &Other) { + clear(); + set(Other); + return *this; + } + + CoalescingBitVector(ThisT &&Other) = delete; + ThisT &operator=(ThisT &&Other) = delete; + + /// @} + + /// Clear all the bits. + void clear() { Intervals.clear(); } + + /// Check whether no bits are set. + bool empty() const { return Intervals.empty(); } + + /// Count the number of set bits. + unsigned count() const { + unsigned Bits = 0; + for (auto It = Intervals.begin(), End = Intervals.end(); It != End; ++It) + Bits += 1 + It.stop() - It.start(); + return Bits; + } + + /// Set the bit at \p Index. + /// + /// This method does /not/ support setting a bit that has already been set, + /// for efficiency reasons. If possible, restructure your code to not set the + /// same bit multiple times, or use \ref test_and_set. + void set(IndexT Index) { + assert(!test(Index) && "Setting already-set bits not supported/efficient, " + "IntervalMap will assert"); + insert(Index, Index); + } + + /// Set the bits set in \p Other. + /// + /// This method does /not/ support setting already-set bits, see \ref set + /// for the rationale. For a safe set union operation, use \ref operator|=. + void set(const ThisT &Other) { + for (auto It = Other.Intervals.begin(), End = Other.Intervals.end(); + It != End; ++It) + insert(It.start(), It.stop()); + } + + /// Set the bits at \p Indices. Used for testing, primarily. + void set(std::initializer_list Indices) { + for (IndexT Index : Indices) + set(Index); + } + + /// Check whether the bit at \p Index is set. + bool test(IndexT Index) const { + const auto It = Intervals.find(Index); + if (It == Intervals.end()) + return false; + assert(It.stop() >= Index && "Interval must end after Index"); + return It.start() <= Index; + } + + /// Set the bit at \p Index. Supports setting an already-set bit. + void test_and_set(IndexT Index) { + if (!test(Index)) + set(Index); + } + + /// Reset the bit at \p Index. Supports resetting an already-unset bit. + void reset(IndexT Index) { + auto It = Intervals.find(Index); + if (It == Intervals.end()) + return; + + // Split the interval containing Index into up to two parts: one from + // [Start, Index-1] and another from [Index+1, Stop]. If Index is equal to + // either Start or Stop, we create one new interval. If Index is equal to + // both Start and Stop, we simply erase the existing interval. + IndexT Start = It.start(); + if (Index < Start) + // The index was not set. + return; + IndexT Stop = It.stop(); + assert(Index <= Stop && "Wrong interval for index"); + It.erase(); + if (Start < Index) + insert(Start, Index - 1); + if (Index < Stop) + insert(Index + 1, Stop); + } + + /// Set union. If \p RHS is guaranteed to not overlap with this, \ref set may + /// be a faster alternative. + void operator|=(const ThisT &RHS) { + // Get the overlaps between the two interval maps. + SmallVector Overlaps; + getOverlaps(RHS, Overlaps); + + // Insert the non-overlapping parts of all the intervals from RHS. + for (auto It = RHS.Intervals.begin(), End = RHS.Intervals.end(); + It != End; ++It) { + IndexT Start = It.start(); + IndexT Stop = It.stop(); + SmallVector NonOverlappingParts; + getNonOverlappingParts(Start, Stop, Overlaps, NonOverlappingParts); + for (IntervalT AdditivePortion : NonOverlappingParts) + insert(AdditivePortion.first, AdditivePortion.second); + } + } + + /// Set intersection. + void operator&=(const ThisT &RHS) { + // Get the overlaps between the two interval maps (i.e. the intersection). + SmallVector Overlaps; + getOverlaps(RHS, Overlaps); + // Rebuild the interval map, including only the overlaps. + clear(); + for (IntervalT Overlap : Overlaps) + insert(Overlap.first, Overlap.second); + } + + /// Reset all bits present in \p Other. + void intersectWithComplement(const ThisT &Other) { + SmallVector Overlaps; + if (!getOverlaps(Other, Overlaps)) { + // If there is no overlap with Other, the intersection is empty. + return; + } + + // Delete the overlapping intervals. Split up intervals that only partially + // intersect an overlap. + for (IntervalT Overlap : Overlaps) { + IndexT OlapStart, OlapStop; + std::tie(OlapStart, OlapStop) = Overlap; + + auto It = Intervals.find(OlapStart); + IndexT CurrStart = It.start(); + IndexT CurrStop = It.stop(); + assert(CurrStart <= OlapStart && OlapStop <= CurrStop && + "Expected some intersection!"); + + // Split the overlap interval into up to two parts: one from [CurrStart, + // OlapStart-1] and another from [OlapStop+1, CurrStop]. If OlapStart is + // equal to CurrStart, the first split interval is unnecessary. Ditto for + // when OlapStop is equal to CurrStop, we omit the second split interval. + It.erase(); + if (CurrStart < OlapStart) + insert(CurrStart, OlapStart - 1); + if (OlapStop < CurrStop) + insert(OlapStop + 1, CurrStop); + } + } + + bool operator==(const ThisT &RHS) const { + // We cannot just use std::equal because it checks the dereferenced values + // of an iterator pair for equality, not the iterators themselves. In our + // case that results in comparison of the (unused) IntervalMap values. + auto ItL = Intervals.begin(); + auto ItR = RHS.Intervals.begin(); + while (ItL != Intervals.end() && ItR != RHS.Intervals.end() && + ItL.start() == ItR.start() && ItL.stop() == ItR.stop()) { + ++ItL; + ++ItR; + } + return ItL == Intervals.end() && ItR == RHS.Intervals.end(); + } + + bool operator!=(const ThisT &RHS) const { return !operator==(RHS); } + + class const_iterator + : public std::iterator { + friend class CoalescingBitVector; + + // For performance reasons, make the offset at the end different than the + // one used in \ref begin, to optimize the common `It == end()` pattern. + static constexpr unsigned kIteratorAtTheEndOffset = ~0u; + + UnderlyingIterator MapIterator; + unsigned OffsetIntoMapIterator = 0; + + // Querying the start/stop of an IntervalMap iterator can be very expensive. + // Cache these values for performance reasons. + IndexT CachedStart = IndexT(); + IndexT CachedStop = IndexT(); + + void setToEnd() { + OffsetIntoMapIterator = kIteratorAtTheEndOffset; + CachedStart = IndexT(); + CachedStop = IndexT(); + } + + /// MapIterator has just changed, reset the cached state to point to the + /// start of the new underlying iterator. + void resetCache() { + if (MapIterator.valid()) { + OffsetIntoMapIterator = 0; + CachedStart = MapIterator.start(); + CachedStop = MapIterator.stop(); + } else { + setToEnd(); + } + } + + /// Advance the iterator to \p Index, if it is contained within the current + /// interval. The public-facing method which supports advancing past the + /// current interval is \ref advanceToLowerBound. + void advanceTo(IndexT Index) { + assert(Index <= CachedStop && "Cannot advance to OOB index"); + if (Index < CachedStart) + // We're already past this index. + return; + OffsetIntoMapIterator = Index - CachedStart; + } + + const_iterator(UnderlyingIterator MapIt) : MapIterator(MapIt) { + resetCache(); + } + + public: + const_iterator() { setToEnd(); } + + bool operator==(const const_iterator &RHS) const { + // Do /not/ compare MapIterator for equality, as this is very expensive. + // The cached start/stop values make that check unnecessary. + return std::tie(OffsetIntoMapIterator, CachedStart, CachedStop) == + std::tie(RHS.OffsetIntoMapIterator, RHS.CachedStart, + RHS.CachedStop); + } + + bool operator!=(const const_iterator &RHS) const { + return !operator==(RHS); + } + + IndexT operator*() const { return CachedStart + OffsetIntoMapIterator; } + + const_iterator &operator++() { // Pre-increment (++It). + if (CachedStart + OffsetIntoMapIterator < CachedStop) { + // Keep going within the current interval. + ++OffsetIntoMapIterator; + } else { + // We reached the end of the current interval: advance. + ++MapIterator; + resetCache(); + } + return *this; + } + + const_iterator operator++(int) { // Post-increment (It++). + const_iterator tmp = *this; + operator++(); + return tmp; + } + + /// Advance the iterator to the first set bit AT, OR AFTER, \p Index. If + /// no such set bit exists, advance to end(). This is like std::lower_bound. + /// This is useful if \p Index is close to the current iterator position. + /// However, unlike \ref find(), this has worst-case O(n) performance. + void advanceToLowerBound(IndexT Index) { + if (OffsetIntoMapIterator == kIteratorAtTheEndOffset) + return; + + // Advance to the first interval containing (or past) Index, or to end(). + while (Index > CachedStop) { + ++MapIterator; + resetCache(); + if (OffsetIntoMapIterator == kIteratorAtTheEndOffset) + return; + } + + advanceTo(Index); + } + }; + + const_iterator begin() const { return const_iterator(Intervals.begin()); } + + const_iterator end() const { return const_iterator(); } + + /// Return an iterator pointing to the first set bit AT, OR AFTER, \p Index. + /// If no such set bit exists, return end(). This is like std::lower_bound. + /// This has worst-case logarithmic performance (roughly O(log(gaps between + /// contiguous ranges))). + const_iterator find(IndexT Index) const { + auto UnderlyingIt = Intervals.find(Index); + if (UnderlyingIt == Intervals.end()) + return end(); + auto It = const_iterator(UnderlyingIt); + It.advanceTo(Index); + return It; + } + + /// Return a range iterator which iterates over all of the set bits in the + /// half-open range [Start, End). + iterator_range half_open_range(IndexT Start, + IndexT End) const { + assert(Start < End && "Not a valid range"); + auto StartIt = find(Start); + if (StartIt == end() || *StartIt >= End) + return {end(), end()}; + auto EndIt = StartIt; + EndIt.advanceToLowerBound(End); + return {StartIt, EndIt}; + } + + void print(raw_ostream &OS) const { + OS << "{"; + for (auto It = Intervals.begin(), End = Intervals.end(); It != End; + ++It) { + OS << "[" << It.start(); + if (It.start() != It.stop()) + OS << ", " << It.stop(); + OS << "]"; + } + OS << "}"; + } + +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) + LLVM_DUMP_METHOD void dump() const { + // LLDB swallows the first line of output after callling dump(). Add + // newlines before/after the braces to work around this. + dbgs() << "\n"; + print(dbgs()); + dbgs() << "\n"; + } +#endif + +private: + void insert(IndexT Start, IndexT End) { Intervals.insert(Start, End, 0); } + + /// Record the overlaps between \p this and \p Other in \p Overlaps. Return + /// true if there is any overlap. + bool getOverlaps(const ThisT &Other, + SmallVectorImpl &Overlaps) const { + for (IntervalMapOverlaps I(Intervals, Other.Intervals); + I.valid(); ++I) + Overlaps.emplace_back(I.start(), I.stop()); + assert(llvm::is_sorted(Overlaps, + [](IntervalT LHS, IntervalT RHS) { + return LHS.second < RHS.first; + }) && + "Overlaps must be sorted"); + return !Overlaps.empty(); + } + + /// Given the set of overlaps between this and some other bitvector, and an + /// interval [Start, Stop] from that bitvector, determine the portions of the + /// interval which do not overlap with this. + void getNonOverlappingParts(IndexT Start, IndexT Stop, + const SmallVectorImpl &Overlaps, + SmallVectorImpl &NonOverlappingParts) { + IndexT NextUncoveredBit = Start; + for (IntervalT Overlap : Overlaps) { + IndexT OlapStart, OlapStop; + std::tie(OlapStart, OlapStop) = Overlap; + + // [Start;Stop] and [OlapStart;OlapStop] overlap iff OlapStart <= Stop + // and Start <= OlapStop. + bool DoesOverlap = OlapStart <= Stop && Start <= OlapStop; + if (!DoesOverlap) + continue; + + // Cover the range [NextUncoveredBit, OlapStart). This puts the start of + // the next uncovered range at OlapStop+1. + if (NextUncoveredBit < OlapStart) + NonOverlappingParts.emplace_back(NextUncoveredBit, OlapStart - 1); + NextUncoveredBit = OlapStop + 1; + if (NextUncoveredBit > Stop) + break; + } + if (NextUncoveredBit <= Stop) + NonOverlappingParts.emplace_back(NextUncoveredBit, Stop); + } + + Allocator *Alloc; + MapT Intervals; +}; + +} // namespace llvm + +#endif // LLVM_ADT_COALESCINGBITVECTOR_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/DAGDeltaAlgorithm.h b/contrib/llvm-project/llvm/include/llvm/ADT/DAGDeltaAlgorithm.h index d4cdc3c86048..c3872af2a0b4 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/DAGDeltaAlgorithm.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/DAGDeltaAlgorithm.h @@ -29,7 +29,7 @@ namespace llvm { /// /// P(S) => P(S union pred(S)) /// -/// The minization algorithm uses this dependency information to attempt to +/// The minimization algorithm uses this dependency information to attempt to /// eagerly prune large subsets of changes. As with \see DeltaAlgorithm, the DAG /// is not required to satisfy this property, but the algorithm will run /// substantially fewer tests with appropriate dependencies. \see DeltaAlgorithm diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/DeltaAlgorithm.h b/contrib/llvm-project/llvm/include/llvm/ADT/DeltaAlgorithm.h index 114b95499530..e1743fd00196 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/DeltaAlgorithm.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/DeltaAlgorithm.h @@ -54,7 +54,7 @@ private: /// Split - Partition a set of changes \p S into one or two subsets. void Split(const changeset_ty &S, changesetlist_ty &Res); - /// Delta - Minimize a set of \p Changes which has been partioned into + /// Delta - Minimize a set of \p Changes which has been partitioned into /// smaller sets, by attempting to remove individual subsets. changeset_ty Delta(const changeset_ty &Changes, const changesetlist_ty &Sets); diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/DenseMap.h b/contrib/llvm-project/llvm/include/llvm/ADT/DenseMap.h index 148d319c8603..34d397cc9793 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/DenseMap.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/DenseMap.h @@ -18,6 +18,7 @@ #include "llvm/Support/AlignOf.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/MathExtras.h" +#include "llvm/Support/MemAlloc.h" #include "llvm/Support/ReverseIteration.h" #include "llvm/Support/type_traits.h" #include @@ -119,9 +120,8 @@ public: } const KeyT EmptyKey = getEmptyKey(), TombstoneKey = getTombstoneKey(); - if (is_trivially_copyable::value && - is_trivially_copyable::value) { - // Use a simpler loop when these are trivial types. + if (std::is_trivially_destructible::value) { + // Use a simpler loop when values don't need destruction. for (BucketT *P = getBuckets(), *E = getBucketsEnd(); P != E; ++P) P->getFirst() = EmptyKey; } else { @@ -150,13 +150,19 @@ public: iterator find(const_arg_type_t Val) { BucketT *TheBucket; if (LookupBucketFor(Val, TheBucket)) - return makeIterator(TheBucket, getBucketsEnd(), *this, true); + return makeIterator(TheBucket, + shouldReverseIterate() ? getBuckets() + : getBucketsEnd(), + *this, true); return end(); } const_iterator find(const_arg_type_t Val) const { const BucketT *TheBucket; if (LookupBucketFor(Val, TheBucket)) - return makeConstIterator(TheBucket, getBucketsEnd(), *this, true); + return makeConstIterator(TheBucket, + shouldReverseIterate() ? getBuckets() + : getBucketsEnd(), + *this, true); return end(); } @@ -169,14 +175,20 @@ public: iterator find_as(const LookupKeyT &Val) { BucketT *TheBucket; if (LookupBucketFor(Val, TheBucket)) - return makeIterator(TheBucket, getBucketsEnd(), *this, true); + return makeIterator(TheBucket, + shouldReverseIterate() ? getBuckets() + : getBucketsEnd(), + *this, true); return end(); } template const_iterator find_as(const LookupKeyT &Val) const { const BucketT *TheBucket; if (LookupBucketFor(Val, TheBucket)) - return makeConstIterator(TheBucket, getBucketsEnd(), *this, true); + return makeConstIterator(TheBucket, + shouldReverseIterate() ? getBuckets() + : getBucketsEnd(), + *this, true); return end(); } @@ -210,16 +222,22 @@ public: std::pair try_emplace(KeyT &&Key, Ts &&... Args) { BucketT *TheBucket; if (LookupBucketFor(Key, TheBucket)) - return std::make_pair( - makeIterator(TheBucket, getBucketsEnd(), *this, true), - false); // Already in map. + return std::make_pair(makeIterator(TheBucket, + shouldReverseIterate() + ? getBuckets() + : getBucketsEnd(), + *this, true), + false); // Already in map. // Otherwise, insert the new element. TheBucket = InsertIntoBucket(TheBucket, std::move(Key), std::forward(Args)...); - return std::make_pair( - makeIterator(TheBucket, getBucketsEnd(), *this, true), - true); + return std::make_pair(makeIterator(TheBucket, + shouldReverseIterate() + ? getBuckets() + : getBucketsEnd(), + *this, true), + true); } // Inserts key,value pair into the map if the key isn't already in the map. @@ -229,15 +247,21 @@ public: std::pair try_emplace(const KeyT &Key, Ts &&... Args) { BucketT *TheBucket; if (LookupBucketFor(Key, TheBucket)) - return std::make_pair( - makeIterator(TheBucket, getBucketsEnd(), *this, true), - false); // Already in map. + return std::make_pair(makeIterator(TheBucket, + shouldReverseIterate() + ? getBuckets() + : getBucketsEnd(), + *this, true), + false); // Already in map. // Otherwise, insert the new element. TheBucket = InsertIntoBucket(TheBucket, Key, std::forward(Args)...); - return std::make_pair( - makeIterator(TheBucket, getBucketsEnd(), *this, true), - true); + return std::make_pair(makeIterator(TheBucket, + shouldReverseIterate() + ? getBuckets() + : getBucketsEnd(), + *this, true), + true); } /// Alternate version of insert() which allows a different, and possibly @@ -250,16 +274,22 @@ public: const LookupKeyT &Val) { BucketT *TheBucket; if (LookupBucketFor(Val, TheBucket)) - return std::make_pair( - makeIterator(TheBucket, getBucketsEnd(), *this, true), - false); // Already in map. + return std::make_pair(makeIterator(TheBucket, + shouldReverseIterate() + ? getBuckets() + : getBucketsEnd(), + *this, true), + false); // Already in map. // Otherwise, insert the new element. TheBucket = InsertIntoBucketWithLookup(TheBucket, std::move(KV.first), std::move(KV.second), Val); - return std::make_pair( - makeIterator(TheBucket, getBucketsEnd(), *this, true), - true); + return std::make_pair(makeIterator(TheBucket, + shouldReverseIterate() + ? getBuckets() + : getBucketsEnd(), + *this, true), + true); } /// insert - Range insertion of pairs. @@ -695,7 +725,7 @@ class DenseMap : public DenseMapBase, unsigned NumBuckets; public: - /// Create a DenseMap wth an optional \p InitialReserve that guarantee that + /// Create a DenseMap with an optional \p InitialReserve that guarantee that /// this number of elements can be inserted in the map without grow() explicit DenseMap(unsigned InitialReserve = 0) { init(InitialReserve); } @@ -1194,19 +1224,21 @@ public: // for const iterator destinations so it doesn't end up as a user defined copy // constructor. template ::type> + typename = std::enable_if_t> DenseMapIterator( const DenseMapIterator &I) : DebugEpochBase::HandleBase(I), Ptr(I.Ptr), End(I.End) {} reference operator*() const { assert(isHandleInSync() && "invalid iterator access!"); + assert(Ptr != End && "dereferencing end() iterator"); if (shouldReverseIterate()) return Ptr[-1]; return *Ptr; } pointer operator->() const { assert(isHandleInSync() && "invalid iterator access!"); + assert(Ptr != End && "dereferencing end() iterator"); if (shouldReverseIterate()) return &(Ptr[-1]); return Ptr; @@ -1229,6 +1261,7 @@ public: inline DenseMapIterator& operator++() { // Preincrement assert(isHandleInSync() && "invalid iterator access!"); + assert(Ptr != End && "incrementing end() iterator"); if (shouldReverseIterate()) { --Ptr; RetreatPastEmptyBuckets(); diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/DenseMapInfo.h b/contrib/llvm-project/llvm/include/llvm/ADT/DenseMapInfo.h index bd4c60c8f13e..e465331ac6f7 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/DenseMapInfo.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/DenseMapInfo.h @@ -16,8 +16,6 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/Hashing.h" #include "llvm/ADT/StringRef.h" -#include "llvm/Support/PointerLikeTypeTraits.h" -#include "llvm/Support/TypeSize.h" #include #include #include @@ -25,6 +23,24 @@ namespace llvm { +namespace detail { + +/// Simplistic combination of 32-bit hash values into 32-bit hash values. +static inline unsigned combineHashValue(unsigned a, unsigned b) { + uint64_t key = (uint64_t)a << 32 | (uint64_t)b; + key += ~(key << 32); + key ^= (key >> 22); + key += ~(key << 13); + key ^= (key >> 8); + key += (key << 3); + key ^= (key >> 15); + key += ~(key << 27); + key ^= (key >> 31); + return (unsigned)key; +} + +} // end namespace detail + template struct DenseMapInfo { //static inline T getEmptyKey(); @@ -33,18 +49,28 @@ struct DenseMapInfo { //static bool isEqual(const T &LHS, const T &RHS); }; -// Provide DenseMapInfo for all pointers. +// Provide DenseMapInfo for all pointers. Come up with sentinel pointer values +// that are aligned to alignof(T) bytes, but try to avoid requiring T to be +// complete. This allows clients to instantiate DenseMap with forward +// declared key types. Assume that no pointer key type requires more than 4096 +// bytes of alignment. template struct DenseMapInfo { + // The following should hold, but it would require T to be complete: + // static_assert(alignof(T) <= (1 << Log2MaxAlign), + // "DenseMap does not support pointer keys requiring more than " + // "Log2MaxAlign bits of alignment"); + static constexpr uintptr_t Log2MaxAlign = 12; + static inline T* getEmptyKey() { uintptr_t Val = static_cast(-1); - Val <<= PointerLikeTypeTraits::NumLowBitsAvailable; + Val <<= Log2MaxAlign; return reinterpret_cast(Val); } static inline T* getTombstoneKey() { uintptr_t Val = static_cast(-2); - Val <<= PointerLikeTypeTraits::NumLowBitsAvailable; + Val <<= Log2MaxAlign; return reinterpret_cast(Val); } @@ -198,17 +224,8 @@ struct DenseMapInfo> { } static unsigned getHashValue(const Pair& PairVal) { - uint64_t key = (uint64_t)FirstInfo::getHashValue(PairVal.first) << 32 - | (uint64_t)SecondInfo::getHashValue(PairVal.second); - key += ~(key << 32); - key ^= (key >> 22); - key += ~(key << 13); - key ^= (key >> 8); - key += (key << 3); - key ^= (key >> 15); - key += ~(key << 27); - key ^= (key >> 31); - return (unsigned)key; + return detail::combineHashValue(FirstInfo::getHashValue(PairVal.first), + SecondInfo::getHashValue(PairVal.second)); } static bool isEqual(const Pair &LHS, const Pair &RHS) { @@ -217,6 +234,56 @@ struct DenseMapInfo> { } }; +// Provide DenseMapInfo for all tuples whose members have info. +template struct DenseMapInfo> { + using Tuple = std::tuple; + + static inline Tuple getEmptyKey() { + return Tuple(DenseMapInfo::getEmptyKey()...); + } + + static inline Tuple getTombstoneKey() { + return Tuple(DenseMapInfo::getTombstoneKey()...); + } + + template + static unsigned getHashValueImpl(const Tuple &values, std::false_type) { + using EltType = typename std::tuple_element::type; + std::integral_constant atEnd; + return detail::combineHashValue( + DenseMapInfo::getHashValue(std::get(values)), + getHashValueImpl(values, atEnd)); + } + + template + static unsigned getHashValueImpl(const Tuple &values, std::true_type) { + return 0; + } + + static unsigned getHashValue(const std::tuple &values) { + std::integral_constant atEnd; + return getHashValueImpl<0>(values, atEnd); + } + + template + static bool isEqualImpl(const Tuple &lhs, const Tuple &rhs, std::false_type) { + using EltType = typename std::tuple_element::type; + std::integral_constant atEnd; + return DenseMapInfo::isEqual(std::get(lhs), std::get(rhs)) && + isEqualImpl(lhs, rhs, atEnd); + } + + template + static bool isEqualImpl(const Tuple &lhs, const Tuple &rhs, std::true_type) { + return true; + } + + static bool isEqual(const Tuple &lhs, const Tuple &rhs) { + std::integral_constant atEnd; + return isEqualImpl<0>(lhs, rhs, atEnd); + } +}; + // Provide DenseMapInfo for StringRefs. template <> struct DenseMapInfo { static inline StringRef getEmptyKey() { @@ -280,21 +347,6 @@ template <> struct DenseMapInfo { static bool isEqual(hash_code LHS, hash_code RHS) { return LHS == RHS; } }; -template <> struct DenseMapInfo { - static inline ElementCount getEmptyKey() { return {~0U, true}; } - static inline ElementCount getTombstoneKey() { return {~0U - 1, false}; } - static unsigned getHashValue(const ElementCount& EltCnt) { - if (EltCnt.Scalable) - return (EltCnt.Min * 37U) - 1U; - - return EltCnt.Min * 37U; - } - - static bool isEqual(const ElementCount& LHS, const ElementCount& RHS) { - return LHS == RHS; - } -}; - } // end namespace llvm #endif // LLVM_ADT_DENSEMAPINFO_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/DenseSet.h b/contrib/llvm-project/llvm/include/llvm/ADT/DenseSet.h index 9afb715ae1db..07edc3d8e4ec 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/DenseSet.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/DenseSet.h @@ -66,6 +66,12 @@ public: explicit DenseSetImpl(unsigned InitialReserve = 0) : TheMap(InitialReserve) {} + template + DenseSetImpl(const InputIt &I, const InputIt &E) + : DenseSetImpl(PowerOf2Ceil(std::distance(I, E))) { + insert(I, E); + } + DenseSetImpl(std::initializer_list Elems) : DenseSetImpl(PowerOf2Ceil(Elems.size())) { insert(Elems.begin(), Elems.end()); diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/EnumeratedArray.h b/contrib/llvm-project/llvm/include/llvm/ADT/EnumeratedArray.h index a9528115618c..a66ec9d08c37 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/EnumeratedArray.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/EnumeratedArray.h @@ -38,6 +38,7 @@ public: static_cast &>(*this)[Index]); } + inline IndexType size() { return Size; } private: ValueType Underlying[Size]; diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/FloatingPointMode.h b/contrib/llvm-project/llvm/include/llvm/ADT/FloatingPointMode.h index 670b2368da9f..3ba8ae1b2855 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/FloatingPointMode.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/FloatingPointMode.h @@ -14,28 +14,123 @@ #define LLVM_FLOATINGPOINTMODE_H #include "llvm/ADT/StringSwitch.h" +#include "llvm/Support/raw_ostream.h" namespace llvm { -/// Represent handled modes for denormal (aka subnormal) modes in the floating -/// point environment. -enum class DenormalMode { - Invalid = -1, +/// Rounding mode. +/// +/// Enumerates supported rounding modes, as well as some special values. The set +/// of the modes must agree with IEEE-754, 4.3.1 and 4.3.2. The constants +/// assigned to the IEEE rounding modes must agree with the values used by +/// FLT_ROUNDS (C11, 5.2.4.2.2p8). +/// +/// This value is packed into bitfield in some cases, including \c FPOptions, so +/// the rounding mode values and the special value \c Dynamic must fit into the +/// the bit field (now - 3 bits). The value \c Invalid is used only in values +/// returned by intrinsics to indicate errors, it should never be stored as +/// rounding mode value, so it does not need to fit the bit fields. +/// +enum class RoundingMode : int8_t { + // Rounding mode defined in IEEE-754. + TowardZero = 0, ///< roundTowardZero. + NearestTiesToEven = 1, ///< roundTiesToEven. + TowardPositive = 2, ///< roundTowardPositive. + TowardNegative = 3, ///< roundTowardNegative. + NearestTiesToAway = 4, ///< roundTiesToAway. - /// IEEE-754 denormal numbers preserved. - IEEE, + // Special values. + Dynamic = 7, ///< Denotes mode unknown at compile time. + Invalid = -1 ///< Denotes invalid value. +}; + +/// Represent subnormal handling kind for floating point instruction inputs and +/// outputs. +struct DenormalMode { + /// Represent handled modes for denormal (aka subnormal) modes in the floating + /// point environment. + enum DenormalModeKind : int8_t { + Invalid = -1, + + /// IEEE-754 denormal numbers preserved. + IEEE, + + /// The sign of a flushed-to-zero number is preserved in the sign of 0 + PreserveSign, + + /// Denormals are flushed to positive zero. + PositiveZero + }; - /// The sign of a flushed-to-zero number is preserved in the sign of 0 - PreserveSign, + /// Denormal flushing mode for floating point instruction results in the + /// default floating point environment. + DenormalModeKind Output = DenormalModeKind::Invalid; + + /// Denormal treatment kind for floating point instruction inputs in the + /// default floating-point environment. If this is not DenormalModeKind::IEEE, + /// floating-point instructions implicitly treat the input value as 0. + DenormalModeKind Input = DenormalModeKind::Invalid; + + constexpr DenormalMode() = default; + constexpr DenormalMode(DenormalModeKind Out, DenormalModeKind In) : + Output(Out), Input(In) {} + + + static constexpr DenormalMode getInvalid() { + return DenormalMode(DenormalModeKind::Invalid, DenormalModeKind::Invalid); + } - /// Denormals are flushed to positive zero. - PositiveZero + static constexpr DenormalMode getIEEE() { + return DenormalMode(DenormalModeKind::IEEE, DenormalModeKind::IEEE); + } + + static constexpr DenormalMode getPreserveSign() { + return DenormalMode(DenormalModeKind::PreserveSign, + DenormalModeKind::PreserveSign); + } + + static constexpr DenormalMode getPositiveZero() { + return DenormalMode(DenormalModeKind::PositiveZero, + DenormalModeKind::PositiveZero); + } + + bool operator==(DenormalMode Other) const { + return Output == Other.Output && Input == Other.Input; + } + + bool operator!=(DenormalMode Other) const { + return !(*this == Other); + } + + bool isSimple() const { + return Input == Output; + } + + bool isValid() const { + return Output != DenormalModeKind::Invalid && + Input != DenormalModeKind::Invalid; + } + + inline void print(raw_ostream &OS) const; + + inline std::string str() const { + std::string storage; + raw_string_ostream OS(storage); + print(OS); + return OS.str(); + } }; +inline raw_ostream& operator<<(raw_ostream &OS, DenormalMode Mode) { + Mode.print(OS); + return OS; +} + /// Parse the expected names from the denormal-fp-math attribute. -inline DenormalMode parseDenormalFPAttribute(StringRef Str) { +inline DenormalMode::DenormalModeKind +parseDenormalFPAttributeComponent(StringRef Str) { // Assume ieee on unspecified attribute. - return StringSwitch(Str) + return StringSwitch(Str) .Cases("", "ieee", DenormalMode::IEEE) .Case("preserve-sign", DenormalMode::PreserveSign) .Case("positive-zero", DenormalMode::PositiveZero) @@ -44,7 +139,7 @@ inline DenormalMode parseDenormalFPAttribute(StringRef Str) { /// Return the name used for the denormal handling mode used by the the /// expected names from the denormal-fp-math attribute. -inline StringRef denormalModeName(DenormalMode Mode) { +inline StringRef denormalModeKindName(DenormalMode::DenormalModeKind Mode) { switch (Mode) { case DenormalMode::IEEE: return "ieee"; @@ -57,6 +152,26 @@ inline StringRef denormalModeName(DenormalMode Mode) { } } +/// Returns the denormal mode to use for inputs and outputs. +inline DenormalMode parseDenormalFPAttribute(StringRef Str) { + StringRef OutputStr, InputStr; + std::tie(OutputStr, InputStr) = Str.split(','); + + DenormalMode Mode; + Mode.Output = parseDenormalFPAttributeComponent(OutputStr); + + // Maintain compatability with old form of the attribute which only specified + // one component. + Mode.Input = InputStr.empty() ? Mode.Output : + parseDenormalFPAttributeComponent(InputStr); + + return Mode; +} + +void DenormalMode::print(raw_ostream &OS) const { + OS << denormalModeKindName(Output) << ',' << denormalModeKindName(Input); +} + } #endif // LLVM_FLOATINGPOINTMODE_H diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/FoldingSet.h b/contrib/llvm-project/llvm/include/llvm/ADT/FoldingSet.h index 4968b1ea7780..fb1cb03a4b5c 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/FoldingSet.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/FoldingSet.h @@ -110,8 +110,6 @@ class StringRef; /// back to the bucket to facilitate node removal. /// class FoldingSetBase { - virtual void anchor(); // Out of line virtual method. - protected: /// Buckets - Array of bucket chains. void **Buckets; @@ -154,11 +152,6 @@ public: /// empty - Returns true if there are no nodes in the folding set. bool empty() const { return NumNodes == 0; } - /// reserve - Increase the number of buckets such that adding the - /// EltCount-th node won't cause a rebucket operation. reserve is permitted - /// to allocate more space than requested by EltCount. - void reserve(unsigned EltCount); - /// capacity - Returns the number of nodes permitted in the folding set /// before a rebucket operation is performed. unsigned capacity() { @@ -167,32 +160,46 @@ public: return NumBuckets * 2; } +protected: + /// Functions provided by the derived class to compute folding properties. + /// This is effectively a vtable for FoldingSetBase, except that we don't + /// actually store a pointer to it in the object. + struct FoldingSetInfo { + /// GetNodeProfile - Instantiations of the FoldingSet template implement + /// this function to gather data bits for the given node. + void (*GetNodeProfile)(const FoldingSetBase *Self, Node *N, + FoldingSetNodeID &ID); + + /// NodeEquals - Instantiations of the FoldingSet template implement + /// this function to compare the given node with the given ID. + bool (*NodeEquals)(const FoldingSetBase *Self, Node *N, + const FoldingSetNodeID &ID, unsigned IDHash, + FoldingSetNodeID &TempID); + + /// ComputeNodeHash - Instantiations of the FoldingSet template implement + /// this function to compute a hash value for the given node. + unsigned (*ComputeNodeHash)(const FoldingSetBase *Self, Node *N, + FoldingSetNodeID &TempID); + }; + private: /// GrowHashTable - Double the size of the hash table and rehash everything. - void GrowHashTable(); + void GrowHashTable(const FoldingSetInfo &Info); /// GrowBucketCount - resize the hash table and rehash everything. /// NewBucketCount must be a power of two, and must be greater than the old /// bucket count. - void GrowBucketCount(unsigned NewBucketCount); + void GrowBucketCount(unsigned NewBucketCount, const FoldingSetInfo &Info); protected: - /// GetNodeProfile - Instantiations of the FoldingSet template implement - /// this function to gather data bits for the given node. - virtual void GetNodeProfile(Node *N, FoldingSetNodeID &ID) const = 0; - - /// NodeEquals - Instantiations of the FoldingSet template implement - /// this function to compare the given node with the given ID. - virtual bool NodeEquals(Node *N, const FoldingSetNodeID &ID, unsigned IDHash, - FoldingSetNodeID &TempID) const=0; - - /// ComputeNodeHash - Instantiations of the FoldingSet template implement - /// this function to compute a hash value for the given node. - virtual unsigned ComputeNodeHash(Node *N, FoldingSetNodeID &TempID) const = 0; - // The below methods are protected to encourage subclasses to provide a more // type-safe API. + /// reserve - Increase the number of buckets such that adding the + /// EltCount-th node won't cause a rebucket operation. reserve is permitted + /// to allocate more space than requested by EltCount. + void reserve(unsigned EltCount, const FoldingSetInfo &Info); + /// RemoveNode - Remove a node from the folding set, returning true if one /// was removed or false if the node was not in the folding set. bool RemoveNode(Node *N); @@ -200,17 +207,18 @@ protected: /// GetOrInsertNode - If there is an existing simple Node exactly /// equal to the specified node, return it. Otherwise, insert 'N' and return /// it instead. - Node *GetOrInsertNode(Node *N); + Node *GetOrInsertNode(Node *N, const FoldingSetInfo &Info); /// FindNodeOrInsertPos - Look up the node specified by ID. If it exists, /// return it. If not, return the insertion token that will make insertion /// faster. - Node *FindNodeOrInsertPos(const FoldingSetNodeID &ID, void *&InsertPos); + Node *FindNodeOrInsertPos(const FoldingSetNodeID &ID, void *&InsertPos, + const FoldingSetInfo &Info); /// InsertNode - Insert the specified node into the folding set, knowing that /// it is not already in the folding set. InsertPos must be obtained from /// FindNodeOrInsertPos. - void InsertNode(Node *N, void *InsertPos); + void InsertNode(Node *N, void *InsertPos, const FoldingSetInfo &Info); }; //===----------------------------------------------------------------------===// @@ -397,7 +405,7 @@ DefaultContextualFoldingSetTrait::ComputeHash(T &X, //===----------------------------------------------------------------------===// /// FoldingSetImpl - An implementation detail that lets us share code between /// FoldingSet and ContextualFoldingSet. -template class FoldingSetImpl : public FoldingSetBase { +template class FoldingSetImpl : public FoldingSetBase { protected: explicit FoldingSetImpl(unsigned Log2InitSize) : FoldingSetBase(Log2InitSize) {} @@ -427,29 +435,40 @@ public: return bucket_iterator(Buckets + (hash & (NumBuckets-1)), true); } + /// reserve - Increase the number of buckets such that adding the + /// EltCount-th node won't cause a rebucket operation. reserve is permitted + /// to allocate more space than requested by EltCount. + void reserve(unsigned EltCount) { + return FoldingSetBase::reserve(EltCount, Derived::getFoldingSetInfo()); + } + /// RemoveNode - Remove a node from the folding set, returning true if one /// was removed or false if the node was not in the folding set. - bool RemoveNode(T *N) { return FoldingSetBase::RemoveNode(N); } + bool RemoveNode(T *N) { + return FoldingSetBase::RemoveNode(N); + } /// GetOrInsertNode - If there is an existing simple Node exactly /// equal to the specified node, return it. Otherwise, insert 'N' and /// return it instead. T *GetOrInsertNode(T *N) { - return static_cast(FoldingSetBase::GetOrInsertNode(N)); + return static_cast( + FoldingSetBase::GetOrInsertNode(N, Derived::getFoldingSetInfo())); } /// FindNodeOrInsertPos - Look up the node specified by ID. If it exists, /// return it. If not, return the insertion token that will make insertion /// faster. T *FindNodeOrInsertPos(const FoldingSetNodeID &ID, void *&InsertPos) { - return static_cast(FoldingSetBase::FindNodeOrInsertPos(ID, InsertPos)); + return static_cast(FoldingSetBase::FindNodeOrInsertPos( + ID, InsertPos, Derived::getFoldingSetInfo())); } /// InsertNode - Insert the specified node into the folding set, knowing that /// it is not already in the folding set. InsertPos must be obtained from /// FindNodeOrInsertPos. void InsertNode(T *N, void *InsertPos) { - FoldingSetBase::InsertNode(N, InsertPos); + FoldingSetBase::InsertNode(N, InsertPos, Derived::getFoldingSetInfo()); } /// InsertNode - Insert the specified node into the folding set, knowing that @@ -470,32 +489,43 @@ public: /// moved-from state is not a valid state for anything other than /// move-assigning and destroying. This is primarily to enable movable APIs /// that incorporate these objects. -template class FoldingSet final : public FoldingSetImpl { - using Super = FoldingSetImpl; +template +class FoldingSet : public FoldingSetImpl, T> { + using Super = FoldingSetImpl; using Node = typename Super::Node; - /// GetNodeProfile - Each instantiatation of the FoldingSet needs to provide a + /// GetNodeProfile - Each instantiation of the FoldingSet needs to provide a /// way to convert nodes into a unique specifier. - void GetNodeProfile(Node *N, FoldingSetNodeID &ID) const override { + static void GetNodeProfile(const FoldingSetBase *, Node *N, + FoldingSetNodeID &ID) { T *TN = static_cast(N); FoldingSetTrait::Profile(*TN, ID); } /// NodeEquals - Instantiations may optionally provide a way to compare a /// node with a specified ID. - bool NodeEquals(Node *N, const FoldingSetNodeID &ID, unsigned IDHash, - FoldingSetNodeID &TempID) const override { + static bool NodeEquals(const FoldingSetBase *, Node *N, + const FoldingSetNodeID &ID, unsigned IDHash, + FoldingSetNodeID &TempID) { T *TN = static_cast(N); return FoldingSetTrait::Equals(*TN, ID, IDHash, TempID); } /// ComputeNodeHash - Instantiations may optionally provide a way to compute a /// hash value directly from a node. - unsigned ComputeNodeHash(Node *N, FoldingSetNodeID &TempID) const override { + static unsigned ComputeNodeHash(const FoldingSetBase *, Node *N, + FoldingSetNodeID &TempID) { T *TN = static_cast(N); return FoldingSetTrait::ComputeHash(*TN, TempID); } + static const FoldingSetBase::FoldingSetInfo &getFoldingSetInfo() { + static constexpr FoldingSetBase::FoldingSetInfo Info = { + GetNodeProfile, NodeEquals, ComputeNodeHash}; + return Info; + } + friend Super; + public: explicit FoldingSet(unsigned Log2InitSize = 6) : Super(Log2InitSize) {} FoldingSet(FoldingSet &&Arg) = default; @@ -512,35 +542,51 @@ public: /// function with signature /// void Profile(FoldingSetNodeID &, Ctx); template -class ContextualFoldingSet final : public FoldingSetImpl { +class ContextualFoldingSet + : public FoldingSetImpl, T> { // Unfortunately, this can't derive from FoldingSet because the // construction of the vtable for FoldingSet requires // FoldingSet::GetNodeProfile to be instantiated, which in turn // requires a single-argument T::Profile(). - using Super = FoldingSetImpl; + using Super = FoldingSetImpl; using Node = typename Super::Node; Ctx Context; + static const Ctx &getContext(const FoldingSetBase *Base) { + return static_cast(Base)->Context; + } + /// GetNodeProfile - Each instantiatation of the FoldingSet needs to provide a /// way to convert nodes into a unique specifier. - void GetNodeProfile(Node *N, FoldingSetNodeID &ID) const override { + static void GetNodeProfile(const FoldingSetBase *Base, Node *N, + FoldingSetNodeID &ID) { T *TN = static_cast(N); - ContextualFoldingSetTrait::Profile(*TN, ID, Context); + ContextualFoldingSetTrait::Profile(*TN, ID, getContext(Base)); } - bool NodeEquals(Node *N, const FoldingSetNodeID &ID, unsigned IDHash, - FoldingSetNodeID &TempID) const override { + static bool NodeEquals(const FoldingSetBase *Base, Node *N, + const FoldingSetNodeID &ID, unsigned IDHash, + FoldingSetNodeID &TempID) { T *TN = static_cast(N); return ContextualFoldingSetTrait::Equals(*TN, ID, IDHash, TempID, - Context); + getContext(Base)); } - unsigned ComputeNodeHash(Node *N, FoldingSetNodeID &TempID) const override { + static unsigned ComputeNodeHash(const FoldingSetBase *Base, Node *N, + FoldingSetNodeID &TempID) { T *TN = static_cast(N); - return ContextualFoldingSetTrait::ComputeHash(*TN, TempID, Context); + return ContextualFoldingSetTrait::ComputeHash(*TN, TempID, + getContext(Base)); + } + + static const FoldingSetBase::FoldingSetInfo &getFoldingSetInfo() { + static constexpr FoldingSetBase::FoldingSetInfo Info = { + GetNodeProfile, NodeEquals, ComputeNodeHash}; + return Info; } + friend Super; public: explicit ContextualFoldingSet(Ctx Context, unsigned Log2InitSize = 6) diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h b/contrib/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h index 121aa527a5da..4c75e4d2547b 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h @@ -11,11 +11,11 @@ /// in ``. /// /// It provides `unique_function`, which works like `std::function` but supports -/// move-only callable objects. +/// move-only callable objects and const-qualification. /// /// Future plans: -/// - Add a `function` that provides const, volatile, and ref-qualified support, -/// which doesn't work with `std::function`. +/// - Add a `function` that provides ref-qualified support, which doesn't work +/// with `std::function`. /// - Provide support for specifying multiple signatures to type erase callable /// objects with an overload set, such as those produced by generic lambdas. /// - Expand to include a copyable utility that directly replaces std::function @@ -34,15 +34,34 @@ #include "llvm/ADT/PointerIntPair.h" #include "llvm/ADT/PointerUnion.h" +#include "llvm/Support/MemAlloc.h" #include "llvm/Support/type_traits.h" #include +#include namespace llvm { +/// unique_function is a type-erasing functor similar to std::function. +/// +/// It can hold move-only function objects, like lambdas capturing unique_ptrs. +/// Accordingly, it is movable but not copyable. +/// +/// It supports const-qualification: +/// - unique_function has a const operator(). +/// It can only hold functions which themselves have a const operator(). +/// - unique_function has a non-const operator(). +/// It can hold functions with a non-const operator(), like mutable lambdas. template class unique_function; -template -class unique_function { +namespace detail { + +template +using EnableIfTrivial = + std::enable_if_t::value && + std::is_trivially_destructible::value>; + +template class UniqueFunctionBase { +protected: static constexpr size_t InlineStorageSize = sizeof(void *) * 3; // MSVC has a bug and ICEs if we give it a particular dependent value @@ -112,8 +131,11 @@ class unique_function { // For in-line storage, we just provide an aligned character buffer. We // provide three pointers worth of storage here. - typename std::aligned_storage::type - InlineStorage; + // This is mutable as an inlined `const unique_function` may + // still modify its own mutable members. + mutable + typename std::aligned_storage::type + InlineStorage; } StorageUnion; // A compressed pointer to either our dispatching callback or our table of @@ -136,11 +158,25 @@ class unique_function { .template get(); } - void *getInlineStorage() { return &StorageUnion.InlineStorage; } + CallPtrT getCallPtr() const { + return isTrivialCallback() ? getTrivialCallback() + : getNonTrivialCallbacks()->CallPtr; + } - void *getOutOfLineStorage() { + // These three functions are only const in the narrow sense. They return + // mutable pointers to function state. + // This allows unique_function::operator() to be const, even if the + // underlying functor may be internally mutable. + // + // const callers must ensure they're only used in const-correct ways. + void *getCalleePtr() const { + return isInlineStorage() ? getInlineStorage() : getOutOfLineStorage(); + } + void *getInlineStorage() const { return &StorageUnion.InlineStorage; } + void *getOutOfLineStorage() const { return StorageUnion.OutOfLineStorage.StoragePtr; } + size_t getOutOfLineStorageSize() const { return StorageUnion.OutOfLineStorage.Size; } @@ -152,10 +188,11 @@ class unique_function { StorageUnion.OutOfLineStorage = {Ptr, Size, Alignment}; } - template - static ReturnT CallImpl(void *CallableAddr, AdjustedParamT... Params) { - return (*reinterpret_cast(CallableAddr))( - std::forward(Params)...); + template + static ReturnT CallImpl(void *CallableAddr, + AdjustedParamT... Params) { + auto &Func = *reinterpret_cast(CallableAddr); + return Func(std::forward(Params)...); } template @@ -169,11 +206,54 @@ class unique_function { reinterpret_cast(CallableAddr)->~CallableT(); } -public: - unique_function() = default; - unique_function(std::nullptr_t /*null_callable*/) {} + // The pointers to call/move/destroy functions are determined for each + // callable type (and called-as type, which determines the overload chosen). + // (definitions are out-of-line). + + // By default, we need an object that contains all the different + // type erased behaviors needed. Create a static instance of the struct type + // here and each instance will contain a pointer to it. + // Wrap in a struct to avoid https://gcc.gnu.org/PR71954 + template + struct CallbacksHolder { + static NonTrivialCallbacks Callbacks; + }; + // See if we can create a trivial callback. We need the callable to be + // trivially moved and trivially destroyed so that we don't have to store + // type erased callbacks for those operations. + template + struct CallbacksHolder> { + static TrivialCallback Callbacks; + }; + + // A simple tag type so the call-as type to be passed to the constructor. + template struct CalledAs {}; + + // Essentially the "main" unique_function constructor, but subclasses + // provide the qualified type to be used for the call. + // (We always store a T, even if the call will use a pointer to const T). + template + UniqueFunctionBase(CallableT Callable, CalledAs) { + bool IsInlineStorage = true; + void *CallableAddr = getInlineStorage(); + if (sizeof(CallableT) > InlineStorageSize || + alignof(CallableT) > alignof(decltype(StorageUnion.InlineStorage))) { + IsInlineStorage = false; + // Allocate out-of-line storage. FIXME: Use an explicit alignment + // parameter in C++17 mode. + auto Size = sizeof(CallableT); + auto Alignment = alignof(CallableT); + CallableAddr = allocate_buffer(Size, Alignment); + setOutOfLineStorage(CallableAddr, Size, Alignment); + } + + // Now move into the storage. + new (CallableAddr) CallableT(std::move(Callable)); + CallbackAndInlineFlag.setPointerAndInt( + &CallbacksHolder::Callbacks, IsInlineStorage); + } - ~unique_function() { + ~UniqueFunctionBase() { if (!CallbackAndInlineFlag.getPointer()) return; @@ -189,7 +269,7 @@ public: getOutOfLineStorageAlignment()); } - unique_function(unique_function &&RHS) noexcept { + UniqueFunctionBase(UniqueFunctionBase &&RHS) noexcept { // Copy the callback and inline flag. CallbackAndInlineFlag = RHS.CallbackAndInlineFlag; @@ -218,72 +298,83 @@ public: #endif } - unique_function &operator=(unique_function &&RHS) noexcept { + UniqueFunctionBase &operator=(UniqueFunctionBase &&RHS) noexcept { if (this == &RHS) return *this; // Because we don't try to provide any exception safety guarantees we can // implement move assignment very simply by first destroying the current // object and then move-constructing over top of it. - this->~unique_function(); - new (this) unique_function(std::move(RHS)); + this->~UniqueFunctionBase(); + new (this) UniqueFunctionBase(std::move(RHS)); return *this; } - template unique_function(CallableT Callable) { - bool IsInlineStorage = true; - void *CallableAddr = getInlineStorage(); - if (sizeof(CallableT) > InlineStorageSize || - alignof(CallableT) > alignof(decltype(StorageUnion.InlineStorage))) { - IsInlineStorage = false; - // Allocate out-of-line storage. FIXME: Use an explicit alignment - // parameter in C++17 mode. - auto Size = sizeof(CallableT); - auto Alignment = alignof(CallableT); - CallableAddr = allocate_buffer(Size, Alignment); - setOutOfLineStorage(CallableAddr, Size, Alignment); - } + UniqueFunctionBase() = default; - // Now move into the storage. - new (CallableAddr) CallableT(std::move(Callable)); +public: + explicit operator bool() const { + return (bool)CallbackAndInlineFlag.getPointer(); + } +}; - // See if we can create a trivial callback. We need the callable to be - // trivially moved and trivially destroyed so that we don't have to store - // type erased callbacks for those operations. - // - // FIXME: We should use constexpr if here and below to avoid instantiating - // the non-trivial static objects when unnecessary. While the linker should - // remove them, it is still wasteful. - if (llvm::is_trivially_move_constructible::value && - std::is_trivially_destructible::value) { - // We need to create a nicely aligned object. We use a static variable - // for this because it is a trivial struct. - static TrivialCallback Callback = { &CallImpl }; - - CallbackAndInlineFlag = {&Callback, IsInlineStorage}; - return; - } +template +template +typename UniqueFunctionBase::NonTrivialCallbacks UniqueFunctionBase< + R, P...>::CallbacksHolder::Callbacks = { + &CallImpl, &MoveImpl, &DestroyImpl}; - // Otherwise, we need to point at an object that contains all the different - // type erased behaviors needed. Create a static instance of the struct type - // here and then use a pointer to that. - static NonTrivialCallbacks Callbacks = { - &CallImpl, &MoveImpl, &DestroyImpl}; +template +template +typename UniqueFunctionBase::TrivialCallback + UniqueFunctionBase::CallbacksHolder< + CallableT, CalledAsT, EnableIfTrivial>::Callbacks{ + &CallImpl}; - CallbackAndInlineFlag = {&Callbacks, IsInlineStorage}; - } +} // namespace detail + +template +class unique_function : public detail::UniqueFunctionBase { + using Base = detail::UniqueFunctionBase; + +public: + unique_function() = default; + unique_function(std::nullptr_t) {} + unique_function(unique_function &&) = default; + unique_function(const unique_function &) = delete; + unique_function &operator=(unique_function &&) = default; + unique_function &operator=(const unique_function &) = delete; - ReturnT operator()(ParamTs... Params) { - void *CallableAddr = - isInlineStorage() ? getInlineStorage() : getOutOfLineStorage(); + template + unique_function(CallableT Callable) + : Base(std::forward(Callable), + typename Base::template CalledAs{}) {} - return (isTrivialCallback() - ? getTrivialCallback() - : getNonTrivialCallbacks()->CallPtr)(CallableAddr, Params...); + R operator()(P... Params) { + return this->getCallPtr()(this->getCalleePtr(), Params...); } +}; - explicit operator bool() const { - return (bool)CallbackAndInlineFlag.getPointer(); +template +class unique_function + : public detail::UniqueFunctionBase { + using Base = detail::UniqueFunctionBase; + +public: + unique_function() = default; + unique_function(std::nullptr_t) {} + unique_function(unique_function &&) = default; + unique_function(const unique_function &) = delete; + unique_function &operator=(unique_function &&) = default; + unique_function &operator=(const unique_function &) = delete; + + template + unique_function(CallableT Callable) + : Base(std::forward(Callable), + typename Base::template CalledAs{}) {} + + R operator()(P... Params) const { + return this->getCallPtr()(this->getCalleePtr(), Params...); } }; diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/Hashing.h b/contrib/llvm-project/llvm/include/llvm/ADT/Hashing.h index adcc5cf54da9..9ee310c879fd 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/Hashing.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/Hashing.h @@ -101,8 +101,7 @@ public: /// differing argument types even if they would implicit promote to a common /// type without changing the value. template -typename std::enable_if::value, hash_code>::type -hash_value(T value); +std::enable_if_t::value, hash_code> hash_value(T value); /// Compute a hash_code for a pointer's address. /// @@ -158,10 +157,10 @@ inline uint32_t fetch32(const char *p) { } /// Some primes between 2^63 and 2^64 for various uses. -static const uint64_t k0 = 0xc3a5c85c97cb3127ULL; -static const uint64_t k1 = 0xb492b66fbe98f273ULL; -static const uint64_t k2 = 0x9ae16a3b2f90404fULL; -static const uint64_t k3 = 0xc949d7c7509e6557ULL; +static constexpr uint64_t k0 = 0xc3a5c85c97cb3127ULL; +static constexpr uint64_t k1 = 0xb492b66fbe98f273ULL; +static constexpr uint64_t k2 = 0x9ae16a3b2f90404fULL; +static constexpr uint64_t k3 = 0xc949d7c7509e6557ULL; /// Bitwise right rotate. /// Normally this will compile to a single instruction, especially if the @@ -360,7 +359,7 @@ template struct is_hashable_data > /// Helper to get the hashable data representation for a type. /// This variant is enabled when the type itself can be used. template -typename std::enable_if::value, T>::type +std::enable_if_t::value, T> get_hashable_data(const T &value) { return value; } @@ -368,7 +367,7 @@ get_hashable_data(const T &value) { /// This variant is enabled when we must first call hash_value and use the /// result as our data. template -typename std::enable_if::value, size_t>::type +std::enable_if_t::value, size_t> get_hashable_data(const T &value) { using ::llvm::hash_value; return hash_value(value); @@ -442,7 +441,7 @@ hash_code hash_combine_range_impl(InputIteratorT first, InputIteratorT last) { /// are stored in contiguous memory, this routine avoids copying each value /// and directly reads from the underlying memory. template -typename std::enable_if::value, hash_code>::type +std::enable_if_t::value, hash_code> hash_combine_range_impl(ValueT *first, ValueT *last) { const uint64_t seed = get_execution_seed(); const char *s_begin = reinterpret_cast(first); @@ -627,8 +626,7 @@ inline hash_code hash_integer_value(uint64_t value) { // Declared and documented above, but defined here so that any of the hashing // infrastructure is available. template -typename std::enable_if::value, hash_code>::type -hash_value(T value) { +std::enable_if_t::value, hash_code> hash_value(T value) { return ::llvm::hashing::detail::hash_integer_value( static_cast(value)); } diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/ImmutableMap.h b/contrib/llvm-project/llvm/include/llvm/ADT/ImmutableMap.h index 86fd7fefaec3..30689d2274a8 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/ImmutableMap.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/ImmutableMap.h @@ -70,33 +70,14 @@ public: using TreeTy = ImutAVLTree; protected: - TreeTy* Root; + IntrusiveRefCntPtr Root; public: /// Constructs a map from a pointer to a tree root. In general one /// should use a Factory object to create maps instead of directly /// invoking the constructor, but there are cases where make this /// constructor public is useful. - explicit ImmutableMap(const TreeTy* R) : Root(const_cast(R)) { - if (Root) { Root->retain(); } - } - - ImmutableMap(const ImmutableMap &X) : Root(X.Root) { - if (Root) { Root->retain(); } - } - - ~ImmutableMap() { - if (Root) { Root->release(); } - } - - ImmutableMap &operator=(const ImmutableMap &X) { - if (Root != X.Root) { - if (X.Root) { X.Root->retain(); } - if (Root) { Root->release(); } - Root = X.Root; - } - return *this; - } + explicit ImmutableMap(const TreeTy *R) : Root(const_cast(R)) {} class Factory { typename TreeTy::Factory F; @@ -115,12 +96,12 @@ public: LLVM_NODISCARD ImmutableMap add(ImmutableMap Old, key_type_ref K, data_type_ref D) { - TreeTy *T = F.add(Old.Root, std::pair(K,D)); + TreeTy *T = F.add(Old.Root.get(), std::pair(K, D)); return ImmutableMap(Canonicalize ? F.getCanonicalTree(T): T); } LLVM_NODISCARD ImmutableMap remove(ImmutableMap Old, key_type_ref K) { - TreeTy *T = F.remove(Old.Root,K); + TreeTy *T = F.remove(Old.Root.get(), K); return ImmutableMap(Canonicalize ? F.getCanonicalTree(T): T); } @@ -134,19 +115,20 @@ public: } bool operator==(const ImmutableMap &RHS) const { - return Root && RHS.Root ? Root->isEqual(*RHS.Root) : Root == RHS.Root; + return Root && RHS.Root ? Root->isEqual(*RHS.Root.get()) : Root == RHS.Root; } bool operator!=(const ImmutableMap &RHS) const { - return Root && RHS.Root ? Root->isNotEqual(*RHS.Root) : Root != RHS.Root; + return Root && RHS.Root ? Root->isNotEqual(*RHS.Root.get()) + : Root != RHS.Root; } TreeTy *getRoot() const { if (Root) { Root->retain(); } - return Root; + return Root.get(); } - TreeTy *getRootWithoutRetain() const { return Root; } + TreeTy *getRootWithoutRetain() const { return Root.get(); } void manualRetain() { if (Root) Root->retain(); @@ -217,7 +199,7 @@ public: data_type_ref getData() const { return (*this)->second; } }; - iterator begin() const { return iterator(Root); } + iterator begin() const { return iterator(Root.get()); } iterator end() const { return iterator(); } data_type* lookup(key_type_ref K) const { @@ -243,7 +225,7 @@ public: unsigned getHeight() const { return Root ? Root->getHeight() : 0; } static inline void Profile(FoldingSetNodeID& ID, const ImmutableMap& M) { - ID.AddPointer(M.Root); + ID.AddPointer(M.Root.get()); } inline void Profile(FoldingSetNodeID& ID) const { @@ -266,7 +248,7 @@ public: using FactoryTy = typename TreeTy::Factory; protected: - TreeTy *Root; + IntrusiveRefCntPtr Root; FactoryTy *Factory; public: @@ -274,44 +256,12 @@ public: /// should use a Factory object to create maps instead of directly /// invoking the constructor, but there are cases where make this /// constructor public is useful. - explicit ImmutableMapRef(const TreeTy *R, FactoryTy *F) - : Root(const_cast(R)), Factory(F) { - if (Root) { - Root->retain(); - } - } + ImmutableMapRef(const TreeTy *R, FactoryTy *F) + : Root(const_cast(R)), Factory(F) {} - explicit ImmutableMapRef(const ImmutableMap &X, - typename ImmutableMap::Factory &F) - : Root(X.getRootWithoutRetain()), - Factory(F.getTreeFactory()) { - if (Root) { Root->retain(); } - } - - ImmutableMapRef(const ImmutableMapRef &X) : Root(X.Root), Factory(X.Factory) { - if (Root) { - Root->retain(); - } - } - - ~ImmutableMapRef() { - if (Root) - Root->release(); - } - - ImmutableMapRef &operator=(const ImmutableMapRef &X) { - if (Root != X.Root) { - if (X.Root) - X.Root->retain(); - - if (Root) - Root->release(); - - Root = X.Root; - Factory = X.Factory; - } - return *this; - } + ImmutableMapRef(const ImmutableMap &X, + typename ImmutableMap::Factory &F) + : Root(X.getRootWithoutRetain()), Factory(F.getTreeFactory()) {} static inline ImmutableMapRef getEmptyMap(FactoryTy *F) { return ImmutableMapRef(0, F); @@ -326,12 +276,13 @@ public: } ImmutableMapRef add(key_type_ref K, data_type_ref D) const { - TreeTy *NewT = Factory->add(Root, std::pair(K, D)); + TreeTy *NewT = + Factory->add(Root.get(), std::pair(K, D)); return ImmutableMapRef(NewT, Factory); } ImmutableMapRef remove(key_type_ref K) const { - TreeTy *NewT = Factory->remove(Root, K); + TreeTy *NewT = Factory->remove(Root.get(), K); return ImmutableMapRef(NewT, Factory); } @@ -340,15 +291,16 @@ public: } ImmutableMap asImmutableMap() const { - return ImmutableMap(Factory->getCanonicalTree(Root)); + return ImmutableMap(Factory->getCanonicalTree(Root.get())); } bool operator==(const ImmutableMapRef &RHS) const { - return Root && RHS.Root ? Root->isEqual(*RHS.Root) : Root == RHS.Root; + return Root && RHS.Root ? Root->isEqual(*RHS.Root.get()) : Root == RHS.Root; } bool operator!=(const ImmutableMapRef &RHS) const { - return Root && RHS.Root ? Root->isNotEqual(*RHS.Root) : Root != RHS.Root; + return Root && RHS.Root ? Root->isNotEqual(*RHS.Root.get()) + : Root != RHS.Root; } bool isEmpty() const { return !Root; } @@ -377,7 +329,7 @@ public: data_type_ref getData() const { return (*this)->second; } }; - iterator begin() const { return iterator(Root); } + iterator begin() const { return iterator(Root.get()); } iterator end() const { return iterator(); } data_type *lookup(key_type_ref K) const { diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/ImmutableSet.h b/contrib/llvm-project/llvm/include/llvm/ADT/ImmutableSet.h index a6a6abfd9600..f19913f8dcdd 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/ImmutableSet.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/ImmutableSet.h @@ -15,6 +15,7 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/FoldingSet.h" +#include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/iterator.h" #include "llvm/Support/Allocator.h" @@ -169,7 +170,7 @@ public: bool contains(key_type_ref K) { return (bool) find(K); } /// foreach - A member template the accepts invokes operator() on a functor - /// object (specifed by Callback) for every node/subtree in the tree. + /// object (specified by Callback) for every node/subtree in the tree. /// Nodes are visited using an inorder traversal. template void foreach(Callback& C) { @@ -183,7 +184,7 @@ public: } /// validateTree - A utility method that checks that the balancing and - /// ordering invariants of the tree are satisifed. It is a recursive + /// ordering invariants of the tree are satisfied. It is a recursive /// method that returns the height of the tree, which is then consumed /// by the enclosing validateTree call. External callers should ignore the /// return value. An invalid tree will cause an assertion to fire in @@ -357,6 +358,12 @@ public: } }; +template +struct IntrusiveRefCntPtrInfo> { + static void retain(ImutAVLTree *Tree) { Tree->retain(); } + static void release(ImutAVLTree *Tree) { Tree->release(); } +}; + //===----------------------------------------------------------------------===// // Immutable AVL-Tree Factory class. //===----------------------------------------------------------------------===// @@ -450,7 +457,7 @@ protected: //===--------------------------------------------------===// // "createNode" is used to generate new tree roots that link - // to other trees. The functon may also simply move links + // to other trees. The function may also simply move links // in an existing root if that root is still marked mutable. // This is necessary because otherwise our balancing code // would leak memory as it would create nodes that are @@ -961,33 +968,14 @@ public: using TreeTy = ImutAVLTree; private: - TreeTy *Root; + IntrusiveRefCntPtr Root; public: /// Constructs a set from a pointer to a tree root. In general one /// should use a Factory object to create sets instead of directly /// invoking the constructor, but there are cases where make this /// constructor public is useful. - explicit ImmutableSet(TreeTy* R) : Root(R) { - if (Root) { Root->retain(); } - } - - ImmutableSet(const ImmutableSet &X) : Root(X.Root) { - if (Root) { Root->retain(); } - } - - ~ImmutableSet() { - if (Root) { Root->release(); } - } - - ImmutableSet &operator=(const ImmutableSet &X) { - if (Root != X.Root) { - if (X.Root) { X.Root->retain(); } - if (Root) { Root->release(); } - Root = X.Root; - } - return *this; - } + explicit ImmutableSet(TreeTy *R) : Root(R) {} class Factory { typename TreeTy::Factory F; @@ -1016,7 +1004,7 @@ public: /// The memory allocated to represent the set is released when the /// factory object that created the set is destroyed. LLVM_NODISCARD ImmutableSet add(ImmutableSet Old, value_type_ref V) { - TreeTy *NewT = F.add(Old.Root, V); + TreeTy *NewT = F.add(Old.Root.get(), V); return ImmutableSet(Canonicalize ? F.getCanonicalTree(NewT) : NewT); } @@ -1028,7 +1016,7 @@ public: /// The memory allocated to represent the set is released when the /// factory object that created the set is destroyed. LLVM_NODISCARD ImmutableSet remove(ImmutableSet Old, value_type_ref V) { - TreeTy *NewT = F.remove(Old.Root, V); + TreeTy *NewT = F.remove(Old.Root.get(), V); return ImmutableSet(Canonicalize ? F.getCanonicalTree(NewT) : NewT); } @@ -1047,21 +1035,20 @@ public: } bool operator==(const ImmutableSet &RHS) const { - return Root && RHS.Root ? Root->isEqual(*RHS.Root) : Root == RHS.Root; + return Root && RHS.Root ? Root->isEqual(*RHS.Root.get()) : Root == RHS.Root; } bool operator!=(const ImmutableSet &RHS) const { - return Root && RHS.Root ? Root->isNotEqual(*RHS.Root) : Root != RHS.Root; + return Root && RHS.Root ? Root->isNotEqual(*RHS.Root.get()) + : Root != RHS.Root; } TreeTy *getRoot() { if (Root) { Root->retain(); } - return Root; + return Root.get(); } - TreeTy *getRootWithoutRetain() const { - return Root; - } + TreeTy *getRootWithoutRetain() const { return Root.get(); } /// isEmpty - Return true if the set contains no elements. bool isEmpty() const { return !Root; } @@ -1082,7 +1069,7 @@ public: using iterator = ImutAVLValueIterator; - iterator begin() const { return iterator(Root); } + iterator begin() const { return iterator(Root.get()); } iterator end() const { return iterator(); } //===--------------------------------------------------===// @@ -1092,7 +1079,7 @@ public: unsigned getHeight() const { return Root ? Root->getHeight() : 0; } static void Profile(FoldingSetNodeID &ID, const ImmutableSet &S) { - ID.AddPointer(S.Root); + ID.AddPointer(S.Root.get()); } void Profile(FoldingSetNodeID &ID) const { return Profile(ID, *this); } @@ -1114,7 +1101,7 @@ public: using FactoryTy = typename TreeTy::Factory; private: - TreeTy *Root; + IntrusiveRefCntPtr Root; FactoryTy *Factory; public: @@ -1122,42 +1109,18 @@ public: /// should use a Factory object to create sets instead of directly /// invoking the constructor, but there are cases where make this /// constructor public is useful. - explicit ImmutableSetRef(TreeTy* R, FactoryTy *F) - : Root(R), - Factory(F) { - if (Root) { Root->retain(); } - } - - ImmutableSetRef(const ImmutableSetRef &X) - : Root(X.Root), - Factory(X.Factory) { - if (Root) { Root->retain(); } - } - - ~ImmutableSetRef() { - if (Root) { Root->release(); } - } - - ImmutableSetRef &operator=(const ImmutableSetRef &X) { - if (Root != X.Root) { - if (X.Root) { X.Root->retain(); } - if (Root) { Root->release(); } - Root = X.Root; - Factory = X.Factory; - } - return *this; - } + ImmutableSetRef(TreeTy *R, FactoryTy *F) : Root(R), Factory(F) {} static ImmutableSetRef getEmptySet(FactoryTy *F) { return ImmutableSetRef(0, F); } ImmutableSetRef add(value_type_ref V) { - return ImmutableSetRef(Factory->add(Root, V), Factory); + return ImmutableSetRef(Factory->add(Root.get(), V), Factory); } ImmutableSetRef remove(value_type_ref V) { - return ImmutableSetRef(Factory->remove(Root, V), Factory); + return ImmutableSetRef(Factory->remove(Root.get(), V), Factory); } /// Returns true if the set contains the specified value. @@ -1166,20 +1129,19 @@ public: } ImmutableSet asImmutableSet(bool canonicalize = true) const { - return ImmutableSet(canonicalize ? - Factory->getCanonicalTree(Root) : Root); + return ImmutableSet( + canonicalize ? Factory->getCanonicalTree(Root.get()) : Root.get()); } - TreeTy *getRootWithoutRetain() const { - return Root; - } + TreeTy *getRootWithoutRetain() const { return Root.get(); } bool operator==(const ImmutableSetRef &RHS) const { - return Root && RHS.Root ? Root->isEqual(*RHS.Root) : Root == RHS.Root; + return Root && RHS.Root ? Root->isEqual(*RHS.Root.get()) : Root == RHS.Root; } bool operator!=(const ImmutableSetRef &RHS) const { - return Root && RHS.Root ? Root->isNotEqual(*RHS.Root) : Root != RHS.Root; + return Root && RHS.Root ? Root->isNotEqual(*RHS.Root.get()) + : Root != RHS.Root; } /// isEmpty - Return true if the set contains no elements. @@ -1195,7 +1157,7 @@ public: using iterator = ImutAVLValueIterator; - iterator begin() const { return iterator(Root); } + iterator begin() const { return iterator(Root.get()); } iterator end() const { return iterator(); } //===--------------------------------------------------===// @@ -1205,7 +1167,7 @@ public: unsigned getHeight() const { return Root ? Root->getHeight() : 0; } static void Profile(FoldingSetNodeID &ID, const ImmutableSetRef &S) { - ID.AddPointer(S.Root); + ID.AddPointer(S.Root.get()); } void Profile(FoldingSetNodeID &ID) const { return Profile(ID, *this); } diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/IntervalMap.h b/contrib/llvm-project/llvm/include/llvm/ADT/IntervalMap.h index a02876ee77f3..db7804d0a551 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/IntervalMap.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/IntervalMap.h @@ -491,7 +491,7 @@ class NodeRef { struct CacheAlignedPointerTraits { static inline void *getAsVoidPointer(void *P) { return P; } static inline void *getFromVoidPointer(void *P) { return P; } - enum { NumLowBitsAvailable = Log2CacheLine }; + static constexpr int NumLowBitsAvailable = Log2CacheLine; }; PointerIntPair pip; @@ -823,7 +823,7 @@ public: } /// reset - Reset cached information about node(Level) from subtree(Level -1). - /// @param Level 1..height. THe node to update after parent node changed. + /// @param Level 1..height. The node to update after parent node changed. void reset(unsigned Level) { path[Level] = Entry(subtree(Level - 1), offset(Level)); } @@ -884,7 +884,7 @@ public: } /// getLeftSibling - Get the left sibling node at Level, or a null NodeRef. - /// @param Level Get the sinbling to node(Level). + /// @param Level Get the sibling to node(Level). /// @return Left sibling, or NodeRef(). NodeRef getRightSibling(unsigned Level) const; @@ -1396,7 +1396,7 @@ public: setRoot(map->rootSize); } - /// preincrement - move to the next interval. + /// preincrement - Move to the next interval. const_iterator &operator++() { assert(valid() && "Cannot increment end()"); if (++path.leafOffset() == path.leafSize() && branched()) @@ -1404,14 +1404,14 @@ public: return *this; } - /// postincrement - Dont do that! + /// postincrement - Don't do that! const_iterator operator++(int) { const_iterator tmp = *this; operator++(); return tmp; } - /// predecrement - move to the previous interval. + /// predecrement - Move to the previous interval. const_iterator &operator--() { if (path.leafOffset() && (valid() || !branched())) --path.leafOffset(); @@ -1420,7 +1420,7 @@ public: return *this; } - /// postdecrement - Dont do that! + /// postdecrement - Don't do that! const_iterator operator--(int) { const_iterator tmp = *this; operator--(); diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/Optional.h b/contrib/llvm-project/llvm/include/llvm/ADT/Optional.h index c84f9aa8b342..c64b82352397 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/Optional.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/Optional.h @@ -269,7 +269,7 @@ public: /// Apply a function to the value if present; otherwise return None. template - auto map(const Function &F) const + auto map(const Function &F) const LLVM_LVALUE_FUNCTION -> Optional { if (*this) return F(getValue()); return None; diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/PointerEmbeddedInt.h b/contrib/llvm-project/llvm/include/llvm/ADT/PointerEmbeddedInt.h index 3eb6edb03430..fbc48af79da1 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/PointerEmbeddedInt.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/PointerEmbeddedInt.h @@ -94,7 +94,7 @@ struct PointerLikeTypeTraits> { return T(reinterpret_cast(P), typename T::RawValueTag()); } - enum { NumLowBitsAvailable = T::Shift }; + static constexpr int NumLowBitsAvailable = T::Shift; }; // Teach DenseMap how to use PointerEmbeddedInt objects as keys if the Int type diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/PointerIntPair.h b/contrib/llvm-project/llvm/include/llvm/ADT/PointerIntPair.h index fa6bf1504469..cb8b202c48b7 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/PointerIntPair.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/PointerIntPair.h @@ -147,7 +147,7 @@ struct PointerIntPairInfo { "cannot use a pointer type that has all bits free"); static_assert(IntBits <= PtrTraits::NumLowBitsAvailable, "PointerIntPair with integer size too large for pointer"); - enum : uintptr_t { + enum MaskAndShiftConstants : uintptr_t { /// PointerBitMask - The bits that come from the pointer. PointerBitMask = ~(uintptr_t)(((intptr_t)1 << PtrTraits::NumLowBitsAvailable) - 1), @@ -235,7 +235,8 @@ struct PointerLikeTypeTraits< return PointerIntPair::getFromOpaqueValue(P); } - enum { NumLowBitsAvailable = PtrTraits::NumLowBitsAvailable - IntBits }; + static constexpr int NumLowBitsAvailable = + PtrTraits::NumLowBitsAvailable - IntBits; }; } // end namespace llvm diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/PointerSumType.h b/contrib/llvm-project/llvm/include/llvm/ADT/PointerSumType.h index d467f83f58ac..a7ef774e205e 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/PointerSumType.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/PointerSumType.h @@ -214,7 +214,7 @@ struct PointerSumTypeHelper : MemberTs... { LookupOverload(PointerSumTypeMember *); template static void LookupOverload(...); template struct Lookup { - // Compute a particular member type by resolving the lookup helper ovorload. + // Compute a particular member type by resolving the lookup helper overload. using MemberT = decltype( LookupOverload(static_cast(nullptr))); diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/PointerUnion.h b/contrib/llvm-project/llvm/include/llvm/ADT/PointerUnion.h index 40b7b000da40..6fecff8d756f 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/PointerUnion.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/PointerUnion.h @@ -181,7 +181,7 @@ public: explicit operator bool() const { return !isNull(); } /// Test if the Union currently holds the type matching T. - template int is() const { + template bool is() const { constexpr int Index = pointer_union_detail::TypeIndex::Index; static_assert(Index < sizeof...(PTs), "PointerUnion::is given type not in the union"); @@ -197,7 +197,7 @@ public: } /// Returns the current pointer if it is of the specified pointer type, - /// otherwises returns null. + /// otherwise returns null. template T dyn_cast() const { if (is()) return get(); diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/PostOrderIterator.h b/contrib/llvm-project/llvm/include/llvm/ADT/PostOrderIterator.h index 2fe7447a8e77..bb413a956d9f 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/PostOrderIterator.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/PostOrderIterator.h @@ -18,6 +18,7 @@ #include "llvm/ADT/GraphTraits.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/SmallPtrSet.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/iterator_range.h" #include #include @@ -101,7 +102,7 @@ class po_iterator // VisitStack - Used to maintain the ordering. Top = current block // First element is basic block pointer, second is the 'next child' to visit - std::vector> VisitStack; + SmallVector, 8> VisitStack; po_iterator(NodeRef BB) { this->insertEdge(Optional(), BB); diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/PriorityWorklist.h b/contrib/llvm-project/llvm/include/llvm/ADT/PriorityWorklist.h index 96d22c87557e..01dd59a2e71a 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/PriorityWorklist.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/PriorityWorklist.h @@ -110,7 +110,7 @@ public: /// Insert a sequence of new elements into the PriorityWorklist. template - typename std::enable_if::value>::type + std::enable_if_t::value> insert(SequenceT &&Input) { if (std::begin(Input) == std::end(Input)) // Nothing to do for an empty input sequence. diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/SCCIterator.h b/contrib/llvm-project/llvm/include/llvm/ADT/SCCIterator.h index 1e642b9f75d3..8a7c0a78a0fc 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/SCCIterator.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/SCCIterator.h @@ -124,11 +124,11 @@ public: return CurrentSCC; } - /// Test if the current SCC has a loop. + /// Test if the current SCC has a cycle. /// /// If the SCC has more than one node, this is trivially true. If not, it may - /// still contain a loop if the node has an edge back to itself. - bool hasLoop() const; + /// still contain a cycle if the node has an edge back to itself. + bool hasCycle() const; /// This informs the \c scc_iterator that the specified \c Old node /// has been deleted, and \c New is to be used in its place. @@ -212,7 +212,7 @@ template void scc_iterator::GetNextSCC() { } template -bool scc_iterator::hasLoop() const { +bool scc_iterator::hasCycle() const { assert(!CurrentSCC.empty() && "Dereferencing END SCC iterator!"); if (CurrentSCC.size() > 1) return true; diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/STLExtras.h b/contrib/llvm-project/llvm/include/llvm/ADT/STLExtras.h index b61dab2459d1..50b688b36648 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/STLExtras.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/STLExtras.h @@ -50,6 +50,10 @@ namespace detail { template using IterOfRange = decltype(std::begin(std::declval())); +template +using ValueOfRange = typename std::remove_reference()))>::type; + } // end namespace detail //===----------------------------------------------------------------------===// @@ -75,6 +79,79 @@ template struct make_const_ref { typename std::add_const::type>::type; }; +/// Utilities for detecting if a given trait holds for some set of arguments +/// 'Args'. For example, the given trait could be used to detect if a given type +/// has a copy assignment operator: +/// template +/// using has_copy_assign_t = decltype(std::declval() +/// = std::declval()); +/// bool fooHasCopyAssign = is_detected::value; +namespace detail { +template using void_t = void; +template class Op, class... Args> struct detector { + using value_t = std::false_type; +}; +template