Combiner.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //== ----- llvm/CodeGen/GlobalISel/Combiner.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
  14. /// This contains common code to drive combines. Combiner Passes will need to
  15. /// setup a CombinerInfo and call combineMachineFunction.
  16. ///
  17. //===----------------------------------------------------------------------===//
  18. #ifndef LLVM_CODEGEN_GLOBALISEL_COMBINER_H
  19. #define LLVM_CODEGEN_GLOBALISEL_COMBINER_H
  20. #include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
  21. #include "llvm/CodeGen/MachineFunctionPass.h"
  22. namespace llvm {
  23. class MachineRegisterInfo;
  24. class CombinerInfo;
  25. class GISelCSEInfo;
  26. class TargetPassConfig;
  27. class MachineFunction;
  28. class Combiner {
  29. public:
  30. Combiner(CombinerInfo &CombinerInfo, const TargetPassConfig *TPC);
  31. /// If CSEInfo is not null, then the Combiner will setup observer for
  32. /// CSEInfo and instantiate a CSEMIRBuilder. Pass nullptr if CSE is not
  33. /// needed.
  34. bool combineMachineInstrs(MachineFunction &MF, GISelCSEInfo *CSEInfo);
  35. protected:
  36. CombinerInfo &CInfo;
  37. MachineRegisterInfo *MRI = nullptr;
  38. const TargetPassConfig *TPC;
  39. std::unique_ptr<MachineIRBuilder> Builder;
  40. };
  41. } // End namespace llvm.
  42. #endif // LLVM_CODEGEN_GLOBALISEL_COMBINER_H
  43. #ifdef __GNUC__
  44. #pragma GCC diagnostic pop
  45. #endif