LLVM  8.0.1
CombinerInfo.h
Go to the documentation of this file.
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 GISelChangeObserver;
21 class LegalizerInfo;
22 class MachineInstr;
23 class MachineIRBuilder;
24 class MachineRegisterInfo;
25 
26 // Contains information relevant to enabling/disabling various combines for a
27 // pass.
28 class CombinerInfo {
29 public:
30  CombinerInfo(bool AllowIllegalOps, bool ShouldLegalizeIllegal,
32  : IllegalOpsAllowed(AllowIllegalOps),
33  LegalizeIllegalOps(ShouldLegalizeIllegal), LInfo(LInfo) {
34  assert(((AllowIllegalOps || !LegalizeIllegalOps) || LInfo) &&
35  "Expecting legalizerInfo when illegalops not allowed");
36  }
37  virtual ~CombinerInfo() = default;
38  /// If \p IllegalOpsAllowed is false, the CombinerHelper will make use of
39  /// the legalizerInfo to check for legality before each transformation.
40  bool IllegalOpsAllowed; // TODO: Make use of this.
41 
42  /// If \p LegalizeIllegalOps is true, the Combiner will also legalize the
43  /// illegal ops that are created.
44  bool LegalizeIllegalOps; // TODO: Make use of this.
46 
47  /// Attempt to combine instructions using MI as the root.
48  ///
49  /// Use Observer to report the creation, modification, and erasure of
50  /// instructions. GISelChangeObserver will automatically report certain
51  /// kinds of operations. These operations are:
52  /// * Instructions that are newly inserted into the MachineFunction
53  /// * Instructions that are erased from the MachineFunction.
54  ///
55  /// However, it is important to report instruction modification and this is
56  /// not automatic.
57  virtual bool combine(GISelChangeObserver &Observer, MachineInstr &MI,
58  MachineIRBuilder &B) const = 0;
59 };
60 } // namespace llvm
61 
62 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:24
virtual ~CombinerInfo()=default
virtual bool combine(GISelChangeObserver &Observer, MachineInstr &MI, MachineIRBuilder &B) const =0
Attempt to combine instructions using MI as the root.
const LegalizerInfo * LInfo
Definition: CombinerInfo.h:45
CombinerInfo(bool AllowIllegalOps, bool ShouldLegalizeIllegal, LegalizerInfo *LInfo)
Definition: CombinerInfo.h:30
Abstract class that contains various methods for clients to notify about changes. ...
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
Helper class to build MachineInstr.
bool IllegalOpsAllowed
If IllegalOpsAllowed is false, the CombinerHelper will make use of the legalizerInfo to check for leg...
Definition: CombinerInfo.h:40
bool LegalizeIllegalOps
If LegalizeIllegalOps is true, the Combiner will also legalize the illegal ops that are created...
Definition: CombinerInfo.h:44
Representation of each machine instruction.
Definition: MachineInstr.h:64
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
IRTranslator LLVM IR MI