Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/CodeGen/GlobalISel/Legalizer.h
Line
Count
Source
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
23
#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
24
#include "llvm/CodeGen/MachineFunctionPass.h"
25
26
namespace llvm {
27
28
class MachineRegisterInfo;
29
30
class Legalizer : public MachineFunctionPass {
31
public:
32
  static char ID;
33
34
private:
35
36
  /// Initialize the field members using \p MF.
37
  void init(MachineFunction &MF);
38
39
public:
40
  // Ctor, nothing fancy.
41
  Legalizer();
42
43
247k
  StringRef getPassName() const override { return "Legalizer"; }
44
45
  void getAnalysisUsage(AnalysisUsage &AU) const override;
46
47
7.34k
  MachineFunctionProperties getRequiredProperties() const override {
48
7.34k
    return MachineFunctionProperties().set(
49
7.34k
        MachineFunctionProperties::Property::IsSSA);
50
7.34k
  }
51
52
7.34k
  MachineFunctionProperties getSetProperties() const override {
53
7.34k
    return MachineFunctionProperties().set(
54
7.34k
        MachineFunctionProperties::Property::Legalized);
55
7.34k
  }
56
57
7.34k
  MachineFunctionProperties getClearedProperties() const override {
58
7.34k
    return MachineFunctionProperties()
59
7.34k
      .set(MachineFunctionProperties::Property::NoPHIs);
60
7.34k
  }
61
62
  bool combineExtracts(MachineInstr &MI, MachineRegisterInfo &MRI,
63
                       const TargetInstrInfo &TII);
64
65
  bool runOnMachineFunction(MachineFunction &MF) override;
66
};
67
} // End namespace llvm.
68
69
#endif