LLVM 24.0.0git
HexagonTargetMachine.cpp
Go to the documentation of this file.
1//===-- HexagonTargetMachine.cpp - Define TargetMachine for Hexagon -------===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8//
9// Implements the info about Hexagon target spec.
10//
11//===----------------------------------------------------------------------===//
12
14#include "Hexagon.h"
15#include "HexagonISelLowering.h"
24#include "llvm/CodeGen/Passes.h"
33#include <optional>
34
35using namespace llvm;
36
37static cl::opt<bool>
38 EnableCExtOpt("hexagon-cext", cl::Hidden, cl::init(true),
39 cl::desc("Enable Hexagon constant-extender optimization"));
40
42 cl::desc("Enable RDF-based optimizations"));
43
45 "hexagon-handle-qfloat", cl::init(true), cl::Hidden,
46 cl::desc("Fix up QFloat spills and reloads after register allocation"));
47
49 "rdf-bb-limit", cl::Hidden, cl::init(1000),
50 cl::desc("Basic block limit for a function for RDF optimizations"));
51
52static cl::opt<bool>
53 DisableHardwareLoops("disable-hexagon-hwloops", cl::Hidden,
54 cl::desc("Disable Hardware Loops for Hexagon target"));
55
56static cl::opt<bool> EnableMCR("hexagon-mcr", cl::Hidden, cl::init(true),
57 cl::desc("Enable the machine combiner pass"));
58
59static cl::opt<bool>
60 DisableAModeOpt("disable-hexagon-amodeopt", cl::Hidden,
61 cl::desc("Disable Hexagon Addressing Mode Optimization"));
62
63static cl::opt<bool>
64 DisableHexagonCFGOpt("disable-hexagon-cfgopt", cl::Hidden,
65 cl::desc("Disable Hexagon CFG Optimization"));
66
67static cl::opt<bool>
68 DisableHCP("disable-hcp", cl::Hidden,
69 cl::desc("Disable Hexagon constant propagation"));
70
72 "disable-mask", cl::Hidden,
73 cl::desc("Disable Hexagon specific Mask generation pass"));
74
76 "disable-hlv", cl::Hidden,
77 cl::desc("Disable Hexagon specific post-RA live-variable analysis"));
78static cl::opt<bool> DisableStoreWidening("disable-store-widen", cl::Hidden,
79 cl::init(false),
80 cl::desc("Disable store widening"));
81
82static cl::opt<bool> DisableLoadWidening("disable-load-widen", cl::Hidden,
83 cl::desc("Disable load widening"));
84
85static cl::opt<bool> EnableExpandCondsets("hexagon-expand-condsets",
86 cl::init(true), cl::Hidden,
87 cl::desc("Early expansion of MUX"));
88
89static cl::opt<bool> EnableTfrCleanup("hexagon-tfr-cleanup", cl::init(true),
91 cl::desc("Cleanup of TFRs/COPYs"));
92
93static cl::opt<bool> EnableEarlyIf("hexagon-eif", cl::init(true), cl::Hidden,
94 cl::desc("Enable early if-conversion"));
95
96static cl::opt<bool> EnableCopyHoist("hexagon-copy-hoist", cl::init(true),
98 cl::desc("Enable Hexagon copy hoisting"));
99
100static cl::opt<bool>
101 EnableGenInsert("hexagon-insert", cl::init(true), cl::Hidden,
102 cl::desc("Generate \"insert\" instructions"));
103
104static cl::opt<bool>
105 EnableCommGEP("hexagon-commgep", cl::init(true), cl::Hidden,
106 cl::desc("Enable commoning of GEP instructions"));
107
108static cl::opt<bool>
109 EnableGenExtract("hexagon-extract", cl::init(true), cl::Hidden,
110 cl::desc("Generate \"extract\" instructions"));
111
113 "hexagon-mux", cl::init(true), cl::Hidden,
114 cl::desc("Enable converting conditional transfers into MUX instructions"));
115
116static cl::opt<bool>
117 EnableGenPred("hexagon-gen-pred", cl::init(true), cl::Hidden,
118 cl::desc("Enable conversion of arithmetic operations to "
119 "predicate instructions"));
120
121static cl::opt<bool>
122 EnableLoopPrefetch("hexagon-loop-prefetch", cl::Hidden,
123 cl::desc("Enable loop data prefetch on Hexagon"));
124
125static cl::opt<bool>
126 DisableHSDR("disable-hsdr", cl::init(false), cl::Hidden,
127 cl::desc("Disable splitting double registers"));
128
129static cl::opt<bool>
130 EnableGenMemAbs("hexagon-mem-abs", cl::init(true), cl::Hidden,
131 cl::desc("Generate absolute set instructions"));
132
133static cl::opt<bool> EnableBitSimplify("hexagon-bit", cl::init(true),
135 cl::desc("Bit simplification"));
136
137static cl::opt<bool> EnableLoopResched("hexagon-loop-resched", cl::init(true),
139 cl::desc("Loop rescheduling"));
140
141static cl::opt<bool> HexagonNoOpt("hexagon-noopt", cl::init(false), cl::Hidden,
142 cl::desc("Disable backend optimizations"));
143
144static cl::opt<bool>
145 EnableVectorPrint("enable-hexagon-vector-print", cl::Hidden,
146 cl::desc("Enable Hexagon Vector print instr pass"));
147
148static cl::opt<bool>
149 EnableVExtractOpt("hexagon-opt-vextract", cl::Hidden, cl::init(true),
150 cl::desc("Enable vextract optimization"));
151
152static cl::opt<bool>
153 EnableVectorCombine("hexagon-vector-combine", cl::Hidden, cl::init(true),
154 cl::desc("Enable HVX vector combining"));
155
157 "hexagon-initial-cfg-cleanup", cl::Hidden, cl::init(true),
158 cl::desc("Simplify the CFG after atomic expansion pass"));
159
160static cl::opt<bool> EnableInstSimplify("hexagon-instsimplify", cl::Hidden,
161 cl::init(true),
162 cl::desc("Enable instsimplify"));
163
165 "hexagon-qfloat-mode", cl::desc("Specify the qfloat mode to operate on."),
168 clEnumValN(QFloatMode::StrictIEEE, "strict-ieee",
169 "Enable code generation for qfloat strict IEEE-754 mode"),
171 "Enable code generation for qfloat IEEE-754 mode"),
173 "Enable code generation for qfloat lossy-subnormals mode"),
175 "Enable code generation for qfloat legacy mode")));
176
177/// HexagonTargetMachineModule - Note that this is used on hosts that
178/// cannot link in a library unless there are references into the
179/// library. In particular, it seems that it is not possible to get
180/// things to work on Win32 without this. Though it is unused, do not
181/// remove it.
184
187 C, std::make_unique<HexagonConvergingVLIWScheduler>());
188 DAG->addMutation(std::make_unique<HexagonSubtarget::UsrOverflowMutation>());
189 DAG->addMutation(std::make_unique<HexagonSubtarget::HVXMemLatencyMutation>());
190 DAG->addMutation(std::make_unique<HexagonSubtarget::CallMutation>());
192 return DAG;
193}
194
196 SchedCustomRegistry("hexagon", "Run Hexagon's custom scheduler",
198
199static Reloc::Model getEffectiveRelocModel(std::optional<Reloc::Model> RM) {
200 return RM.value_or(Reloc::Static);
201}
202
205 // Register the target.
207
255}
256
258 StringRef CPU, StringRef FS,
259 const TargetOptions &Options,
260 std::optional<Reloc::Model> RM,
261 std::optional<CodeModel::Model> CM,
262 CodeGenOptLevel OL, bool JIT)
263 // Specify the vector alignment explicitly. For v512x1, the calculated
264 // alignment would be 512*alignment(i1), which is 512 bytes, instead of
265 // the required minimum of 64 bytes.
266 : CodeGenTargetMachineImpl(T, TT.computeDataLayout(), TT, CPU, FS, Options,
270 TLOF(std::make_unique<HexagonTargetObjectFile>()),
271 Subtarget(Triple(TT), CPU, FS, *this) {
272 initAsmInfo();
273}
274
275const HexagonSubtarget *
277 AttributeList FnAttrs = F.getAttributes();
278 Attribute CPUAttr = FnAttrs.getFnAttr("target-cpu");
279 Attribute FSAttr = FnAttrs.getFnAttr("target-features");
280
281 std::string CPU =
282 CPUAttr.isValid() ? CPUAttr.getValueAsString().str() : TargetCPU;
283 std::string FS =
284 FSAttr.isValid() ? FSAttr.getValueAsString().str() : TargetFS;
285
286 auto &I = SubtargetMap[CPU + FS];
287 if (!I)
288 I = std::make_unique<HexagonSubtarget>(TargetTriple, CPU, FS, *this);
289 return I.get();
290}
291
293#define GET_PASS_REGISTRY "HexagonPassRegistry.def"
295
296 PB.registerLateLoopOptimizationsEPCallback(
297 [=](LoopPassManager &LPM, OptimizationLevel Level) {
298 if (Level != OptimizationLevel::O0)
299 LPM.addPass(HexagonLoopIdiomRecognitionPass());
300 });
301 PB.registerLoopOptimizerEndEPCallback(
302 [=](LoopPassManager &LPM, OptimizationLevel Level) {
303 if (Level != OptimizationLevel::O0)
305 });
306}
307
310 return TargetTransformInfo(std::make_unique<HexagonTTIImpl>(this, F));
311}
312
319
324
327 const auto *MFI = MF.getInfo<HexagonMachineFunctionInfo>();
328 const auto &TRI = *MF.getSubtarget().getRegisterInfo();
329 return new yaml::HexagonFunctionInfo(*MFI, TRI);
330}
331
334 SMDiagnostic &Error, SMRange &SourceRange) const {
335 const auto &YamlMFI = static_cast<const yaml::HexagonFunctionInfo &>(MFI_);
336 MachineFunction &MF = PFS.MF;
338
339 MFI->initializeBaseYamlFields(YamlMFI);
340
341 // Parse StackAlignBaseReg register name
342 if (!YamlMFI.StackAlignBaseReg.Value.empty()) {
343 Register Reg;
344 if (parseNamedRegisterReference(PFS, Reg, YamlMFI.StackAlignBaseReg.Value,
345 Error)) {
346 SourceRange = YamlMFI.StackAlignBaseReg.SourceRange;
347 return true;
348 }
349 MFI->setStackAlignBaseReg(Reg);
350 }
351
352 return false;
353}
354
356
361
362namespace {
363/// Hexagon Code Generator Pass Configuration Options.
364class HexagonPassConfig : public TargetPassConfig {
365public:
366 HexagonPassConfig(HexagonTargetMachine &TM, PassManagerBase &PM)
367 : TargetPassConfig(TM, PM) {}
368
369 HexagonTargetMachine &getHexagonTargetMachine() const {
371 }
372
373 void addIRPasses() override;
374 bool addInstSelector() override;
375 bool addILPOpts() override;
376 void addPreRegAlloc() override;
377 void addPostRegAlloc() override;
378 void addPreSched2() override;
379 void addPreEmitPass() override;
380};
381} // namespace
382
384 return new HexagonPassConfig(*this, PM);
385}
386
387void HexagonPassConfig::addIRPasses() {
389 bool NoOpt = (getOptLevel() == CodeGenOptLevel::None);
390
391 if (!NoOpt) {
395 }
396
398
399 if (!NoOpt) {
402 .forwardSwitchCondToPhi(true)
403 .convertSwitchRangeToICmp(true)
404 .convertSwitchToLookupTable(true)
405 .needCanonicalLoops(false)
406 .hoistCommonInsts(true)
407 .sinkCommonInsts(true)));
412 if (EnableCommGEP)
413 addPass(createHexagonCommonGEP());
414 // Replace certain combinations of shifts and ands with extracts.
416 addPass(createHexagonGenExtract());
417 }
418}
419
420bool HexagonPassConfig::addInstSelector() {
421 HexagonTargetMachine &TM = getHexagonTargetMachine();
422 const HexagonSubtarget *HST = TM.getHexagonSubtarget();
423 bool NoOpt = (getOptLevel() == CodeGenOptLevel::None);
424
425 if (!NoOpt)
427
428 addPass(createHexagonISelDag(TM, getOptLevel()));
429 // Run the QFloat mode code generation pass only if v79 or greater.
430 // Do not run this pass, if legacy mode is passed on command line.
433
434 if (!NoOpt) {
436 addPass(createHexagonVExtract());
437 // Create logical operations on predicate registers.
438 if (EnableGenPred)
439 addPass(createHexagonGenPredicate());
440 // Rotate loops to expose bit-simplification opportunities.
443 // Split double registers.
444 if (!DisableHSDR)
446 // Bit simplification.
448 addPass(createHexagonBitSimplify());
449 addPass(createHexagonPeephole());
450 // Constant propagation.
451 if (!DisableHCP) {
454 }
455 if (EnableGenInsert)
456 addPass(createHexagonGenInsert());
457 if (EnableEarlyIf)
459 // For v75 or below, or if legacy mode is requested, run QFPOptizer pass
460 // to preserve backward compatibility.
462 addPass(createHexagonQFPOptimizer());
463 }
464
465 return false;
466}
467
468bool HexagonPassConfig::addILPOpts() {
469 if (EnableMCR)
470 addPass(&MachineCombinerID);
471
472 return true;
473}
474
475void HexagonPassConfig::addPreRegAlloc() {
476 if (getOptLevel() != CodeGenOptLevel::None) {
477 if (EnableCExtOpt)
481 if (EnableCopyHoist)
488 addPass(createHexagonLoadWidening());
489 if (EnableGenMemAbs)
493 }
495 addPass(&MachinePipelinerID);
497}
498
499void HexagonPassConfig::addPostRegAlloc() {
500 HexagonTargetMachine &HTM = getHexagonTargetMachine();
501 const HexagonSubtarget *HST = HTM.getHexagonSubtarget();
502 // Run PostRAQFP on v79 and above.
505
506 if (getOptLevel() != CodeGenOptLevel::None) {
507 if (EnableRDFOpt)
508 addPass(createHexagonRDFOpt());
510 addPass(createHexagonCFGOptimizer());
511 if (!DisableAModeOpt)
512 addPass(createHexagonOptAddrMode());
513 }
514}
515
516void HexagonPassConfig::addPreSched2() {
517 bool NoOpt = (getOptLevel() == CodeGenOptLevel::None);
519 if (getOptLevel() != CodeGenOptLevel::None)
520 addPass(&IfConverterID);
522 if (!NoOpt && !DisableHexagonMask)
523 addPass(createHexagonMask());
524
525 if (!NoOpt && !DisableHexagonLiveVars) {
526 addPass(&HexagonLiveVariablesID);
527 }
528}
529
530void HexagonPassConfig::addPreEmitPass() {
531 bool NoOpt = (getOptLevel() == CodeGenOptLevel::None);
532
533 if (!NoOpt)
534 addPass(createHexagonNewValueJump());
535
537
538 if (!NoOpt) {
540 addPass(createHexagonFixupHwLoops());
541 // Generate MUX from pairs of conditional transfers.
542 if (EnableGenMux)
543 addPass(createHexagonGenMux());
545 addPass(&HexagonLiveVariablesID);
546 }
547
548 // Emit KCFI checks for indirect calls. Must run before packetization so
549 // the check and call can be bundled together into a VLIW packet.
550 addPass(createKCFIPass());
551
552 // Packetization is mandatory: it handles gather/scatter at all opt levels.
553 addPass(createHexagonPacketizer(NoOpt));
554
555 if (!NoOpt) {
556 // Global pull-up scheduler
558
559 addPass(createHexagonLoopAlign());
560 }
561
563 addPass(createHexagonVectorPrint());
564
565 // Add CFI instructions if necessary.
567}
static cl::opt< bool > EnableMCR("aarch64-enable-mcr", cl::desc("Enable the machine combiner pass"), cl::init(true), cl::Hidden)
static Reloc::Model getEffectiveRelocModel()
static cl::opt< bool > EnableLoopPrefetch("amdgpu-loop-prefetch", cl::desc("Enable loop data prefetch on AMDGPU"), cl::Hidden, cl::init(false))
#define X(NUM, ENUM, NAME)
Definition ELF.h:856
#define clEnumValN(ENUMVAL, FLAGNAME, DESC)
#define LLVM_ABI
Definition Compiler.h:215
#define LLVM_EXTERNAL_VISIBILITY
Definition Compiler.h:132
cl::opt< QFloatMode > QFloatModeValue
static cl::opt< bool > EnableExpandCondsets("hexagon-expand-condsets", cl::init(true), cl::Hidden, cl::desc("Early expansion of MUX"))
static cl::opt< bool > HexagonNoOpt("hexagon-noopt", cl::init(false), cl::Hidden, cl::desc("Disable backend optimizations"))
static cl::opt< bool > EnableGenExtract("hexagon-extract", cl::init(true), cl::Hidden, cl::desc("Generate \"extract\" instructions"))
static cl::opt< bool > EnableVectorCombine("hexagon-vector-combine", cl::Hidden, cl::init(true), cl::desc("Enable HVX vector combining"))
static cl::opt< bool > EnableGenMux("hexagon-mux", cl::init(true), cl::Hidden, cl::desc("Enable converting conditional transfers into MUX instructions"))
static cl::opt< bool > DisableHexagonCFGOpt("disable-hexagon-cfgopt", cl::Hidden, cl::desc("Disable Hexagon CFG Optimization"))
cl::opt< QFloatMode > QFloatModeValue("hexagon-qfloat-mode", cl::desc("Specify the qfloat mode to operate on."), cl::Hidden, cl::init(QFloatMode::Legacy), cl::values(clEnumValN(QFloatMode::StrictIEEE, "strict-ieee", "Enable code generation for qfloat strict IEEE-754 mode"), clEnumValN(QFloatMode::IEEE, "ieee", "Enable code generation for qfloat IEEE-754 mode"), clEnumValN(QFloatMode::Lossy, "lossy", "Enable code generation for qfloat lossy-subnormals mode"), clEnumValN(QFloatMode::Legacy, "legacy", "Enable code generation for qfloat legacy mode")))
static cl::opt< bool > DisableAModeOpt("disable-hexagon-amodeopt", cl::Hidden, cl::desc("Disable Hexagon Addressing Mode Optimization"))
LLVM_ABI LLVM_EXTERNAL_VISIBILITY void LLVMInitializeHexagonTarget()
static cl::opt< bool > DisableHCP("disable-hcp", cl::Hidden, cl::desc("Disable Hexagon constant propagation"))
static cl::opt< bool > DisableStoreWidening("disable-store-widen", cl::Hidden, cl::init(false), cl::desc("Disable store widening"))
static cl::opt< bool > EnableBitSimplify("hexagon-bit", cl::init(true), cl::Hidden, cl::desc("Bit simplification"))
static cl::opt< bool > EnableVectorPrint("enable-hexagon-vector-print", cl::Hidden, cl::desc("Enable Hexagon Vector print instr pass"))
static MachineSchedRegistry SchedCustomRegistry("hexagon", "Run Hexagon's custom scheduler", createVLIWMachineSched)
static cl::opt< bool > DisableHardwareLoops("disable-hexagon-hwloops", cl::Hidden, cl::desc("Disable Hardware Loops for Hexagon target"))
static cl::opt< bool > EnableGenPred("hexagon-gen-pred", cl::init(true), cl::Hidden, cl::desc("Enable conversion of arithmetic operations to " "predicate instructions"))
static cl::opt< bool > DisableHexagonLiveVars("disable-hlv", cl::Hidden, cl::desc("Disable Hexagon specific post-RA live-variable analysis"))
static cl::opt< bool > EnableGenMemAbs("hexagon-mem-abs", cl::init(true), cl::Hidden, cl::desc("Generate absolute set instructions"))
static cl::opt< bool > EnableVExtractOpt("hexagon-opt-vextract", cl::Hidden, cl::init(true), cl::desc("Enable vextract optimization"))
static cl::opt< bool > EnableInstSimplify("hexagon-instsimplify", cl::Hidden, cl::init(true), cl::desc("Enable instsimplify"))
static cl::opt< bool > EnableRDFOpt("rdf-opt", cl::Hidden, cl::init(true), cl::desc("Enable RDF-based optimizations"))
static cl::opt< bool > EnableCExtOpt("hexagon-cext", cl::Hidden, cl::init(true), cl::desc("Enable Hexagon constant-extender optimization"))
static cl::opt< bool > DisableLoadWidening("disable-load-widen", cl::Hidden, cl::desc("Disable load widening"))
int HexagonTargetMachineModule
HexagonTargetMachineModule - Note that this is used on hosts that cannot link in a library unless the...
static cl::opt< bool > DisableHexagonMask("disable-mask", cl::Hidden, cl::desc("Disable Hexagon specific Mask generation pass"))
static cl::opt< bool > EnableCopyHoist("hexagon-copy-hoist", cl::init(true), cl::Hidden, cl::desc("Enable Hexagon copy hoisting"))
static cl::opt< bool > EnableLoopResched("hexagon-loop-resched", cl::init(true), cl::Hidden, cl::desc("Loop rescheduling"))
static ScheduleDAGInstrs * createVLIWMachineSched(MachineSchedContext *C)
static cl::opt< bool > EnableTfrCleanup("hexagon-tfr-cleanup", cl::init(true), cl::Hidden, cl::desc("Cleanup of TFRs/COPYs"))
static cl::opt< bool > DisableHSDR("disable-hsdr", cl::init(false), cl::Hidden, cl::desc("Disable splitting double registers"))
static cl::opt< bool > EnableInitialCFGCleanup("hexagon-initial-cfg-cleanup", cl::Hidden, cl::init(true), cl::desc("Simplify the CFG after atomic expansion pass"))
cl::opt< unsigned > RDFFuncBlockLimit("rdf-bb-limit", cl::Hidden, cl::init(1000), cl::desc("Basic block limit for a function for RDF optimizations"))
static cl::opt< bool > EnablePostRAHandleQFP("hexagon-handle-qfloat", cl::init(true), cl::Hidden, cl::desc("Fix up QFloat spills and reloads after register allocation"))
static cl::opt< bool > EnableMCR("hexagon-mcr", cl::Hidden, cl::init(true), cl::desc("Enable the machine combiner pass"))
static cl::opt< bool > EnableLoopPrefetch("hexagon-loop-prefetch", cl::Hidden, cl::desc("Enable loop data prefetch on Hexagon"))
static cl::opt< bool > EnableGenInsert("hexagon-insert", cl::init(true), cl::Hidden, cl::desc("Generate \"insert\" instructions"))
static cl::opt< bool > EnableCommGEP("hexagon-commgep", cl::init(true), cl::Hidden, cl::desc("Enable commoning of GEP instructions"))
static cl::opt< bool > EnableEarlyIf("hexagon-eif", cl::init(true), cl::Hidden, cl::desc("Enable early if-conversion"))
This file implements a TargetTransformInfo analysis pass specific to the Hexagon target machine.
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
Register const TargetRegisterInfo * TRI
#define T
PassBuilder PB(Machine, PassOpts->PTO, std::nullopt, &PIC)
const GCNTargetMachine & getTM(const GCNSubtarget *STI)
Target-Independent Code Generator Pass Configuration Options pass.
Functions, function parameters, and return types can have attributes to indicate how they should be t...
Definition Attributes.h:105
LLVM_ABI StringRef getValueAsString() const
Return the attribute's value as a string.
bool isValid() const
Return true if the attribute is any kind of attribute.
Definition Attributes.h:261
CodeGenTargetMachineImpl(const Target &T, StringRef DataLayoutString, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM, CodeGenOptLevel OL)
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
Hexagon target-specific information for each MachineFunction.
void initializeBaseYamlFields(const yaml::HexagonFunctionInfo &YamlMFI)
ScheduleDAGInstrs * createMachineScheduler(MachineSchedContext *C) const override
Create an instance of ScheduleDAGInstrs to be run within the standard MachineScheduler pass for this ...
MachineFunctionInfo * createMachineFunctionInfo(BumpPtrAllocator &Allocator, const Function &F, const TargetSubtargetInfo *STI) const override
Create the target's instance of MachineFunctionInfo.
bool parseMachineFunctionInfo(const yaml::MachineFunctionInfo &, PerFunctionMIParsingState &PFS, SMDiagnostic &Error, SMRange &SourceRange) const override
Parse out the target's MachineFunctionInfo from the YAML reprsentation.
TargetPassConfig * createPassConfig(PassManagerBase &PM) override
Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...
void registerPassBuilderCallbacks(PassBuilder &PB) override
Allow the target to modify the pass pipeline.
yaml::MachineFunctionInfo * convertFuncInfoToYAML(const MachineFunction &MF) const override
Allocate and initialize an instance of the YAML representation of the MachineFunctionInfo.
HexagonTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, std::optional< Reloc::Model > RM, std::optional< CodeModel::Model > CM, CodeGenOptLevel OL, bool JIT)
const HexagonSubtarget * getSubtargetImpl(const Function &F) const override
Virtual method implemented by subclasses that returns a reference to that target's TargetSubtargetInf...
yaml::MachineFunctionInfo * createDefaultFuncInfoYAML() const override
Allocate and return a default initialized instance of the YAML representation for the MachineFunction...
TargetTransformInfo getTargetTransformInfo(const Function &F) const override
Get a TargetTransformInfo implementation for the target.
const HexagonSubtarget * getHexagonSubtarget() const
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
MachineSchedRegistry provides a selection of available machine instruction schedulers.
This class provides access to building LLVM's passes.
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...
static LLVM_ABI PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
Wrapper class representing virtual and physical registers.
Definition Register.h:20
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...
Definition SourceMgr.h:308
Represents a range in source code.
Definition SMLoc.h:47
A ScheduleDAG for scheduling lists of MachineInstr.
ScheduleDAGMILive is an implementation of ScheduleDAGInstrs that schedules machine instructions while...
void addMutation(std::unique_ptr< ScheduleDAGMutation > Mutation)
Add a postprocessing step to the DAG builder.
const TargetInstrInfo * TII
Target instruction information.
const TargetRegisterInfo * TRI
Target processor register info.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
std::string str() const
Get the contents as an std::string.
Definition StringRef.h:222
CodeGenOptLevel getOptLevel() const
Returns the optimization level: None, Less, Default, or Aggressive.
Triple TargetTriple
Triple string, CPU name, and target feature strings the TargetMachine instance is created with.
std::unique_ptr< const MCSubtargetInfo > STI
TargetOptions Options
Target-Independent Code Generator Pass Configuration Options.
virtual void addIRPasses()
Add common target configurable passes that perform LLVM IR to IR transforms following machine indepen...
TargetSubtargetInfo - Generic base class for all target subtargets.
virtual const TargetRegisterInfo * getRegisterInfo() const =0
Return the target's register information.
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
Target - Wrapper for Target specific information.
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:48
Extend the standard ScheduleDAGMILive to provide more context and override the top-level schedule() d...
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
Interfaces for registering analysis passes, producing common pass manager configurations,...
@ C
The default llvm calling convention, compatible with C.
Definition CallingConv.h:34
ValuesClass values(OptsTy... Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
FunctionPass * createHexagonVectorPrint()
void initializeHexagonCopyHoistingPass(PassRegistry &)
FunctionPass * createHexagonVectorCombineLegacyPass()
void initializeHexagonOptAddrModePass(PassRegistry &)
LLVM_ABI FunctionPass * createCFGSimplificationPass(SimplifyCFGOptions Options=SimplifyCFGOptions(), std::function< bool(const Function &)> Ftor=nullptr)
void initializeHexagonNewValueJumpPass(PassRegistry &)
char & HexagonTfrCleanupID
FunctionPass * createHexagonCFGOptimizer()
FunctionPass * createHexagonXQFloatGenerator()
void initializeHexagonSplitConst32AndConst64Pass(PassRegistry &)
void initializeHexagonVectorLoopCarriedReuseLegacyPassPass(PassRegistry &)
LLVM_ABI char & RegisterCoalescerID
RegisterCoalescer - This pass merges live ranges to eliminate copies.
void initializeHexagonDAGToDAGISelLegacyPass(PassRegistry &)
void initializeHexagonSplitDoubleRegsPass(PassRegistry &)
LLVM_ABI FunctionPass * createDeadCodeEliminationPass()
Definition DCE.cpp:145
FunctionPass * createHexagonQFPOptimizer()
void initializeHexagonCommonGEPPass(PassRegistry &)
FunctionPass * createHexagonNewValueJump()
void initializeHexagonRDFOptPass(PassRegistry &)
void initializeHexagonPostRAHandleQFPPass(PassRegistry &)
FunctionPass * createHexagonBranchRelaxation()
FunctionPass * createHexagonLoopAlign()
FunctionPass * createHexagonBitSimplify()
@ O0
Disable as many optimizations as possible.
FunctionPass * createHexagonPeephole()
void initializeHexagonGlobalSchedulerPass(PassRegistry &)
FunctionPass * createHexagonConstExtenders()
FunctionPass * createHexagonConstPropagationPass()
void initializeHexagonGenMemAbsolutePass(PassRegistry &)
FunctionPass * createHexagonFixupHwLoops()
Target & getTheHexagonTarget()
void initializeHexagonMaskPass(PassRegistry &)
void initializeHexagonExpandCondsetsPass(PassRegistry &)
void initializeHexagonAsmPrinterPass(PassRegistry &)
void initializeHexagonVectorPrintPass(PassRegistry &)
FunctionPass * createHexagonMask()
void initializeHexagonPacketizerPass(PassRegistry &)
void initializeHexagonHVXSaveRemarkPass(PassRegistry &)
LLVM_ABI void initializeMachineKCFILegacyPass(PassRegistry &)
PassManager< Loop, LoopAnalysisManager, LoopStandardAnalysisResults &, LPMUpdater & > LoopPassManager
The Loop pass manager.
LLVM_ABI char & MachineCombinerID
This pass performs instruction combining using trace metrics to estimate critical-path and resource d...
FunctionPass * createHexagonPacketizer(bool Minimal)
static Reloc::Model getEffectiveRelocModel(std::optional< Reloc::Model > RM)
FunctionPass * createHexagonPostRAHandleQFP()
CodeModel::Model getEffectiveCodeModel(std::optional< CodeModel::Model > CM, CodeModel::Model Default)
Helper method for getting the code model, returning Default if CM does not have a value.
FunctionPass * createHexagonGenMux()
FunctionPass * createHexagonGenExtract()
LLVM_ABI char & UnreachableMachineBlockElimID
UnreachableMachineBlockElimination - This pass removes unreachable machine basic blocks.
LLVM_ABI FunctionPass * createKCFIPass()
Lowers KCFI operand bundles for indirect calls.
Definition KCFI.cpp:75
FunctionPass * createHexagonEarlyIfConversion()
char & HexagonLiveVariablesID
LLVM_ABI FunctionPass * createLoopDataPrefetchPass()
FunctionPass * createHexagonLoadWidening()
void initializeHexagonStoreWideningPass(PassRegistry &)
FunctionPass * createHexagonCallFrameInformation()
FunctionPass * createHexagonHardwareLoops()
void initializeHexagonGenPredicatePass(PassRegistry &)
void initializeHexagonTfrCleanupPass(PassRegistry &)
FunctionPass * createHexagonVExtract()
void initializeHexagonGenMuxPass(PassRegistry &)
void initializeHexagonFixupHwLoopsPass(PassRegistry &)
FunctionPass * createHexagonGenPredicate()
void initializeHexagonVectorCombineLegacyPass(PassRegistry &)
void initializeHexagonCFGOptimizerPass(PassRegistry &)
void initializeHexagonPeepholePass(PassRegistry &)
CodeGenOptLevel
Code generation optimization level.
Definition CodeGen.h:82
@ Default
-O2, -Os, -Oz
Definition CodeGen.h:85
FunctionPass * createHexagonGenInsert()
void initializeHexagonBranchRelaxationPass(PassRegistry &)
FunctionPass * createHexagonOptimizeSZextends()
FunctionPass * createHexagonLoopRescheduling()
void initializeHexagonCallFrameInformationPass(PassRegistry &)
void initializeHexagonLoopReschedulingPass(PassRegistry &)
void initializeHexagonGenExtractPass(PassRegistry &)
FunctionPass * createHexagonSplitConst32AndConst64()
void initializeHexagonLiveVariablesPass(PassRegistry &)
FunctionPass * createHexagonCopyToCombine()
LLVM_ABI char & MachinePipelinerID
This pass performs software pipelining on machine instructions.
FunctionPass * createHexagonCommonGEP()
FunctionPass * createHexagonISelDag(HexagonTargetMachine &TM, CodeGenOptLevel OptLevel)
createHexagonISelDag - This pass converts a legalized DAG into a Hexagon-specific DAG,...
char & HexagonExpandCondsetsID
void initializeHexagonXQFloatGeneratorPass(PassRegistry &)
void initializeHexagonLoadWideningPass(PassRegistry &)
FunctionPass * createHexagonOptAddrMode()
void initializeHexagonCopyToCombinePass(PassRegistry &)
void initializeHexagonEarlyIfConversionPass(PassRegistry &)
FunctionPass * createHexagonGenMemAbsolute()
FunctionPass * createHexagonHVXSaveRemark()
void initializeHexagonLoopIdiomRecognizeLegacyPassPass(PassRegistry &)
LLVM_ABI char & VirtRegRewriterID
VirtRegRewriter pass.
FunctionPass * createHexagonSplitDoubleRegs()
void initializeHexagonOptimizeSZextendsPass(PassRegistry &)
void initializeHexagonBitSimplifyPass(PassRegistry &)
LLVM_ABI char & IfConverterID
IfConverter - This pass performs machine code if conversion.
void initializeHexagonConstPropagationPass(PassRegistry &)
LLVM_ABI FunctionPass * createAtomicExpandLegacyPass()
AtomicExpandPass - At IR level this pass replace atomic instructions with __atomic_* library calls,...
void initializeHexagonGenInsertPass(PassRegistry &)
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
Definition Allocator.h:390
void initializeHexagonConstExtendersPass(PassRegistry &)
LLVM_ABI bool parseNamedRegisterReference(PerFunctionMIParsingState &PFS, Register &Reg, StringRef Src, SMDiagnostic &Error)
FunctionPass * createHexagonStoreWidening()
LLVM_ABI std::unique_ptr< ScheduleDAGMutation > createCopyConstrainDAGMutation(const TargetInstrInfo *TII, const TargetRegisterInfo *TRI)
void initializeHexagonLoopAlignPass(PassRegistry &)
void initializeHexagonHardwareLoopsPass(PassRegistry &)
char & HexagonCopyHoistingID
void initializeHexagonQFPOptimizerPass(PassRegistry &)
FunctionPass * createHexagonGlobalScheduler()
FunctionPass * createHexagonRDFOpt()
LLVM_ABI FunctionPass * createInstSimplifyLegacyPass()
void initializeHexagonVExtractPass(PassRegistry &)
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:878
Hexagon Vector Loop Carried Reuse Pass.
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
static FuncInfoTy * create(BumpPtrAllocator &Allocator, const Function &F, const SubtargetTy *STI)
Factory function: default behavior is to call new using the supplied allocator.
MachineSchedContext provides enough context from the MachineScheduler pass for the target to instanti...
RegisterTargetMachine - Helper template for registering a target machine implementation,...
Hexagon-specific MachineFunction properties for YAML serialization.
Targets should override this in a way that mirrors the implementation of llvm::MachineFunctionInfo.