xref: /freebsd/contrib/llvm-project/llvm/lib/CodeGen/BasicTargetTransformInfo.cpp (revision 0b57cec536236d46e3dba9bd041533462f33dbb7)
1*0b57cec5SDimitry Andric //===- BasicTargetTransformInfo.cpp - Basic target-independent TTI impl ---===//
2*0b57cec5SDimitry Andric //
3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0b57cec5SDimitry Andric //
7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
8*0b57cec5SDimitry Andric /// \file
9*0b57cec5SDimitry Andric /// This file provides the implementation of a basic TargetTransformInfo pass
10*0b57cec5SDimitry Andric /// predicated on the target abstractions present in the target independent
11*0b57cec5SDimitry Andric /// code generator. It uses these (primarily TargetLowering) to model as much
12*0b57cec5SDimitry Andric /// of the TTI query interface as possible. It is included by most targets so
13*0b57cec5SDimitry Andric /// that they can specialize only a small subset of the query space.
14*0b57cec5SDimitry Andric ///
15*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
16*0b57cec5SDimitry Andric 
17*0b57cec5SDimitry Andric #include "llvm/CodeGen/BasicTTIImpl.h"
18*0b57cec5SDimitry Andric #include "llvm/CodeGen/TargetSubtargetInfo.h"
19*0b57cec5SDimitry Andric #include "llvm/IR/Function.h"
20*0b57cec5SDimitry Andric #include "llvm/Support/CommandLine.h"
21*0b57cec5SDimitry Andric #include "llvm/Target/TargetMachine.h"
22*0b57cec5SDimitry Andric 
23*0b57cec5SDimitry Andric using namespace llvm;
24*0b57cec5SDimitry Andric 
25*0b57cec5SDimitry Andric // This flag is used by the template base class for BasicTTIImpl, and here to
26*0b57cec5SDimitry Andric // provide a definition.
27*0b57cec5SDimitry Andric cl::opt<unsigned>
28*0b57cec5SDimitry Andric llvm::PartialUnrollingThreshold("partial-unrolling-threshold", cl::init(0),
29*0b57cec5SDimitry Andric                                 cl::desc("Threshold for partial unrolling"),
30*0b57cec5SDimitry Andric                                 cl::Hidden);
31*0b57cec5SDimitry Andric 
32*0b57cec5SDimitry Andric BasicTTIImpl::BasicTTIImpl(const TargetMachine *TM, const Function &F)
33*0b57cec5SDimitry Andric     : BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl(F)),
34*0b57cec5SDimitry Andric       TLI(ST->getTargetLowering()) {}
35