Combiner.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. namespace llvm {
  22. class MachineRegisterInfo;
  23. class CombinerInfo;
  24. class GISelCSEInfo;
  25. class TargetPassConfig;
  26. class MachineFunction;
  27. class Combiner {
  28. public:
  29. Combiner(CombinerInfo &CombinerInfo, const TargetPassConfig *TPC);
  30. /// If CSEInfo is not null, then the Combiner will setup observer for
  31. /// CSEInfo and instantiate a CSEMIRBuilder. Pass nullptr if CSE is not
  32. /// needed.
  33. bool combineMachineInstrs(MachineFunction &MF, GISelCSEInfo *CSEInfo);
  34. protected:
  35. CombinerInfo &CInfo;
  36. MachineRegisterInfo *MRI = nullptr;
  37. const TargetPassConfig *TPC;
  38. std::unique_ptr<MachineIRBuilder> Builder;
  39. };
  40. } // End namespace llvm.
  41. #endif // LLVM_CODEGEN_GLOBALISEL_COMBINER_H
  42. #ifdef __GNUC__
  43. #pragma GCC diagnostic pop
  44. #endif