BasicTargetTransformInfo.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. //===- BasicTargetTransformInfo.cpp - Basic target-independent TTI impl ---===//
  2. //
  3. // 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
  6. //
  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. #include "llvm/CodeGen/BasicTTIImpl.h"
  17. #include "llvm/CodeGen/TargetSubtargetInfo.h"
  18. #include "llvm/IR/Function.h"
  19. #include "llvm/Support/CommandLine.h"
  20. #include "llvm/Target/TargetMachine.h"
  21. using namespace llvm;
  22. // This flag is used by the template base class for BasicTTIImpl, and here to
  23. // provide a definition.
  24. cl::opt<unsigned>
  25. llvm::PartialUnrollingThreshold("partial-unrolling-threshold", cl::init(0),
  26. cl::desc("Threshold for partial unrolling"),
  27. cl::Hidden);
  28. BasicTTIImpl::BasicTTIImpl(const TargetMachine *TM, const Function &F)
  29. : BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl(F)),
  30. TLI(ST->getTargetLowering()) {}