LLVM  8.0.1
CombinerHelper.h
Go to the documentation of this file.
1 //===-- llvm/CodeGen/GlobalISel/CombinerHelper.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 /// This contains common combine transformations that may be used in a combine
11 /// pass,or by the target elsewhere.
12 /// Targets can pick individual opcode transformations from the helper or use
13 /// tryCombine which invokes all transformations. All of the transformations
14 /// return true if the MachineInstruction changed and false otherwise.
15 //
16 //===--------------------------------------------------------------------===//
17 
18 #ifndef LLVM_CODEGEN_GLOBALISEL_COMBINER_HELPER_H
19 #define LLVM_CODEGEN_GLOBALISEL_COMBINER_HELPER_H
20 
21 namespace llvm {
22 
23 class GISelChangeObserver;
24 class MachineIRBuilder;
25 class MachineRegisterInfo;
26 class MachineInstr;
27 class MachineOperand;
28 
30  MachineIRBuilder &Builder;
32  GISelChangeObserver &Observer;
33 
34 public:
36 
37  /// MachineRegisterInfo::replaceRegWith() and inform the observer of the changes
38  void replaceRegWith(MachineRegisterInfo &MRI, unsigned FromReg, unsigned ToReg) const;
39 
40  /// Replace a single register operand with a new register and inform the
41  /// observer of the changes.
43  unsigned ToReg) const;
44 
45  /// If \p MI is COPY, try to combine it.
46  /// Returns true if MI changed.
48 
49  /// If \p MI is extend that consumes the result of a load, try to combine it.
50  /// Returns true if MI changed.
52 
53  /// Try to transform \p MI by using all of the above
54  /// combine functions. Returns true if changed.
55  bool tryCombine(MachineInstr &MI);
56 };
57 } // namespace llvm
58 
59 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:24
bool tryCombine(MachineInstr &MI)
Try to transform MI by using all of the above combine functions.
CombinerHelper(GISelChangeObserver &Observer, MachineIRBuilder &B)
Abstract class that contains various methods for clients to notify about changes. ...
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
void replaceRegWith(MachineRegisterInfo &MRI, unsigned FromReg, unsigned ToReg) const
MachineRegisterInfo::replaceRegWith() and inform the observer of the changes.
Helper class to build MachineInstr.
void replaceRegOpWith(MachineRegisterInfo &MRI, MachineOperand &FromRegOp, unsigned ToReg) const
Replace a single register operand with a new register and inform the observer of the changes...
bool tryCombineExtendingLoads(MachineInstr &MI)
If MI is extend that consumes the result of a load, try to combine it.
bool tryCombineCopy(MachineInstr &MI)
If MI is COPY, try to combine it.
MachineOperand class - Representation of each machine instruction operand.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
Representation of each machine instruction.
Definition: MachineInstr.h:64
IRTranslator LLVM IR MI