LLVM 20.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
21namespace llvm {
22
23class InstructionSelector;
24class GISelKnownBits;
25class BlockFrequencyInfo;
26class ProfileSummaryInfo;
27
28/// This pass is responsible for selecting generic machine instructions to
29/// target-specific instructions. It relies on the InstructionSelector provided
30/// by the target.
31/// Selection is done by examining blocks in post-order, and instructions in
32/// reverse order.
33///
34/// \post for all inst in MF: not isPreISelGenericOpcode(inst.opcode)
36public:
37 static char ID;
38 StringRef getPassName() const override { return "InstructionSelect"; }
39
40 void getAnalysisUsage(AnalysisUsage &AU) const override;
41
47 }
48
52 }
53
55 char &PassID = ID);
56
57 bool runOnMachineFunction(MachineFunction &MF) override;
59 void setInstructionSelector(InstructionSelector *NewISel) { ISel = NewISel; }
60
61protected:
62 class MIIteratorMaintainer;
63
65 GISelKnownBits *KB = nullptr;
68
70
72};
73} // End namespace llvm.
74
75#endif
IRTranslator LLVM IR MI
Represent the analysis usage information of a pass.
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
This pass is responsible for selecting generic machine instructions to target-specific instructions.
InstructionSelector * ISel
bool selectMachineFunction(MachineFunction &MF)
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
MachineFunctionProperties getRequiredProperties() const override
void setInstructionSelector(InstructionSelector *NewISel)
bool runOnMachineFunction(MachineFunction &MF) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
ProfileSummaryInfo * PSI
MachineFunctionProperties getSetProperties() const override
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
bool selectInstr(MachineInstr &MI)
BlockFrequencyInfo * BFI
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
Properties which a MachineFunction may have at a given point in time.
MachineFunctionProperties & set(Property P)
Representation of each machine instruction.
Definition: MachineInstr.h:69
Analysis providing profile information.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
CodeGenOptLevel
Code generation optimization level.
Definition: CodeGen.h:54