Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame^] | 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 MachineIRBuilder; |
| 24 | class MachineRegisterInfo; |
| 25 | class MachineInstr; |
| 26 | |
| 27 | class CombinerHelper { |
| 28 | MachineIRBuilder &Builder; |
| 29 | MachineRegisterInfo &MRI; |
| 30 | |
| 31 | public: |
| 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 |