LLVM 22.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"
29
30namespace llvm {
31
32class LegalizerInfo;
33class MachineIRBuilder;
34class MachineInstr;
35class GISelChangeObserver;
36class LostDebugLocObserver;
37
39public:
40 static char ID;
41
42 struct MFResult {
43 bool Changed;
45 };
46
47private:
48 /// Initialize the field members using \p MF.
49 void init(MachineFunction &MF);
50
51public:
52 // Ctor, nothing fancy.
53 Legalizer();
54
55 StringRef getPassName() const override { return "Legalizer"; }
56
57 void getAnalysisUsage(AnalysisUsage &AU) const override;
58
60 return MachineFunctionProperties().setIsSSA();
61 }
62
64 return MachineFunctionProperties().setLegalized();
65 }
66
68 return MachineFunctionProperties().setNoPHIs().setNoVRegs();
69 }
70
71 bool runOnMachineFunction(MachineFunction &MF) override;
72
73 static MFResult
74 legalizeMachineFunction(MachineFunction &MF, const LegalizerInfo &LI,
76 LostDebugLocObserver &LocObserver,
77 MachineIRBuilder &MIRBuilder, GISelValueTracking *VT);
78};
79} // End namespace llvm.
80
81#endif
#define LLVM_ABI
Definition: Compiler.h:213
DXIL Legalizer
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
MachineFunctionProperties getClearedProperties() const override
Definition: Legalizer.h:67
static char ID
Definition: Legalizer.h:40
MachineFunctionProperties getSetProperties() const override
Definition: Legalizer.h:63
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Definition: Legalizer.h:55
MachineFunctionProperties getRequiredProperties() const override
Definition: Legalizer.h:59
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.
Helper class to build MachineInstr.
Representation of each machine instruction.
Definition: MachineInstr.h:72
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:55
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
const MachineInstr * FailedOn
Definition: Legalizer.h:44