xref: /freebsd-src/contrib/llvm-project/llvm/lib/Target/PowerPC/GISel/PPCRegisterBankInfo.cpp (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
1e8d8bef9SDimitry Andric //===- PPCRegisterBankInfo.cpp --------------------------------------------===//
2e8d8bef9SDimitry Andric //
3e8d8bef9SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4e8d8bef9SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5e8d8bef9SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6e8d8bef9SDimitry Andric //
7e8d8bef9SDimitry Andric //===----------------------------------------------------------------------===//
8e8d8bef9SDimitry Andric /// \file
9e8d8bef9SDimitry Andric /// This file implements the targeting of the RegisterBankInfo class for
10e8d8bef9SDimitry Andric /// PowerPC.
11e8d8bef9SDimitry Andric //===----------------------------------------------------------------------===//
12e8d8bef9SDimitry Andric 
13e8d8bef9SDimitry Andric #include "PPCRegisterBankInfo.h"
14e8d8bef9SDimitry Andric #include "PPCRegisterInfo.h"
155f757f3fSDimitry Andric #include "llvm/CodeGen/GlobalISel/GenericMachineInstrs.h"
16*0fca6ea1SDimitry Andric #include "llvm/CodeGen/GlobalISel/Utils.h"
17e8d8bef9SDimitry Andric #include "llvm/CodeGen/MachineFunction.h"
18e8d8bef9SDimitry Andric #include "llvm/CodeGen/MachineRegisterInfo.h"
19e8d8bef9SDimitry Andric #include "llvm/Support/Debug.h"
20e8d8bef9SDimitry Andric 
21e8d8bef9SDimitry Andric #define DEBUG_TYPE "ppc-reg-bank-info"
22e8d8bef9SDimitry Andric 
23e8d8bef9SDimitry Andric #define GET_TARGET_REGBANK_IMPL
24e8d8bef9SDimitry Andric #include "PPCGenRegisterBank.inc"
25e8d8bef9SDimitry Andric 
26bdd1243dSDimitry Andric // This file will be TableGen'ed at some point.
27bdd1243dSDimitry Andric #include "PPCGenRegisterBankInfo.def"
28bdd1243dSDimitry Andric 
29e8d8bef9SDimitry Andric using namespace llvm;
30e8d8bef9SDimitry Andric 
3181ad6265SDimitry Andric PPCRegisterBankInfo::PPCRegisterBankInfo(const TargetRegisterInfo &TRI) {}
32bdd1243dSDimitry Andric 
33bdd1243dSDimitry Andric const RegisterBank &
34bdd1243dSDimitry Andric PPCRegisterBankInfo::getRegBankFromRegClass(const TargetRegisterClass &RC,
35bdd1243dSDimitry Andric                                             LLT Ty) const {
36bdd1243dSDimitry Andric   switch (RC.getID()) {
37bdd1243dSDimitry Andric   case PPC::G8RCRegClassID:
38bdd1243dSDimitry Andric   case PPC::G8RC_NOX0RegClassID:
39bdd1243dSDimitry Andric   case PPC::G8RC_and_G8RC_NOX0RegClassID:
40bdd1243dSDimitry Andric   case PPC::GPRCRegClassID:
41bdd1243dSDimitry Andric   case PPC::GPRC_NOR0RegClassID:
42bdd1243dSDimitry Andric   case PPC::GPRC_and_GPRC_NOR0RegClassID:
43bdd1243dSDimitry Andric     return getRegBank(PPC::GPRRegBankID);
44bdd1243dSDimitry Andric   case PPC::VSFRCRegClassID:
45bdd1243dSDimitry Andric   case PPC::SPILLTOVSRRC_and_VSFRCRegClassID:
46bdd1243dSDimitry Andric   case PPC::SPILLTOVSRRC_and_VFRCRegClassID:
47bdd1243dSDimitry Andric   case PPC::SPILLTOVSRRC_and_F4RCRegClassID:
48bdd1243dSDimitry Andric   case PPC::F8RCRegClassID:
49bdd1243dSDimitry Andric   case PPC::VFRCRegClassID:
50bdd1243dSDimitry Andric   case PPC::VSSRCRegClassID:
51bdd1243dSDimitry Andric   case PPC::F4RCRegClassID:
52bdd1243dSDimitry Andric     return getRegBank(PPC::FPRRegBankID);
5306c3fb27SDimitry Andric   case PPC::VSRCRegClassID:
5406c3fb27SDimitry Andric   case PPC::VRRCRegClassID:
5506c3fb27SDimitry Andric   case PPC::VRRC_with_sub_64_in_SPILLTOVSRRCRegClassID:
5606c3fb27SDimitry Andric   case PPC::VSRC_with_sub_64_in_SPILLTOVSRRCRegClassID:
5706c3fb27SDimitry Andric   case PPC::SPILLTOVSRRCRegClassID:
5806c3fb27SDimitry Andric   case PPC::VSLRCRegClassID:
5906c3fb27SDimitry Andric   case PPC::VSLRC_with_sub_64_in_SPILLTOVSRRCRegClassID:
6006c3fb27SDimitry Andric     return getRegBank(PPC::VECRegBankID);
61bdd1243dSDimitry Andric   case PPC::CRRCRegClassID:
62bdd1243dSDimitry Andric   case PPC::CRBITRCRegClassID:
63bdd1243dSDimitry Andric     return getRegBank(PPC::CRRegBankID);
64bdd1243dSDimitry Andric   default:
65bdd1243dSDimitry Andric     llvm_unreachable("Unexpected register class");
66bdd1243dSDimitry Andric   }
67bdd1243dSDimitry Andric }
68bdd1243dSDimitry Andric 
69bdd1243dSDimitry Andric const RegisterBankInfo::InstructionMapping &
70bdd1243dSDimitry Andric PPCRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
71bdd1243dSDimitry Andric   const unsigned Opc = MI.getOpcode();
72bdd1243dSDimitry Andric 
73bdd1243dSDimitry Andric   // Try the default logic for non-generic instructions that are either copies
74bdd1243dSDimitry Andric   // or already have some operands assigned to banks.
75bdd1243dSDimitry Andric   if (!isPreISelGenericOpcode(Opc) || Opc == TargetOpcode::G_PHI) {
76bdd1243dSDimitry Andric     const RegisterBankInfo::InstructionMapping &Mapping =
77bdd1243dSDimitry Andric         getInstrMappingImpl(MI);
78bdd1243dSDimitry Andric     if (Mapping.isValid())
79bdd1243dSDimitry Andric       return Mapping;
80bdd1243dSDimitry Andric   }
81bdd1243dSDimitry Andric 
82bdd1243dSDimitry Andric   const MachineFunction &MF = *MI.getParent()->getParent();
83bdd1243dSDimitry Andric   const MachineRegisterInfo &MRI = MF.getRegInfo();
84bdd1243dSDimitry Andric   const TargetSubtargetInfo &STI = MF.getSubtarget();
85bdd1243dSDimitry Andric   const TargetRegisterInfo &TRI = *STI.getRegisterInfo();
86bdd1243dSDimitry Andric 
87bdd1243dSDimitry Andric   unsigned NumOperands = MI.getNumOperands();
88bdd1243dSDimitry Andric   const ValueMapping *OperandsMapping = nullptr;
89bdd1243dSDimitry Andric   unsigned Cost = 1;
90bdd1243dSDimitry Andric   unsigned MappingID = DefaultMappingID;
91bdd1243dSDimitry Andric 
92bdd1243dSDimitry Andric   switch (Opc) {
93bdd1243dSDimitry Andric     // Arithmetic ops.
94bdd1243dSDimitry Andric   case TargetOpcode::G_ADD:
95bdd1243dSDimitry Andric   case TargetOpcode::G_SUB:
96bdd1243dSDimitry Andric     // Bitwise ops.
97bdd1243dSDimitry Andric   case TargetOpcode::G_AND:
98bdd1243dSDimitry Andric   case TargetOpcode::G_OR:
99bdd1243dSDimitry Andric   case TargetOpcode::G_XOR:
100bdd1243dSDimitry Andric     // Extension ops.
101bdd1243dSDimitry Andric   case TargetOpcode::G_SEXT:
102bdd1243dSDimitry Andric   case TargetOpcode::G_ZEXT:
10306c3fb27SDimitry Andric   case TargetOpcode::G_ANYEXT: {
104bdd1243dSDimitry Andric     assert(NumOperands <= 3 &&
105bdd1243dSDimitry Andric            "This code is for instructions with 3 or less operands");
10606c3fb27SDimitry Andric     LLT Ty = MRI.getType(MI.getOperand(0).getReg());
10706c3fb27SDimitry Andric     unsigned Size = Ty.getSizeInBits();
10806c3fb27SDimitry Andric     switch (Size) {
10906c3fb27SDimitry Andric     case 128:
11006c3fb27SDimitry Andric       OperandsMapping = getValueMapping(PMI_VEC128);
11106c3fb27SDimitry Andric       break;
11206c3fb27SDimitry Andric     default:
113bdd1243dSDimitry Andric       OperandsMapping = getValueMapping(PMI_GPR64);
114bdd1243dSDimitry Andric       break;
11506c3fb27SDimitry Andric     }
11606c3fb27SDimitry Andric     break;
11706c3fb27SDimitry Andric   }
118bdd1243dSDimitry Andric   case TargetOpcode::G_FADD:
119bdd1243dSDimitry Andric   case TargetOpcode::G_FSUB:
120bdd1243dSDimitry Andric   case TargetOpcode::G_FMUL:
121bdd1243dSDimitry Andric   case TargetOpcode::G_FDIV: {
122bdd1243dSDimitry Andric     Register SrcReg = MI.getOperand(1).getReg();
123bdd1243dSDimitry Andric     unsigned Size = getSizeInBits(SrcReg, MRI, TRI);
124bdd1243dSDimitry Andric 
12506c3fb27SDimitry Andric     assert((Size == 32 || Size == 64 || Size == 128) &&
12606c3fb27SDimitry Andric            "Unsupported floating point types!\n");
12706c3fb27SDimitry Andric     switch (Size) {
12806c3fb27SDimitry Andric     case 32:
12906c3fb27SDimitry Andric       OperandsMapping = getValueMapping(PMI_FPR32);
13006c3fb27SDimitry Andric       break;
13106c3fb27SDimitry Andric     case 64:
13206c3fb27SDimitry Andric       OperandsMapping = getValueMapping(PMI_FPR64);
13306c3fb27SDimitry Andric       break;
13406c3fb27SDimitry Andric     case 128:
13506c3fb27SDimitry Andric       OperandsMapping = getValueMapping(PMI_VEC128);
13606c3fb27SDimitry Andric       break;
13706c3fb27SDimitry Andric     }
138bdd1243dSDimitry Andric     break;
139bdd1243dSDimitry Andric   }
140bdd1243dSDimitry Andric   case TargetOpcode::G_FCMP: {
141bdd1243dSDimitry Andric     unsigned CmpSize = MRI.getType(MI.getOperand(2).getReg()).getSizeInBits();
142bdd1243dSDimitry Andric 
143bdd1243dSDimitry Andric     OperandsMapping = getOperandsMapping(
144bdd1243dSDimitry Andric         {getValueMapping(PMI_CR), nullptr,
145bdd1243dSDimitry Andric          getValueMapping(CmpSize == 32 ? PMI_FPR32 : PMI_FPR64),
146bdd1243dSDimitry Andric          getValueMapping(CmpSize == 32 ? PMI_FPR32 : PMI_FPR64)});
147bdd1243dSDimitry Andric     break;
148bdd1243dSDimitry Andric   }
149bdd1243dSDimitry Andric   case TargetOpcode::G_CONSTANT:
150bdd1243dSDimitry Andric     OperandsMapping = getOperandsMapping({getValueMapping(PMI_GPR64), nullptr});
151bdd1243dSDimitry Andric     break;
15206c3fb27SDimitry Andric   case TargetOpcode::G_CONSTANT_POOL:
15306c3fb27SDimitry Andric     OperandsMapping = getOperandsMapping({getValueMapping(PMI_GPR64), nullptr});
15406c3fb27SDimitry Andric     break;
155bdd1243dSDimitry Andric   case TargetOpcode::G_FPTOUI:
156bdd1243dSDimitry Andric   case TargetOpcode::G_FPTOSI: {
157bdd1243dSDimitry Andric     Register SrcReg = MI.getOperand(1).getReg();
158bdd1243dSDimitry Andric     unsigned Size = getSizeInBits(SrcReg, MRI, TRI);
159bdd1243dSDimitry Andric 
160bdd1243dSDimitry Andric     OperandsMapping = getOperandsMapping(
161bdd1243dSDimitry Andric         {getValueMapping(PMI_GPR64),
162bdd1243dSDimitry Andric          getValueMapping(Size == 32 ? PMI_FPR32 : PMI_FPR64)});
163bdd1243dSDimitry Andric     break;
164bdd1243dSDimitry Andric   }
165bdd1243dSDimitry Andric   case TargetOpcode::G_UITOFP:
166bdd1243dSDimitry Andric   case TargetOpcode::G_SITOFP: {
167bdd1243dSDimitry Andric     Register SrcReg = MI.getOperand(0).getReg();
168bdd1243dSDimitry Andric     unsigned Size = getSizeInBits(SrcReg, MRI, TRI);
169bdd1243dSDimitry Andric 
170bdd1243dSDimitry Andric     OperandsMapping =
171bdd1243dSDimitry Andric         getOperandsMapping({getValueMapping(Size == 32 ? PMI_FPR32 : PMI_FPR64),
172bdd1243dSDimitry Andric                             getValueMapping(PMI_GPR64)});
173bdd1243dSDimitry Andric     break;
174bdd1243dSDimitry Andric   }
175bdd1243dSDimitry Andric   case TargetOpcode::G_LOAD: {
176bdd1243dSDimitry Andric     unsigned Size = MRI.getType(MI.getOperand(0).getReg()).getSizeInBits();
177bdd1243dSDimitry Andric     // Check if that load feeds fp instructions.
178bdd1243dSDimitry Andric     if (any_of(MRI.use_nodbg_instructions(MI.getOperand(0).getReg()),
179bdd1243dSDimitry Andric                [&](const MachineInstr &UseMI) {
180bdd1243dSDimitry Andric                  // If we have at least one direct use in a FP instruction,
181bdd1243dSDimitry Andric                  // assume this was a floating point load in the IR. If it was
182bdd1243dSDimitry Andric                  // not, we would have had a bitcast before reaching that
183bdd1243dSDimitry Andric                  // instruction.
184bdd1243dSDimitry Andric                  //
185bdd1243dSDimitry Andric                  // Int->FP conversion operations are also captured in
186bdd1243dSDimitry Andric                  // onlyDefinesFP().
187bdd1243dSDimitry Andric                  return onlyUsesFP(UseMI, MRI, TRI);
188bdd1243dSDimitry Andric                }))
189bdd1243dSDimitry Andric       OperandsMapping = getOperandsMapping(
190bdd1243dSDimitry Andric           {getValueMapping(Size == 64 ? PMI_FPR64 : PMI_FPR32),
191bdd1243dSDimitry Andric            getValueMapping(PMI_GPR64)});
192bdd1243dSDimitry Andric     else
193bdd1243dSDimitry Andric       OperandsMapping = getOperandsMapping(
194bdd1243dSDimitry Andric           {getValueMapping(Size == 64 ? PMI_GPR64 : PMI_GPR32),
195bdd1243dSDimitry Andric            getValueMapping(PMI_GPR64)});
196bdd1243dSDimitry Andric     break;
197bdd1243dSDimitry Andric   }
198bdd1243dSDimitry Andric   case TargetOpcode::G_STORE: {
199bdd1243dSDimitry Andric     // Check if the store is fed by fp instructions.
200bdd1243dSDimitry Andric     MachineInstr *DefMI = MRI.getVRegDef(MI.getOperand(0).getReg());
201bdd1243dSDimitry Andric     unsigned Size = MRI.getType(MI.getOperand(0).getReg()).getSizeInBits();
202bdd1243dSDimitry Andric     if (onlyDefinesFP(*DefMI, MRI, TRI))
203bdd1243dSDimitry Andric       OperandsMapping = getOperandsMapping(
204bdd1243dSDimitry Andric           {getValueMapping(Size == 64 ? PMI_FPR64 : PMI_FPR32),
205bdd1243dSDimitry Andric            getValueMapping(PMI_GPR64)});
206bdd1243dSDimitry Andric     else
207bdd1243dSDimitry Andric       OperandsMapping = getOperandsMapping(
208bdd1243dSDimitry Andric           {getValueMapping(Size == 64 ? PMI_GPR64 : PMI_GPR32),
209bdd1243dSDimitry Andric            getValueMapping(PMI_GPR64)});
210bdd1243dSDimitry Andric     break;
211bdd1243dSDimitry Andric   }
212bdd1243dSDimitry Andric   case TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS: {
213bdd1243dSDimitry Andric     // FIXME: We have to check every operand in this MI and compute value
214bdd1243dSDimitry Andric     // mapping accordingly.
215bdd1243dSDimitry Andric     SmallVector<const ValueMapping *, 8> OpdsMapping(NumOperands);
216bdd1243dSDimitry Andric     OperandsMapping = getOperandsMapping(OpdsMapping);
217bdd1243dSDimitry Andric     break;
218bdd1243dSDimitry Andric   }
21906c3fb27SDimitry Andric   case TargetOpcode::G_BITCAST: {
22006c3fb27SDimitry Andric     LLT DstTy = MRI.getType(MI.getOperand(0).getReg());
22106c3fb27SDimitry Andric     LLT SrcTy = MRI.getType(MI.getOperand(1).getReg());
22206c3fb27SDimitry Andric     unsigned DstSize = DstTy.getSizeInBits();
22306c3fb27SDimitry Andric 
22406c3fb27SDimitry Andric     bool DstIsGPR = !DstTy.isVector();
22506c3fb27SDimitry Andric     bool SrcIsGPR = !SrcTy.isVector();
22606c3fb27SDimitry Andric     // TODO: Currently, only vector and GPR register banks are handled.
22706c3fb27SDimitry Andric     //       This needs to be extended to handle floating point register
22806c3fb27SDimitry Andric     //       banks in the future.
22906c3fb27SDimitry Andric     const RegisterBank &DstRB = DstIsGPR ? PPC::GPRRegBank : PPC::VECRegBank;
23006c3fb27SDimitry Andric     const RegisterBank &SrcRB = SrcIsGPR ? PPC::GPRRegBank : PPC::VECRegBank;
23106c3fb27SDimitry Andric 
23206c3fb27SDimitry Andric     return getInstructionMapping(
23306c3fb27SDimitry Andric         MappingID, Cost, getCopyMapping(DstRB.getID(), SrcRB.getID(), DstSize),
23406c3fb27SDimitry Andric         NumOperands);
23506c3fb27SDimitry Andric   }
236bdd1243dSDimitry Andric   default:
237bdd1243dSDimitry Andric     return getInvalidInstructionMapping();
238bdd1243dSDimitry Andric   }
239bdd1243dSDimitry Andric 
240bdd1243dSDimitry Andric   return getInstructionMapping(MappingID, Cost, OperandsMapping, NumOperands);
241bdd1243dSDimitry Andric }
242bdd1243dSDimitry Andric 
243bdd1243dSDimitry Andric /// \returns true if a given intrinsic \p ID only uses and defines FPRs.
244bdd1243dSDimitry Andric static bool isFPIntrinsic(unsigned ID) {
245bdd1243dSDimitry Andric   // TODO: Add more intrinsics.
246bdd1243dSDimitry Andric   return false;
247bdd1243dSDimitry Andric }
248bdd1243dSDimitry Andric 
249bdd1243dSDimitry Andric /// FIXME: this is copied from target AArch64. Needs some code refactor here to
250bdd1243dSDimitry Andric /// put this function in class RegisterBankInfo.
251bdd1243dSDimitry Andric bool PPCRegisterBankInfo::hasFPConstraints(const MachineInstr &MI,
252bdd1243dSDimitry Andric                                            const MachineRegisterInfo &MRI,
253bdd1243dSDimitry Andric                                            const TargetRegisterInfo &TRI,
254bdd1243dSDimitry Andric                                            unsigned Depth) const {
255bdd1243dSDimitry Andric   unsigned Op = MI.getOpcode();
2565f757f3fSDimitry Andric 
2575f757f3fSDimitry Andric   if (auto *GI = dyn_cast<GIntrinsic>(&MI)) {
2585f757f3fSDimitry Andric     if (isFPIntrinsic(GI->getIntrinsicID()))
259bdd1243dSDimitry Andric       return true;
2605f757f3fSDimitry Andric   }
261bdd1243dSDimitry Andric 
262bdd1243dSDimitry Andric   // Do we have an explicit floating point instruction?
263bdd1243dSDimitry Andric   if (isPreISelGenericFloatingPointOpcode(Op))
264bdd1243dSDimitry Andric     return true;
265bdd1243dSDimitry Andric 
266bdd1243dSDimitry Andric   // No. Check if we have a copy-like instruction. If we do, then we could
267bdd1243dSDimitry Andric   // still be fed by floating point instructions.
268bdd1243dSDimitry Andric   if (Op != TargetOpcode::COPY && !MI.isPHI() &&
269bdd1243dSDimitry Andric       !isPreISelGenericOptimizationHint(Op))
270bdd1243dSDimitry Andric     return false;
271bdd1243dSDimitry Andric 
272bdd1243dSDimitry Andric   // Check if we already know the register bank.
273bdd1243dSDimitry Andric   auto *RB = getRegBank(MI.getOperand(0).getReg(), MRI, TRI);
274bdd1243dSDimitry Andric   if (RB == &PPC::FPRRegBank)
275bdd1243dSDimitry Andric     return true;
276bdd1243dSDimitry Andric   if (RB == &PPC::GPRRegBank)
277bdd1243dSDimitry Andric     return false;
278bdd1243dSDimitry Andric 
279bdd1243dSDimitry Andric   // We don't know anything.
280bdd1243dSDimitry Andric   //
281bdd1243dSDimitry Andric   // If we have a phi, we may be able to infer that it will be assigned a FPR
282bdd1243dSDimitry Andric   // based off of its inputs.
283bdd1243dSDimitry Andric   if (!MI.isPHI() || Depth > MaxFPRSearchDepth)
284bdd1243dSDimitry Andric     return false;
285bdd1243dSDimitry Andric 
286bdd1243dSDimitry Andric   return any_of(MI.explicit_uses(), [&](const MachineOperand &Op) {
287bdd1243dSDimitry Andric     return Op.isReg() &&
288bdd1243dSDimitry Andric            onlyDefinesFP(*MRI.getVRegDef(Op.getReg()), MRI, TRI, Depth + 1);
289bdd1243dSDimitry Andric   });
290bdd1243dSDimitry Andric }
291bdd1243dSDimitry Andric 
292bdd1243dSDimitry Andric /// FIXME: this is copied from target AArch64. Needs some code refactor here to
293bdd1243dSDimitry Andric /// put this function in class RegisterBankInfo.
294bdd1243dSDimitry Andric bool PPCRegisterBankInfo::onlyUsesFP(const MachineInstr &MI,
295bdd1243dSDimitry Andric                                      const MachineRegisterInfo &MRI,
296bdd1243dSDimitry Andric                                      const TargetRegisterInfo &TRI,
297bdd1243dSDimitry Andric                                      unsigned Depth) const {
298bdd1243dSDimitry Andric   switch (MI.getOpcode()) {
299bdd1243dSDimitry Andric   case TargetOpcode::G_FPTOSI:
300bdd1243dSDimitry Andric   case TargetOpcode::G_FPTOUI:
301bdd1243dSDimitry Andric   case TargetOpcode::G_FCMP:
302bdd1243dSDimitry Andric   case TargetOpcode::G_LROUND:
303bdd1243dSDimitry Andric   case TargetOpcode::G_LLROUND:
304bdd1243dSDimitry Andric     return true;
305bdd1243dSDimitry Andric   default:
306bdd1243dSDimitry Andric     break;
307bdd1243dSDimitry Andric   }
308bdd1243dSDimitry Andric   return hasFPConstraints(MI, MRI, TRI, Depth);
309bdd1243dSDimitry Andric }
310bdd1243dSDimitry Andric 
311bdd1243dSDimitry Andric /// FIXME: this is copied from target AArch64. Needs some code refactor here to
312bdd1243dSDimitry Andric /// put this function in class RegisterBankInfo.
313bdd1243dSDimitry Andric bool PPCRegisterBankInfo::onlyDefinesFP(const MachineInstr &MI,
314bdd1243dSDimitry Andric                                         const MachineRegisterInfo &MRI,
315bdd1243dSDimitry Andric                                         const TargetRegisterInfo &TRI,
316bdd1243dSDimitry Andric                                         unsigned Depth) const {
317bdd1243dSDimitry Andric   switch (MI.getOpcode()) {
318bdd1243dSDimitry Andric   case TargetOpcode::G_SITOFP:
319bdd1243dSDimitry Andric   case TargetOpcode::G_UITOFP:
320bdd1243dSDimitry Andric     return true;
321bdd1243dSDimitry Andric   default:
322bdd1243dSDimitry Andric     break;
323bdd1243dSDimitry Andric   }
324bdd1243dSDimitry Andric   return hasFPConstraints(MI, MRI, TRI, Depth);
325bdd1243dSDimitry Andric }
326bdd1243dSDimitry Andric 
327bdd1243dSDimitry Andric RegisterBankInfo::InstructionMappings
328bdd1243dSDimitry Andric PPCRegisterBankInfo::getInstrAlternativeMappings(const MachineInstr &MI) const {
329bdd1243dSDimitry Andric   // TODO Implement.
330bdd1243dSDimitry Andric   return RegisterBankInfo::getInstrAlternativeMappings(MI);
331bdd1243dSDimitry Andric }
332