LLVM  14.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 LostDebugLocObserver;
29 
31 public:
32  static char ID;
33 
34  struct MFResult {
35  bool Changed;
37  };
38 
39 private:
40  /// Initialize the field members using \p MF.
41  void init(MachineFunction &MF);
42 
43 public:
44  // Ctor, nothing fancy.
45  Legalizer();
46 
47  StringRef getPassName() const override { return "Legalizer"; }
48 
49  void getAnalysisUsage(AnalysisUsage &AU) const override;
50 
54  }
55 
59  }
60 
64  }
65 
66  bool runOnMachineFunction(MachineFunction &MF) override;
67 
68  static MFResult
71  LostDebugLocObserver &LocObserver,
72  MachineIRBuilder &MIRBuilder);
73 };
74 } // End namespace llvm.
75 
76 #endif
llvm::Legalizer::MFResult::FailedOn
const MachineInstr * FailedOn
Definition: Legalizer.h:36
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
llvm::LostDebugLocObserver
Definition: LostDebugLocObserver.h:19
llvm::Legalizer::ID
static char ID
Definition: Legalizer.h:32
llvm::Legalizer::MFResult::Changed
bool Changed
Definition: Legalizer.h:35
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:51
llvm::Legalizer
Definition: Legalizer.h:30
llvm::AnalysisUsage
Represent the analysis usage information of a pass.
Definition: PassAnalysisSupport.h:47
llvm::Legalizer::getSetProperties
MachineFunctionProperties getSetProperties() const override
Definition: Legalizer.h:56
llvm::MachineFunctionProperties::set
MachineFunctionProperties & set(Property P)
Definition: MachineFunction.h:180
llvm::MachineIRBuilder
Helper class to build MachineInstr.
Definition: MachineIRBuilder.h:212
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:307
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:88
MachineFunctionPass.h
llvm::Legalizer::getClearedProperties
MachineFunctionProperties getClearedProperties() const override
Definition: Legalizer.h:61
llvm::MachineFunction
Definition: MachineFunction.h:241
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:86
llvm::Legalizer::legalizeMachineFunction
static MFResult legalizeMachineFunction(MachineFunction &MF, const LegalizerInfo &LI, ArrayRef< GISelChangeObserver * > AuxObservers, LostDebugLocObserver &LocObserver, MachineIRBuilder &MIRBuilder)
Definition: Legalizer.cpp:177
llvm::Legalizer::MFResult
Definition: Legalizer.h:34
llvm::MachineFunctionProperties::Property::NoPHIs
@ NoPHIs
llvm::Legalizer::getPassName
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Definition: Legalizer.h:47
llvm::LegalizerInfo
Definition: LegalizerInfo.h:1143
llvm::MachineFunctionProperties::Property::Legalized
@ Legalized