1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00
llvm-mirror/include/llvm/CodeGen
Barry Revzin 2fc9f32ca3 Make LLVM build in C++20 mode
Part of the <=> changes in C++20 make certain patterns of writing equality
operators ambiguous with themselves (sorry!).
This patch goes through and adjusts all the comparison operators such that
they should work in both C++17 and C++20 modes. It also makes two other small
C++20-specific changes (adding a constructor to a type that cases to be an
aggregate, and adding casts from u8 literals which no longer have type
const char*).

There were four categories of errors that this review fixes.
Here are canonical examples of them, ordered from most to least common:

// 1) Missing const
namespace missing_const {
    struct A {
    #ifndef FIXED
        bool operator==(A const&);
    #else
        bool operator==(A const&) const;
    #endif
    };

    bool a = A{} == A{}; // error
}

// 2) Type mismatch on CRTP
namespace crtp_mismatch {
    template <typename Derived>
    struct Base {
    #ifndef FIXED
        bool operator==(Derived const&) const;
    #else
        // in one case changed to taking Base const&
        friend bool operator==(Derived const&, Derived const&);
    #endif
    };

    struct D : Base<D> { };

    bool b = D{} == D{}; // error
}

// 3) iterator/const_iterator with only mixed comparison
namespace iter_const_iter {
    template <bool Const>
    struct iterator {
        using const_iterator = iterator<true>;

        iterator();

        template <bool B, std::enable_if_t<(Const && !B), int> = 0>
        iterator(iterator<B> const&);

    #ifndef FIXED
        bool operator==(const_iterator const&) const;
    #else
        friend bool operator==(iterator const&, iterator const&);
    #endif
    };

    bool c = iterator<false>{} == iterator<false>{} // error
          || iterator<false>{} == iterator<true>{}
          || iterator<true>{} == iterator<false>{}
          || iterator<true>{} == iterator<true>{};
}

// 4) Same-type comparison but only have mixed-type operator
namespace ambiguous_choice {
    enum Color { Red };

    struct C {
        C();
        C(Color);
        operator Color() const;
        bool operator==(Color) const;
        friend bool operator==(C, C);
    };

    bool c = C{} == C{}; // error
    bool d = C{} == Red;
}

