1 //==-- llvm/CodeGen/GlobalISel/Utils.h ---------------------------*- C++ -*-==//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 /// \file This file declares the API of helper functions used throughout the
11 /// GlobalISel pipeline.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_CODEGEN_GLOBALISEL_UTILS_H
16 #define LLVM_CODEGEN_GLOBALISEL_UTILS_H
20 class MachineFunction;
22 class MachineRegisterInfo;
24 class RegisterBankInfo;
25 class TargetInstrInfo;
26 class TargetRegisterInfo;
28 /// Try to constrain Reg so that it is usable by argument OpIdx of the
29 /// provided MCInstrDesc \p II. If this fails, create a new virtual
30 /// register in the correct class and insert a COPY before \p InsertPt.
31 /// The debug location of \p InsertPt is used for the new copy.
33 /// \return The virtual register constrained to the right register class.
34 unsigned constrainOperandRegClass(const MachineFunction &MF,
35 const TargetRegisterInfo &TRI,
36 MachineRegisterInfo &MRI,
37 const TargetInstrInfo &TII,
38 const RegisterBankInfo &RBI,
39 MachineInstr &InsertPt, const MCInstrDesc &II,
40 unsigned Reg, unsigned OpIdx);
42 } // End namespace llvm.