InstructionSelect.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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/CodeGen/GlobalISel/InstructionSelector.h"
  20. #include "llvm/CodeGen/MachineFunctionPass.h"
  21. namespace llvm {
  22. class BlockFrequencyInfo;
  23. class ProfileSummaryInfo;
  24. /// This pass is responsible for selecting generic machine instructions to
  25. /// target-specific instructions. It relies on the InstructionSelector provided
  26. /// by the target.
  27. /// Selection is done by examining blocks in post-order, and instructions in
  28. /// reverse order.
  29. ///
  30. /// \post for all inst in MF: not isPreISelGenericOpcode(inst.opcode)
  31. class InstructionSelect : public MachineFunctionPass {
  32. public:
  33. static char ID;
  34. StringRef getPassName() const override { return "InstructionSelect"; }
  35. void getAnalysisUsage(AnalysisUsage &AU) const override;
  36. MachineFunctionProperties getRequiredProperties() const override {
  37. return MachineFunctionProperties()
  38. .set(MachineFunctionProperties::Property::IsSSA)
  39. .set(MachineFunctionProperties::Property::Legalized)
  40. .set(MachineFunctionProperties::Property::RegBankSelected);
  41. }
  42. MachineFunctionProperties getSetProperties() const override {
  43. return MachineFunctionProperties().set(
  44. MachineFunctionProperties::Property::Selected);
  45. }
  46. InstructionSelect(CodeGenOpt::Level OL);
  47. InstructionSelect();
  48. bool runOnMachineFunction(MachineFunction &MF) override;
  49. protected:
  50. BlockFrequencyInfo *BFI = nullptr;
  51. ProfileSummaryInfo *PSI = nullptr;
  52. CodeGenOpt::Level OptLevel = CodeGenOpt::None;
  53. };
  54. } // End namespace llvm.
  55. #endif
  56. #ifdef __GNUC__
  57. #pragma GCC diagnostic pop
  58. #endif