LLVM  13.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 
25 
26 namespace llvm {
27 
28 class MachineRegisterInfo;
29 class LostDebugLocObserver;
30 
32 public:
33  static char ID;
34 
35  struct MFResult {
36  bool Changed;
38  };
39 
40 private:
41  /// Initialize the field members using \p MF.
42  void init(MachineFunction &MF);
43 
44 public:
45  // Ctor, nothing fancy.
46  Legalizer();
47 
48  StringRef getPassName() const override { return "Legalizer"; }
49 
50  void getAnalysisUsage(AnalysisUsage &AU) const override;
51 
55  }
56 
60  }
61 
65  }
66 
67  bool runOnMachineFunction(MachineFunction &MF) override;
68 
69  static MFResult
72  LostDebugLocObserver &LocObserver,
73  MachineIRBuilder &MIRBuilder);
74 };
75 } // End namespace llvm.
76 
77 #endif
llvm::Legalizer::MFResult::FailedOn
const MachineInstr * FailedOn
Definition: Legalizer.h:37
llvm
Definition: AllocatorList.h:23
llvm::LostDebugLocObserver
Definition: LostDebugLocObserver.h:19
llvm::Legalizer::ID
static char ID
Definition: Legalizer.h:33
llvm::Legalizer::MFResult::Changed
bool Changed
Definition: Legalizer.h:36
llvm::MachineFunctionPass
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
Definition: MachineFunctionPass.h:30
llvm::MachineFunctionProperties::Property::IsSSA
@ IsSSA
llvm::MachineFunctionProperties
Properties which a MachineFunction may have at a given point in time.
Definition: MachineFunction.h:111
MachineIRBuilder.h
llvm::Legalizer::getRequiredProperties
MachineFunctionProperties getRequiredProperties() const override
Definition: Legalizer.h:52
llvm::Legalizer
Definition: Legalizer.h:31
llvm::AnalysisUsage
Represent the analysis usage information of a pass.
Definition: PassAnalysisSupport.h:47
llvm::Legalizer::getSetProperties
MachineFunctionProperties getSetProperties() const override
Definition: Legalizer.h:57
llvm::MachineFunctionProperties::set
MachineFunctionProperties & set(Property P)
Definition: MachineFunction.h:169
llvm::MachineIRBuilder
Helper class to build MachineInstr.
Definition: MachineIRBuilder.h:220
llvm::MachineInstr
Representation of each machine instruction.
Definition: MachineInstr.h:64
llvm::Legalizer::runOnMachineFunction
bool runOnMachineFunction(MachineFunction &MF) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
Definition: Legalizer.cpp:310
llvm::Legalizer::getAnalysisUsage
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
Definition: Legalizer.cpp:81
MachineFunctionPass.h
llvm::Legalizer::getClearedProperties
MachineFunctionProperties getClearedProperties() const override
Definition: Legalizer.h:62
llvm::MachineFunction
Definition: MachineFunction.h:230
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm::Legalizer::Legalizer
Legalizer()
Definition: Legalizer.cpp:79
llvm::Legalizer::legalizeMachineFunction
static MFResult legalizeMachineFunction(MachineFunction &MF, const LegalizerInfo &LI, ArrayRef< GISelChangeObserver * > AuxObservers, LostDebugLocObserver &LocObserver, MachineIRBuilder &MIRBuilder)
Definition: Legalizer.cpp:168
llvm::Legalizer::MFResult
Definition: Legalizer.h:35
llvm::MachineFunctionProperties::Property::NoPHIs
@ NoPHIs
llvm::Legalizer::getPassName
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Definition: Legalizer.h:48
llvm::LegalizerInfo
Definition: LegalizerInfo.h:1058
llvm::MachineFunctionProperties::Property::Legalized
@ Legalized