LLVM 24.0.0git
InstructionSelector.h
Go to the documentation of this file.
1//===- llvm/CodeGen/GlobalISel/InstructionSelector.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//
9/// \file This file declares the API for the instruction selector.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CODEGEN_GLOBALISEL_INSTRUCTIONSELECTOR_H
14#define LLVM_CODEGEN_GLOBALISEL_INSTRUCTIONSELECTOR_H
15
20
21namespace llvm {
23
25public:
27
28 /// Select the (possibly generic) instruction \p I to only use target-specific
29 /// opcodes. It is OK to insert multiple instructions, but they cannot be
30 /// generic pre-isel instructions.
31 ///
32 /// \returns whether selection succeeded.
33 /// \pre I.getParent() && I.getParent()->getParent()
34 /// \post
35 /// if returns true:
36 /// for I in all mutated/inserted instructions:
37 /// !isPreISelGenericOpcode(I.getOpcode())
38 virtual bool select(MachineInstr &I) = 0;
39
41
42 /// Note: InstructionSelect does not track changed instructions.
43 /// changingInstr() and changedInstr() will never be called on these
44 /// observers.
46
47protected:
49 int OpIdx) const;
50};
51} // namespace llvm
52
53#endif
#define LLVM_ABI
Definition Compiler.h:215
IRTranslator LLVM IR MI
#define I(x, y, z)
Definition MD5.cpp:57
MachineInstr unsigned OpIdx
Simple wrapper observer that takes several observers, and calls each one for each event.
GISelObserverWrapper * AllObservers
Note: InstructionSelect does not track changed instructions.
virtual bool select(MachineInstr &I)=0
Select the (possibly generic) instruction I to only use target-specific opcodes.
MachineOptimizationRemarkEmitter * MORE
void renderFrameIndex(MachineInstrBuilder &MIB, const MachineInstr &MI, int OpIdx) const
Representation of each machine instruction.
This is an optimization pass for GlobalISel generic memory operations.