LLVM 24.0.0git
SparcTargetTransformInfo.cpp
Go to the documentation of this file.
1//===-- SparcTargetTransformInfo.cpp - SPARC 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
13#define DEBUG_TYPE "sparctti"
14
16 if (Vector)
17 return VRRC;
18 if (Ty &&
19 (Ty->getScalarType()->isFloatTy() || Ty->getScalarType()->isDoubleTy()))
20 return FPRRC;
21 if (Ty && (Ty->getScalarType()->isFP128Ty()))
22 return FP128RRC;
23 return GPRRC;
24}
25
26unsigned SparcTTIImpl::getNumberOfRegisters(unsigned ClassID) const {
27 switch (ClassID) {
28 case GPRRC:
29 // %g0, %g6, %g7, %o6, %i6, and %i7 are used for special purposes so we
30 // discount them here.
31 return 26;
32 case FPRRC:
33 return 32;
34 case FP128RRC:
35 return 16;
36 case VRRC:
37 // TODO We have vector capabilities as part of the VIS extensions, but the
38 // codegen doesn't currently use it. Revisit this when vector codegen is
39 // ready.
40 return 0;
41 }
42
43 llvm_unreachable("Unsupported register class");
44}
45
48 switch (K) {
50 // TODO When targeting V8+ ABI, G and O registers are 64-bit.
51 return TypeSize::getFixed(ST->is64Bit() ? 64 : 32);
53 // TODO We have vector capabilities as part of the VIS extensions, but the
54 // codegen doesn't currently use it. Revisit this when vector codegen is
55 // ready.
56 return TypeSize::getFixed(0);
58 return TypeSize::getScalable(0);
59 }
60
61 llvm_unreachable("Unsupported register kind");
62}
This file a TargetTransformInfoImplBase conforming object specific to the SPARC target machine.
unsigned getNumberOfRegisters(unsigned ClassID) const override
TypeSize getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const override
unsigned getRegisterClassForType(bool Vector, Type *Ty=nullptr) const override
static constexpr TypeSize getFixed(ScalarTy ExactSize)
Definition TypeSize.h:352
static constexpr TypeSize getScalable(ScalarTy MinimumSize)
Definition TypeSize.h:355
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:46
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.