LLVM 24.0.0git
InstructionSelect.h
Go to the documentation of this file.
1//== llvm/CodeGen/GlobalISel/InstructionSelect.h -----------------*- C++ -*-==//
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/// \file This file describes the interface of the MachineFunctionPass
9/// responsible for selecting (possibly generic) machine instructions to
10/// target-specific instructions.
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CODEGEN_GLOBALISEL_INSTRUCTIONSELECT_H
14#define LLVM_CODEGEN_GLOBALISEL_INSTRUCTIONSELECT_H
15
16#include "llvm/ADT/StringRef.h"
20#include "llvm/IR/Analysis.h"
21#include "llvm/IR/PassManager.h"
24
25namespace llvm {
26
31
32/// This pass is responsible for selecting generic machine instructions to
33/// target-specific instructions. It relies on the InstructionSelector provided
34/// by the target.
35/// Selection is done by examining blocks in post-order, and instructions in
36/// reverse order.
37///
38/// \post for all inst in MF: not isPreISelGenericOpcode(inst.opcode)
40public:
41 static char ID;
42 StringRef getPassName() const override { return "InstructionSelect"; }
43
44 void getAnalysisUsage(AnalysisUsage &AU) const override;
45
47 MachineFunctionProperties RequiredProperties;
48 RequiredProperties.setIsSSA().setLegalized();
50 RequiredProperties.setRegBankSelected();
51 return RequiredProperties;
52 }
53
55 return MachineFunctionProperties().setSelected();
56 }
57
59 bool RequireRegBankSelection = true,
60 char &PassID = ID);
61
62 bool runOnMachineFunction(MachineFunction &MF) override;
63
64protected:
67};
68
91
93 : public RequiredPassInfoMixin<InstructionSelectPass> {
94 CodeGenOptLevel OptLevel;
95 bool RequireRegBankSelection = true;
96
97public:
99 bool RequireRegBankSelection = true);
102
104 MachineFunctionProperties RequiredProperties;
105 RequiredProperties.setIsSSA().setLegalized();
106 if (RequireRegBankSelection)
107 RequiredProperties.setRegBankSelected();
108 return RequiredProperties;
109 }
110
112 return MachineFunctionProperties().setSelected();
113 }
114};
115
116} // End namespace llvm.
117
118#endif
#define LLVM_ABI
Definition Compiler.h:215
IRTranslator LLVM IR MI
This header defines various interfaces for pass management in LLVM.
Represent the analysis usage information of a pass.
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
void setInstructionSelector(InstructionSelector *NewISel)
bool selectMachineFunction(MachineFunction &MF)
InstructionSelectImpl(CodeGenOptLevel OL)
InstructionSelector * ISel
bool runOnMachineFunction(MachineFunction &MF, function_ref< GISelValueTracking *()> GetVT, function_ref< ProfileSummaryInfo *()> GetPSI, function_ref< BlockFrequencyInfo *()> GetBFI)
bool selectInstr(MachineInstr &MI)
This pass is responsible for selecting generic machine instructions to target-specific instructions.
MachineFunctionProperties getSetProperties() const override
InstructionSelectLegacy(CodeGenOptLevel OL=CodeGenOptLevel::Default, bool RequireRegBankSelection=true, char &PassID=ID)
MachineFunctionProperties getRequiredProperties() const override
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
MachineFunctionProperties getSetProperties() const
MachineFunctionProperties getRequiredProperties() const
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
InstructionSelectPass(CodeGenOptLevel OL=CodeGenOptLevel::Default, bool RequireRegBankSelection=true)
Properties which a MachineFunction may have at a given point in time.
Representation of each machine instruction.
A set of analyses that are preserved following a run of a transformation pass.
Definition Analysis.h:112
Analysis providing profile information.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
An efficient, type-erasing, non-owning reference to a callable.
Pass manager infrastructure for declaring and invalidating analyses.
This is an optimization pass for GlobalISel generic memory operations.
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
CodeGenOptLevel
Code generation optimization level.
Definition CodeGen.h:149
@ Default
-O2, -Os, -Oz
Definition CodeGen.h:152
A CRTP mix-in for passes that should not be skipped.