• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- llvm/CodeGen/GlobalISel/CombinerInfo.h ------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 /// Interface for Targets to specify which operations are combined how and when.
11 ///
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CODEGEN_GLOBALISEL_COMBINER_INFO_H
15 #define LLVM_CODEGEN_GLOBALISEL_COMBINER_INFO_H
16 
17 #include <cassert>
18 namespace llvm {
19 
20 class LegalizerInfo;
21 class MachineInstr;
22 class MachineIRBuilder;
23 class MachineRegisterInfo;
24 // Contains information relevant to enabling/disabling various combines for a
25 // pass.
26 class CombinerInfo {
27 public:
CombinerInfo(bool AllowIllegalOps,bool ShouldLegalizeIllegal,LegalizerInfo * LInfo)28   CombinerInfo(bool AllowIllegalOps, bool ShouldLegalizeIllegal,
29                LegalizerInfo *LInfo)
30       : IllegalOpsAllowed(AllowIllegalOps),
31         LegalizeIllegalOps(ShouldLegalizeIllegal), LInfo(LInfo) {
32     assert(((AllowIllegalOps || !LegalizeIllegalOps) || LInfo) &&
33            "Expecting legalizerInfo when illegalops not allowed");
34   }
35   virtual ~CombinerInfo() = default;
36   /// If \p IllegalOpsAllowed is false, the CombinerHelper will make use of
37   /// the legalizerInfo to check for legality before each transformation.
38   bool IllegalOpsAllowed; // TODO: Make use of this.
39 
40   /// If \p LegalizeIllegalOps is true, the Combiner will also legalize the
41   /// illegal ops that are created.
42   bool LegalizeIllegalOps; // TODO: Make use of this.
43   const LegalizerInfo *LInfo;
44   virtual bool combine(MachineInstr &MI, MachineIRBuilder &B) const = 0;
45 };
46 } // namespace llvm
47 
48 #endif
49