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"
35#include <optional>
36
37using namespace llvm;
38
39static cl::opt<bool>
40 EnableCExtOpt("hexagon-cext", cl::Hidden, cl::init(true),
41 cl::desc("Enable Hexagon constant-extender optimization"));
42
44 cl::desc("Enable RDF-based optimizations"));
45
47 "hexagon-handle-qfloat", cl::init(true), cl::Hidden,
48 cl::desc("Fix up QFloat spills and reloads after register allocation"));
49
51 "rdf-bb-limit", cl::Hidden, cl::init(1000),
52 cl::desc("Basic block limit for a function for RDF optimizations"));
53
54static cl::opt<bool>
55 DisableHardwareLoops("disable-hexagon-hwloops", cl::Hidden,
56 cl::desc("Disable Hardware Loops for Hexagon target"));
57
58static cl::opt<bool> EnableMCR("hexagon-mcr", cl::Hidden, cl::init(true),
59 cl::desc("Enable the machine combiner pass"));
60
61static cl::opt<bool>
62 DisableAModeOpt("disable-hexagon-amodeopt", cl::Hidden,
63 cl::desc("Disable Hexagon Addressing Mode Optimization"));
64
65static cl::opt<bool>
66 DisableHexagonCFGOpt("disable-hexagon-cfgopt", cl::Hidden,
67 cl::desc("Disable Hexagon CFG Optimization"));
68
69static cl::opt<bool>
70 DisableHCP("disable-hcp", cl::Hidden,
71 cl::desc("Disable Hexagon constant propagation"));
72
74 "disable-mask", cl::Hidden,
75 cl::desc("Disable Hexagon specific Mask generation pass"));
76
78 "disable-hlv", cl::Hidden,
79 cl::desc("Disable Hexagon specific post-RA live-variable analysis"));
80static cl::opt<bool> DisableStoreWidening("disable-store-widen", cl::Hidden,
81 cl::init(false),
82 cl::desc("Disable store widening"));
83
84static cl::opt<bool> DisableLoadWidening("disable-load-widen", cl::Hidden,
85 cl::desc("Disable load widening"));
86
87static cl::opt<bool> EnableExpandCondsets("hexagon-expand-condsets",
88 cl::init(true), cl::Hidden,
89 cl::desc("Early expansion of MUX"));
90
91static cl::opt<bool> EnableTfrCleanup("hexagon-tfr-cleanup", cl::init(true),
93 cl::desc("Cleanup of TFRs/COPYs"));
94
95static cl::opt<bool> EnableEarlyIf("hexagon-eif", cl::init(true), cl::Hidden,
96 cl::desc("Enable early if-conversion"));
97
98static cl::opt<bool> EnableCopyHoist("hexagon-copy-hoist", cl::init(true),
100 cl::desc("Enable Hexagon copy hoisting"));
101
102static cl::opt<bool>
103 EnableGenInsert("hexagon-insert", cl::init(true), cl::Hidden,
104 cl::desc("Generate \"insert\" instructions"));
105
106static cl::opt<bool>
107 EnableCommGEP("hexagon-commgep", cl::init(true), cl::Hidden,
108 cl::desc("Enable commoning of GEP instructions"));
109
110static cl::opt<bool>
111 EnableGenExtract("hexagon-extract", cl::init(true), cl::Hidden,
112 cl::desc("Generate \"extract\" instructions"));
113
115 "hexagon-mux", cl::init(true), cl::Hidden,
116 cl::desc("Enable converting conditional transfers into MUX instructions"));
117
118static cl::opt<bool>
119 EnableGenPred("hexagon-gen-pred", cl::init(true), cl::Hidden,
120 cl::desc("Enable conversion of arithmetic operations to "
121 "predicate instructions"));
122
123static cl::opt<bool>
124 EnableLoopPrefetch("hexagon-loop-prefetch", cl::Hidden,
125 cl::desc("Enable loop data prefetch on Hexagon"));
126
127static cl::opt<bool>
128 DisableHSDR("disable-hsdr", cl::init(false), cl::Hidden,
129 cl::desc("Disable splitting double registers"));
130
131static cl::opt<bool>
132 EnableGenMemAbs("hexagon-mem-abs", cl::init(true), cl::Hidden,
133 cl::desc("Generate absolute set instructions"));
134
135static cl::opt<bool> EnableBitSimplify("hexagon-bit", cl::init(true),
137 cl::desc("Bit simplification"));
138
139static cl::opt<bool> EnableLoopResched("hexagon-loop-resched", cl::init(true),
141 cl::desc("Loop rescheduling"));
142
143static cl::opt<bool> HexagonNoOpt("hexagon-noopt", cl::init(false), cl::Hidden,
144 cl::desc("Disable backend optimizations"));
145
146static cl::opt<bool>
147 EnableVectorPrint("enable-hexagon-vector-print", cl::Hidden,
148 cl::desc("Enable Hexagon Vector print instr pass"));
149
150static cl::opt<bool>
151 EnableVExtractOpt("hexagon-opt-vextract", cl::Hidden, cl::init(true),
152 cl::desc("Enable vextract optimization"));
153
154static cl::opt<bool>
155 EnableVectorCombine("hexagon-vector-combine", cl::Hidden, cl::init(true),
156 cl::desc("Enable HVX vector combining"));
157
159 "hexagon-initial-cfg-cleanup", cl::Hidden, cl::init(true),
160 cl::desc("Simplify the CFG after atomic expansion pass"));
161
162static cl::opt<bool> EnableInstSimplify("hexagon-instsimplify", cl::Hidden,
163 cl::init(true),
164 cl::desc("Enable instsimplify"));
165
167 "hexagon-qfloat-mode", cl::desc("Specify the qfloat mode to operate on."),
170 clEnumValN(QFloatMode::StrictIEEE, "strict-ieee",
171 "Enable code generation for qfloat strict IEEE-754 mode"),
173 "Enable code generation for qfloat IEEE-754 mode"),
175 "Enable code generation for qfloat lossy-subnormals mode"),
177 "Enable code generation for qfloat legacy mode")));
178
179/// HexagonTargetMachineModule - Note that this is used on hosts that
180/// cannot link in a library unless there are references into the
181/// library. In particular, it seems that it is not possible to get
182/// things to work on Win32 without this. Though it is unused, do not
183/// remove it.
186
189 C, std::make_unique<HexagonConvergingVLIWScheduler>());
190 DAG->addMutation(std::make_unique<HexagonSubtarget::UsrOverflowMutation>());
191 DAG->addMutation(std::make_unique<HexagonSubtarget::HVXMemLatencyMutation>());
192 DAG->addMutation(
193 std::make_unique<HexagonSubtarget::HMXActivateWeightMutation>());
194 DAG->addMutation(std::make_unique<HexagonSubtarget::CallMutation>());
196 DAG->addMutation(std::make_unique<HexagonSubtarget::HLXPseudoMutation>());
197 return DAG;
198}
199
201 SchedCustomRegistry("hexagon", "Run Hexagon's custom scheduler",
203
204static Reloc::Model getEffectiveRelocModel(std::optional<Reloc::Model> RM) {
205 return RM.value_or(Reloc::Static);
206}
207
210 // Register the target.
213
267}
268
270 StringRef CPU, StringRef FS,
271 const TargetOptions &Options,
272 std::optional<Reloc::Model> RM,
273 std::optional<CodeModel::Model> CM,
274 CodeGenOptLevel OL, bool JIT)
275 : CodeGenTargetMachineImpl(T, TT, CPU, FS, Options,
279 CLOpts(cl::LibraryOptionsContext::get<HexagonOptions>(
280 Options.MCOptions.LibraryOptions)),
281 TLOF(std::make_unique<HexagonTargetObjectFile>()),
282 Subtarget(Triple(TT), CPU, FS, *this) {
283 initAsmInfo();
284}
285
286const HexagonSubtarget *
288 AttributeSet FnAttrs = F.getAttributes().getFnAttrs();
289 const Module *M = F.getParent();
290 if (const HexagonSubtarget *ST = LastSubtarget.lookup(FnAttrs, M))
291 return ST;
292
293 SubtargetAttrs Attrs;
294 Attrs.CPU = FnAttrs.getAttribute("target-cpu");
295 Attrs.FS = FnAttrs.getAttribute("target-features");
296
297 if (const HexagonSubtarget *ST = LastSubtarget.lookup(FnAttrs, M, Attrs))
298 return ST;
299
300 std::string CPU =
301 Attrs.CPU.isValid() ? Attrs.CPU.getValueAsString().str() : TargetCPU;
302 std::string FS =
303 Attrs.FS.isValid() ? Attrs.FS.getValueAsString().str() : TargetFS;
304
305 auto &I = SubtargetMap[CPU + FS];
306 if (!I)
307 I = std::make_unique<HexagonSubtarget>(TargetTriple, CPU, FS, *this);
308 LastSubtarget.set(FnAttrs, M, Attrs, I.get());
309 return I.get();
310}
311
313#define GET_PASS_REGISTRY "HexagonPassRegistry.def"
315
316 PB.registerLateLoopOptimizationsEPCallback(
317 [=](LoopPassManager &LPM, OptimizationLevel Level) {
318 if (Level != OptimizationLevel::O0)
319 LPM.addPass(HexagonLoopIdiomRecognitionPass());
320 });
321 PB.registerLoopOptimizerEndEPCallback(
322 [=](LoopPassManager &LPM, OptimizationLevel Level) {
323 if (Level != OptimizationLevel::O0)
325 });
326}
327
330 return TargetTransformInfo(std::make_unique<HexagonTTIImpl>(this, F));
331}
332
339
344
347 const auto *MFI = MF.getInfo<HexagonMachineFunctionInfo>();
348 const auto &TRI = *MF.getSubtarget().getRegisterInfo();
349 return new yaml::HexagonFunctionInfo(*MFI, TRI);
350}
351
354 SMDiagnostic &Error, SMRange &SourceRange) const {
355 const auto &YamlMFI = static_cast<const yaml::HexagonFunctionInfo &>(MFI_);
356 MachineFunction &MF = PFS.MF;
358
359 MFI->initializeBaseYamlFields(YamlMFI);
360
361 // Parse StackAlignBaseReg register name
362 if (!YamlMFI.StackAlignBaseReg.Value.empty()) {
363 Register Reg;
364 if (parseNamedRegisterReference(PFS, Reg, YamlMFI.StackAlignBaseReg.Value,
365 Error)) {
366 SourceRange = YamlMFI.StackAlignBaseReg.SourceRange;
367 return true;
368 }
369 MFI->setStackAlignBaseReg(Reg);
370 }
371
372 return false;
373}
374
376
381
382namespace {
383/// Hexagon Code Generator Pass Configuration Options.
384class HexagonPassConfig : public TargetPassConfig {
385public:
386 HexagonPassConfig(HexagonTargetMachine &TM, PassManagerBase &PM)
387 : TargetPassConfig(TM, PM) {}
388
389 HexagonTargetMachine &getHexagonTargetMachine() const {
391 }
392
393 void addIRPasses() override;
394 bool addPreISel() override;
395 bool addInstSelector() override;
396 bool addILPOpts() override;
397 void addMachineSSAOptimization() override;
398 void addPreRegAlloc() override;
399 bool isMachinePipelinerEnabled() const override {
400 return getOptLevel() >= CodeGenOptLevel::Default;
401 }
402 void addPostRegAlloc() override;
403 void addPreSched2() override;
404 void addPreEmitPass() override;
405};
406} // namespace
407
409 return new HexagonPassConfig(*this, PM);
410}
411
412void HexagonPassConfig::addIRPasses() {
414 bool NoOpt = (getOptLevel() == CodeGenOptLevel::None);
415
416 if (!NoOpt) {
417 // Raise the alignment of global integer arrays to 8 bytes. At -O1/-O2,
418 // reduce .rodata size by keeping byte/half-word arrays at their natural
419 // alignment; apply full 8-byte alignment at -O3.
420 addPass(createHexagonAlignGlobalArrays(getOptLevel() !=
425 }
426
428
429 if (!NoOpt) {
432 .forwardSwitchCondToPhi(true)
433 .convertSwitchRangeToICmp(true)
434 .convertSwitchToLookupTable(true)
435 .needCanonicalLoops(false)
436 .hoistCommonInsts(true)
437 .sinkCommonInsts(true)));
442 if (EnableCommGEP)
443 addPass(createHexagonCommonGEP());
444 // Replace certain combinations of shifts and ands with extracts.
446 addPass(createHexagonGenExtract());
447 }
448}
449
450bool HexagonPassConfig::addPreISel() {
451 // Functions can enable HLX through target-features, so the pass filters
452 // individual functions instead of being gated by the default subtarget.
454 return false;
455}
456
457bool HexagonPassConfig::addInstSelector() {
458 HexagonTargetMachine &TM = getHexagonTargetMachine();
459 const HexagonSubtarget *HST = TM.getHexagonSubtarget();
460 bool NoOpt = (getOptLevel() == CodeGenOptLevel::None);
461
462 if (!NoOpt)
464
465 addPass(createHexagonISelDag(TM, getOptLevel()));
466 // Run the QFloat mode code generation pass only if v79 or greater.
467 // Do not run this pass, if legacy mode is passed on command line.
470
471 if (!NoOpt) {
473 addPass(createHexagonVExtract());
474 // Create logical operations on predicate registers.
475 if (EnableGenPred)
476 addPass(createHexagonGenPredicate());
477 // Rotate loops to expose bit-simplification opportunities.
480 // Split double registers.
481 if (!DisableHSDR)
483 // Bit simplification.
485 addPass(createHexagonBitSimplify());
486 addPass(createHexagonPeephole());
487 // Constant propagation.
488 if (!DisableHCP) {
491 }
492 if (EnableGenInsert)
493 addPass(createHexagonGenInsert());
494 if (EnableEarlyIf)
496 // For v75 or below, or if legacy mode is requested, run QFPOptizer pass
497 // to preserve backward compatibility.
499 addPass(createHexagonQFPOptimizer());
500 }
501
502 return false;
503}
504
505bool HexagonPassConfig::addILPOpts() {
506 if (EnableMCR)
507 addPass(&MachineCombinerID);
508
509 return true;
510}
511
512void HexagonPassConfig::addMachineSSAOptimization() {
514
515 if (EnableCExtOpt)
520 addPass(createHexagonLoadWidening());
521 if (EnableGenMemAbs)
525}
526
527void HexagonPassConfig::addPreRegAlloc() {
528 // HMX activation/weight pairs must be adjacent before register allocation.
529 // With optimized register allocation, run after the machine scheduler,
530 // which may separate the pairs.
531 if (getOptimizeRegAlloc())
533 else
535
536 if (getOptLevel() != CodeGenOptLevel::None) {
539 if (EnableCopyHoist)
543 }
545}
546
547void HexagonPassConfig::addPostRegAlloc() {
548 HexagonTargetMachine &HTM = getHexagonTargetMachine();
549 const HexagonSubtarget *HST = HTM.getHexagonSubtarget();
550 // Run PostRAQFP on v79 and above.
553
554 if (getOptLevel() != CodeGenOptLevel::None) {
555 if (EnableRDFOpt)
556 addPass(createHexagonRDFOpt());
558 addPass(createHexagonCFGOptimizer());
559 if (!DisableAModeOpt)
560 addPass(createHexagonOptAddrMode());
561 }
562}
563
564void HexagonPassConfig::addPreSched2() {
565 bool NoOpt = (getOptLevel() == CodeGenOptLevel::None);
567 if (getOptLevel() != CodeGenOptLevel::None)
568 addPass(&IfConverterID);
570 if (!NoOpt && !DisableHexagonMask)
571 addPass(createHexagonMask());
572
573 if (!NoOpt && !DisableHexagonLiveVars) {
574 addPass(&HexagonLiveVariablesID);
575 }
576}
577
578void HexagonPassConfig::addPreEmitPass() {
579 bool NoOpt = (getOptLevel() == CodeGenOptLevel::None);
580
581 if (!NoOpt)
582 addPass(createHexagonNewValueJump());
583
585
586 if (!NoOpt) {
588 addPass(createHexagonFixupHwLoops());
589 // Generate MUX from pairs of conditional transfers.
590 if (EnableGenMux)
591 addPass(createHexagonGenMux());
593 addPass(&HexagonLiveVariablesID);
594 }
595
597
598 // Emit KCFI checks for indirect calls. Must run before packetization so
599 // the check and call can be bundled together into a VLIW packet.
600 addPass(createKCFIPass());
601
602 // Packetization is mandatory: it handles gather/scatter at all opt levels.
603 addPass(createHexagonPacketizer(NoOpt));
604
605 // Expand HLX load/store pseudos into their final bundled form. This must run
606 // after packetization so the resulting bundles are not seen by the scheduler.
607 addPass(createHLXExpandPseudos());
608
609 if (!NoOpt) {
610 // Global pull-up scheduler
613
614 addPass(createHexagonLoopAlign());
615 }
616
618 addPass(createHexagonVectorPrint());
619
620 // Add CFI instructions if necessary.
622}
static Reloc::Model getEffectiveRelocModel()
#define X(NUM, ENUM, NAME)
Definition ELF.h:665
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
#define clEnumValN(ENUMVAL, FLAGNAME, DESC)
#define LLVM_ABI
Definition Compiler.h:211
#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(Mod->getContext(), Machine, PassOpts->PTO, std::nullopt, &PIC)
const GCNTargetMachine & getTM(const GCNSubtarget *STI)
Target-Independent Code Generator Pass Configuration Options pass.
This class holds the attributes for a particular argument, parameter, function, or return value.
Definition Attributes.h:445
LLVM_ABI Attribute getAttribute(Attribute::AttrKind Kind) const
Return the attribute object.
CodeGenTargetMachineImpl(const Target &T, 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.
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:68
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:307
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.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
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...
virtual void addMachineSSAOptimization()
addMachineSSAOptimization - Add standard passes that optimize machine instructions in SSA form.
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 ...
Registers T with cl::parseCommandLineOptions.
Interfaces for registering analysis passes, producing common pass manager configurations,...
This namespace contains all of the command line option processing machinery.
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)
FunctionPass * createHLXExpandPseudos()
void initializeHexagonNewValueJumpPass(PassRegistry &)
char & HexagonTfrCleanupID
FunctionPass * createHexagonCFGOptimizer()
FunctionPass * createHexagonXQFloatGenerator()
FunctionPass * createHexagonLowerHLXPairAllocas()
void initializeHexagonSplitConst32AndConst64Pass(PassRegistry &)
void initializeHexagonGlobalSchedulerV2Pass(PassRegistry &)
void initializeHexagonVectorLoopCarriedReuseLegacyPassPass(PassRegistry &)
LLVM_ABI char & RegisterCoalescerID
RegisterCoalescer - This pass merges live ranges to eliminate copies.
void initializeHexagonDAGToDAGISelLegacyPass(PassRegistry &)
void initializeHexagonSplitDoubleRegsPass(PassRegistry &)
void initializeHexagonAlignGlobalArraysPass(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()
FunctionPass * createHexagonMergeActivateWeight2()
@ O0
Disable as many optimizations as possible.
FunctionPass * createHexagonPeephole()
void initializeHexagonGlobalSchedulerPass(PassRegistry &)
FunctionPass * createHexagonConstExtenders()
FunctionPass * createHexagonConstPropagationPass()
LLVM_ABI char & MachineSchedulerID
MachineScheduler - This pass schedules machine instructions.
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)
char & HexagonMergeActivateWeightID
FunctionPass * createHexagonPostRAHandleQFP()
void initializeHexagonLowerHLXPairAllocasPass(PassRegistry &)
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.
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
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 initializeHLXExpandPseudosPass(PassRegistry &)
void initializeHexagonCFGOptimizerPass(PassRegistry &)
void initializeHexagonPeepholePass(PassRegistry &)
CodeGenOptLevel
Code generation optimization level.
Definition CodeGen.h:280
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()
FunctionPass * createHexagonGlobalSchedulerV2()
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 &)
LLVM_ABI std::unique_ptr< ScheduleDAGMutation > createCopyConstrainDAGMutation(const TargetInstrInfo *TII)
void initializeHexagonLoadWideningPass(PassRegistry &)
FunctionPass * createHexagonOptAddrMode()
void initializeHexagonMergeActivateWeight2Pass(PassRegistry &)
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:391
void initializeHexagonConstExtendersPass(PassRegistry &)
LLVM_ABI char & PHIEliminationID
PHIElimination - This pass eliminates machine instruction PHI nodes by inserting copy instructions.
LLVM_ABI bool parseNamedRegisterReference(PerFunctionMIParsingState &PFS, Register &Reg, StringRef Src, SMDiagnostic &Error)
FunctionPass * createHexagonStoreWidening()
void initializeHexagonLoopAlignPass(PassRegistry &)
void initializeHexagonMergeActivateWeightPass(PassRegistry &)
void initializeHexagonHardwareLoopsPass(PassRegistry &)
char & HexagonCopyHoistingID
void initializeHexagonQFPOptimizerPass(PassRegistry &)
FunctionPass * createHexagonGlobalScheduler()
FunctionPass * createHexagonRDFOpt()
LLVM_ABI FunctionPass * createInstSimplifyLegacyPass()
void initializeHexagonVExtractPass(PassRegistry &)
ModulePass * createHexagonAlignGlobalArrays(bool ReduceRodataSize)
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:879
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.