LLVM  10.0.0
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_LEGALIZEMACHINEIRPASS_H
21 #define LLVM_CODEGEN_GLOBALISEL_LEGALIZEMACHINEIRPASS_H
22 
25 
26 namespace llvm {
27 
28 class MachineRegisterInfo;
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 
67  const TargetInstrInfo &TII);
68 
69  bool runOnMachineFunction(MachineFunction &MF) override;
70 
71  static MFResult
74  MachineIRBuilder &MIRBuilder);
75 };
76 } // End namespace llvm.
77 
78 #endif
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Definition: Legalizer.h:47
This class represents lattice values for constants.
Definition: AllocatorList.h:23
const MachineInstr * FailedOn
Definition: Legalizer.h:36
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
const HexagonInstrInfo * TII
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:32
TargetInstrInfo - Interface to description of machine instruction set.
static MFResult legalizeMachineFunction(MachineFunction &MF, const LegalizerInfo &LI, ArrayRef< GISelChangeObserver *> AuxObservers, MachineIRBuilder &MIRBuilder)
Definition: Legalizer.cpp:144
unsigned const MachineRegisterInfo * MRI
Helper class to build MachineInstr.
Represent the analysis usage information of a pass.
bool runOnMachineFunction(MachineFunction &MF) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
Definition: Legalizer.cpp:277
MachineFunctionProperties getSetProperties() const override
Definition: Legalizer.h:56
This file declares the MachineIRBuilder class.
static char ID
Definition: Legalizer.h:32
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
MachineFunctionProperties & set(Property P)
Representation of each machine instruction.
Definition: MachineInstr.h:63
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
Definition: Legalizer.cpp:56
bool combineExtracts(MachineInstr &MI, MachineRegisterInfo &MRI, const TargetInstrInfo &TII)
MachineFunctionProperties getRequiredProperties() const override
Definition: Legalizer.h:51
IRTranslator LLVM IR MI
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:54
MachineFunctionProperties getClearedProperties() const override
Definition: Legalizer.h:61
Properties which a MachineFunction may have at a given point in time.