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 //===----------------------------------------------------------------------===//
18 #include "XCoreTargetMachine.h"
19 #include "llvm/Analysis/TargetTransformInfo.h"
20 #include "llvm/CodeGen/BasicTTIImpl.h"
21 #include "llvm/Support/Debug.h"
22 #include "llvm/Target/CostTable.h"
23 #include "llvm/Target/TargetLowering.h"
26 #define DEBUG_TYPE "xcoretti"
30 class XCoreTTIImpl : public BasicTTIImplBase<XCoreTTIImpl> {
31 typedef BasicTTIImplBase<XCoreTTIImpl> BaseT;
32 typedef TargetTransformInfo TTI;
35 explicit XCoreTTIImpl(const XCoreTargetMachine *TM = nullptr) : BaseT(TM) {}
37 // Provide value semantics. MSVC requires that we spell all of these out.
38 XCoreTTIImpl(const XCoreTTIImpl &Arg)
39 : BaseT(static_cast<const BaseT &>(Arg)) {}
40 XCoreTTIImpl(XCoreTTIImpl &&Arg)
41 : BaseT(std::move(static_cast<BaseT &>(Arg))) {}
42 XCoreTTIImpl &operator=(const XCoreTTIImpl &RHS) {
43 BaseT::operator=(static_cast<const BaseT &>(RHS));
46 XCoreTTIImpl &operator=(XCoreTTIImpl &&RHS) {
47 BaseT::operator=(std::move(static_cast<BaseT &>(RHS)));
51 unsigned getNumberOfRegisters(bool Vector) {
59 } // end anonymous namespace
62 llvm::createXCoreTargetTransformInfoPass(const XCoreTargetMachine *TM) {
63 return new TargetTransformInfoWrapperPass(XCoreTTIImpl(TM));