LLVM 22.0.0git
MipsTargetTransformInfo.cpp
Go to the documentation of this file.
1//===-- MipsTargetTransformInfo.cpp - Mips specific TTI ----------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
10
11using namespace llvm;
12
13bool MipsTTIImpl::hasDivRemOp(Type *DataType, bool IsSigned) const {
14 EVT VT = TLI->getValueType(DL, DataType);
15 return TLI->isOperationLegalOrCustom(IsSigned ? ISD::SDIVREM : ISD::UDIVREM,
16 VT);
17}
18
20 const TargetTransformInfo::LSRCost &C2) const {
21 // MIPS specific here are "instruction number 1st priority".
22 // If we need to emit adds inside the loop to add up base registers, then
23 // we need at least one extra temporary register.
24 unsigned C1NumRegs = C1.NumRegs + (C1.NumBaseAdds != 0);
25 unsigned C2NumRegs = C2.NumRegs + (C2.NumBaseAdds != 0);
26 return std::tie(C1.Insns, C1NumRegs, C1.AddRecCost, C1.NumIVMuls,
27 C1.NumBaseAdds, C1.ScaleCost, C1.ImmCost, C1.SetupCost) <
28 std::tie(C2.Insns, C2NumRegs, C2.AddRecCost, C2.NumIVMuls,
29 C2.NumBaseAdds, C2.ScaleCost, C2.ImmCost, C2.SetupCost);
30}
bool hasDivRemOp(Type *DataType, bool IsSigned) const override
bool isLSRCostLess(const TargetTransformInfo::LSRCost &C1, const TargetTransformInfo::LSRCost &C2) const override
EVT getValueType(const DataLayout &DL, Type *Ty, bool AllowUnknown=false) const
Return the EVT corresponding to this LLVM type.
bool isOperationLegalOrCustom(unsigned Op, EVT VT, bool LegalOnly=false) const
Return true if the specified operation is legal on this target or can be made legal with custom lower...
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
@ SDIVREM
SDIVREM/UDIVREM - Divide two integers and produce both a quotient and remainder result.
Definition: ISDOpcodes.h:275
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
Extended Value Type.
Definition: ValueTypes.h:35
unsigned Insns
TODO: Some of these could be merged.