Subversion Repositories QNX 8.QNX8 LLVM/Clang compiler suite

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
14 pmbaty 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
 
23
#include "llvm/ADT/ArrayRef.h"
24
#include "llvm/ADT/StringRef.h"
25
#include "llvm/CodeGen/MachineFunction.h"
26
#include "llvm/CodeGen/MachineFunctionPass.h"
27
 
28
namespace llvm {
29
 
30
class LegalizerInfo;
31
class MachineIRBuilder;
32
class MachineInstr;
33
class GISelChangeObserver;
34
class LostDebugLocObserver;
35
 
36
class Legalizer : public MachineFunctionPass {
37
public:
38
  static char ID;
39
 
40
  struct MFResult {
41
    bool Changed;
42
    const MachineInstr *FailedOn;
43
  };
44
 
45
private:
46
  /// Initialize the field members using \p MF.
47
  void init(MachineFunction &MF);
48
 
49
public:
50
  // Ctor, nothing fancy.
51
  Legalizer();
52
 
53
  StringRef getPassName() const override { return "Legalizer"; }
54
 
55
  void getAnalysisUsage(AnalysisUsage &AU) const override;
56
 
57
  MachineFunctionProperties getRequiredProperties() const override {
58
    return MachineFunctionProperties().set(
59
        MachineFunctionProperties::Property::IsSSA);
60
  }
61
 
62
  MachineFunctionProperties getSetProperties() const override {
63
    return MachineFunctionProperties().set(
64
        MachineFunctionProperties::Property::Legalized);
65
  }
66
 
67
  MachineFunctionProperties getClearedProperties() const override {
68
    return MachineFunctionProperties().set(
69
        MachineFunctionProperties::Property::NoPHIs);
70
  }
71
 
72
  bool runOnMachineFunction(MachineFunction &MF) override;
73
 
74
  static MFResult
75
  legalizeMachineFunction(MachineFunction &MF, const LegalizerInfo &LI,
76
                          ArrayRef<GISelChangeObserver *> AuxObservers,
77
                          LostDebugLocObserver &LocObserver,
78
                          MachineIRBuilder &MIRBuilder);
79
};
80
} // End namespace llvm.
81
 
82
#endif