1 //===-- XCoreTargetTransformInfo.cpp - XCore 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 /// XCore 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 "xcoretti"
19 #include "llvm/Analysis/TargetTransformInfo.h"
20 #include "llvm/Support/Debug.h"
21 #include "llvm/Target/CostTable.h"
22 #include "llvm/Target/TargetLowering.h"
25 // Declare the pass initialization routine locally as target-specific passes
26 // don't havve a target-wide initialization entry point, and so we rely on the
27 // pass constructor initialization.
29 void initializeXCoreTTIPass(PassRegistry &);
34 class XCoreTTI final : public ImmutablePass, public TargetTransformInfo {
36 XCoreTTI() : ImmutablePass(ID) {
37 llvm_unreachable("This pass cannot be directly constructed");
40 XCoreTTI(const XCoreTargetMachine *TM)
42 initializeXCoreTTIPass(*PassRegistry::getPassRegistry());
45 virtual void initializePass() override {
49 virtual void finalizePass() {
53 virtual void getAnalysisUsage(AnalysisUsage &AU) const override {
54 TargetTransformInfo::getAnalysisUsage(AU);
59 virtual void *getAdjustedAnalysisPointer(const void *ID) override {
60 if (ID == &TargetTransformInfo::ID)
61 return (TargetTransformInfo*)this;
65 unsigned getNumberOfRegisters(bool Vector) const override {
73 } // end anonymous namespace
75 INITIALIZE_AG_PASS(XCoreTTI, TargetTransformInfo, "xcoretti",
76 "XCore Target Transform Info", true, true, false)
77 char XCoreTTI::ID = 0;
81 llvm::createXCoreTargetTransformInfoPass(const XCoreTargetMachine *TM) {
82 return new XCoreTTI(TM);