llvm-project/llvm/lib/Target/DirectX/DirectXTargetTransformInfo.h
David Green 48e54f3a22
[CostModel] Mark all TTIImpls as final. NFC (#143404)
In the AArch64 version this helps reduce the number of blr instruction
(indirect jumps) in from 325 to 87, and reduces the size of the object
file by 4%. It seems to help make the code more efficient even if it
doesn't greatly affect compile time.

The AMDGPU variants are already marked as final.
2025-06-15 08:51:59 +01:00

46 lines
1.7 KiB
C++

//===- DirectXTargetTransformInfo.h - DirectX TTI ---------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
//===----------------------------------------------------------------------===//
#ifndef LLVM_DIRECTX_DIRECTXTARGETTRANSFORMINFO_H
#define LLVM_DIRECTX_DIRECTXTARGETTRANSFORMINFO_H
#include "DirectXSubtarget.h"
#include "DirectXTargetMachine.h"
#include "llvm/CodeGen/BasicTTIImpl.h"
#include "llvm/IR/Function.h"
namespace llvm {
class DirectXTTIImpl final : public BasicTTIImplBase<DirectXTTIImpl> {
using BaseT = BasicTTIImplBase<DirectXTTIImpl>;
using TTI = TargetTransformInfo;
friend BaseT;
const DirectXSubtarget *ST;
const DirectXTargetLowering *TLI;
const DirectXSubtarget *getST() const { return ST; }
const DirectXTargetLowering *getTLI() const { return TLI; }
public:
explicit DirectXTTIImpl(const DirectXTargetMachine *TM, const Function &F)
: BaseT(TM, F.getDataLayout()), ST(TM->getSubtargetImpl(F)),
TLI(ST->getTargetLowering()) {}
unsigned getMinVectorRegisterBitWidth() const override { return 32; }
bool isTargetIntrinsicTriviallyScalarizable(Intrinsic::ID ID) const override;
bool isTargetIntrinsicWithScalarOpAtArg(Intrinsic::ID ID,
unsigned ScalarOpdIdx) const override;
bool isTargetIntrinsicWithOverloadTypeAtArg(Intrinsic::ID ID,
int OpdIdx) const override;
};
} // namespace llvm
#endif // LLVM_DIRECTX_DIRECTXTARGETTRANSFORMINFO_H