1311116Sdim//== llvm/CodeGen/GlobalISel/InstructionSelect.h -----------------*- C++ -*-==//
2311116Sdim//
3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4353358Sdim// See https://llvm.org/LICENSE.txt for license information.
5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6311116Sdim//
7311116Sdim//===----------------------------------------------------------------------===//
8311116Sdim/// \file This file describes the interface of the MachineFunctionPass
9311116Sdim/// responsible for selecting (possibly generic) machine instructions to
10311116Sdim/// target-specific instructions.
11311116Sdim//===----------------------------------------------------------------------===//
12311116Sdim
13311116Sdim#ifndef LLVM_CODEGEN_GLOBALISEL_INSTRUCTIONSELECT_H
14311116Sdim#define LLVM_CODEGEN_GLOBALISEL_INSTRUCTIONSELECT_H
15311116Sdim
16311116Sdim#include "llvm/CodeGen/GlobalISel/InstructionSelector.h"
17311116Sdim#include "llvm/CodeGen/MachineFunctionPass.h"
18311116Sdim
19311116Sdimnamespace llvm {
20311116Sdim/// This pass is responsible for selecting generic machine instructions to
21311116Sdim/// target-specific instructions.  It relies on the InstructionSelector provided
22311116Sdim/// by the target.
23311116Sdim/// Selection is done by examining blocks in post-order, and instructions in
24311116Sdim/// reverse order.
25311116Sdim///
26311116Sdim/// \post for all inst in MF: not isPreISelGenericOpcode(inst.opcode)
27311116Sdimclass InstructionSelect : public MachineFunctionPass {
28311116Sdimpublic:
29311116Sdim  static char ID;
30311116Sdim  StringRef getPassName() const override { return "InstructionSelect"; }
31311116Sdim
32311116Sdim  void getAnalysisUsage(AnalysisUsage &AU) const override;
33311116Sdim
34311116Sdim  MachineFunctionProperties getRequiredProperties() const override {
35311116Sdim    return MachineFunctionProperties()
36311116Sdim        .set(MachineFunctionProperties::Property::IsSSA)
37311116Sdim        .set(MachineFunctionProperties::Property::Legalized)
38311116Sdim        .set(MachineFunctionProperties::Property::RegBankSelected);
39311116Sdim  }
40311116Sdim
41311116Sdim  MachineFunctionProperties getSetProperties() const override {
42311116Sdim    return MachineFunctionProperties().set(
43311116Sdim        MachineFunctionProperties::Property::Selected);
44311116Sdim  }
45311116Sdim
46311116Sdim  InstructionSelect();
47311116Sdim
48311116Sdim  bool runOnMachineFunction(MachineFunction &MF) override;
49311116Sdim};
50311116Sdim} // End namespace llvm.
51311116Sdim
52311116Sdim#endif
53