LLVM 19.0.0git
Legalizer.h
Go to the documentation of this file.
1//== llvm/CodeGen/GlobalISel/Legalizer.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 A pass to convert the target-illegal operations created by IR -> MIR
10/// translation into ones the target expects to be able to select. This may
11/// occur in multiple phases, for example G_ADD <2 x i8> -> G_ADD <2 x i16> ->
12/// G_ADD <4 x i16>.
13///
14/// The LegalizeHelper class is where most of the work happens, and is designed
15/// to be callable from other passes that find themselves with an illegal
16/// instruction.
17//
18//===----------------------------------------------------------------------===//
19
20#ifndef LLVM_CODEGEN_GLOBALISEL_LEGALIZER_H
21#define LLVM_CODEGEN_GLOBALISEL_LEGALIZER_H
22
23#include "llvm/ADT/ArrayRef.h"
24#include "llvm/ADT/StringRef.h"
28
29namespace llvm {
30
31class LegalizerInfo;
32class MachineIRBuilder;
33class MachineInstr;
34class GISelChangeObserver;
35class LostDebugLocObserver;
36
38public:
39 static char ID;
40
41 struct MFResult {
42 bool Changed;
44 };
45
46private:
47 /// Initialize the field members using \p MF.
48 void init(MachineFunction &MF);
49
50public:
51 // Ctor, nothing fancy.
52 Legalizer();
53
54 StringRef getPassName() const override { return "Legalizer"; }
55
56 void getAnalysisUsage(AnalysisUsage &AU) const override;
57
61 }
62
66 }
67
72 }
73
74 bool runOnMachineFunction(MachineFunction &MF) override;
75
76 static MFResult
79 LostDebugLocObserver &LocObserver,
80 MachineIRBuilder &MIRBuilder, GISelKnownBits *KB);
81};
82} // End namespace llvm.
83
84#endif
Provides analysis for querying information about KnownBits during GISel passes.
Represent the analysis usage information of a pass.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
bool runOnMachineFunction(MachineFunction &MF) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
Definition: Legalizer.cpp:310
MachineFunctionProperties getClearedProperties() const override
Definition: Legalizer.h:68
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
Definition: Legalizer.cpp:86
static char ID
Definition: Legalizer.h:39
static MFResult legalizeMachineFunction(MachineFunction &MF, const LegalizerInfo &LI, ArrayRef< GISelChangeObserver * > AuxObservers, LostDebugLocObserver &LocObserver, MachineIRBuilder &MIRBuilder, GISelKnownBits *KB)
Definition: Legalizer.cpp:177
MachineFunctionProperties getSetProperties() const override
Definition: Legalizer.h:63
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Definition: Legalizer.h:54
MachineFunctionProperties getRequiredProperties() const override
Definition: Legalizer.h:58
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)
Helper class to build MachineInstr.
Representation of each machine instruction.
Definition: MachineInstr.h:69
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
const MachineInstr * FailedOn
Definition: Legalizer.h:43