InstructionSelect.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //== llvm/CodeGen/GlobalISel/InstructionSelect.h -----------------*- C++ -*-==//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. /// \file This file describes the interface of the MachineFunctionPass
  14. /// responsible for selecting (possibly generic) machine instructions to
  15. /// target-specific instructions.
  16. //===----------------------------------------------------------------------===//
  17. #ifndef LLVM_CODEGEN_GLOBALISEL_INSTRUCTIONSELECT_H
  18. #define LLVM_CODEGEN_GLOBALISEL_INSTRUCTIONSELECT_H
  19. #include "llvm/ADT/StringRef.h"
  20. #include "llvm/CodeGen/MachineFunction.h"
  21. #include "llvm/CodeGen/MachineFunctionPass.h"
  22. #include "llvm/Support/CodeGen.h"
  23. namespace llvm {
  24. class BlockFrequencyInfo;
  25. class ProfileSummaryInfo;
  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. void getAnalysisUsage(AnalysisUsage &AU) const override;
  38. MachineFunctionProperties getRequiredProperties() const override {
  39. return MachineFunctionProperties()
  40. .set(MachineFunctionProperties::Property::IsSSA)
  41. .set(MachineFunctionProperties::Property::Legalized)
  42. .set(MachineFunctionProperties::Property::RegBankSelected);
  43. }
  44. MachineFunctionProperties getSetProperties() const override {
  45. return MachineFunctionProperties().set(
  46. MachineFunctionProperties::Property::Selected);
  47. }
  48. InstructionSelect(CodeGenOpt::Level OL);
  49. InstructionSelect();
  50. bool runOnMachineFunction(MachineFunction &MF) override;
  51. protected:
  52. BlockFrequencyInfo *BFI = nullptr;
  53. ProfileSummaryInfo *PSI = nullptr;
  54. CodeGenOpt::Level OptLevel = CodeGenOpt::None;
  55. };
  56. } // End namespace llvm.
  57. #endif
  58. #ifdef __GNUC__
  59. #pragma GCC diagnostic pop
  60. #endif