1 //== llvm/CodeGen/GlobalISel/LegalizePass.h ------------- -*- C++ -*-==//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
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> ->
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
19 //===----------------------------------------------------------------------===//
21 #ifndef LLVM_CODEGEN_GLOBALISEL_LEGALIZEMACHINEIRPASS_H
22 #define LLVM_CODEGEN_GLOBALISEL_LEGALIZEMACHINEIRPASS_H
24 #include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
25 #include "llvm/CodeGen/MachineFunctionPass.h"
29 class MachineRegisterInfo;
31 class Legalizer : public MachineFunctionPass {
37 /// Initialize the field members using \p MF.
38 void init(MachineFunction &MF);
41 // Ctor, nothing fancy.
44 StringRef getPassName() const override { return "Legalizer"; }
46 void getAnalysisUsage(AnalysisUsage &AU) const override;
48 MachineFunctionProperties getRequiredProperties() const override {
49 return MachineFunctionProperties().set(
50 MachineFunctionProperties::Property::IsSSA);
53 MachineFunctionProperties getSetProperties() const override {
54 return MachineFunctionProperties().set(
55 MachineFunctionProperties::Property::Legalized);
58 bool combineExtracts(MachineInstr &MI, MachineRegisterInfo &MRI,
59 const TargetInstrInfo &TII);
61 bool runOnMachineFunction(MachineFunction &MF) override;
63 } // End namespace llvm.