]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/CodeGen/GlobalISel/Legalizer.h
MFV r331695, 331700: 9166 zfs storage pool checkpoint
[FreeBSD/FreeBSD.git] / contrib / llvm / include / llvm / CodeGen / GlobalISel / Legalizer.h
1 //== llvm/CodeGen/GlobalISel/LegalizePass.h ------------- -*- C++ -*-==//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 /// \file A pass to convert the target-illegal operations created by IR -> MIR
11 /// translation into ones the target expects to be able to select. This may
12 /// occur in multiple phases, for example G_ADD <2 x i8> -> G_ADD <2 x i16> ->
13 /// G_ADD <4 x i16>.
14 ///
15 /// The LegalizeHelper class is where most of the work happens, and is designed
16 /// to be callable from other passes that find themselves with an illegal
17 /// instruction.
18 //
19 //===----------------------------------------------------------------------===//
20
21 #ifndef LLVM_CODEGEN_GLOBALISEL_LEGALIZEMACHINEIRPASS_H
22 #define LLVM_CODEGEN_GLOBALISEL_LEGALIZEMACHINEIRPASS_H
23
24 #include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
25 #include "llvm/CodeGen/MachineFunctionPass.h"
26
27 namespace llvm {
28
29 class MachineRegisterInfo;
30
31 class Legalizer : public MachineFunctionPass {
32 public:
33   static char ID;
34
35 private:
36
37   /// Initialize the field members using \p MF.
38   void init(MachineFunction &MF);
39
40 public:
41   // Ctor, nothing fancy.
42   Legalizer();
43
44   StringRef getPassName() const override { return "Legalizer"; }
45
46   void getAnalysisUsage(AnalysisUsage &AU) const override;
47
48   MachineFunctionProperties getRequiredProperties() const override {
49     return MachineFunctionProperties().set(
50         MachineFunctionProperties::Property::IsSSA);
51   }
52
53   MachineFunctionProperties getSetProperties() const override {
54     return MachineFunctionProperties().set(
55         MachineFunctionProperties::Property::Legalized);
56   }
57
58   bool combineExtracts(MachineInstr &MI, MachineRegisterInfo &MRI,
59                        const TargetInstrInfo &TII);
60
61   bool runOnMachineFunction(MachineFunction &MF) override;
62 };
63 } // End namespace llvm.
64
65 #endif