XCoreTargetTransformInfo.h revision 360784
11960Sdg//===-- XCoreTargetTransformInfo.h - XCore specific TTI ---------*- C++ -*-===// 21960Sdg// 31960Sdg// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 41960Sdg// See https://llvm.org/LICENSE.txt for license information. 51960Sdg// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 61960Sdg// 71960Sdg//===----------------------------------------------------------------------===// 81960Sdg/// \file 91960Sdg/// This file a TargetTransformInfo::Concept conforming object specific to the 101960Sdg/// XCore target machine. It uses the target's detailed information to 111960Sdg/// provide more precise answers to certain TTI queries, while letting the 121960Sdg/// target independent and default TTI implementations handle the rest. 131960Sdg/// 141960Sdg//===----------------------------------------------------------------------===// 151960Sdg 161960Sdg#ifndef LLVM_LIB_TARGET_XCORE_XCORETARGETTRANSFORMINFO_H 171960Sdg#define LLVM_LIB_TARGET_XCORE_XCORETARGETTRANSFORMINFO_H 181960Sdg 191960Sdg#include "XCore.h" 201960Sdg#include "XCoreTargetMachine.h" 211960Sdg#include "llvm/Analysis/TargetTransformInfo.h" 221960Sdg#include "llvm/CodeGen/BasicTTIImpl.h" 231960Sdg#include "llvm/CodeGen/TargetLowering.h" 241960Sdg 251960Sdgnamespace llvm { 261960Sdg 271960Sdgclass XCoreTTIImpl : public BasicTTIImplBase<XCoreTTIImpl> { 281960Sdg typedef BasicTTIImplBase<XCoreTTIImpl> BaseT; 291960Sdg typedef TargetTransformInfo TTI; 301960Sdg friend BaseT; 311960Sdg 321960Sdg const XCoreSubtarget *ST; 331960Sdg const XCoreTargetLowering *TLI; 341960Sdg 351960Sdg const XCoreSubtarget *getST() const { return ST; } 361960Sdg const XCoreTargetLowering *getTLI() const { return TLI; } 3715493Sbde 381960Sdgpublic: 391960Sdg explicit XCoreTTIImpl(const XCoreTargetMachine *TM, const Function &F) 402165Spaul : BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl()), 4115493Sbde TLI(ST->getTargetLowering()) {} 422165Spaul 431960Sdg unsigned getNumberOfRegisters(unsigned ClassID) const { 441960Sdg bool Vector = (ClassID == 1); 451960Sdg if (Vector) { 461960Sdg return 0; 471960Sdg } 481960Sdg return 12; 491960Sdg } 501960Sdg}; 511960Sdg 521960Sdg} // end namespace llvm 531960Sdg 541960Sdg#endif 551960Sdg