TargetTransformInfo.cpp revision be04929f7fd76a921540e9901f24563e51dc1219
1be04929f7fd76a921540e9901f24563e51dc1219Chandler Carruth//===- llvm/Analysis/TargetTransformInfo.cpp ------------------------------===// 2cbd9a19b5d6ff93efa82c467508ede78b8af3bacNadav Rotem// 3cbd9a19b5d6ff93efa82c467508ede78b8af3bacNadav Rotem// The LLVM Compiler Infrastructure 4cbd9a19b5d6ff93efa82c467508ede78b8af3bacNadav Rotem// 5cbd9a19b5d6ff93efa82c467508ede78b8af3bacNadav Rotem// This file is distributed under the University of Illinois Open Source 6cbd9a19b5d6ff93efa82c467508ede78b8af3bacNadav Rotem// License. See LICENSE.TXT for details. 7cbd9a19b5d6ff93efa82c467508ede78b8af3bacNadav Rotem// 8cbd9a19b5d6ff93efa82c467508ede78b8af3bacNadav Rotem//===----------------------------------------------------------------------===// 9cbd9a19b5d6ff93efa82c467508ede78b8af3bacNadav Rotem 10aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth#define DEBUG_TYPE "tti" 11be04929f7fd76a921540e9901f24563e51dc1219Chandler Carruth#include "llvm/Analysis/TargetTransformInfo.h" 12cbd9a19b5d6ff93efa82c467508ede78b8af3bacNadav Rotem#include "llvm/Support/ErrorHandling.h" 13cbd9a19b5d6ff93efa82c467508ede78b8af3bacNadav Rotem 14cbd9a19b5d6ff93efa82c467508ede78b8af3bacNadav Rotemusing namespace llvm; 15cbd9a19b5d6ff93efa82c467508ede78b8af3bacNadav Rotem 167bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth// Setup the analysis group to manage the TargetTransformInfo passes. 177bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler CarruthINITIALIZE_ANALYSIS_GROUP(TargetTransformInfo, "Target Information", NoTTI) 18cbd9a19b5d6ff93efa82c467508ede78b8af3bacNadav Rotemchar TargetTransformInfo::ID = 0; 19cbd9a19b5d6ff93efa82c467508ede78b8af3bacNadav Rotem 207bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler CarruthTargetTransformInfo::~TargetTransformInfo() { 217bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth} 227bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 23aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruthvoid TargetTransformInfo::pushTTIStack(Pass *P) { 24aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth TopTTI = this; 25aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth PrevTTI = &P->getAnalysis<TargetTransformInfo>(); 26aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth 27aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth // Walk up the chain and update the top TTI pointer. 28aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth for (TargetTransformInfo *PTTI = PrevTTI; PTTI; PTTI = PTTI->PrevTTI) 29aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth PTTI->TopTTI = this; 30aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth} 31aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth 32aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruthvoid TargetTransformInfo::popTTIStack() { 33aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth TopTTI = 0; 34aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth 35aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth // Walk up the chain and update the top TTI pointer. 36aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth for (TargetTransformInfo *PTTI = PrevTTI; PTTI; PTTI = PTTI->PrevTTI) 37aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth PTTI->TopTTI = PrevTTI; 38aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth 39aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth PrevTTI = 0; 40aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth} 41aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth 427bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruthvoid TargetTransformInfo::getAnalysisUsage(AnalysisUsage &AU) const { 437bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth AU.addRequired<TargetTransformInfo>(); 447bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth} 457bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 467bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruthbool TargetTransformInfo::isLegalAddImmediate(int64_t Imm) const { 477bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth return PrevTTI->isLegalAddImmediate(Imm); 487bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth} 497bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 507bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruthbool TargetTransformInfo::isLegalICmpImmediate(int64_t Imm) const { 517bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth return PrevTTI->isLegalICmpImmediate(Imm); 527bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth} 537bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 547bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruthbool TargetTransformInfo::isLegalAddressingMode(Type *Ty, GlobalValue *BaseGV, 557bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth int64_t BaseOffset, 567bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth bool HasBaseReg, 577bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth int64_t Scale) const { 587bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth return PrevTTI->isLegalAddressingMode(Ty, BaseGV, BaseOffset, HasBaseReg, 597bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth Scale); 607bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth} 617bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 627bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruthbool TargetTransformInfo::isTruncateFree(Type *Ty1, Type *Ty2) const { 637bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth return PrevTTI->isTruncateFree(Ty1, Ty2); 647bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth} 657bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 667bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruthbool TargetTransformInfo::isTypeLegal(Type *Ty) const { 677bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth return PrevTTI->isTypeLegal(Ty); 687bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth} 697bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 707bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruthunsigned TargetTransformInfo::getJumpBufAlignment() const { 717bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth return PrevTTI->getJumpBufAlignment(); 727bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth} 737bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 747bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruthunsigned TargetTransformInfo::getJumpBufSize() const { 757bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth return PrevTTI->getJumpBufSize(); 767bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth} 777bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 787bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruthbool TargetTransformInfo::shouldBuildLookupTables() const { 797bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth return PrevTTI->shouldBuildLookupTables(); 807bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth} 817bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 827bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler CarruthTargetTransformInfo::PopcntHwSupport 837bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler CarruthTargetTransformInfo::getPopcntHwSupport(unsigned IntTyWidthInBit) const { 847bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth return PrevTTI->getPopcntHwSupport(IntTyWidthInBit); 857bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth} 867bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 877bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruthunsigned TargetTransformInfo::getIntImmCost(const APInt &Imm, Type *Ty) const { 887bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth return PrevTTI->getIntImmCost(Imm, Ty); 897bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth} 907bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 917bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruthunsigned TargetTransformInfo::getNumberOfRegisters(bool Vector) const { 927bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth return PrevTTI->getNumberOfRegisters(Vector); 937bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth} 947bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 957bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruthunsigned TargetTransformInfo::getArithmeticInstrCost(unsigned Opcode, 967bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth Type *Ty) const { 977bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth return PrevTTI->getArithmeticInstrCost(Opcode, Ty); 987bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth} 997bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 1007bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruthunsigned TargetTransformInfo::getShuffleCost(ShuffleKind Kind, Type *Tp, 1017bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth int Index, Type *SubTp) const { 1027bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth return PrevTTI->getShuffleCost(Kind, Tp, Index, SubTp); 1037bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth} 1047bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 1057bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruthunsigned TargetTransformInfo::getCastInstrCost(unsigned Opcode, Type *Dst, 1067bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth Type *Src) const { 1077bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth return PrevTTI->getCastInstrCost(Opcode, Dst, Src); 1087bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth} 1097bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 1107bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruthunsigned TargetTransformInfo::getCFInstrCost(unsigned Opcode) const { 1117bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth return PrevTTI->getCFInstrCost(Opcode); 1127bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth} 1137bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 1147bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruthunsigned TargetTransformInfo::getCmpSelInstrCost(unsigned Opcode, Type *ValTy, 1157bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth Type *CondTy) const { 1167bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth return PrevTTI->getCmpSelInstrCost(Opcode, ValTy, CondTy); 1177bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth} 1187bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 1197bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruthunsigned TargetTransformInfo::getVectorInstrCost(unsigned Opcode, Type *Val, 1207bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth unsigned Index) const { 1217bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth return PrevTTI->getVectorInstrCost(Opcode, Val, Index); 1227bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth} 1237bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 1247bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruthunsigned TargetTransformInfo::getMemoryOpCost(unsigned Opcode, Type *Src, 1257bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth unsigned Alignment, 1267bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth unsigned AddressSpace) const { 1277bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth return PrevTTI->getMemoryOpCost(Opcode, Src, Alignment, AddressSpace); 1287bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth ; 1297bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth} 1307bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 1317bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruthunsigned 1327bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler CarruthTargetTransformInfo::getIntrinsicInstrCost(Intrinsic::ID ID, 1337bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth Type *RetTy, 1347bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth ArrayRef<Type *> Tys) const { 1357bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth return PrevTTI->getIntrinsicInstrCost(ID, RetTy, Tys); 1367bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth} 1377bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 1387bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruthunsigned TargetTransformInfo::getNumberOfParts(Type *Tp) const { 1397bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth return PrevTTI->getNumberOfParts(Tp); 1407bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth} 1417bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 1427bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 1437bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruthnamespace { 1447bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 145aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruthstruct NoTTI : ImmutablePass, TargetTransformInfo { 146aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth NoTTI() : ImmutablePass(ID) { 147aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth initializeNoTTIPass(*PassRegistry::getPassRegistry()); 1487bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth } 1497bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 150aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth virtual void initializePass() { 151aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth // Note that this subclass is special, and must *not* call initializeTTI as 152aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth // it does not chain. 153aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth PrevTTI = 0; 1547bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth } 1557bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 156aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth virtual void getAnalysisUsage(AnalysisUsage &AU) const { 1577bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth // Note that this subclass is special, and must *not* call 1587bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth // TTI::getAnalysisUsage as it breaks the recursion. 1597bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth } 1607bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 1617bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth /// Pass identification. 1627bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth static char ID; 1637bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 1647bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth /// Provide necessary pointer adjustments for the two base classes. 1657bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth virtual void *getAdjustedAnalysisPointer(const void *ID) { 1667bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth if (ID == &TargetTransformInfo::ID) 1677bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth return (TargetTransformInfo*)this; 1687bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth return this; 1697bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth } 1707bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 1717bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 1727bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth bool isLegalAddImmediate(int64_t Imm) const { 173aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth return false; 1747bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth } 1757bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 1767bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth bool isLegalICmpImmediate(int64_t Imm) const { 177aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth return false; 1787bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth } 1797bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 1807bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth bool isLegalAddressingMode(Type *Ty, GlobalValue *BaseGV, int64_t BaseOffset, 1817bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth bool HasBaseReg, int64_t Scale) const { 182aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth return false; 1837bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth } 1847bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 1857bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth bool isTruncateFree(Type *Ty1, Type *Ty2) const { 186aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth return false; 1877bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth } 1887bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 1897bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth bool isTypeLegal(Type *Ty) const { 190aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth return false; 1917bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth } 1927bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 1937bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth unsigned getJumpBufAlignment() const { 194aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth return 0; 1957bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth } 1967bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 1977bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth unsigned getJumpBufSize() const { 198aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth return 0; 1997bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth } 2007bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 2017bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth bool shouldBuildLookupTables() const { 202aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth return true; 2037bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth } 2047bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 2057bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth PopcntHwSupport getPopcntHwSupport(unsigned IntTyWidthInBit) const { 206aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth return None; 2077bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth } 2087bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 2097bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth unsigned getIntImmCost(const APInt &Imm, Type *Ty) const { 210aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth return 1; 2117bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth } 2127bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 2137bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth unsigned getNumberOfRegisters(bool Vector) const { 214aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth return 8; 2157bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth } 2167bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 2177bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth unsigned getArithmeticInstrCost(unsigned Opcode, Type *Ty) const { 218aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth return 1; 2197bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth } 2207bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 2217bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth unsigned getShuffleCost(ShuffleKind Kind, Type *Tp, 2227bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth int Index = 0, Type *SubTp = 0) const { 223aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth return 1; 2247bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth } 2257bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 2267bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth unsigned getCastInstrCost(unsigned Opcode, Type *Dst, 2277bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth Type *Src) const { 228aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth return 1; 2297bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth } 2307bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 2317bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth unsigned getCFInstrCost(unsigned Opcode) const { 232aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth return 1; 2337bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth } 2347bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 2357bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth unsigned getCmpSelInstrCost(unsigned Opcode, Type *ValTy, 2367bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth Type *CondTy = 0) const { 237aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth return 1; 2387bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth } 2397bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 2407bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth unsigned getVectorInstrCost(unsigned Opcode, Type *Val, 2417bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth unsigned Index = -1) const { 242aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth return 1; 2437bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth } 2447bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 2457bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth unsigned getMemoryOpCost(unsigned Opcode, Type *Src, 2467bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth unsigned Alignment, 2477bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth unsigned AddressSpace) const { 248aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth return 1; 2497bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth } 2507bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 2517bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth unsigned getIntrinsicInstrCost(Intrinsic::ID ID, 2527bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth Type *RetTy, 2537bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth ArrayRef<Type*> Tys) const { 254aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth return 1; 2557bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth } 2567bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 2577bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth unsigned getNumberOfParts(Type *Tp) const { 258aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth return 0; 2597bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth } 2607bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth}; 2617bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 2627bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth} // end anonymous namespace 2637bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 264aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler CarruthINITIALIZE_AG_PASS(NoTTI, TargetTransformInfo, "notti", 2657bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth "No target information", true, true, true) 2667bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruthchar NoTTI::ID = 0; 2677bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth 268aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler CarruthImmutablePass *llvm::createNoTargetTransformInfoPass() { 269aeef83c6afa1e18d1cf9d359cc678ca0ad556175Chandler Carruth return new NoTTI(); 2707bdf6b00e04c177f22133b5d4be10cb246cb1e76Chandler Carruth} 271