1 //===- AArch64TargetTransformInfo.cpp - AArch64 specific TTI pass ---------===//
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 /// This file implements a TargetTransformInfo analysis pass specific to the
11 /// AArch64 target machine. It uses the target's detailed information to provide
12 /// more precise answers to certain TTI queries, while letting the target
13 /// independent and default TTI implementations handle the rest.
15 //===----------------------------------------------------------------------===//
17 #define DEBUG_TYPE "aarch64tti"
19 #include "AArch64TargetMachine.h"
20 #include "llvm/Analysis/TargetTransformInfo.h"
21 #include "llvm/Support/Debug.h"
22 #include "llvm/Target/CostTable.h"
23 #include "llvm/Target/TargetLowering.h"
26 // Declare the pass initialization routine locally as target-specific passes
27 // don't have a target-wide initialization entry point, and so we rely on the
28 // pass constructor initialization.
30 void initializeAArch64TTIPass(PassRegistry &);
35 class AArch64TTI final : public ImmutablePass, public TargetTransformInfo {
36 const AArch64Subtarget *ST;
37 const AArch64TargetLowering *TLI;
40 AArch64TTI() : ImmutablePass(ID), ST(0), TLI(0) {
41 llvm_unreachable("This pass cannot be directly constructed");
44 AArch64TTI(const AArch64TargetMachine *TM)
45 : ImmutablePass(ID), ST(TM->getSubtargetImpl()),
46 TLI(TM->getTargetLowering()) {
47 initializeAArch64TTIPass(*PassRegistry::getPassRegistry());
50 virtual void initializePass() override {
54 virtual void getAnalysisUsage(AnalysisUsage &AU) const override {
55 TargetTransformInfo::getAnalysisUsage(AU);
58 /// Pass identification.
61 /// Provide necessary pointer adjustments for the two base classes.
62 virtual void *getAdjustedAnalysisPointer(const void *ID) override {
63 if (ID == &TargetTransformInfo::ID)
64 return (TargetTransformInfo*)this;
68 /// \name Scalar TTI Implementations
74 /// \name Vector TTI Implementations
77 unsigned getNumberOfRegisters(bool Vector) const {
86 unsigned getRegisterBitWidth(bool Vector) const {
98 } // end anonymous namespace
100 INITIALIZE_AG_PASS(AArch64TTI, TargetTransformInfo, "aarch64tti",
101 "AArch64 Target Transform Info", true, true, false)
102 char AArch64TTI::ID = 0;
105 llvm::createAArch64TargetTransformInfoPass(const AArch64TargetMachine *TM) {
106 return new AArch64TTI(TM);