]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/CodeGen/GlobalISel/Utils.h
Merge lldb trunk r300422 and resolve conflicts.
[FreeBSD/FreeBSD.git] / contrib / llvm / include / llvm / CodeGen / GlobalISel / Utils.h
1 //==-- llvm/CodeGen/GlobalISel/Utils.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 /// \file This file declares the API of helper functions used throughout the
11 /// GlobalISel pipeline.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_CODEGEN_GLOBALISEL_UTILS_H
16 #define LLVM_CODEGEN_GLOBALISEL_UTILS_H
17
18 #include "llvm/ADT/StringRef.h"
19
20 namespace llvm {
21
22 class MachineFunction;
23 class MachineInstr;
24 class MachineOptimizationRemarkEmitter;
25 class MachineOptimizationRemarkMissed;
26 class MachineRegisterInfo;
27 class MCInstrDesc;
28 class RegisterBankInfo;
29 class TargetInstrInfo;
30 class TargetPassConfig;
31 class TargetRegisterInfo;
32 class Twine;
33
34 /// Try to constrain Reg so that it is usable by argument OpIdx of the
35 /// provided MCInstrDesc \p II. If this fails, create a new virtual
36 /// register in the correct class and insert a COPY before \p InsertPt.
37 /// The debug location of \p InsertPt is used for the new copy.
38 ///
39 /// \return The virtual register constrained to the right register class.
40 unsigned constrainOperandRegClass(const MachineFunction &MF,
41                                   const TargetRegisterInfo &TRI,
42                                   MachineRegisterInfo &MRI,
43                                   const TargetInstrInfo &TII,
44                                   const RegisterBankInfo &RBI,
45                                   MachineInstr &InsertPt, const MCInstrDesc &II,
46                                   unsigned Reg, unsigned OpIdx);
47
48 /// Check whether an instruction \p MI is dead: it only defines dead virtual
49 /// registers, and doesn't have other side effects.
50 bool isTriviallyDead(const MachineInstr &MI, const MachineRegisterInfo &MRI);
51
52 /// Report an ISel error as a missed optimization remark to the LLVMContext's
53 /// diagnostic stream.  Set the FailedISel MachineFunction property.
54 void reportGISelFailure(MachineFunction &MF, const TargetPassConfig &TPC,
55                         MachineOptimizationRemarkEmitter &MORE,
56                         MachineOptimizationRemarkMissed &R);
57
58 void reportGISelFailure(MachineFunction &MF, const TargetPassConfig &TPC,
59                         MachineOptimizationRemarkEmitter &MORE,
60                         const char *PassName, StringRef Msg,
61                         const MachineInstr &MI);
62
63 } // End namespace llvm.
64 #endif