1664e354dSChandler Carruth //===- BasicTargetTransformInfo.cpp - Basic target-independent TTI impl ---===//
2664e354dSChandler Carruth //
3664e354dSChandler Carruth //                     The LLVM Compiler Infrastructure
4664e354dSChandler Carruth //
5664e354dSChandler Carruth // This file is distributed under the University of Illinois Open Source
6664e354dSChandler Carruth // License. See LICENSE.TXT for details.
7664e354dSChandler Carruth //
8664e354dSChandler Carruth //===----------------------------------------------------------------------===//
9664e354dSChandler Carruth /// \file
10664e354dSChandler Carruth /// This file provides the implementation of a basic TargetTransformInfo pass
11664e354dSChandler Carruth /// predicated on the target abstractions present in the target independent
12664e354dSChandler Carruth /// code generator. It uses these (primarily TargetLowering) to model as much
13664e354dSChandler Carruth /// of the TTI query interface as possible. It is included by most targets so
14664e354dSChandler Carruth /// that they can specialize only a small subset of the query space.
15664e354dSChandler Carruth ///
16664e354dSChandler Carruth //===----------------------------------------------------------------------===//
17664e354dSChandler Carruth 
18*705b185fSChandler Carruth #include "llvm/CodeGen/BasicTTIImpl.h"
19664e354dSChandler Carruth #include "llvm/CodeGen/Passes.h"
206532c20fSHal Finkel #include "llvm/Analysis/LoopInfo.h"
21d3e73556SChandler Carruth #include "llvm/Analysis/TargetTransformInfo.h"
22*705b185fSChandler Carruth #include "llvm/Analysis/TargetTransformInfoImpl.h"
236532c20fSHal Finkel #include "llvm/Support/CommandLine.h"
24664e354dSChandler Carruth #include <utility>
25664e354dSChandler Carruth using namespace llvm;
26664e354dSChandler Carruth 
27*705b185fSChandler Carruth cl::opt<unsigned>
28*705b185fSChandler Carruth     llvm::PartialUnrollingThreshold("partial-unrolling-threshold", cl::init(0),
29*705b185fSChandler Carruth                                     cl::desc("Threshold for partial unrolling"),
30*705b185fSChandler Carruth                                     cl::Hidden);
316532c20fSHal Finkel 
321b9dde08SChandler Carruth #define DEBUG_TYPE "basictti"
331b9dde08SChandler Carruth 
34664e354dSChandler Carruth namespace {
35*705b185fSChandler Carruth class BasicTTIImpl : public BasicTTIImplBase<BasicTTIImpl> {
36*705b185fSChandler Carruth   typedef BasicTTIImplBase<BasicTTIImpl> BaseT;
37afc1036fSBill Wendling 
38664e354dSChandler Carruth public:
39*705b185fSChandler Carruth   explicit BasicTTIImpl(const TargetMachine *TM = nullptr) : BaseT(TM) {}
40*705b185fSChandler Carruth 
41*705b185fSChandler Carruth   // Provide value semantics. MSVC requires that we spell all of these out.
42*705b185fSChandler Carruth   BasicTTIImpl(const BasicTTIImpl &Arg)
43*705b185fSChandler Carruth       : BaseT(static_cast<const BaseT &>(Arg)) {}
44*705b185fSChandler Carruth   BasicTTIImpl(BasicTTIImpl &&Arg)
45*705b185fSChandler Carruth       : BaseT(std::move(static_cast<BaseT &>(Arg))) {}
46*705b185fSChandler Carruth   BasicTTIImpl &operator=(const BasicTTIImpl &RHS) {
47*705b185fSChandler Carruth     BaseT::operator=(static_cast<const BaseT &>(RHS));
48*705b185fSChandler Carruth     return *this;
49664e354dSChandler Carruth   }
50*705b185fSChandler Carruth   BasicTTIImpl &operator=(BasicTTIImpl &&RHS) {
51*705b185fSChandler Carruth     BaseT::operator=(std::move(static_cast<BaseT &>(RHS)));
52*705b185fSChandler Carruth     return *this;
53664e354dSChandler Carruth   }
54664e354dSChandler Carruth };
55664e354dSChandler Carruth }
56664e354dSChandler Carruth 
57664e354dSChandler Carruth ImmutablePass *
58afc1036fSBill Wendling llvm::createBasicTargetTransformInfoPass(const TargetMachine *TM) {
59*705b185fSChandler Carruth   return new TargetTransformInfoWrapperPass(BasicTTIImpl(TM));
60664e354dSChandler Carruth }
61664e354dSChandler Carruth 
628f2e7005SHal Finkel 
63664e354dSChandler Carruth //===----------------------------------------------------------------------===//
64664e354dSChandler Carruth //
65664e354dSChandler Carruth // Calls used by the vectorizers.
66664e354dSChandler Carruth //
67664e354dSChandler Carruth //===----------------------------------------------------------------------===//
68664e354dSChandler Carruth 
69