| David Blaikie | b3bde2e | 2017-11-17 01:07:10 +0000 | [diff] [blame] | 1 | //===- llvm/CodeGen/TargetSubtargetInfo.h - Target Information --*- C++ -*-===// | 
| Nate Begeman | f26625e | 2005-07-12 01:41:54 +0000 | [diff] [blame] | 2 | // | 
| Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | 
|  | 4 | // See https://llvm.org/LICENSE.txt for license information. | 
|  | 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | 
| Nate Begeman | f26625e | 2005-07-12 01:41:54 +0000 | [diff] [blame] | 6 | // | 
|  | 7 | //===----------------------------------------------------------------------===// | 
|  | 8 | // | 
|  | 9 | // This file describes the subtarget options of a Target machine. | 
|  | 10 | // | 
|  | 11 | //===----------------------------------------------------------------------===// | 
|  | 12 |  | 
| David Blaikie | b3bde2e | 2017-11-17 01:07:10 +0000 | [diff] [blame] | 13 | #ifndef LLVM_CODEGEN_TARGETSUBTARGETINFO_H | 
|  | 14 | #define LLVM_CODEGEN_TARGETSUBTARGETINFO_H | 
| Nate Begeman | f26625e | 2005-07-12 01:41:54 +0000 | [diff] [blame] | 15 |  | 
| Andrea Di Biagio | 8b6c314 | 2018-09-19 15:57:45 +0000 | [diff] [blame] | 16 | #include "llvm/ADT/APInt.h" | 
| Eugene Zelenko | c4ad1ce | 2017-01-11 01:45:03 +0000 | [diff] [blame] | 17 | #include "llvm/ADT/ArrayRef.h" | 
|  | 18 | #include "llvm/ADT/SmallVector.h" | 
|  | 19 | #include "llvm/ADT/StringRef.h" | 
| Lang Hames | 8f31f44 | 2014-10-09 18:20:51 +0000 | [diff] [blame] | 20 | #include "llvm/CodeGen/PBQPRAConstraint.h" | 
| Krzysztof Parzyszek | 5c61d11 | 2016-03-05 15:45:23 +0000 | [diff] [blame] | 21 | #include "llvm/CodeGen/ScheduleDAGMutation.h" | 
| Chandler Carruth | 6bda14b | 2017-06-06 11:49:48 +0000 | [diff] [blame] | 22 | #include "llvm/CodeGen/SchedulerRegistry.h" | 
| Evan Cheng | 54b68e3 | 2011-07-01 20:45:01 +0000 | [diff] [blame] | 23 | #include "llvm/MC/MCSubtargetInfo.h" | 
| Craig Topper | 7a901d9 | 2012-03-25 18:09:44 +0000 | [diff] [blame] | 24 | #include "llvm/Support/CodeGen.h" | 
| Eugene Zelenko | c4ad1ce | 2017-01-11 01:45:03 +0000 | [diff] [blame] | 25 | #include <memory> | 
| Krzysztof Parzyszek | 5c61d11 | 2016-03-05 15:45:23 +0000 | [diff] [blame] | 26 | #include <vector> | 
| Evan Cheng | 007ceb4 | 2009-10-16 21:06:15 +0000 | [diff] [blame] | 27 |  | 
| Eugene Zelenko | 8361b0a | 2017-06-19 22:43:19 +0000 | [diff] [blame] | 28 |  | 
| Nate Begeman | f26625e | 2005-07-12 01:41:54 +0000 | [diff] [blame] | 29 | namespace llvm { | 
|  | 30 |  | 
| Quentin Colombet | ba2a016 | 2016-02-16 19:26:02 +0000 | [diff] [blame] | 31 | class CallLowering; | 
| Eugene Zelenko | 8361b0a | 2017-06-19 22:43:19 +0000 | [diff] [blame] | 32 | class InstrItineraryData; | 
|  | 33 | struct InstrStage; | 
| Ahmed Bougacha | 6756a2c | 2016-07-27 14:31:55 +0000 | [diff] [blame] | 34 | class InstructionSelector; | 
| Tim Northover | 69fa84a | 2016-10-14 22:18:18 +0000 | [diff] [blame] | 35 | class LegalizerInfo; | 
| Andrew Trick | 1188e43 | 2012-09-18 03:32:57 +0000 | [diff] [blame] | 36 | class MachineInstr; | 
| Eugene Zelenko | 8361b0a | 2017-06-19 22:43:19 +0000 | [diff] [blame] | 37 | struct MachineSchedPolicy; | 
|  | 38 | struct MCReadAdvanceEntry; | 
|  | 39 | struct MCWriteLatencyEntry; | 
|  | 40 | struct MCWriteProcResEntry; | 
| Quentin Colombet | 62c1b91 | 2016-04-05 22:50:40 +0000 | [diff] [blame] | 41 | class RegisterBankInfo; | 
| David Goodwin | 90e6b8b | 2009-08-13 16:05:04 +0000 | [diff] [blame] | 42 | class SDep; | 
| Eugene Zelenko | c4ad1ce | 2017-01-11 01:45:03 +0000 | [diff] [blame] | 43 | class SelectionDAGTargetInfo; | 
| Eugene Zelenko | 8361b0a | 2017-06-19 22:43:19 +0000 | [diff] [blame] | 44 | struct SubtargetFeatureKV; | 
| Craig Topper | ca26808 | 2019-03-05 18:54:34 +0000 | [diff] [blame] | 45 | struct SubtargetSubTypeKV; | 
| Eugene Zelenko | 8361b0a | 2017-06-19 22:43:19 +0000 | [diff] [blame] | 46 | struct SubtargetInfoKV; | 
| David Goodwin | 9b48cd4 | 2009-08-19 16:08:58 +0000 | [diff] [blame] | 47 | class SUnit; | 
| Eric Christopher | d913448 | 2014-08-04 21:25:23 +0000 | [diff] [blame] | 48 | class TargetFrameLowering; | 
|  | 49 | class TargetInstrInfo; | 
| Eric Christopher | d913448 | 2014-08-04 21:25:23 +0000 | [diff] [blame] | 50 | class TargetLowering; | 
| David Goodwin | 0d412c2 | 2009-11-10 00:48:55 +0000 | [diff] [blame] | 51 | class TargetRegisterClass; | 
| Eric Christopher | d913448 | 2014-08-04 21:25:23 +0000 | [diff] [blame] | 52 | class TargetRegisterInfo; | 
| Andrew Trick | 1188e43 | 2012-09-18 03:32:57 +0000 | [diff] [blame] | 53 | class TargetSchedModel; | 
| Eugene Zelenko | 8361b0a | 2017-06-19 22:43:19 +0000 | [diff] [blame] | 54 | class Triple; | 
| David Goodwin | 90e6b8b | 2009-08-13 16:05:04 +0000 | [diff] [blame] | 55 |  | 
| Nate Begeman | f26625e | 2005-07-12 01:41:54 +0000 | [diff] [blame] | 56 | //===----------------------------------------------------------------------===// | 
|  | 57 | /// | 
| Evan Cheng | 0d639a2 | 2011-07-01 21:01:15 +0000 | [diff] [blame] | 58 | /// TargetSubtargetInfo - Generic base class for all target subtargets.  All | 
| Nate Begeman | f26625e | 2005-07-12 01:41:54 +0000 | [diff] [blame] | 59 | /// Target-specific options that control code generation and printing should | 
| Evan Cheng | 0d639a2 | 2011-07-01 21:01:15 +0000 | [diff] [blame] | 60 | /// be exposed through a TargetSubtargetInfo-derived class. | 
| Nate Begeman | f26625e | 2005-07-12 01:41:54 +0000 | [diff] [blame] | 61 | /// | 
| Evan Cheng | 0d639a2 | 2011-07-01 21:01:15 +0000 | [diff] [blame] | 62 | class TargetSubtargetInfo : public MCSubtargetInfo { | 
| Nate Begeman | f26625e | 2005-07-12 01:41:54 +0000 | [diff] [blame] | 63 | protected: // Can only create subclasses... | 
| Daniel Sanders | 50f1723 | 2015-09-15 16:17:27 +0000 | [diff] [blame] | 64 | TargetSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS, | 
| Duncan P. N. Exon Smith | 754e21f | 2015-07-10 22:43:42 +0000 | [diff] [blame] | 65 | ArrayRef<SubtargetFeatureKV> PF, | 
| Craig Topper | ca26808 | 2019-03-05 18:54:34 +0000 | [diff] [blame] | 66 | ArrayRef<SubtargetSubTypeKV> PD, | 
| Duncan P. N. Exon Smith | 754e21f | 2015-07-10 22:43:42 +0000 | [diff] [blame] | 67 | const MCWriteProcResEntry *WPR, | 
|  | 68 | const MCWriteLatencyEntry *WL, | 
|  | 69 | const MCReadAdvanceEntry *RA, const InstrStage *IS, | 
|  | 70 | const unsigned *OC, const unsigned *FP); | 
| Eric Christopher | 09e9232 | 2015-04-04 03:53:25 +0000 | [diff] [blame] | 71 |  | 
| Nate Begeman | f26625e | 2005-07-12 01:41:54 +0000 | [diff] [blame] | 72 | public: | 
| David Goodwin | 02ad4cb | 2009-10-22 23:19:17 +0000 | [diff] [blame] | 73 | // AntiDepBreakMode - Type of anti-dependence breaking that should | 
|  | 74 | // be performed before post-RA scheduling. | 
| Eugene Zelenko | 8361b0a | 2017-06-19 22:43:19 +0000 | [diff] [blame] | 75 | using AntiDepBreakMode = enum { ANTIDEP_NONE, ANTIDEP_CRITICAL, ANTIDEP_ALL }; | 
|  | 76 | using RegClassVector = SmallVectorImpl<const TargetRegisterClass *>; | 
| David Goodwin | 02ad4cb | 2009-10-22 23:19:17 +0000 | [diff] [blame] | 77 |  | 
| Eugene Zelenko | c4ad1ce | 2017-01-11 01:45:03 +0000 | [diff] [blame] | 78 | TargetSubtargetInfo() = delete; | 
|  | 79 | TargetSubtargetInfo(const TargetSubtargetInfo &) = delete; | 
| Eugene Zelenko | 8361b0a | 2017-06-19 22:43:19 +0000 | [diff] [blame] | 80 | TargetSubtargetInfo &operator=(const TargetSubtargetInfo &) = delete; | 
|  | 81 | ~TargetSubtargetInfo() override; | 
| Dan Gohman | b9a0121 | 2008-12-16 03:35:01 +0000 | [diff] [blame] | 82 |  | 
| Dean Michael Berris | 46401544 | 2016-09-19 00:54:35 +0000 | [diff] [blame] | 83 | virtual bool isXRaySupported() const { return false; } | 
|  | 84 |  | 
| Eric Christopher | d913448 | 2014-08-04 21:25:23 +0000 | [diff] [blame] | 85 | // Interfaces to the major aspects of target machine information: | 
|  | 86 | // | 
|  | 87 | // -- Instruction opcode and operand information | 
|  | 88 | // -- Pipelines and scheduling information | 
|  | 89 | // -- Stack frame information | 
|  | 90 | // -- Selection DAG lowering information | 
| Quentin Colombet | ba2a016 | 2016-02-16 19:26:02 +0000 | [diff] [blame] | 91 | // -- Call lowering information | 
| Eric Christopher | d913448 | 2014-08-04 21:25:23 +0000 | [diff] [blame] | 92 | // | 
|  | 93 | // N.B. These objects may change during compilation. It's not safe to cache | 
|  | 94 | // them between functions. | 
|  | 95 | virtual const TargetInstrInfo *getInstrInfo() const { return nullptr; } | 
|  | 96 | virtual const TargetFrameLowering *getFrameLowering() const { | 
|  | 97 | return nullptr; | 
|  | 98 | } | 
|  | 99 | virtual const TargetLowering *getTargetLowering() const { return nullptr; } | 
| Benjamin Kramer | f9172fd4 | 2016-01-27 16:32:26 +0000 | [diff] [blame] | 100 | virtual const SelectionDAGTargetInfo *getSelectionDAGInfo() const { | 
| Eric Christopher | d913448 | 2014-08-04 21:25:23 +0000 | [diff] [blame] | 101 | return nullptr; | 
|  | 102 | } | 
| Quentin Colombet | ba2a016 | 2016-02-16 19:26:02 +0000 | [diff] [blame] | 103 | virtual const CallLowering *getCallLowering() const { return nullptr; } | 
| Ahmed Bougacha | 6756a2c | 2016-07-27 14:31:55 +0000 | [diff] [blame] | 104 |  | 
|  | 105 | // FIXME: This lets targets specialize the selector by subtarget (which lets | 
|  | 106 | // us do things like a dedicated avx512 selector).  However, we might want | 
|  | 107 | // to also specialize selectors by MachineFunction, which would let us be | 
|  | 108 | // aware of optsize/optnone and such. | 
|  | 109 | virtual const InstructionSelector *getInstructionSelector() const { | 
|  | 110 | return nullptr; | 
|  | 111 | } | 
|  | 112 |  | 
| Krzysztof Parzyszek | 788e768 | 2017-09-14 20:44:20 +0000 | [diff] [blame] | 113 | virtual unsigned getHwMode() const { return 0; } | 
|  | 114 |  | 
| Mehdi Amini | b58f813 | 2015-07-28 06:18:04 +0000 | [diff] [blame] | 115 | /// Target can subclass this hook to select a different DAG scheduler. | 
|  | 116 | virtual RegisterScheduler::FunctionPassCtor | 
|  | 117 | getDAGScheduler(CodeGenOpt::Level) const { | 
|  | 118 | return nullptr; | 
|  | 119 | } | 
| Eric Christopher | d913448 | 2014-08-04 21:25:23 +0000 | [diff] [blame] | 120 |  | 
| Tim Northover | 69fa84a | 2016-10-14 22:18:18 +0000 | [diff] [blame] | 121 | virtual const LegalizerInfo *getLegalizerInfo() const { return nullptr; } | 
| Tim Northover | 33b07d6 | 2016-07-22 20:03:43 +0000 | [diff] [blame] | 122 |  | 
| Eric Christopher | d913448 | 2014-08-04 21:25:23 +0000 | [diff] [blame] | 123 | /// getRegisterInfo - If register information is available, return it.  If | 
| Quentin Colombet | 6ae3b78 | 2016-04-05 23:04:54 +0000 | [diff] [blame] | 124 | /// not, return null. | 
| Eric Christopher | d913448 | 2014-08-04 21:25:23 +0000 | [diff] [blame] | 125 | virtual const TargetRegisterInfo *getRegisterInfo() const { return nullptr; } | 
|  | 126 |  | 
| Quentin Colombet | 62c1b91 | 2016-04-05 22:50:40 +0000 | [diff] [blame] | 127 | /// If the information for the register banks is available, return it. | 
|  | 128 | /// Otherwise return nullptr. | 
|  | 129 | virtual const RegisterBankInfo *getRegBankInfo() const { return nullptr; } | 
|  | 130 |  | 
| Eric Christopher | d913448 | 2014-08-04 21:25:23 +0000 | [diff] [blame] | 131 | /// getInstrItineraryData - Returns instruction itinerary data for the target | 
|  | 132 | /// or specific subtarget. | 
| Eric Christopher | d913448 | 2014-08-04 21:25:23 +0000 | [diff] [blame] | 133 | virtual const InstrItineraryData *getInstrItineraryData() const { | 
|  | 134 | return nullptr; | 
|  | 135 | } | 
|  | 136 |  | 
| Andrew Trick | 1188e43 | 2012-09-18 03:32:57 +0000 | [diff] [blame] | 137 | /// Resolve a SchedClass at runtime, where SchedClass identifies an | 
|  | 138 | /// MCSchedClassDesc with the isVariant property. This may return the ID of | 
|  | 139 | /// another variant SchedClass, but repeated invocation must quickly terminate | 
|  | 140 | /// in a nonvariant SchedClass. | 
| Eric Christopher | 09e9232 | 2015-04-04 03:53:25 +0000 | [diff] [blame] | 141 | virtual unsigned resolveSchedClass(unsigned SchedClass, | 
|  | 142 | const MachineInstr *MI, | 
|  | 143 | const TargetSchedModel *SchedModel) const { | 
| Andrew Trick | 1188e43 | 2012-09-18 03:32:57 +0000 | [diff] [blame] | 144 | return 0; | 
| Andrew Trick | ab722bd | 2012-09-18 03:18:56 +0000 | [diff] [blame] | 145 | } | 
|  | 146 |  | 
| Andrea Di Biagio | 045aa20 | 2018-09-20 11:07:57 +0000 | [diff] [blame] | 147 | /// Returns true if MI is a dependency breaking zero-idiom instruction for the | 
|  | 148 | /// subtarget. | 
| Andrea Di Biagio | 8b6c314 | 2018-09-19 15:57:45 +0000 | [diff] [blame] | 149 | /// | 
| Andrea Di Biagio | 045aa20 | 2018-09-20 11:07:57 +0000 | [diff] [blame] | 150 | /// This function also sets bits in Mask related to input operands that | 
| Andrea Di Biagio | 8b6c314 | 2018-09-19 15:57:45 +0000 | [diff] [blame] | 151 | /// are not in a data dependency relationship.  There is one bit for each | 
|  | 152 | /// machine operand; implicit operands follow explicit operands in the bit | 
| Andrea Di Biagio | 045aa20 | 2018-09-20 11:07:57 +0000 | [diff] [blame] | 153 | /// representation used for Mask.  An empty (i.e. a mask with all bits | 
|  | 154 | /// cleared) means: data dependencies are "broken" for all the explicit input | 
|  | 155 | /// machine operands of MI. | 
| Andrea Di Biagio | 8b6c314 | 2018-09-19 15:57:45 +0000 | [diff] [blame] | 156 | virtual bool isZeroIdiom(const MachineInstr *MI, APInt &Mask) const { | 
|  | 157 | return false; | 
|  | 158 | } | 
|  | 159 |  | 
| Andrea Di Biagio | 045aa20 | 2018-09-20 11:07:57 +0000 | [diff] [blame] | 160 | /// Returns true if MI is a dependency breaking instruction for the subtarget. | 
| Andrea Di Biagio | 8b6c314 | 2018-09-19 15:57:45 +0000 | [diff] [blame] | 161 | /// | 
|  | 162 | /// Similar in behavior to `isZeroIdiom`. However, it knows how to identify | 
|  | 163 | /// all dependency breaking instructions (i.e. not just zero-idioms). | 
|  | 164 | /// | 
|  | 165 | /// As for `isZeroIdiom`, this method returns a mask of "broken" dependencies. | 
| Andrea Di Biagio | 045aa20 | 2018-09-20 11:07:57 +0000 | [diff] [blame] | 166 | /// (See method `isZeroIdiom` for a detailed description of Mask). | 
| Andrea Di Biagio | 8b6c314 | 2018-09-19 15:57:45 +0000 | [diff] [blame] | 167 | virtual bool isDependencyBreaking(const MachineInstr *MI, APInt &Mask) const { | 
|  | 168 | return isZeroIdiom(MI, Mask); | 
|  | 169 | } | 
|  | 170 |  | 
| Andrea Di Biagio | 6eebbe0 | 2018-10-12 11:23:04 +0000 | [diff] [blame] | 171 | /// Returns true if MI is a candidate for move elimination. | 
|  | 172 | /// | 
|  | 173 | /// A candidate for move elimination may be optimized out at register renaming | 
|  | 174 | /// stage. Subtargets can specify the set of optimizable moves by | 
|  | 175 | /// instantiating tablegen class `IsOptimizableRegisterMove` (see | 
|  | 176 | /// llvm/Target/TargetInstrPredicate.td). | 
|  | 177 | /// | 
|  | 178 | /// SubtargetEmitter is responsible for processing all the definitions of class | 
|  | 179 | /// IsOptimizableRegisterMove, and auto-generate an override for this method. | 
|  | 180 | virtual bool isOptimizableRegisterMove(const MachineInstr *MI) const { | 
|  | 181 | return false; | 
|  | 182 | } | 
|  | 183 |  | 
| Adrian Prantl | 5f8f34e4 | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 184 | /// True if the subtarget should run MachineScheduler after aggressive | 
| Andrew Trick | 108c88c | 2012-11-13 08:47:29 +0000 | [diff] [blame] | 185 | /// coalescing. | 
|  | 186 | /// | 
|  | 187 | /// This currently replaces the SelectionDAG scheduler with the "source" order | 
| Eric Christopher | 5f141b0 | 2015-03-11 22:56:10 +0000 | [diff] [blame] | 188 | /// scheduler (though see below for an option to turn this off and use the | 
|  | 189 | /// TargetLowering preference). It does not yet disable the postRA scheduler. | 
| Andrew Trick | 108c88c | 2012-11-13 08:47:29 +0000 | [diff] [blame] | 190 | virtual bool enableMachineScheduler() const; | 
|  | 191 |  | 
| Adrian Prantl | 5f8f34e4 | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 192 | /// True if the machine scheduler should disable the TLI preference | 
| Eric Christopher | 5f141b0 | 2015-03-11 22:56:10 +0000 | [diff] [blame] | 193 | /// for preRA scheduling with the source level scheduler. | 
|  | 194 | virtual bool enableMachineSchedDefaultSched() const { return true; } | 
|  | 195 |  | 
| Jinsong Ji | ef2d6d9 | 2019-06-11 17:40:39 +0000 | [diff] [blame] | 196 | /// True if the subtarget should run MachinePipeliner | 
|  | 197 | virtual bool enableMachinePipeliner() const { return true; }; | 
|  | 198 |  | 
| Adrian Prantl | 5f8f34e4 | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 199 | /// True if the subtarget should enable joining global copies. | 
| Eric Christopher | 5f141b0 | 2015-03-11 22:56:10 +0000 | [diff] [blame] | 200 | /// | 
|  | 201 | /// By default this is enabled if the machine scheduler is enabled, but | 
|  | 202 | /// can be overridden. | 
|  | 203 | virtual bool enableJoinGlobalCopies() const; | 
|  | 204 |  | 
| Matthias Braun | 39a2afc | 2015-06-13 03:42:16 +0000 | [diff] [blame] | 205 | /// True if the subtarget should run a scheduler after register allocation. | 
| Andrew Trick | 8d2ee37 | 2014-06-04 07:06:27 +0000 | [diff] [blame] | 206 | /// | 
| Matthias Braun | 39a2afc | 2015-06-13 03:42:16 +0000 | [diff] [blame] | 207 | /// By default this queries the PostRAScheduling bit in the scheduling model | 
|  | 208 | /// which is the preferred way to influence this. | 
|  | 209 | virtual bool enablePostRAScheduler() const; | 
| Andrew Trick | 8d2ee37 | 2014-06-04 07:06:27 +0000 | [diff] [blame] | 210 |  | 
| Adrian Prantl | 5f8f34e4 | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 211 | /// True if the subtarget should run the atomic expansion pass. | 
| Robin Morisset | 59c23cd | 2014-08-21 21:50:01 +0000 | [diff] [blame] | 212 | virtual bool enableAtomicExpand() const; | 
| Eric Christopher | c40e5ed | 2014-06-19 21:03:04 +0000 | [diff] [blame] | 213 |  | 
| Chandler Carruth | c58f216 | 2018-01-22 22:05:25 +0000 | [diff] [blame] | 214 | /// True if the subtarget should run the indirectbr expansion pass. | 
|  | 215 | virtual bool enableIndirectBrExpand() const; | 
|  | 216 |  | 
| Adrian Prantl | 5f8f34e4 | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 217 | /// Override generic scheduling policy within a region. | 
| Andrew Trick | 75e411c | 2013-09-06 17:32:34 +0000 | [diff] [blame] | 218 | /// | 
|  | 219 | /// This is a convenient way for targets that don't provide any custom | 
|  | 220 | /// scheduling heuristics (no custom MachineSchedStrategy) to make | 
|  | 221 | /// changes to the generic scheduling policy. | 
|  | 222 | virtual void overrideSchedPolicy(MachineSchedPolicy &Policy, | 
| Andrew Trick | 75e411c | 2013-09-06 17:32:34 +0000 | [diff] [blame] | 223 | unsigned NumRegionInstrs) const {} | 
|  | 224 |  | 
| Adrian Prantl | 5f8f34e4 | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 225 | // Perform target specific adjustments to the latency of a schedule | 
| Eric Christopher | ed19bad | 2014-05-21 23:40:18 +0000 | [diff] [blame] | 226 | // dependency. | 
| Eric Christopher | 09e9232 | 2015-04-04 03:53:25 +0000 | [diff] [blame] | 227 | virtual void adjustSchedDependency(SUnit *def, SUnit *use, SDep &dep) const {} | 
| NAKAMURA Takumi | 16d99f93 | 2014-07-23 00:42:52 +0000 | [diff] [blame] | 228 |  | 
| Sanjay Patel | a2f658d | 2014-07-15 22:39:58 +0000 | [diff] [blame] | 229 | // For use with PostRAScheduling: get the anti-dependence breaking that should | 
|  | 230 | // be performed before post-RA scheduling. | 
| Eric Christopher | 09e9232 | 2015-04-04 03:53:25 +0000 | [diff] [blame] | 231 | virtual AntiDepBreakMode getAntiDepBreakMode() const { return ANTIDEP_NONE; } | 
| NAKAMURA Takumi | 16d99f93 | 2014-07-23 00:42:52 +0000 | [diff] [blame] | 232 |  | 
| Sanjay Patel | a2f658d | 2014-07-15 22:39:58 +0000 | [diff] [blame] | 233 | // For use with PostRAScheduling: in CriticalPathRCs, return any register | 
|  | 234 | // classes that should only be considered for anti-dependence breaking if they | 
|  | 235 | // are on the critical path. | 
|  | 236 | virtual void getCriticalPathRCs(RegClassVector &CriticalPathRCs) const { | 
|  | 237 | return CriticalPathRCs.clear(); | 
|  | 238 | } | 
| NAKAMURA Takumi | 16d99f93 | 2014-07-23 00:42:52 +0000 | [diff] [blame] | 239 |  | 
| Adrian Prantl | 5f8f34e4 | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 240 | // Provide an ordered list of schedule DAG mutations for the post-RA | 
| Krzysztof Parzyszek | 5c61d11 | 2016-03-05 15:45:23 +0000 | [diff] [blame] | 241 | // scheduler. | 
|  | 242 | virtual void getPostRAMutations( | 
|  | 243 | std::vector<std::unique_ptr<ScheduleDAGMutation>> &Mutations) const { | 
|  | 244 | } | 
|  | 245 |  | 
| Adrian Prantl | 5f8f34e4 | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 246 | // Provide an ordered list of schedule DAG mutations for the machine | 
| Krzysztof Parzyszek | 8839124 | 2016-12-22 19:21:20 +0000 | [diff] [blame] | 247 | // pipeliner. | 
|  | 248 | virtual void getSMSMutations( | 
|  | 249 | std::vector<std::unique_ptr<ScheduleDAGMutation>> &Mutations) const { | 
|  | 250 | } | 
|  | 251 |  | 
| Jinsong Ji | f6cb3bc | 2019-05-29 03:02:59 +0000 | [diff] [blame] | 252 | /// Default to DFA for resource management, return false when target will use | 
|  | 253 | /// ProcResource in InstrSchedModel instead. | 
|  | 254 | virtual bool useDFAforSMS() const { return true; } | 
|  | 255 |  | 
| Sanjay Patel | a2f658d | 2014-07-15 22:39:58 +0000 | [diff] [blame] | 256 | // For use with PostRAScheduling: get the minimum optimization level needed | 
|  | 257 | // to enable post-RA scheduling. | 
|  | 258 | virtual CodeGenOpt::Level getOptLevelToEnablePostRAScheduler() const { | 
|  | 259 | return CodeGenOpt::Default; | 
|  | 260 | } | 
| NAKAMURA Takumi | 16d99f93 | 2014-07-23 00:42:52 +0000 | [diff] [blame] | 261 |  | 
| Adrian Prantl | 5f8f34e4 | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 262 | /// True if the subtarget should run the local reassignment | 
| Quentin Colombet | 5caa6a2 | 2014-07-02 18:32:04 +0000 | [diff] [blame] | 263 | /// heuristic of the register allocator. | 
|  | 264 | /// This heuristic may be compile time intensive, \p OptLevel provides | 
|  | 265 | /// a finer grain to tune the register allocator. | 
|  | 266 | virtual bool enableRALocalReassignment(CodeGenOpt::Level OptLevel) const; | 
|  | 267 |  | 
| Adrian Prantl | 5f8f34e4 | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 268 | /// True if the subtarget should consider the cost of local intervals | 
| Marina Yatsina | f9371d8 | 2017-10-22 17:59:38 +0000 | [diff] [blame] | 269 | /// created by a split candidate when choosing the best split candidate. This | 
|  | 270 | /// heuristic may be compile time intensive. | 
|  | 271 | virtual bool enableAdvancedRASplitCost() const; | 
|  | 272 |  | 
| Adrian Prantl | 5f8f34e4 | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 273 | /// Enable use of alias analysis during code generation (during MI | 
| Hal Finkel | b350ffd | 2013-08-29 03:25:05 +0000 | [diff] [blame] | 274 | /// scheduling, DAGCombine, etc.). | 
|  | 275 | virtual bool useAA() const; | 
|  | 276 |  | 
| Adrian Prantl | 5f8f34e4 | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 277 | /// Enable the use of the early if conversion pass. | 
| Eric Christopher | 6b0fcfe | 2014-05-21 23:40:26 +0000 | [diff] [blame] | 278 | virtual bool enableEarlyIfConversion() const { return false; } | 
| Lang Hames | 8f31f44 | 2014-10-09 18:20:51 +0000 | [diff] [blame] | 279 |  | 
| Adrian Prantl | 5f8f34e4 | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 280 | /// Return PBQPConstraint(s) for the target. | 
| Lang Hames | 8f31f44 | 2014-10-09 18:20:51 +0000 | [diff] [blame] | 281 | /// | 
|  | 282 | /// Override to provide custom PBQP constraints. | 
|  | 283 | virtual std::unique_ptr<PBQPRAConstraint> getCustomPBQPConstraints() const { | 
|  | 284 | return nullptr; | 
|  | 285 | } | 
| Matthias Braun | e3d3b88 | 2014-12-10 01:12:30 +0000 | [diff] [blame] | 286 |  | 
|  | 287 | /// Enable tracking of subregister liveness in register allocator. | 
| Matthias Braun | f1b20c5 | 2016-08-24 22:17:45 +0000 | [diff] [blame] | 288 | /// Please use MachineRegisterInfo::subRegLivenessEnabled() instead where | 
|  | 289 | /// possible. | 
| Eric Christopher | 09e9232 | 2015-04-04 03:53:25 +0000 | [diff] [blame] | 290 | virtual bool enableSubRegLiveness() const { return false; } | 
| Andrew V. Tischenko | 75745d0 | 2017-04-14 07:44:23 +0000 | [diff] [blame] | 291 |  | 
| Matthias Braun | 5c290dc | 2018-01-19 03:16:36 +0000 | [diff] [blame] | 292 | /// This is called after a .mir file was loaded. | 
|  | 293 | virtual void mirFileLoaded(MachineFunction &MF) const; | 
| Oliver Stannard | 830b203 | 2019-07-03 09:58:52 +0000 | [diff] [blame] | 294 |  | 
|  | 295 | /// True if the register allocator should use the allocation orders exactly as | 
|  | 296 | /// written in the tablegen descriptions, false if it should allocate | 
|  | 297 | /// the specified physical register later if is it callee-saved. | 
|  | 298 | virtual bool ignoreCSRForAllocationOrder(const MachineFunction &MF, | 
|  | 299 | unsigned PhysReg) const { | 
|  | 300 | return false; | 
|  | 301 | } | 
| Nate Begeman | f26625e | 2005-07-12 01:41:54 +0000 | [diff] [blame] | 302 | }; | 
|  | 303 |  | 
| Eugene Zelenko | c4ad1ce | 2017-01-11 01:45:03 +0000 | [diff] [blame] | 304 | } // end namespace llvm | 
| Nate Begeman | f26625e | 2005-07-12 01:41:54 +0000 | [diff] [blame] | 305 |  | 
| David Blaikie | b3bde2e | 2017-11-17 01:07:10 +0000 | [diff] [blame] | 306 | #endif // LLVM_CODEGEN_TARGETSUBTARGETINFO_H |