blob: 57cefae2066a9cd51dab881a541d2fa9f64dcbfc [file] [log] [blame]
Chandler Carruth664e3542013-01-07 01:37:14 +00001//===- BasicTargetTransformInfo.cpp - Basic target-independent TTI impl ---===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Chandler Carruth664e3542013-01-07 01:37:14 +00006//
7//===----------------------------------------------------------------------===//
8/// \file
9/// This file provides the implementation of a basic TargetTransformInfo pass
10/// predicated on the target abstractions present in the target independent
11/// code generator. It uses these (primarily TargetLowering) to model as much
12/// of the TTI query interface as possible. It is included by most targets so
13/// that they can specialize only a small subset of the query space.
14///
15//===----------------------------------------------------------------------===//
16
Chandler Carruth6bda14b2017-06-06 11:49:48 +000017#include "llvm/CodeGen/BasicTTIImpl.h"
David Blaikieb3bde2e2017-11-17 01:07:10 +000018#include "llvm/CodeGen/TargetSubtargetInfo.h"
Eugene Zelenko4f81cdd2017-09-29 21:55:49 +000019#include "llvm/IR/Function.h"
Hal Finkel6532c202014-05-08 09:14:44 +000020#include "llvm/Support/CommandLine.h"
Eugene Zelenko4f81cdd2017-09-29 21:55:49 +000021#include "llvm/Target/TargetMachine.h"
Eugene Zelenko4f81cdd2017-09-29 21:55:49 +000022
Chandler Carruth664e3542013-01-07 01:37:14 +000023using namespace llvm;
24
Chandler Carruth93dcdc42015-01-31 11:17:59 +000025// This flag is used by the template base class for BasicTTIImpl, and here to
26// provide a definition.
Chandler Carruth705b1852015-01-31 03:43:40 +000027cl::opt<unsigned>
Eugene Zelenko4f81cdd2017-09-29 21:55:49 +000028llvm::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
Eric Christophera4e5d3c2015-09-16 23:38:13 +000032BasicTTIImpl::BasicTTIImpl(const TargetMachine *TM, const Function &F)
Mehdi Amini5010ebf2015-07-09 02:08:42 +000033 : BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl(F)),
34 TLI(ST->getTargetLowering()) {}