blob: 5d5b8398452c5b205983c48c8af33451b1f22a95 [file] [log] [blame]
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001//== 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
21namespace llvm {
22
23class MachineIRBuilder;
24class MachineRegisterInfo;
25class MachineInstr;
26
27class CombinerHelper {
28 MachineIRBuilder &Builder;
29 MachineRegisterInfo &MRI;
30
31public:
32 CombinerHelper(MachineIRBuilder &B);
33
34 /// If \p MI is COPY, try to combine it.
35 /// Returns true if MI changed.
36 bool tryCombineCopy(MachineInstr &MI);
37
38 /// Try to transform \p MI by using all of the above
39 /// combine functions. Returns true if changed.
40 bool tryCombine(MachineInstr &MI);
41};
42} // namespace llvm
43
44#endif