Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 14 | pmbaty | 1 | //== llvm/CodeGen/GlobalISel/InstructionSelect.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 | /// \file This file describes the interface of the MachineFunctionPass |
||
| 9 | /// responsible for selecting (possibly generic) machine instructions to |
||
| 10 | /// target-specific instructions. |
||
| 11 | //===----------------------------------------------------------------------===// |
||
| 12 | |||
| 13 | #ifndef LLVM_CODEGEN_GLOBALISEL_INSTRUCTIONSELECT_H |
||
| 14 | #define LLVM_CODEGEN_GLOBALISEL_INSTRUCTIONSELECT_H |
||
| 15 | |||
| 16 | #include "llvm/ADT/StringRef.h" |
||
| 17 | #include "llvm/CodeGen/MachineFunction.h" |
||
| 18 | #include "llvm/CodeGen/MachineFunctionPass.h" |
||
| 19 | #include "llvm/Support/CodeGen.h" |
||
| 20 | |||
| 21 | namespace llvm { |
||
| 22 | |||
| 23 | class BlockFrequencyInfo; |
||
| 24 | class ProfileSummaryInfo; |
||
| 25 | |||
| 26 | /// This pass is responsible for selecting generic machine instructions to |
||
| 27 | /// target-specific instructions. It relies on the InstructionSelector provided |
||
| 28 | /// by the target. |
||
| 29 | /// Selection is done by examining blocks in post-order, and instructions in |
||
| 30 | /// reverse order. |
||
| 31 | /// |
||
| 32 | /// \post for all inst in MF: not isPreISelGenericOpcode(inst.opcode) |
||
| 33 | class InstructionSelect : public MachineFunctionPass { |
||
| 34 | public: |
||
| 35 | static char ID; |
||
| 36 | StringRef getPassName() const override { return "InstructionSelect"; } |
||
| 37 | |||
| 38 | void getAnalysisUsage(AnalysisUsage &AU) const override; |
||
| 39 | |||
| 40 | MachineFunctionProperties getRequiredProperties() const override { |
||
| 41 | return MachineFunctionProperties() |
||
| 42 | .set(MachineFunctionProperties::Property::IsSSA) |
||
| 43 | .set(MachineFunctionProperties::Property::Legalized) |
||
| 44 | .set(MachineFunctionProperties::Property::RegBankSelected); |
||
| 45 | } |
||
| 46 | |||
| 47 | MachineFunctionProperties getSetProperties() const override { |
||
| 48 | return MachineFunctionProperties().set( |
||
| 49 | MachineFunctionProperties::Property::Selected); |
||
| 50 | } |
||
| 51 | |||
| 52 | InstructionSelect(CodeGenOpt::Level OL); |
||
| 53 | InstructionSelect(); |
||
| 54 | |||
| 55 | bool runOnMachineFunction(MachineFunction &MF) override; |
||
| 56 | |||
| 57 | protected: |
||
| 58 | BlockFrequencyInfo *BFI = nullptr; |
||
| 59 | ProfileSummaryInfo *PSI = nullptr; |
||
| 60 | |||
| 61 | CodeGenOpt::Level OptLevel = CodeGenOpt::None; |
||
| 62 | }; |
||
| 63 | } // End namespace llvm. |
||
| 64 | |||
| 65 | #endif |