blob: 5cd0ed3bba1d55265c533237796270977cf42909 [file] [log] [blame]
Chandler Carruth664e3542013-01-07 01:37:14 +00001//===- BasicTargetTransformInfo.cpp - Basic target-independent TTI impl ---===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9/// \file
10/// This file provides the implementation of a basic TargetTransformInfo pass
11/// predicated on the target abstractions present in the target independent
12/// code generator. It uses these (primarily TargetLowering) to model as much
13/// of the TTI query interface as possible. It is included by most targets so
14/// that they can specialize only a small subset of the query space.
15///
16//===----------------------------------------------------------------------===//
17
Chandler Carruth705b1852015-01-31 03:43:40 +000018#include "llvm/CodeGen/BasicTTIImpl.h"
Chandler Carruth664e3542013-01-07 01:37:14 +000019#include "llvm/CodeGen/Passes.h"
Hal Finkel6532c202014-05-08 09:14:44 +000020#include "llvm/Analysis/LoopInfo.h"
Chandler Carruthd3e73552013-01-07 03:08:10 +000021#include "llvm/Analysis/TargetTransformInfo.h"
Chandler Carruth705b1852015-01-31 03:43:40 +000022#include "llvm/Analysis/TargetTransformInfoImpl.h"
Hal Finkel6532c202014-05-08 09:14:44 +000023#include "llvm/Support/CommandLine.h"
Chandler Carruth664e3542013-01-07 01:37:14 +000024#include <utility>
Chandler Carruth664e3542013-01-07 01:37:14 +000025using namespace llvm;
26
Chandler Carruth705b1852015-01-31 03:43:40 +000027cl::opt<unsigned>
28 llvm::PartialUnrollingThreshold("partial-unrolling-threshold", cl::init(0),
29 cl::desc("Threshold for partial unrolling"),
30 cl::Hidden);
Hal Finkel6532c202014-05-08 09:14:44 +000031
Chandler Carruth1b9dde02014-04-22 02:02:50 +000032#define DEBUG_TYPE "basictti"
33
Chandler Carruth664e3542013-01-07 01:37:14 +000034namespace {
Chandler Carruth705b1852015-01-31 03:43:40 +000035class BasicTTIImpl : public BasicTTIImplBase<BasicTTIImpl> {
36 typedef BasicTTIImplBase<BasicTTIImpl> BaseT;
Bill Wendlingafc10362013-06-19 20:51:24 +000037
Chandler Carruth664e3542013-01-07 01:37:14 +000038public:
Chandler Carruth705b1852015-01-31 03:43:40 +000039 explicit BasicTTIImpl(const TargetMachine *TM = nullptr) : BaseT(TM) {}
40
41 // Provide value semantics. MSVC requires that we spell all of these out.
42 BasicTTIImpl(const BasicTTIImpl &Arg)
43 : BaseT(static_cast<const BaseT &>(Arg)) {}
44 BasicTTIImpl(BasicTTIImpl &&Arg)
45 : BaseT(std::move(static_cast<BaseT &>(Arg))) {}
46 BasicTTIImpl &operator=(const BasicTTIImpl &RHS) {
47 BaseT::operator=(static_cast<const BaseT &>(RHS));
48 return *this;
Chandler Carruth664e3542013-01-07 01:37:14 +000049 }
Chandler Carruth705b1852015-01-31 03:43:40 +000050 BasicTTIImpl &operator=(BasicTTIImpl &&RHS) {
51 BaseT::operator=(std::move(static_cast<BaseT &>(RHS)));
52 return *this;
Chandler Carruth664e3542013-01-07 01:37:14 +000053 }
Chandler Carruth664e3542013-01-07 01:37:14 +000054};
Chandler Carruth664e3542013-01-07 01:37:14 +000055}
56
Chandler Carruth664e3542013-01-07 01:37:14 +000057ImmutablePass *
Bill Wendlingafc10362013-06-19 20:51:24 +000058llvm::createBasicTargetTransformInfoPass(const TargetMachine *TM) {
Chandler Carruth705b1852015-01-31 03:43:40 +000059 return new TargetTransformInfoWrapperPass(BasicTTIImpl(TM));
Chandler Carruth664e3542013-01-07 01:37:14 +000060}
61
Hal Finkel8f2e7002013-09-11 19:25:43 +000062
Chandler Carruth664e3542013-01-07 01:37:14 +000063//===----------------------------------------------------------------------===//
64//
65// Calls used by the vectorizers.
66//
67//===----------------------------------------------------------------------===//
68