Differential revision: https://reviews.llvm.org/D78938
2020-12-17 10:44:10 +00:00
..
GlobalISel [GlobalISel][IRTranslator] Ensure branch probabilities are added when translating invoke edges. 2020-12-14 23:36:54 -08:00
MIRParser
PBQP
AccelTable.h
Analysis.h
AntiDepBreaker.h AntiDepBreaker.h - remove unnecessary ScheduleDAG.h include. NFCI. 2020-09-07 16:39:42 +01:00
AsmPrinter.h [CSSPGO] Pseudo probe encoding and emission. 2020-12-10 17:29:28 -08:00
AsmPrinterHandler.h make the AsmPrinterHandler array public 2020-11-03 10:02:09 -05:00
AtomicExpandUtils.h
BasicBlockSectionUtils.h [llvm] Add -bbsections-cold-text-prefix to emit cold clusters to a different section. 2020-09-24 15:26:15 -07:00
BasicTTIImpl.h [CostModel] Add costs for llvm.experimental.vector.{extract,insert} intrinsics 2020-12-16 13:39:04 +00:00
BuiltinGCs.h
CalcSpillWeights.h [NFC][Regalloc] Pass VirtRegMap by reference. 2020-10-12 08:32:30 -07:00
CallingConvLower.h [SVE] Deal with SVE tuple call arguments correctly when running out of registers 2020-11-12 08:41:50 +00:00
CommandFlags.h [AIX][XCOFF] emit traceback table for function in aix 2020-12-11 17:50:25 -05:00
CostTable.h
CSEConfigBase.h
DAGCombine.h
DbgEntityHistoryCalculator.h [DwarfDebug] Improve single location detection in validThroughout (2/4) 2020-08-27 11:52:29 +01:00
DebugHandlerBase.h make the AsmPrinterHandler array public 2020-11-03 10:02:09 -05:00
DFAPacketizer.h
DIE.h Make LLVM build in C++20 mode 2020-12-17 10:44:10 +00:00
DIEValue.def
DwarfStringPoolEntry.h [DebugInfo] Make the offset of string pool entries 64-bit (18/19). 2020-09-15 12:23:32 +07:00
EdgeBundles.h
ExecutionDomainFix.h
ExpandReductions.h
FastISel.h [CodeGen] Delete 15 unused declarations 2020-12-06 14:55:04 -08:00
FaultMaps.h
FunctionLoweringInfo.h [Statepoint] Consolidate relocation type tracking [NFC] 2020-07-29 11:45:31 -07:00
GCMetadata.h
GCMetadataPrinter.h
GCStrategy.h
IndirectThunks.h [IndirectThunks] Tiny comment fix 2020-06-18 06:50:30 +01:00
IntrinsicLowering.h
ISDOpcodes.h [VP] Build VP SDNodes 2020-12-09 11:36:51 +01:00
LatencyPriorityQueue.h
LazyMachineBlockFrequencyInfo.h
LexicalScopes.h [CodeGen] Delete 15 unused declarations 2020-12-06 14:55:04 -08:00
LinkAllAsmWriterComponents.h
LinkAllCodegenComponents.h
LiveInterval.h Make LLVM build in C++20 mode 2020-12-17 10:44:10 +00:00
LiveIntervalCalc.h
LiveIntervals.h [NFC] Use [MC]Register in Live-ness tracking 2020-11-02 15:46:13 -08:00
LiveIntervalUnion.h [X86] AMX programming model. 2020-12-10 17:01:54 +08:00
LivePhysRegs.h
LiveRangeCalc.h
LiveRangeEdit.h [NFC] Use [MC]Register in register allocation 2020-11-03 17:34:26 -08:00
LiveRegMatrix.h [X86] AMX programming model. 2020-12-10 17:01:54 +08:00
LiveRegUnits.h LiveRegUnits.h - reduce MachineRegisterInfo.h include. NFC. 2020-09-08 17:27:00 +01:00
LiveStacks.h
LiveVariables.h [NFC] Use [MC]Register in Live-ness tracking 2020-11-02 15:46:13 -08:00
LoopTraversal.h
LowLevelType.h [GISel] Add new combines for unary FP instrs with constant operand 2020-09-16 10:34:15 -07:00
MachineBasicBlock.h Explicitly check for entry basic block, rather than relying on MachineBasicBlock::pred_empty. 2020-10-26 16:15:56 -07:00
MachineBlockFrequencyInfo.h [llvm][NFC] refactor setBlockFrequency for clarity. 2020-07-28 13:04:11 -07:00
MachineBranchProbabilityInfo.h
MachineCombinerPattern.h [PowerPC] fma chain break to expose more ILP 2020-06-15 00:00:04 -04:00
MachineConstantPool.h
MachineDominanceFrontier.h DominanceFrontier - remove unused <vector> includes 2020-11-21 17:11:26 +00:00
MachineDominators.h MachineDominators.h - remove unused <vector> include 2020-11-21 17:11:26 +00:00
MachineFrameInfo.h [Alignment][NFC] Migrate TargetTransformInfo::CreateVariableSizedObject to Align 2020-07-01 14:31:21 +00:00
MachineFunction.h [DebugInfo] Follow up c521e44defb5 with an API improvement 2020-10-21 14:45:55 +01:00
MachineFunctionPass.h
MachineInstr.h [CSSPGO] MIR target-independent pseudo instruction for pseudo-probe intrinsic 2020-11-20 10:52:43 -08:00
MachineInstrBuilder.h [NFC] [MIR] Document the reg state flags 2020-08-03 09:03:24 +02:00
MachineInstrBundle.h
MachineInstrBundleIterator.h
MachineJumpTableInfo.h Fix the compilation assertion due to unreachable BB pruning not deleting the associated BB from the jump tables 2020-11-16 10:35:31 -06:00
MachineLoopInfo.h
MachineLoopUtils.h
MachineMemOperand.h
MachineModuleInfo.h Add MachineModuleInfo constructor with external MCContext 2020-11-30 20:28:13 -08:00
MachineModuleInfoImpls.h
MachineOperand.h [codegen] Ensure target flags are cleared/set properly. NFC. 2020-09-03 18:37:39 -04:00
MachineOptimizationRemarkEmitter.h
MachineOutliner.h LiveRegUnits.h - reduce MachineRegisterInfo.h include. NFC. 2020-09-08 17:27:00 +01:00
MachinePassManager.h [NFC] Fix a comment in MachinePassManager.h 2020-10-08 15:38:57 -07:00
MachinePassRegistry.h
MachinePipeliner.h [NFC] Reduce include files dependency. 2020-12-03 18:25:05 +03:00
MachinePostDominators.h DomTree: Remove getRoots() accessor 2020-07-06 21:58:11 +02:00
MachineRegionInfo.h
MachineRegisterInfo.h [NFC] Use Register in RegisterPressure APIs 2020-10-28 12:14:08 -07:00
MachineScheduler.h Revert "[NFC][ScheduleDAG] Remove unused EntrySU SUnit" 2020-09-21 13:33:05 +02:00
MachineSizeOpts.h
MachineSSAUpdater.h MachineSSAUpdater: Allow initialization with just a register class 2020-08-21 23:04:35 +02:00
MachineStableHash.h [NFC] Fixing comment heading for MachineStableHash.h. 2020-10-26 18:07:26 -04:00
MachineTraceMetrics.h [NFC][MC] Type [MC]Register uses in MachineTraceMetrics 2020-10-19 09:49:52 -07:00
MachORelocation.h
MacroFusion.h
MBFIWrapper.h [MBFIWrapper] Add a new function getBlockProfileCount 2020-09-23 09:31:45 -07:00
MIRFormatter.h MIRFormatter.h - remove MachineInstr.h include. NFC. 2020-09-04 11:17:24 +01:00
MIRPrinter.h
MIRYamlMapping.h [DebugInstrRef] Support recording of instruction reference substitutions 2020-10-15 11:30:14 +01:00
ModuloSchedule.h [ModuloSchedule] Devirtualize PeelingModuloScheduleExpander::expand as it's not needed 2020-07-06 18:05:32 -07:00
MultiHazardRecognizer.h HazardRecognizer - Fix definition/declaration argument name mismatches. NFCI. 2020-11-18 16:50:52 +00:00
NonRelocatableStringpool.h [DebugInfo] Make the offset of string pool entries 64-bit (18/19). 2020-09-15 12:23:32 +07:00
ParallelCG.h
Passes.h [Debugify] Support checking Machine IR debug info 2020-12-16 22:17:25 -08:00
PBQPRAConstraint.h
PreISelIntrinsicLowering.h
PseudoSourceValue.h
RDFGraph.h [CodeGen] Delete 4 unused declarations 2020-12-06 15:02:18 -08:00
RDFLiveness.h [RDF] Use hash-based containers, cache extra information 2020-08-04 18:36:49 -05:00
RDFRegisters.h [CodeGen] Delete 15 unused declarations 2020-12-06 14:55:04 -08:00
ReachingDefAnalysis.h [NFC][MC] Use MCRegister for ReachingDefAnalysis APIs 2020-10-22 08:47:35 -07:00
RegAllocPBQP.h [NFC] Use [MC]Register in RegAllocPBQP & RegisterCoalescer 2020-10-26 17:13:32 -07:00
RegAllocRegistry.h
Register.h [NFC][Regalloc] Type 2 statics in terms of Register 2020-10-20 11:27:41 -07:00
RegisterClassInfo.h
RegisterPressure.h [NFC] Use Register in RegisterPressure APIs 2020-10-28 12:14:08 -07:00
RegisterScavenging.h [NFC][regalloc] Use MCRegister appropriately 2020-11-02 11:48:49 -08:00
RegisterUsageInfo.h
ResourcePriorityQueue.h [CodeGen] Delete 15 unused declarations 2020-12-06 14:55:04 -08:00
RuntimeLibcalls.h [AArch64] Out-of-line atomics (-moutline-atomics) implementation. 2020-11-20 13:30:12 +00:00
ScheduleDAG.h Revert "[NFC][ScheduleDAG] Remove unused EntrySU SUnit" 2020-09-21 13:33:05 +02:00
ScheduleDAGInstrs.h [CodeGen] Delete 15 unused declarations 2020-12-06 14:55:04 -08:00
ScheduleDAGMutation.h
ScheduleDFS.h
ScheduleHazardRecognizer.h HazardRecognizer - Fix definition/declaration argument name mismatches. NFCI. 2020-11-18 16:50:52 +00:00
SchedulerRegistry.h
ScoreboardHazardRecognizer.h
SDNodeProperties.td
SelectionDAG.h [X86] Add X86ISD::SUBV_BROADCAST_LOAD and begin removing X86ISD::SUBV_BROADCAST (PR38969) 2020-12-17 10:25:25 +00:00
SelectionDAGAddressAnalysis.h
SelectionDAGISel.h [CodeGen] Delete 4 unused declarations 2020-12-06 15:02:18 -08:00
SelectionDAGNodes.h Revert "ADT: Migrate users of AlignedCharArrayUnion to std::aligned_union_t, NFC" 2020-12-14 17:04:06 -08:00
SelectionDAGTargetInfo.h [SystemZ] Optimize bcmp calls (PR47420) 2020-09-25 17:55:39 +02:00
SlotIndexes.h
Spiller.h
StableHashing.h [NFC] Fixing a gcc compiler warning. 2020-09-08 19:44:33 -04:00
StackMaps.h [Statepoints] Change statepoint machine instr format to better suit VReg lowering. 2020-10-06 17:40:29 +07:00
StackProtector.h
SwiftErrorValueTracking.h
SwitchLoweringUtils.h SwitchLoweringUtils.h - reduce TargetLowering.h include. NFCI. 2020-09-10 17:42:18 +01:00
TailDuplicator.h TailDuplicator: Use Register 2020-06-30 12:13:08 -04:00
TargetCallingConv.h [SVE] Deal with SVE tuple call arguments correctly when running out of registers 2020-11-12 08:41:50 +00:00
TargetFrameLowering.h [SVE] Return StackOffset for TargetFrameLowering::getFrameIndexReference. 2020-11-05 11:02:18 +00:00
TargetInstrInfo.h [MachineCombiner][NFC] Add MustReduceRegisterPressure goal 2020-12-14 00:02:42 -05:00
TargetLowering.h [DAGCombine][PowerPC] Simplify nabs by using legal smin operation 2020-12-08 03:24:07 +00:00
TargetLoweringObjectFileImpl.h [XCOFF][AIX] Emit EH information in traceback table 2020-12-16 09:34:59 -05:00
TargetOpcodes.h
TargetPassConfig.h [Debugify] Support checking Machine IR debug info 2020-12-16 22:17:25 -08:00
TargetRegisterInfo.h [NFC][MC] TargetRegisterInfo::getSubReg is a MCRegister. 2020-12-02 15:46:38 -08:00
TargetSchedule.h
TargetSubtargetInfo.h [X86][MC][Target] Initial backend support a tune CPU to support -mtune 2020-08-14 15:31:50 -07:00
TileShapeInfo.h Remove Shapet assignment operator that's identical to the default. NFC. 2020-12-10 10:58:41 +01:00
UnreachableBlockElim.h
ValueTypes.h [CodeGen] Split MVT::changeTypeToInteger() functionality from EVT::changeTypeToInteger(). 2020-10-22 14:27:42 +01:00
ValueTypes.td [WebAssembly] Implementation of (most) table instructions 2020-10-23 08:42:54 -07:00
VirtRegMap.h [X86] AMX programming model. 2020-12-10 17:01:54 +08:00
WasmEHFuncInfo.h
WinEHFuncInfo.h