LLVM 23.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;
34class MachineInstr;
38
40public:
41 static char ID;
42
43 struct MFResult {
44 bool Changed;
46 };
47
48private:
49 /// Initialize the field members using \p MF.
50 void init(MachineFunction &MF);
51
52public:
53 // Ctor, nothing fancy.
54 Legalizer();
55
56 StringRef getPassName() const override { return "Legalizer"; }
57
58 void getAnalysisUsage(AnalysisUsage &AU) const override;
59
61 return MachineFunctionProperties().setIsSSA();
62 }
63
65 return MachineFunctionProperties().setLegalized();
66 }
67
69 return MachineFunctionProperties().setNoPHIs().setNoVRegs();
70 }
71
72 bool runOnMachineFunction(MachineFunction &MF) override;
73
74 static MFResult legalizeMachineFunction(
75 MachineFunction &MF, const LegalizerInfo &LI,
77 LostDebugLocObserver &LocObserver, MachineIRBuilder &MIRBuilder,
78 const LibcallLoweringInfo *Libcalls, GISelValueTracking *VT);
79};
80} // End namespace llvm.
81
82#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:40
Abstract class that contains various methods for clients to notify about changes.
MachineFunctionProperties getClearedProperties() const override
Definition Legalizer.h:68
static char ID
Definition Legalizer.h:41
MachineFunctionProperties getSetProperties() const override
Definition Legalizer.h:64
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Definition Legalizer.h:56
MachineFunctionProperties getRequiredProperties() const override
Definition Legalizer.h:60
Tracks which library functions to use for a particular subtarget.
Properties which a MachineFunction may have at a given point in time.
Helper class to build MachineInstr.
Representation of each machine instruction.
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 Types.h:26
const MachineInstr * FailedOn
Definition Legalizer.h:45